Set_window.c 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /****************************************************************************
  2. *
  3. * MODULE: PNG driver
  4. * AUTHOR(S): Glynn Clements <glynn@gclements.plus.com>
  5. * COPYRIGHT: (C) 2007 Glynn Clements
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. *****************************************************************************/
  18. #include <math.h>
  19. #include "pngdriver.h"
  20. void PNG_Set_window(double t, double b, double l, double r)
  21. {
  22. png.clip_top = t > 0 ? t : 0;
  23. png.clip_bot = b < png.height ? b : png.height;
  24. png.clip_left = l > 0 ? l : 0;
  25. png.clip_rite = r < png.width ? r : png.width;
  26. }