exact-image-0.8.1-libpng15.patch 754 B

1234567891011121314151617181920212223242526272829303132333435
  1. --- a/codecs/png.cc
  2. +++ b/codecs/png.cc
  3. @@ -16,6 +16,7 @@
  4. */
  5. #include <stdlib.h>
  6. +#include <zlib.h>
  7. #include <png.h>
  8. #include <iostream>
  9. @@ -104,7 +105,7 @@
  10. image.w = width;
  11. image.h = height;
  12. image.bps = bit_depth;
  13. - image.spp = info_ptr->channels;
  14. + image.spp = png_get_channels(png_ptr, info_ptr);
  15. png_uint_32 res_x, res_y;
  16. res_x = png_get_x_pixels_per_meter(png_ptr, info_ptr);
  17. @@ -120,10 +121,13 @@
  18. // png_set_packswap(png_ptr);
  19. /* Expand paletted colors into true RGB triplets */
  20. +
  21. + int num_trans;
  22. +
  23. if (color_type == PNG_COLOR_TYPE_PALETTE) {
  24. png_set_palette_to_rgb(png_ptr);
  25. image.bps = 8;
  26. - if (info_ptr->num_trans)
  27. + if (num_trans)
  28. image.spp = 4;
  29. else
  30. image.spp = 3;