[libpng16] Updated pngvalid.c with recent changes from libpng17
This commit is contained in:
parent
e8c554661c
commit
eb0bf4f468
15
ANNOUNCE
15
ANNOUNCE
@ -1,4 +1,4 @@
|
||||
Libpng 1.6.19beta03 - September 15, 2015
|
||||
Libpng 1.6.19beta03 - September 18, 2015
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -64,8 +64,19 @@ Version 1.6.19beta02 [August 19, 2015]
|
||||
in ANSI-C (unlike 0x80000000 in the signed case) the checking that
|
||||
occurs later can catch them (John Bowler).
|
||||
|
||||
Version 1.6.19beta03 [September 15, 2015]
|
||||
Version 1.6.19beta03 [September 18, 2015]
|
||||
Fixed png_save_int_32 when int is not 2's complement (John Bowler).
|
||||
Updated libpng16 with all the recent test changes from libpng17,
|
||||
including changes to pngvalid.c to ensure that the original,
|
||||
distributed, version of contrib/visupng/cexcept.h can be used
|
||||
(John Bowler).
|
||||
pngvalid contains the correction to the use of SAVE/STORE_
|
||||
UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7. More
|
||||
tests contain the --strict option to detect warnings and the
|
||||
pngvalid-standard test has been corrected so that it does not
|
||||
turn on progresive-read. There is a separate test which does
|
||||
that. (John Bowler)
|
||||
Also made some signed/unsigned fixes.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
13
CHANGES
13
CHANGES
@ -5345,8 +5345,19 @@ Version 1.6.19beta02 [August 19, 2015]
|
||||
in ANSI-C (unlike 0x80000000 in the signed case) the checking that
|
||||
occurs later can catch them (John Bowler).
|
||||
|
||||
Version 1.6.19beta03 [September 15, 2015]
|
||||
Version 1.6.19beta03 [September 18, 2015]
|
||||
Fixed png_save_int_32 when int is not 2's complement (John Bowler).
|
||||
Updated libpng16 with all the recent test changes from libpng17,
|
||||
including changes to pngvalid.c to ensure that the original,
|
||||
distributed, version of contrib/visupng/cexcept.h can be used
|
||||
(John Bowler).
|
||||
pngvalid contains the correction to the use of SAVE/STORE_
|
||||
UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7. More
|
||||
tests contain the --strict option to detect warnings and the
|
||||
pngvalid-standard test has been corrected so that it does not
|
||||
turn on progresive-read. There is a separate test which does
|
||||
that. (John Bowler)
|
||||
Also made some signed/unsigned fixes.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.19 [(PENDING RELEASE)]
|
||||
* Copyright (c) 2014-2015 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
@ -5661,13 +5661,10 @@ image_pixel_convert_PLTE(image_pixel *this)
|
||||
/* Add an alpha channel; this will import the tRNS information because tRNS is
|
||||
* not valid in an alpha image. The bit depth will invariably be set to at
|
||||
* least 8 prior to 1.7.0. Palette images will be converted to alpha (using
|
||||
* the above API). With png_set_background the alpha channel is never expanded
|
||||
* but this routine is used by pngvalid to simplify code; 'for_background'
|
||||
* records this.
|
||||
* the above API).
|
||||
*/
|
||||
static void
|
||||
image_pixel_add_alpha(image_pixel *this, const standard_display *display,
|
||||
int for_background)
|
||||
image_pixel_add_alpha(image_pixel *this, const standard_display *display)
|
||||
{
|
||||
if (this->colour_type == PNG_COLOR_TYPE_PALETTE)
|
||||
image_pixel_convert_PLTE(this);
|
||||
@ -5677,7 +5674,7 @@ image_pixel_add_alpha(image_pixel *this, const standard_display *display,
|
||||
if (this->colour_type == PNG_COLOR_TYPE_GRAY)
|
||||
{
|
||||
# if PNG_LIBPNG_VER < 10700
|
||||
if (!for_background && this->bit_depth < 8)
|
||||
if (this->bit_depth < 8)
|
||||
this->bit_depth = this->sample_depth = 8;
|
||||
# endif
|
||||
|
||||
@ -5687,7 +5684,7 @@ image_pixel_add_alpha(image_pixel *this, const standard_display *display,
|
||||
* tRNS chunk to expand at this point.
|
||||
*/
|
||||
# if PNG_LIBPNG_VER >= 10700
|
||||
if (!for_background && this->bit_depth < 8)
|
||||
if (this->bit_depth < 8)
|
||||
this->bit_depth = this->sample_depth = 8;
|
||||
# endif
|
||||
|
||||
@ -6577,7 +6574,7 @@ image_transform_png_set_tRNS_to_alpha_mod(const image_transform *this,
|
||||
if (that->colour_type != PNG_COLOR_TYPE_PALETTE &&
|
||||
(that->colour_type & PNG_COLOR_MASK_ALPHA) == 0)
|
||||
# endif
|
||||
image_pixel_add_alpha(that, &display->this, 0/*!for background*/);
|
||||
image_pixel_add_alpha(that, &display->this);
|
||||
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* LIBPNG BUG: otherwise libpng still expands to 8 bits! */
|
||||
@ -6604,8 +6601,8 @@ image_transform_png_set_tRNS_to_alpha_add(image_transform *this,
|
||||
|
||||
/* We don't know yet whether there will be a tRNS chunk, but we know that
|
||||
* this transformation should do nothing if there already is an alpha
|
||||
* channel. In addition, after the bug fix in 1.7.0, there is no longer
|
||||
* any action on a palette image.
|
||||
* channel. In addition, after the bug fix in 1.7.0, there is no longer any
|
||||
* action on a palette image.
|
||||
*/
|
||||
return
|
||||
# if PNG_LIBPNG_VER >= 10700
|
||||
@ -6641,7 +6638,7 @@ image_transform_png_set_gray_to_rgb_mod(const image_transform *this,
|
||||
* doesn't do this, so we don't either.
|
||||
*/
|
||||
if ((that->colour_type & PNG_COLOR_MASK_COLOR) == 0 && that->have_tRNS)
|
||||
image_pixel_add_alpha(that, &display->this, 0/*!for background*/);
|
||||
image_pixel_add_alpha(that, &display->this);
|
||||
|
||||
/* Simply expand the bit depth and alter the colour type as required. */
|
||||
if (that->colour_type == PNG_COLOR_TYPE_GRAY)
|
||||
@ -6705,7 +6702,7 @@ image_transform_png_set_expand_mod(const image_transform *this,
|
||||
that->sample_depth = that->bit_depth = 8;
|
||||
|
||||
if (that->have_tRNS)
|
||||
image_pixel_add_alpha(that, &display->this, 0/*!for background*/);
|
||||
image_pixel_add_alpha(that, &display->this);
|
||||
|
||||
this->next->mod(this->next, that, pp, display);
|
||||
}
|
||||
@ -6815,7 +6812,7 @@ image_transform_png_set_expand_16_mod(const image_transform *this,
|
||||
image_pixel_convert_PLTE(that);
|
||||
|
||||
if (that->have_tRNS)
|
||||
image_pixel_add_alpha(that, &display->this, 0/*!for background*/);
|
||||
image_pixel_add_alpha(that, &display->this);
|
||||
|
||||
if (that->bit_depth < 16)
|
||||
that->sample_depth = that->bit_depth = 16;
|
||||
@ -7758,7 +7755,7 @@ image_transform_png_set_background_mod(const image_transform *this,
|
||||
{
|
||||
/* Check for tRNS first: */
|
||||
if (that->have_tRNS && that->colour_type != PNG_COLOR_TYPE_PALETTE)
|
||||
image_pixel_add_alpha(that, &display->this, 1/*for background*/);
|
||||
image_pixel_add_alpha(that, &display->this);
|
||||
|
||||
/* This is only necessary if the alpha value is less than 1. */
|
||||
if (that->alphaf < 1)
|
||||
@ -11112,9 +11109,9 @@ int main(int argc, char **argv)
|
||||
# endif
|
||||
pm.test_lbg = 0;
|
||||
pm.test_lbg_gamma_threshold = 1;
|
||||
pm.test_lbg_gamma_transform = PNG_LIBPNG_VER >= 10600;
|
||||
pm.test_lbg_gamma_transform = 0/*PNG_LIBPNG_VER >= 10700*/;
|
||||
pm.test_lbg_gamma_sbit = 1;
|
||||
pm.test_lbg_gamma_composition = PNG_LIBPNG_VER >= 10700;
|
||||
pm.test_lbg_gamma_composition = 0;
|
||||
|
||||
/* And the test encodings */
|
||||
pm.encodings = test_encodings;
|
||||
|
Loading…
Reference in New Issue
Block a user