mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Made png_set_chop_16() API removeable
by disabling PNG_CHOP_16_TO_8_SUPPORTED
This commit is contained in:
parent
7dffa41643
commit
2232baa41b
2
ANNOUNCE
2
ANNOUNCE
@ -200,6 +200,8 @@ Version 1.5.4beta02 [June 14, 2011]
|
|||||||
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
|
Use the old scaling method for background if png_set_chop_16() was
|
||||||
called.
|
called.
|
||||||
|
Made png_set_chop_16() API removeable by disabling PNG_CHOP_16_TO_8_SUPPORTED
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
1
CHANGES
1
CHANGES
@ -3463,6 +3463,7 @@ Version 1.5.4beta02 [June 14, 2011]
|
|||||||
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
|
Use the old scaling method for background if png_set_chop_16() was
|
||||||
called.
|
called.
|
||||||
|
Made png_set_chop_16() API removeable by disabling PNG_CHOP_16_TO_8_SUPPORTED
|
||||||
|
|
||||||
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
png.h
2
png.h
@ -1427,9 +1427,11 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr,
|
|||||||
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||||
/* Scale a 16-bit depth file down to 8-bit, accurately. */
|
/* Scale a 16-bit depth file down to 8-bit, accurately. */
|
||||||
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
|
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
|
||||||
|
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
/* Strip the second byte of information from a 16-bit depth file. */
|
/* Strip the second byte of information from a 16-bit depth file. */
|
||||||
PNG_EXPORT(229, void, png_set_chop_16, (png_structp png_ptr));
|
PNG_EXPORT(229, void, png_set_chop_16, (png_structp png_ptr));
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
/* Turn on quantizing, and reduce the palette to the number of colors
|
/* Turn on quantizing, and reduce the palette to the number of colors
|
||||||
|
|||||||
@ -823,8 +823,10 @@ PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
|
|||||||
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
|
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
|
||||||
png_bytep row));
|
png_bytep row));
|
||||||
|
|
||||||
|
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
|
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
|
||||||
png_bytep row));
|
png_bytep row));
|
||||||
|
#endif
|
||||||
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
|
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
|
||||||
png_bytep row));
|
png_bytep row));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
14
pngrtran.c
14
pngrtran.c
@ -143,9 +143,12 @@ png_set_strip_16(png_structp png_ptr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_16_TO_8;
|
png_ptr->transformations |= PNG_16_TO_8;
|
||||||
|
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
png_ptr->transformations &= ~PNG_CHOP_16_TO_8;
|
png_ptr->transformations &= ~PNG_CHOP_16_TO_8;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
/* Chop 16-bit depth files to 8-bit depth */
|
/* Chop 16-bit depth files to 8-bit depth */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_chop_16(png_structp png_ptr)
|
png_set_chop_16(png_structp png_ptr)
|
||||||
@ -159,6 +162,7 @@ png_set_chop_16(png_structp png_ptr)
|
|||||||
png_ptr->transformations &= ~PNG_16_TO_8;
|
png_ptr->transformations &= ~PNG_16_TO_8;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* PNG_READ_16_TO_8_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
@ -1454,7 +1458,7 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
* 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)
|
if (png_ptr->transformations & PNG_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);
|
||||||
@ -1463,17 +1467,19 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
CHOP(png_ptr->background.gray);
|
CHOP(png_ptr->background.gray);
|
||||||
# undef CHOP
|
# undef CHOP
|
||||||
}
|
}
|
||||||
|
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
else /* Use pre-libpng-1.5.4 inaccurate "ACCURATE" scaling */
|
else /* Use pre-libpng-1.5.4 inaccurate "ACCURATE" scaling */
|
||||||
{
|
{
|
||||||
# define CHOP(x) ((png_uint_16)((2*(png_uint_32)(x) + 257)/514))
|
# define CHOP(x) (x)=((png_uint_16)((2*(png_uint_32)(x) + 257)/514))
|
||||||
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
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_READ_CHOP_16_TO_8_SUPPORTED */
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PNG_READ_BACKGROUND_SUPPORTED && PNG_READ_EXPAND_16_SUPPORTED */
|
||||||
|
|
||||||
/* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the
|
/* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the
|
||||||
* background support (see the comments in scripts/pnglibconf.dfa), this
|
* background support (see the comments in scripts/pnglibconf.dfa), this
|
||||||
@ -2149,9 +2155,11 @@ png_do_read_transformations(png_structp png_ptr)
|
|||||||
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_16_TO_8)
|
if (png_ptr->transformations & PNG_16_TO_8)
|
||||||
png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
|
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
else if (png_ptr->transformations & PNG_CHOP_16_TO_8)
|
else if (png_ptr->transformations & PNG_CHOP_16_TO_8)
|
||||||
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_QUANTIZE)
|
if (png_ptr->transformations & PNG_QUANTIZE)
|
||||||
|
|||||||
@ -293,8 +293,8 @@ option READ enables READ_INTERLACING
|
|||||||
|
|
||||||
# Disabling READ_16BIT does not disable reading 16-bit PNG files, but it
|
# Disabling READ_16BIT does not disable reading 16-bit PNG files, but it
|
||||||
# forces them to be chopped down to 8-bit, and disables any 16-bit
|
# forces them to be chopped down to 8-bit, and disables any 16-bit
|
||||||
# processing after that has happened. You need to be sure to enable READ_16_TO_8
|
# processing after that has happened. You need to be sure to enable
|
||||||
# when you disable READ_16BIT for this to work properly.
|
# READ_16_TO_8 when you disable READ_16BIT for this to work properly.
|
||||||
|
|
||||||
option READ_16BIT requires READ enables 16BIT
|
option READ_16BIT requires READ enables 16BIT
|
||||||
|
|
||||||
@ -346,8 +346,6 @@ option INCH_CONVERSIONS
|
|||||||
|
|
||||||
option BUILD_GRAYSCALE_PALETTE
|
option BUILD_GRAYSCALE_PALETTE
|
||||||
|
|
||||||
option READ_16_TO_8_ACCURATE_SCALE requires READ
|
|
||||||
|
|
||||||
# IN DEVELOPMENT
|
# IN DEVELOPMENT
|
||||||
# These are currently experimental features; define them if you want
|
# These are currently experimental features; define them if you want
|
||||||
|
|
||||||
@ -552,7 +550,10 @@ option SAVE_INT_32 requires WRITE
|
|||||||
|
|
||||||
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
|
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
|
||||||
|
|
||||||
# added at libpng-1.5.3
|
# added at libpng-1.5.4
|
||||||
|
|
||||||
|
option READ_CHOP_16_TO_8 requires READ_16_TO_8
|
||||||
|
|
||||||
option WRITE_OPTIMIZE_CMF requires WRITE
|
option WRITE_OPTIMIZE_CMF requires WRITE
|
||||||
|
|
||||||
option READ_COMPRESSED_TEXT disabled
|
option READ_COMPRESSED_TEXT disabled
|
||||||
@ -570,7 +571,6 @@ option WRITE_iTXt enables WRITE_COMPRESSED_TEXT
|
|||||||
option WRITE_zTXt enables WRITE_COMPRESSED_TEXT
|
option WRITE_zTXt enables WRITE_COMPRESSED_TEXT
|
||||||
option WRITE_COMPRESSED_TEXT enables WRITE_TEXT
|
option WRITE_COMPRESSED_TEXT enables WRITE_TEXT
|
||||||
|
|
||||||
|
|
||||||
# Turn this off to disable png_read_png() and png_write_png() and
|
# Turn this off to disable png_read_png() and png_write_png() and
|
||||||
# leave the row_pointers member out of the info structure.
|
# leave the row_pointers member out of the info structure.
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,7 @@
|
|||||||
#define PNG_READ_BGR_SUPPORTED
|
#define PNG_READ_BGR_SUPPORTED
|
||||||
#define PNG_READ_bKGD_SUPPORTED
|
#define PNG_READ_bKGD_SUPPORTED
|
||||||
#define PNG_READ_cHRM_SUPPORTED
|
#define PNG_READ_cHRM_SUPPORTED
|
||||||
|
#define PNG_READ_CHOP_16_TO_8_SUPPORTED
|
||||||
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
#define PNG_READ_EXPAND_16_SUPPORTED
|
#define PNG_READ_EXPAND_16_SUPPORTED
|
||||||
#define PNG_READ_EXPAND_SUPPORTED
|
#define PNG_READ_EXPAND_SUPPORTED
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user