summaryrefslogtreecommitdiff
path: root/contrib/gregbook/readpng.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gregbook/readpng.c')
-rw-r--r--contrib/gregbook/readpng.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c
index abfc1fb4c..df42c301b 100644
--- a/contrib/gregbook/readpng.c
+++ b/contrib/gregbook/readpng.c
@@ -229,8 +229,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr);
+#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16)
+# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ png_set_scale_16(png_ptr);
+# else
png_set_strip_16(png_ptr);
+# endif
+#endif
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
@@ -263,7 +269,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
return NULL;
}
- Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));
+ Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
+ *pChannels, rowbytes, height));
/* set the individual row_pointers to point at the correct offsets */