diff --git a/ANNOUNCE b/ANNOUNCE index c672a8e28db68e965a16f75fc30679fc7fb81cec..9ae7ccb6a42a9e226658d092ee75596e6585ec24 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.0beta35 - December 19, 2012 +Libpng 1.6.0beta35 - December 21, 2012 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. @@ -569,7 +569,9 @@ Version 1.6.0beta34 [December 19, 2012] Disassembled the version number in scripts/options.awk (necessary for building on SunOs). -Version 1.6.0beta35 [December 19, 2012] +Version 1.6.0beta35 [December 21, 2012] + Made default Zlib compression settings be configurable. This adds #defines to + pnglibconf.h to control the defaults. =========================================================================== NOTICE November 17, 2012: diff --git a/CHANGES b/CHANGES index 73794e2518e0cd88e084db70290e4dff65b217d3..41fcc579dd74a2cf0aafe2ac53a4fc683b48e4a5 100644 --- a/CHANGES +++ b/CHANGES @@ -4321,7 +4321,9 @@ Version 1.6.0beta34 [December 19, 2012] Disassembled the version number in scripts/options.awk (necessary for building on SunOs). -Version 1.6.0beta35 [December 19, 2012] +Version 1.6.0beta35 [December 21, 2012] + Made default Zlib compression settings be configurable. This adds #defines to + pnglibconf.h to control the defaults. =========================================================================== NOTICE November 17, 2012: diff --git a/pngwrite.c b/pngwrite.c index 1ef76d6e71cd35c4bb20b55b60885840b25d092d..6e333f58b930961b1708214470d5dcdc22b9de2d 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -501,15 +501,19 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, */ png_ptr->zbuffer_size = PNG_ZBUF_SIZE; - png_ptr->zlib_strategy = Z_FILTERED; /* may be overridden if no filters */ - png_ptr->zlib_level = Z_DEFAULT_COMPRESSION; + /* The 'zlib_strategy' setting is irrelevant because png_default_claim in + * pngwutil.c defaults it according to whether or not filters will be used, + * and ignores this setting. + */ + png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY; + png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION; png_ptr->zlib_mem_level = 8; png_ptr->zlib_window_bits = 15; png_ptr->zlib_method = 8; #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED - png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY; - png_ptr->zlib_text_level = Z_DEFAULT_COMPRESSION; + png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY; + png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION; png_ptr->zlib_text_mem_level = 8; png_ptr->zlib_text_window_bits = 15; png_ptr->zlib_text_method = 8; diff --git a/pngwutil.c b/pngwutil.c index 46908f797fcd6903f5f6bca8983900d044d5a6fe..bd8a4b12cf83d8e5a04d989b3105e6e7c9b86ae9 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -338,10 +338,10 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner, strategy = png_ptr->zlib_strategy; else if (png_ptr->do_filter != PNG_FILTER_NONE) - strategy = Z_FILTERED; + strategy = PNG_Z_DEFAULT_STRATEGY; else - strategy = Z_DEFAULT_STRATEGY; + strategy = PNG_Z_DEFAULT_NOFILTER_STRATEGY; } else diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index 7d71b71db7ce1d5e0e32ec498fbcf46acb5da579..af11ef9a35f86711b12c0cae39417530285296a9 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -182,6 +182,22 @@ setting PREFIX setting DEFAULT_READ_MACROS default 1 +# These settings configure the default compression level (0-9) and 'strategy'; +# strategy is as defined by the implementors of zlib, it describes the input +# data and modifies the zlib parameters in an attempt to optimize the balance +# between search and huffman encoding in the zlib algorithms. The defaults are +# the zlib.h defaults - the apparently recursive definition does not arise +# because the name of the setting is prefixed by PNG_ +# +# The TEXT values are the defaults when writing compressed text (all forms) + +setting Z_DEFAULT_COMPRESSION default Z_DEFAULT_COMPRESSION +setting Z_DEFAULT_STRATEGY default Z_FILTERED +setting Z_DEFAULT_NOFILTER_STRATEGY default Z_DEFAULT_STRATEGY + +setting TEXT_Z_DEFAULT_COMPRESSION default Z_DEFAULT_COMPRESSION +setting TEXT_Z_DEFAULT_STRATEGY default Z_DEFAULT_STRATEGY + # The alternative is to call functions to read PNG values, if # the functions are turned *off* the read macros must always # be enabled, so turning this off will actually force the diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt index 526705d9d0f0c85eced1e63a42dce5f7316506a2..52deab220c22ece9196f9afd4af65f672decf551 100644 --- a/scripts/pnglibconf.h.prebuilt +++ b/scripts/pnglibconf.h.prebuilt @@ -3,7 +3,7 @@ /* pnglibconf.h - library build configuration */ -/* Libpng 1.6.0beta35 - December 19, 2012 */ +/* Libpng 1.6.0beta35 - December 21, 2012 */ /* Copyright (c) 1998-2012 Glenn Randers-Pehrson */ @@ -34,8 +34,13 @@ #define PNG_QUANTIZE_RED_BITS 5 #define PNG_sCAL_PRECISION 5 #define PNG_sRGB_PROFILE_CHECKS 2 +#define PNG_TEXT_Z_DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION +#define PNG_TEXT_Z_DEFAULT_STRATEGY Z_DEFAULT_STRATEGY #define PNG_WEIGHT_SHIFT 8 #define PNG_ZBUF_SIZE 8192 +#define PNG_Z_DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION +#define PNG_Z_DEFAULT_NOFILTER_STRATEGY Z_DEFAULT_STRATEGY +#define PNG_Z_DEFAULT_STRATEGY Z_FILTERED /* end of settings */ /* options */ #define PNG_16BIT_SUPPORTED