[devel] Make png_set_sRGB_gAMA_and_cHRM set values using either the fixed or

floating point APIs, but not both.
This commit is contained in:
Glenn Randers-Pehrson 2010-06-26 12:31:58 -05:00
parent a691ca0f85
commit 82980f31d9
3 changed files with 23 additions and 47 deletions

View File

@ -258,6 +258,8 @@ version 1.5.0beta32 [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

View File

@ -2736,10 +2736,12 @@ version 1.5.0beta31 [June 26, 2010]
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

View File

@ -46,6 +46,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
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 @@ void PNGAPI
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 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#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 */
}