[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.
This commit is contained in:
John Bowler 2011-06-11 06:51:06 -05:00 committed by Glenn Randers-Pehrson
parent d2f0bc2d13
commit 59a6c379dd
3 changed files with 16 additions and 2 deletions

View File

@ -169,7 +169,12 @@ Version 1.5.3beta11 [June 11, 2011]
IDE autogenerates appropriate makefiles (libpng.mk) for batch processing. IDE autogenerates appropriate makefiles (libpng.mk) for batch processing.
The project is configurable, unlike the Visual Studio project, so long The project is configurable, unlike the Visual Studio project, so long
as the developer has an awk. 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: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -3432,7 +3432,12 @@ Version 1.5.3beta11 [June 11, 2011]
IDE autogenerates appropriate makefiles (libpng.mk) for batch processing. IDE autogenerates appropriate makefiles (libpng.mk) for batch processing.
The project is configurable, unlike the Visual Studio project, so long The project is configurable, unlike the Visual Studio project, so long
as the developer has an awk. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -6401,7 +6401,9 @@ gamma_component_validate(PNG_CONST char *name, PNG_CONST validate_info *vi,
if (alpha < 0) /* The alpha channel */ if (alpha < 0) /* The alpha channel */
{ {
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
if (do_background != ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN) if (do_background != ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN)
#endif
{ {
/* In all other cases the output alpha channel is linear already, /* In all other cases the output alpha channel is linear already,
* don't log errors here, they are much larger in linear data. * 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 */ else /* A component */
{ {
if (do_background == ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED && 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; output_is_encoded = 0;
} }
} }
#endif
if (output_is_encoded) if (output_is_encoded)
output = pow(output, vi->screen_gamma); output = pow(output, vi->screen_gamma);