From 6da2f2d92a3bafc725bb3192ca408d4a06de3bae Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 17 Jun 2011 23:07:16 -0500 Subject: [PATCH] [devel] Fix more inconsistencies from the swap of 16_TO_8 APIs. pngvalid still fails. --- png.h | 4 ++-- pngread.c | 15 +++++++++------ scripts/symbols.def | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/png.h b/png.h index c311f74ca..d5d3dc5ce 100644 --- a/png.h +++ b/png.h @@ -1426,12 +1426,12 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr, #ifdef PNG_READ_16_TO_8_SUPPORTED # ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED /* Scale a 16-bit depth file down to 8-bit, accurately. */ -PNG_EXPORT(48, void, png_set_scale_16, (png_structp png_ptr)); +PNG_EXPORT(229, void, png_set_scale_16, (png_structp png_ptr)); # endif # ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED /* Strip the second byte of information from a 16-bit depth file. */ -PNG_EXPORT(229, void, png_set_strip_16, (png_structp png_ptr)); +PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr)); # endif #endif diff --git a/pngread.c b/pngread.c index e200705f0..b11f4db0f 100644 --- a/pngread.c +++ b/pngread.c @@ -1289,18 +1289,21 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, #ifdef PNG_READ_16_TO_8_SUPPORTED /* Tell libpng to strip 16-bit/color files down to 8 bits per color. */ -# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED if (transforms & PNG_TRANSFORM_SCALE_16) png_set_scale_16(png_ptr); +# ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED + else + +# endif # endif # ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED - /* Added at libpng-1.5.4. "strip_16" produces the same result that it - * did in earlier versions, while "scale_16" is now more accurate. - */ - else + /* Added at libpng-1.5.4. "strip_16" produces the same result that it + * did in earlier versions, while "scale_16" is now more accurate. + */ if (transforms & PNG_TRANSFORM_STRIP_16) png_set_strip_16(png_ptr); -#endif +# endif #endif #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED diff --git a/scripts/symbols.def b/scripts/symbols.def index 0e7927ad2..38f942ff7 100644 --- a/scripts/symbols.def +++ b/scripts/symbols.def @@ -234,4 +234,4 @@ EXPORTS png_set_text_compression_method @226 png_set_alpha_mode @227 png_set_alpha_mode_fixed @228 - png_set_chop_16 @229 + png_set_scale_16 @229