mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[master] Ported bugfix in pngrtran.c from 1.5.3: Ensure coefficients are OK for
png_rgb_to_gray_fixed().
This commit is contained in:
parent
c3ac9a507a
commit
0dc882d7c3
22
ANNOUNCE
22
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
|
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.
|
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
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
1.4.8rc01.tar.xz (LZMA-compressed, recommended)
|
1.4.8beta02.tar.xz (LZMA-compressed, recommended)
|
||||||
1.4.8rc01.tar.gz
|
1.4.8beta02.tar.gz
|
||||||
1.4.8rc01.tar.bz2
|
1.4.8beta02.tar.bz2
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lp148r01.7z (LZMA-compressed, recommended)
|
lp148b02.7z (LZMA-compressed, recommended)
|
||||||
lp148r01.zip
|
lp148b02.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
1.4.8rc01-README.txt
|
1.4.8beta02-README.txt
|
||||||
1.4.8rc01-LICENSE.txt
|
1.4.8beta02-LICENSE.txt
|
||||||
|
|
||||||
Changes since the last public release (1.4.7):
|
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.
|
was introduced in libpng-1.2.20beta01.
|
||||||
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
|
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
|
||||||
before IDAT.
|
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.
|
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
|
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||||
or to png-mng-implement at lists.sf.net (subscription required; visit
|
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||||
|
6
CHANGES
6
CHANGES
@ -2802,10 +2802,12 @@ version 1.4.8beta01 [June 4, 2011]
|
|||||||
was introduced in libpng-1.2.20beta01.
|
was introduced in libpng-1.2.20beta01.
|
||||||
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
|
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
|
||||||
before IDAT.
|
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.
|
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
|
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||||
or to png-mng-implement at lists.sf.net (subscription required; visit
|
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||||
|
39
pngrtran.c
39
pngrtran.c
@ -703,27 +703,38 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_uint_16 red_int, green_int;
|
if (red >= 0 && green >= 0 && red + green <= 100000L)
|
||||||
if (red < 0 || green < 0)
|
|
||||||
{
|
|
||||||
red_int = 6968; /* .212671 * 32768 + .5 */
|
|
||||||
green_int = 23434; /* .715160 * 32768 + .5 */
|
|
||||||
}
|
|
||||||
else if (red + green < 100000L)
|
|
||||||
{
|
{
|
||||||
|
png_uint_16 red_int, green_int;
|
||||||
|
|
||||||
red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L);
|
red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L);
|
||||||
green_int = (png_uint_16)(((png_uint_32)green*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
|
else
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients");
|
if (red >= 0 && green >= 0)
|
||||||
red_int = 6968;
|
png_warning(png_ptr,
|
||||||
green_int = 23434;
|
"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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user