mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
API reduction, PNG compression level
PNG compression level setting API: this allows the various compression settings
controlling deflate, fitlering, and so on to be set via a single setting with
six values. This is currently documented in png.h ("Write compression
settings").
Internally the compression settings have been tuned both for the overall setting
and for any specific settings made by the original APIs.
APIs to control iCCP chunk compression separately have been added.
contrib/examples/pngcp.c has been modified to accomodate the new compression
setting and to include options for separate control of iCCP chunk compression.
The new ABI, png_setting, has been modified to accomodate a wider range of
settings and most of the old compression control ABIs have been replaced by
function-like macros with the same API which call png_setting. This is an API
check in 1.7.0 for png_setting (alone). png_setting now handles all of
png_set_option. This eliminates 19 ABIs at the cost of adding 1 (png_setting).
CRC and benign error checking has been updated internally to use bit-fields and
the CRC calculation skip when the CRC is not used has been improved slightly to
avoid the initialization of the CRC. A new png_setting based API allows more
detailed control of benign error/warning messages (this may change, the internal
error handling seems too complex.) The ERROR_NUMBERS support has been removed
with the intent of implementing proper i18n.
The memcpy-size-0 issue in png_push_fill_buffer has been fixed, with an
appropriate debug() assert if a fill for 0 bytes occurs.
Most PNG_FLAG_ values for png_struct::flags have been eliminated (as a result of
the benign error handling changes). Only one remains.
Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
36
pngstruct.h
36
pngstruct.h
@@ -351,6 +351,15 @@ typedef struct png_transform /* Linked list of transform functions */
|
||||
} png_transform;
|
||||
#endif /* TRANSFORM_MECH */
|
||||
|
||||
/* Action to take on CRC errors (four values) */
|
||||
typedef enum
|
||||
{
|
||||
crc_error_quit = PNG_CRC_ERROR_QUIT-1,
|
||||
crc_warn_discard = PNG_CRC_WARN_DISCARD-1,
|
||||
crc_warn_use = PNG_CRC_WARN_USE-1,
|
||||
crc_quiet_use = PNG_CRC_QUIET_USE-1
|
||||
} png_crc_action;
|
||||
|
||||
struct png_struct_def
|
||||
{
|
||||
/* Rearranged in libpng 1.7 to attempt to lessen padding; in general
|
||||
@@ -419,11 +428,6 @@ struct png_struct_def
|
||||
png_byte bit_depth; /* bit depth of file */
|
||||
png_byte sig_bytes; /* magic bytes read/written at start of file */
|
||||
|
||||
/* Options */
|
||||
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||
png_uint_32 options; /* On/off state (up to 16 options) */
|
||||
#endif /* SET_OPTIONS */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
|
||||
/* The png_struct colorspace structure is only required on read - on write it
|
||||
@@ -737,6 +741,28 @@ struct png_struct_def
|
||||
* received; set by the zstream using code for
|
||||
* its own purposes. [progressive read] */
|
||||
# endif /* PROGRESSIVE_READ */
|
||||
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
unsigned int benign_error_action :2;
|
||||
unsigned int app_warning_action :2;
|
||||
unsigned int app_error_action :2;
|
||||
# ifdef PNG_READ_SUPPORTED
|
||||
unsigned int IDAT_error_action :2;
|
||||
# endif /* READ */
|
||||
# endif /* BENIGN_ERRORS */
|
||||
# ifdef PNG_READ_SUPPORTED
|
||||
/* CRC checking actions, one for critical chunks, one for ancillary
|
||||
* chunks.
|
||||
*/
|
||||
unsigned int critical_crc :2;
|
||||
unsigned int ancillary_crc :2;
|
||||
unsigned int current_crc :2; /* Cache of one or other of the above */
|
||||
# endif
|
||||
# ifdef PNG_SET_OPTION_SUPPORTED
|
||||
# ifdef PNG_READ_SUPPORTED
|
||||
unsigned int maximum_inflate_window :1U;
|
||||
# endif /* READ */
|
||||
unsigned int skip_sRGB_profile_check :1U;
|
||||
# endif /* SET_OPTION */
|
||||
|
||||
/* MNG SUPPORT */
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
|
||||
Reference in New Issue
Block a user