[devel] Use the old scaling method for background if png_set_chop_16() was
called.
This commit is contained in:
parent
550bab03fb
commit
7dffa41643
2
ANNOUNCE
2
ANNOUNCE
@ -198,6 +198,8 @@ Version 1.5.4beta02 [June 14, 2011]
|
|||||||
Added png_set_chop_16() API, to match inaccurate results from previous
|
Added png_set_chop_16() API, to match inaccurate results from previous
|
||||||
libpng versions.
|
libpng versions.
|
||||||
Removed the ACCURATE and LEGACY options (they are no longer useable)
|
Removed the ACCURATE and LEGACY options (they are no longer useable)
|
||||||
|
Use the old scaling method for background if png_set_chop_16() was
|
||||||
|
called.
|
||||||
|
|
||||||
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
|
||||||
|
2
CHANGES
2
CHANGES
@ -3461,6 +3461,8 @@ Version 1.5.4beta02 [June 14, 2011]
|
|||||||
Added png_set_chop_16() API, to match inaccurate results from previous
|
Added png_set_chop_16() API, to match inaccurate results from previous
|
||||||
libpng versions.
|
libpng versions.
|
||||||
Removed the ACCURATE and LEGACY options (they are no longer useable)
|
Removed the ACCURATE and LEGACY options (they are no longer useable)
|
||||||
|
Use the old scaling method for background if png_set_chop_16() was
|
||||||
|
called.
|
||||||
|
|
||||||
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
|
||||||
|
13
pngrtran.c
13
pngrtran.c
@ -1453,12 +1453,25 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
* The PNG_BACKGROUND_EXPAND code above does not expand to 16 bits at
|
* 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.)
|
* present, so that case is ok (until do_expand_16 is moved.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (png_ptr->transformations & PNG_CHOP_16_TO_8)
|
||||||
|
{
|
||||||
# define CHOP(x) (x)=((png_uint_16)(((png_uint_32)(x)*255+32895) >> 16))
|
# define CHOP(x) (x)=((png_uint_16)(((png_uint_32)(x)*255+32895) >> 16))
|
||||||
CHOP(png_ptr->background.red);
|
CHOP(png_ptr->background.red);
|
||||||
CHOP(png_ptr->background.green);
|
CHOP(png_ptr->background.green);
|
||||||
CHOP(png_ptr->background.blue);
|
CHOP(png_ptr->background.blue);
|
||||||
CHOP(png_ptr->background.gray);
|
CHOP(png_ptr->background.gray);
|
||||||
# undef CHOP
|
# undef CHOP
|
||||||
|
}
|
||||||
|
else /* Use pre-libpng-1.5.4 inaccurate "ACCURATE" scaling */
|
||||||
|
{
|
||||||
|
# define CHOP(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
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user