[devel] Correction to the expand_16 code; removed extra instance of

png_set_scale_16_to_8 from pngpriv.h
This commit is contained in:
Glenn Randers-Pehrson 2011-06-15 08:20:37 -05:00
parent 140504b11a
commit be720edba7
4 changed files with 8 additions and 18 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.4beta03 - June 14, 2011
Libpng 1.5.4beta03 - June 15, 2011
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.
@ -210,6 +210,8 @@ Version 1.5.4beta03 [June 15, 2011]
form if tRNS was present but alpha was marked to be stripped; this exposed
a check for tRNS in png_do_expand_palette() which is inconsistent with the
code elsewhere in libpng.
Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -3473,6 +3473,8 @@ Version 1.5.4beta03 [June 15, 2011]
form if tRNS was present but alpha was marked to be stripped; this exposed
a check for tRNS in png_do_expand_palette() which is inconsistent with the
code elsewhere in libpng.
Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -827,8 +827,6 @@ PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
png_bytep row));
#endif
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED

View File

@ -1456,28 +1456,16 @@ png_init_read_transformations(png_structp png_ptr)
*
* The PNG_BACKGROUND_EXPAND code above does not expand to 16 bits at
* present, so that case is ok (until do_expand_16 is moved.)
*
* NOTE: this discards the low 16 bits of the user supplied background
* color, but until expand_16 works properly there is no choice!
*/
if (png_ptr->transformations & PNG_16_TO_8)
{
# define CHOP(x) (x)=((png_uint_16)(((png_uint_32)(x)*255+32895) >> 16))
CHOP(png_ptr->background.red);
CHOP(png_ptr->background.green);
CHOP(png_ptr->background.blue);
CHOP(png_ptr->background.gray);
# undef CHOP
}
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
else /* Use pre-libpng-1.5.4 inaccurate "ACCURATE" scaling */
{
# define CHOP(x) (x)=((png_uint_16)((2*(png_uint_32)(x) + 257)/514))
CHOP(png_ptr->background.red);
CHOP(png_ptr->background.green);
CHOP(png_ptr->background.blue);
CHOP(png_ptr->background.gray);
# undef CHOP
}
#endif /* PNG_READ_CHOP_16_TO_8_SUPPORTED */
}
#endif /* PNG_READ_BACKGROUND_SUPPORTED && PNG_READ_EXPAND_16_SUPPORTED */