[devel] Make png_set_sRGB_gAMA_and_cHRM set values using either the fixed or
floating point APIs, but not both.
diff --git a/ANNOUNCE b/ANNOUNCE
index 0f3b7da..aa7510f 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -258,6 +258,8 @@
Made FIXED and FLOATING options consistent in the APIs they enable and
disable. Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
+ Make png_set_sRGB_gAMA_and_cHRM set values using either the fixed or
+ floating point APIs, but not both.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index cac7d2a..1dacdbe 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2736,10 +2736,12 @@
version 1.5.0beta32 [June 26, 2010]
Removed leftover scripts/options.patch and scripts/options.rej
-version 1.5.0beta32 [June 26, 2010]
+version 1.5.0beta33 [June 26, 2010]
Made FIXED and FLOATING options consistent in the APIs they enable and
disable. Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
+ Make png_set_sRGB_gAMA_and_cHRM set values using either the fixed or
+ floating point APIs, but not both.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/pngset.c b/pngset.c
index 2b7cb26..7413783 100644
--- a/pngset.c
+++ b/pngset.c
@@ -46,6 +46,7 @@
if (png_ptr == NULL || info_ptr == NULL)
return;
+ /* TODO: call png_check_cHRM_fixed */
info_ptr->x_white = (float)white_x;
info_ptr->y_white = (float)white_y;
info_ptr->x_red = (float)red_x;
@@ -534,21 +535,6 @@
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int intent)
{
-#ifdef PNG_gAMA_SUPPORTED
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- float file_gamma;
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
- png_fixed_point int_file_gamma;
-#endif
-#endif
-#ifdef PNG_cHRM_SUPPORTED
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
-#endif
- png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
- int_green_y, int_blue_x, int_blue_y;
-#endif
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
if (png_ptr == NULL || info_ptr == NULL)
@@ -558,45 +544,31 @@
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
- int_file_gamma = 45455L;
- png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma);
-#endif
-#ifdef PNG_FLOATING_POINT_SUPPORTED
+ png_set_gAMA_fixed(png_ptr, info_ptr, 45455L);
+#else
/* Floating point must be set! */
- file_gamma = (float).45455;
- png_set_gAMA(png_ptr, info_ptr, file_gamma);
+ png_set_gAMA(png_ptr, info_ptr, .45455);
#endif
#endif
#ifdef PNG_cHRM_SUPPORTED
- int_white_x = 31270L;
- int_white_y = 32900L;
- int_red_x = 64000L;
- int_red_y = 33000L;
- int_green_x = 30000L;
- int_green_y = 60000L;
- int_blue_x = 15000L;
- int_blue_y = 6000L;
-
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- white_x = (float).3127;
- white_y = (float).3290;
- red_x = (float).64;
- red_y = (float).33;
- green_x = (float).30;
- green_y = (float).60;
- blue_x = (float).15;
- blue_y = (float).06;
-#endif
-
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_cHRM_fixed(png_ptr, info_ptr,
- int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
- int_green_y, int_blue_x, int_blue_y);
-#endif
-#ifdef PNG_FLOATING_POINT_SUPPORTED
+ /* color x y */
+ /* white */ 31270L, 32900L,
+ /* red */ 64000L, 33000L,
+ /* green */ 30000L, 60000L,
+ /* blue */ 15000L, 6000L
+ );
+#else
+ /* Floating point must be supported! */
png_set_cHRM(png_ptr, info_ptr,
- white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
+ /* color x y */
+ /* while */ .3127, .3290,
+ /* red */ .64, .33,
+ /* green */ .30, .60,
+ /* blue */ .15, .06
+ );
#endif
#endif /* cHRM */
}