mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Make the 16-to-8 scaling accurate. Dividing by 256 with no rounding is
wrong (high by one) 25% of the time. Dividing by 257 with rounding is
wrong in 128 out of 65536 cases. Getting the right answer all the time
without division is easy.
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
cc2770850a
commit
b2bee3374c
@@ -834,7 +834,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
png_ptr->zlib_method = 8;
|
||||
|
||||
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION
|
||||
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||
if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_STRATEGY))
|
||||
png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY;
|
||||
|
||||
@@ -855,7 +855,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
png_ptr->zlib_text_mem_level = png_ptr->zlib_mem_level;
|
||||
png_ptr->zlib_text_window_bits = png_ptr->zlib_window_bits;
|
||||
png_ptr->zlib_text_method = png_ptr->zlib_method;
|
||||
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
|
||||
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
|
||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||
|
||||
/* Record that the compressor has not yet been initialized. */
|
||||
|
||||
Reference in New Issue
Block a user