diff --git a/ANNOUNCE b/ANNOUNCE index 783834674..fe4e8b60d 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.4.8rc01 - June 4, 2011 +Libpng 1.4.8beta02 - June 5, 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. @@ -9,20 +9,20 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - 1.4.8rc01.tar.xz (LZMA-compressed, recommended) - 1.4.8rc01.tar.gz - 1.4.8rc01.tar.bz2 + 1.4.8beta02.tar.xz (LZMA-compressed, recommended) + 1.4.8beta02.tar.gz + 1.4.8beta02.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lp148r01.7z (LZMA-compressed, recommended) - lp148r01.zip + lp148b02.7z (LZMA-compressed, recommended) + lp148b02.zip Other information: - 1.4.8rc01-README.txt - 1.4.8rc01-LICENSE.txt + 1.4.8beta02-README.txt + 1.4.8beta02-LICENSE.txt Changes since the last public release (1.4.7): @@ -34,10 +34,12 @@ version 1.4.8beta01 [June 4, 2011] was introduced in libpng-1.2.20beta01. Check for up->location !PNG_AFTER_IDAT when writing unknown chunks before IDAT. - Port change to pngrtran.c from 1.5.3: when expanding a paletted image, + Ported bugfix in pngrtran.c from 1.5.3: when expanding a paletted image, always expand to RGBA if transparency is present. -version 1.4.8beta02 [June 4, 2011] +version 1.4.8beta02 [June 5, 2011] + Ported bugfix in pngrtran.c from 1.5.3: Ensure coefficients are OK for + png_rgb_to_gray_fixed(). Send comments/corrections/commendations to glennrp at users.sourceforge.net or to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index b9e550c54..dbbe871ce 100644 --- a/CHANGES +++ b/CHANGES @@ -2802,10 +2802,12 @@ version 1.4.8beta01 [June 4, 2011] was introduced in libpng-1.2.20beta01. Check for up->location !PNG_AFTER_IDAT when writing unknown chunks before IDAT. - Port change to pngrtran.c from 1.5.3: when expanding a paletted image, + Ported bugfix in pngrtran.c from 1.5.3: when expanding a paletted image, always expand to RGBA if transparency is present. -version 1.4.8beta02 [June 4, 2011] +version 1.4.8beta02 [June 5, 2011] + Ported bugfix in pngrtran.c from 1.5.3: Ensure coefficients are OK for + png_rgb_to_gray_fixed(). Send comments/corrections/commendations to glennrp at users.sourceforge.net or to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngrtran.c b/pngrtran.c index 4cd4d8713..0a01db8ba 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -703,27 +703,38 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, } #endif { - png_uint_16 red_int, green_int; - if (red < 0 || green < 0) - { - red_int = 6968; /* .212671 * 32768 + .5 */ - green_int = 23434; /* .715160 * 32768 + .5 */ - } - else if (red + green < 100000L) + if (red >= 0 && green >= 0 && red + green <= 100000L) { + png_uint_16 red_int, green_int; + red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L); green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L); + + png_ptr->rgb_to_gray_red_coeff = red_int; + png_ptr->rgb_to_gray_green_coeff = green_int; + png_ptr->rgb_to_gray_blue_coeff = + (png_uint_16)(32768 - red_int - green_int); } + else { - png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients"); - red_int = 6968; - green_int = 23434; + if (red >= 0 && green >= 0) + png_warning(png_ptr, + "ignoring out of range rgb_to_gray coefficients"); + + /* Use the defaults, from the cHRM chunk if set, else the built in Rec + * 709 values (which correspond to sRGB, so we don't have to worry + * about the sRGB chunk!) + */ + if (png_ptr->rgb_to_gray_red_coeff == 0 && + png_ptr->rgb_to_gray_green_coeff == 0 && + png_ptr->rgb_to_gray_blue_coeff == 0) + { + png_ptr->rgb_to_gray_red_coeff = 6968; /* .212671 * 32768 + .5 */ + png_ptr->rgb_to_gray_green_coeff = 23434; /* .715160 * 32768 + .5 */ + png_ptr->rgb_to_gray_blue_coeff = 2366; + } } - png_ptr->rgb_to_gray_red_coeff = red_int; - png_ptr->rgb_to_gray_green_coeff = green_int; - png_ptr->rgb_to_gray_blue_coeff = - (png_uint_16)(32768 - red_int - green_int); } } #endif