From 59a6c379ddbae204a46275d73f59838bc5fdf0f5 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sat, 11 Jun 2011 06:51:06 -0500 Subject: [PATCH] [devel] Revised pngvalid.c to test PNG_ALPHA_MODE_SUPPORTED correctly. This allows pngvalid to build when ALPHA_MODE is not supported, which is required if it is to build on libpng 1.4. --- ANNOUNCE | 7 ++++++- CHANGES | 7 ++++++- pngvalid.c | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index be24b8d6d..5ae1c4755 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -169,7 +169,12 @@ Version 1.5.3beta11 [June 11, 2011] IDE autogenerates appropriate makefiles (libpng.mk) for batch processing. The project is configurable, unlike the Visual Studio project, so long as the developer has an awk. - Improved gamma range checks and other things OpenWatcom warns about. + Changed png_set_gAMA to limit the gamma value range so that the inverse + of the stored value cannot overflow the fixed point representation, + and changed other things OpenWatcom warns about. + Revised pngvalid.c to test PNG_ALPHA_MODE_SUPPORTED correctly. This allows + pngvalid to build when ALPHA_MODE is not supported, which is required if + it is to build on libpng 1.4. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index e1f8d4976..eb43a19e1 100644 --- a/CHANGES +++ b/CHANGES @@ -3432,7 +3432,12 @@ Version 1.5.3beta11 [June 11, 2011] IDE autogenerates appropriate makefiles (libpng.mk) for batch processing. The project is configurable, unlike the Visual Studio project, so long as the developer has an awk. - Improved gamma range checks and other things OpenWatcom warns about. + Changed png_set_gAMA to limit the gamma value range so that the inverse + of the stored value cannot overflow the fixed point representation, + and changed other things OpenWatcom warns about. + Revised pngvalid.c to test PNG_ALPHA_MODE_SUPPORTED correctly. This allows + pngvalid to build when ALPHA_MODE is not supported, which is required if + it is to build on libpng 1.4. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngvalid.c b/pngvalid.c index cdb612caa..069f8e274 100644 --- a/pngvalid.c +++ b/pngvalid.c @@ -6401,7 +6401,9 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi, if (alpha < 0) /* The alpha channel */ { +#ifdef PNG_READ_ALPHA_MODE_SUPPORTED if (do_background != ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN) +#endif { /* In all other cases the output alpha channel is linear already, * don't log errors here, they are much larger in linear data. @@ -6411,6 +6413,7 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi, } } +#ifdef PNG_READ_ALPHA_MODE_SUPPORTED else /* A component */ { if (do_background == ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED && @@ -6420,6 +6423,7 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi, output_is_encoded = 0; } } +#endif if (output_is_encoded) output = pow(output, vi->screen_gamma);