[devel] Added PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
This commit is contained in:
parent
3bb8683a79
commit
205483d592
6
ANNOUNCE
6
ANNOUNCE
@ -28,11 +28,13 @@ Changes since the last public release (1.5.2):
|
||||
|
||||
Version 1.5.3beta01 [April 1, 2011]
|
||||
Re-initialize the zlib compressor before compressing non-IDAT chunks.
|
||||
Added API functions to set parameters for zlib compression of non-IDAT chunks.
|
||||
Added API functions to set parameters for zlib compression of non-IDAT
|
||||
chunks.
|
||||
|
||||
Version 1.5.3beta02 [April 1, 2011]
|
||||
Updated scripts/symbols.def with new API functions.
|
||||
Only compile the new zlib re-initializing code when text or iCCP is supported.
|
||||
Only compile the new zlib re-initializing code when text or iCCP is
|
||||
supported, using PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
|
||||
(subscription required; visit
|
||||
|
6
CHANGES
6
CHANGES
@ -3289,11 +3289,13 @@ Version 1.5.2 [March 31, 2011]
|
||||
|
||||
Version 1.5.3beta01 [April 1, 2011]
|
||||
Re-initialize the zlib compressor before compressing non-IDAT chunks.
|
||||
Added API functions to set parameters for zlib compression of non-IDAT chunks.
|
||||
Added API functions to set parameters for zlib compression of non-IDAT
|
||||
chunks.
|
||||
|
||||
Version 1.5.3beta02 [April 1, 2011]
|
||||
Updated scripts/symbols.def with new API functions.
|
||||
Only compile the new zlib re-initializing code when text or iCCP is supported.
|
||||
Only compile the new zlib re-initializing code when text or iCCP is
|
||||
supported, using PNG_WRITE_COMPRESSED_TEXT_SUPPORTED macro.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -541,8 +541,7 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
|
||||
png_size_t length));
|
||||
|
||||
/* Decompress data in a chunk that uses compression */
|
||||
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
|
||||
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
|
||||
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED)
|
||||
PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
|
||||
int comp_type, png_size_t chunklength, png_size_t prefix_length,
|
||||
png_size_t *data_length));
|
||||
@ -645,6 +644,7 @@ PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr,
|
||||
png_const_uint_16p hist, int num_hist));
|
||||
#endif
|
||||
|
||||
/* Chunks that have keywords */
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
||||
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
|
||||
|
@ -70,7 +70,7 @@ struct png_struct_def
|
||||
int zlib_mem_level; /* holds zlib compression memory level */
|
||||
int zlib_strategy; /* holds zlib compression strategy */
|
||||
/* Added at libpng 1.5.3 */
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) || \
|
||||
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
|
||||
defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION)
|
||||
int zlib_text_level; /* holds zlib compression level */
|
||||
int zlib_text_method; /* holds zlib compression method */
|
||||
|
12
pngwutil.c
12
pngwutil.c
@ -192,7 +192,7 @@ png_write_chunk_end(png_structp png_ptr)
|
||||
png_write_data(png_ptr, buf, (png_size_t)4);
|
||||
}
|
||||
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
|
||||
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||
/* This pair of functions encapsulates the operation of (a) compressing a
|
||||
* text string, and (b) issuing it later as a series of chunk data writes.
|
||||
* The compression_state structure is shared context for these functions
|
||||
@ -471,7 +471,7 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
|
||||
/* Reset zlib for another zTXt/iTXt or image data */
|
||||
deflateReset(&png_ptr->zstream);
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||
|
||||
/* Write the IHDR chunk, and update the png_struct with the necessary
|
||||
* information. Note that the rest of this code depends upon this
|
||||
@ -664,6 +664,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD))
|
||||
png_ptr->zlib_method = 8;
|
||||
|
||||
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION
|
||||
if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_STRATEGY))
|
||||
png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY;
|
||||
@ -686,6 +687,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
png_ptr->zlib_text_window_bits = 15;
|
||||
png_ptr->zlib_text_method = 8;
|
||||
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
|
||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||
|
||||
/* Initialize the zlib compressor */
|
||||
ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
|
||||
@ -782,10 +784,10 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
|
||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
{
|
||||
int ret;
|
||||
unsigned int z_cmf; /* zlib compression method and flags */
|
||||
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
|
||||
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||
int ret;
|
||||
if (png_ptr->mode & PNG_ZLIB_READY_FOR_ZTXT)
|
||||
{
|
||||
/* png_warning(png_ptr, "Initialize compressor for IDAT"); */
|
||||
@ -815,7 +817,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
}
|
||||
png_ptr->mode &= ~PNG_ZLIB_READY_FOR_ZTXT; /* Ready for IDAT */
|
||||
}
|
||||
#endif /* PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED */
|
||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
|
Loading…
Reference in New Issue
Block a user