[libpng16] Added #ifdef PNG_WRITE_sRGB_SUPPORTED, etc., tests where needed in
png_image_write_main() in pngwrite.c (bug report from Yuriy Levchenko).
diff --git a/ANNOUNCE b/ANNOUNCE
index 065a28c..57e95d9 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -41,6 +41,9 @@
Version 1.6.2beta02 [April 17, 2013]
Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
written by libpng-1.6.0 and 1.6.1.
+ Levchenko).
+ Added #ifdef PNG_WRITE_sRGB_SUPPORTED, etc., tests where needed in
+ png_image_write_main() in pngwrite.c (bug report from Yuriy Levchenko).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index c348451..65c03bd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4489,6 +4489,8 @@
Version 1.6.2beta02 [April 17, 2013]
Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
written by libpng-1.6.0 and 1.6.1.
+ Added #ifdef PNG_WRITE_sRGB_SUPPORTED, etc., tests where needed in
+ png_image_write_main() in pngwrite.c (bug report from Yuriy Levchenko).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/pngwrite.c b/pngwrite.c
index b0887bd..196e8c0 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -2074,9 +2074,12 @@
if (write_16bit)
{
+#ifdef PNG_WRITE_gAMA_SUPPORTED
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
+#endif
+#ifdef PNG_WRITE_cHRM_SUPPORTED
if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB))
png_set_cHRM_fixed(png_ptr, info_ptr,
/* color x y */
@@ -2086,15 +2089,20 @@
/* blue */ 15000, 6000
);
}
+#endif
+#ifdef PNG_WRITE_sRGB_SUPPORTED
else if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB))
png_set_sRGB(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
+#endif
+#ifdef PNG_WRITE_gAMA_SUPPORTED
/* Else writing an 8-bit file and the *colors* aren't sRGB, but the 8-bit
* space must still be gamma encoded.
*/
else
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE);
+#endif
/* Write the file header. */
png_write_info(png_ptr, info_ptr);