[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:
John Bowler
2011-06-10 23:24:58 -05:00
committed by Glenn Randers-Pehrson
parent cc2770850a
commit b2bee3374c
12 changed files with 81 additions and 55 deletions

View File

@@ -1459,7 +1459,7 @@ png_set_compression_method(png_structp png_ptr, int method)
}
/* The following were added to libpng-1.5.3 */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
void PNGAPI
png_set_text_compression_level(png_structp png_ptr, int level)
{
@@ -1538,7 +1538,7 @@ png_set_text_compression_method(png_structp png_ptr, int method)
png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_METHOD;
png_ptr->zlib_text_method = method;
}
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
/* end of API added to libpng-1.5.3 */
void PNGAPI