diff -ru4NwbB libpng-1.5.1/Makefile.am libpng-1.5.2beta01/Makefile.am --- libpng-1.5.1/Makefile.am 2011-02-02 22:58:25.869490312 -0600 +++ libpng-1.5.2beta01/Makefile.am 2011-02-13 07:01:45.378510987 -0600 @@ -161,9 +161,9 @@ rm -f $@ dfn?.out test -z "$(CPPFLAGS)" echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\ $(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out\ - logunsupported=1 - ${srcdir}/scripts/pnglibconf.dfa 1>&2 + logunsupported=2 - ${srcdir}/scripts/pnglibconf.dfa 1>&2 $(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2 rm dfn1.out mv dfn2.out $@ diff -ru4NwbB libpng-1.5.1/png.c libpng-1.5.2beta01/png.c --- libpng-1.5.1/png.c 2011-02-02 22:58:17.727227609 -0600 +++ libpng-1.5.2beta01/png.c 2011-02-13 07:01:38.588914502 -0600 @@ -1,8 +1,8 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.1 [February 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.1/png.h libpng-1.5.2beta01/png.h --- libpng-1.5.1/png.h 2011-02-02 22:58:17.679708709 -0600 +++ libpng-1.5.2beta01/png.h 2011-02-13 07:01:38.539736266 -0600 @@ -146,8 +146,9 @@ * 1.5.0 15 10500 15.so.15.0[.0] * 1.5.1beta01-11 15 10501 15.so.15.1[.0] * 1.5.1rc01-02 15 10501 15.so.15.1[.0] * 1.5.1 15 10501 15.so.15.1[.0] + * 1.5.2beta01 15 10502 15.so.15.2[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The @@ -795,37 +796,35 @@ typedef struct png_struct_def png_struct; typedef PNG_CONST png_struct FAR * png_const_structp; typedef png_struct FAR * png_structp; -typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp), ); -typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t), ); -typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp), ); +typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); +typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t)); +typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32, - int), ); + int)); typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, - int), ); + int)); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED -typedef PNG_CALLBACK(void, *png_progressive_info_ptr, - (png_structp, png_infop), ); -typedef PNG_CALLBACK(void, *png_progressive_end_ptr, - (png_structp, png_infop), ); -typedef PNG_CALLBACK(void, *png_progressive_row_ptr, - (png_structp, png_bytep, png_uint_32, int), ); +typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); +typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); +typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, + png_uint_32, int)); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -typedef PNG_CALLBACK(void, *png_user_transform_ptr, - (png_structp, png_row_infop, png_bytep), ); +typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, + png_bytep)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, - png_unknown_chunkp), ); + png_unknown_chunkp)); #endif #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED -typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp), ); +typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); #endif #ifdef PNG_SETJMP_SUPPORTED /* This must match the function definition in , and the @@ -880,10 +879,10 @@ * ignores the first argument) should be completely compatible with the * following. */ typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, - png_alloc_size_t), ); -typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp), ); + png_alloc_size_t)); +typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); typedef png_struct FAR * FAR * png_structpp; /* Section 3: exported functions @@ -1060,8 +1059,15 @@ PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structp png_ptr)); PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structp png_ptr)); #endif +#ifdef PNG_READ_EXPAND_16_SUPPORTED +/* Expand to 16 bit channels, forces conversion of palette to RGB and expansion + * of a tRNS chunk if present. + */ +PNG_EXPORT(221, void, png_set_expand_16, (png_structp png_ptr)); +#endif + #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) /* Use blue, green, red order for pixels. */ PNG_EXPORT(30, void, png_set_bgr, (png_structp png_ptr)); #endif @@ -1477,8 +1483,12 @@ * transform callback. Also note that when transforming an interlaced image the * row number is still the row in the final, de-interlaced, image but the row * only contains the data of the current pass - consult png_row_info for the * actual width of the row! + * + * In contrast the row numbers passed to the progressive reader and sequential + * reader callbacks are actually the rows in the input data - so the row in the + * interlaced pass for an interlaced image. */ PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp)); PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp)); #endif @@ -2267,9 +2277,9 @@ * one to use is one more than this.) Maintainer, remember to add an entry to * scripts/symbols.def as well. */ #ifdef PNG_EXPORT_LAST_ORDINAL - PNG_EXPORT_LAST_ORDINAL(220); + PNG_EXPORT_LAST_ORDINAL(221); #endif #ifdef __cplusplus } diff -ru4NwbB libpng-1.5.1/pngconf.h libpng-1.5.2beta01/pngconf.h --- libpng-1.5.1/pngconf.h 2011-02-02 22:58:17.686514505 -0600 +++ libpng-1.5.2beta01/pngconf.h 2011-02-13 07:01:38.546721175 -0600 @@ -281,25 +281,17 @@ # define PNG_IMPEXP # endif #endif -/* THe following complexity is concerned with getting the 'attributes' of the - * declared function in the correct place. This potentially requires a separate - * PNG_EXPORT function for every compiler. +/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat + * 'attributes' as a storage class - the attributes go at the start of the + * function definition, and attributes are always appended regardless of the + * compiler. This considerably simplifies these macros but may cause problems + * if any compilers both need function attributes and fail to handle them as + * a storage class (this is unlikely.) */ #ifndef PNG_FUNCTION -# ifdef __GNUC__ -# define PNG_FUNCTION(type, name, args, attributes)\ - attributes type name args -# else /* !GNUC */ -# ifdef _MSC_VER -# define PNG_FUNCTION(type, name, args, attributes)\ - attributes type name args -# else /* !MSC */ -# define PNG_FUNCTION(type, name, args, attributes)\ - type name args -# endif -# endif +# define PNG_FUNCTION(type, name, args, attributes) attributes type name args #endif #ifndef PNG_EXPORT_TYPE # define PNG_EXPORT_TYPE(type) PNG_IMPEXP type @@ -310,23 +302,27 @@ * scripts directory. */ #ifndef PNG_EXPORTA # define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - extern PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args),\ + PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), extern\ attributes) #endif +/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, + * so make something non-empty to satisfy the requirement: + */ +#define PNG_EMPTY /*empty list*/ + #define PNG_EXPORT(ordinal, type, name, args)\ - PNG_EXPORTA(ordinal, type, name, args, ) + PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY) /* Use PNG_REMOVED to comment out a removed interface. */ #ifndef PNG_REMOVED # define PNG_REMOVED(ordinal, type, name, args, attributes) #endif #ifndef PNG_CALLBACK -# define PNG_CALLBACK(type, name, args, attributes)\ - type (PNGCBAPI name) PNGARG(args) attributes +# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args) #endif /* Support for compiler specific function attributes. These are used * so that where compiler support is available incorrect use of API @@ -346,18 +342,32 @@ * so that where compiler support is available incorrect use of API * functions in png.h will generate compiler warnings. Added at libpng * version 1.2.41. */ -# ifdef __GNUC__ +# if defined(__GNUC__) # ifndef PNG_USE_RESULT # define PNG_USE_RESULT __attribute__((__warn_unused_result__)) # endif # ifndef PNG_NORETURN # define PNG_NORETURN __attribute__((__noreturn__)) # endif # ifndef PNG_PTR_NORETURN + /* It's not enough to have the compiler be the correct compiler at + * this point - it's necessary for the library (which defines + * the type of the library longjmp) to also be the GNU library. + * This is because many systems use the GNU compiler with a + * non-GNU libc implementation. Min/GW headers are also compatible + * with GCC as well as uclibc, so it seems best to exclude known + * problem libcs here rather than just including known libcs. + * + * NOTE: this relies on the only use of PNG_PTR_NORETURN being with + * the system longjmp. If the same type is used elsewhere then this + * will need to be changed. + */ +# if !defined(__CYGWIN__) # define PNG_PTR_NORETURN __attribute__((__noreturn__)) # endif +# endif # ifndef PNG_ALLOCATED # define PNG_ALLOCATED __attribute__((__malloc__)) # endif @@ -379,9 +389,9 @@ # else # define PNG_PRIVATE \ __attribute__((__deprecated__)) # endif -# endif /* PNG_PRIVATE */ +# endif # endif /* PNGLIB_BUILD */ # endif /* __GNUC__ */ # ifdef _MSC_VER /* may need to check value */ # ifndef PNG_USE_RESULT @@ -409,11 +419,11 @@ # define PNG_DEPSTRUCT __declspec(deprecated) # endif # ifndef PNG_PRIVATE # define PNG_PRIVATE __declspec(deprecated) -# endif /* PNG_PRIVATE */ +# endif # endif /* PNGLIB_BUILD */ -# endif /* __GNUC__ */ +# endif /* _MSC_VER */ #endif /* PNG_PEDANTIC_WARNINGS */ #ifndef PNG_DEPRECATED # define PNG_DEPRECATED /* Use of this function is deprecated */ @@ -423,8 +433,11 @@ #endif #ifndef PNG_NORETURN # define PNG_NORETURN /* This function does not return */ #endif +#ifndef PNG_PTR_NORETURN +# define PNG_PTR_NORETURN /* This function does not return */ +#endif #ifndef PNG_ALLOCATED # define PNG_ALLOCATED /* The result of the function is new memory */ #endif #ifndef PNG_DEPSTRUCT diff -ru4NwbB libpng-1.5.1/pngerror.c libpng-1.5.2beta01/pngerror.c --- libpng-1.5.1/pngerror.c 2011-02-02 22:58:17.732911879 -0600 +++ libpng-1.5.2beta01/pngerror.c 2011-02-13 07:01:38.594706777 -0600 @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.1 [February 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.1/pngget.c libpng-1.5.2beta01/pngget.c --- libpng-1.5.1/pngget.c 2011-02-02 22:58:17.740070723 -0600 +++ libpng-1.5.2beta01/pngget.c 2011-02-13 07:01:38.602267337 -0600 @@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.1 [February 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.1/pngmem.c libpng-1.5.2beta01/pngmem.c --- libpng-1.5.1/pngmem.c 2011-02-02 22:58:17.746290285 -0600 +++ libpng-1.5.2beta01/pngmem.c 2011-02-13 07:01:38.608682310 -0600 @@ -1,8 +1,8 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.1 [February 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.1/pngpread.c libpng-1.5.2beta01/pngpread.c --- libpng-1.5.1/pngpread.c 2011-02-02 22:58:17.755135954 -0600 +++ libpng-1.5.2beta01/pngpread.c 2011-02-13 07:01:38.617809869 -0600 @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -1025,9 +1025,9 @@ (int)(png_ptr->row_buf[0])); png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1); - if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + if (png_ptr->transformations) png_do_read_transformations(png_ptr); #ifdef PNG_READ_INTERLACING_SUPPORTED /* Blow up interlaced rows to full size */ diff -ru4NwbB libpng-1.5.1/pngpriv.h libpng-1.5.2beta01/pngpriv.h --- libpng-1.5.1/pngpriv.h 2011-02-02 22:58:17.694499401 -0600 +++ libpng-1.5.2beta01/pngpriv.h 2011-02-13 07:01:38.554871770 -0600 @@ -5,9 +5,9 @@ * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h @@ -285,9 +285,9 @@ #define PNG_INVERT_MONO 0x0020 #define PNG_QUANTIZE 0x0040 #define PNG_BACKGROUND 0x0080 #define PNG_BACKGROUND_EXPAND 0x0100 - /* 0x0200 unused */ +#define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */ #define PNG_16_TO_8 0x0400 #define PNG_RGBA 0x0800 #define PNG_EXPAND 0x1000 #define PNG_GAMMA 0x2000 @@ -339,10 +339,10 @@ #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L -#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ -#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ + /* 0x200000L unused */ + /* 0x400000L unused */ #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */ /* 0x1000000L unused */ /* 0x2000000L unused */ /* 0x4000000L unused */ @@ -771,10 +771,10 @@ #endif #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 flags)); +PNG_EXTERN void png_do_strip_channel PNGARG((png_row_infop row_info, + png_bytep row, int at_start)); #endif #ifdef PNG_16BIT_SUPPORTED #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) @@ -874,8 +874,13 @@ PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, png_bytep row, png_const_color_16p trans_color)); #endif +#ifdef PNG_READ_EXPAND_16_SUPPORTED +PNG_EXTERN void png_do_expand_16 PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + /* The following decodes the appropriate chunks, and does error correction, * then calls the appropriate callback for the chunk if it is valid. */ @@ -1183,15 +1188,15 @@ * for overflow, true (1) if no overflow, in which case *res * holds the result. */ PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a, - png_int_32 times, png_int_32 div)); + png_int_32 multiplied_by, png_int_32 divided_by)); #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) /* Same deal, but issue a warning on overflow and return 0. */ PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr, - png_fixed_point a, png_int_32 times, png_int_32 div)); + png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by)); #endif #ifdef PNG_READ_GAMMA_SUPPORTED /* Calculate a reciprocal - used for gamma values. This returns @@ -1216,14 +1221,14 @@ * While the input is an 'unsigned' value it must actually be the * correct bit value - 0..255 or 0..65535 as required. */ PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr, - unsigned int value, png_fixed_point gamma)); -PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma)); + unsigned int value, png_fixed_point gamma_value)); +PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma_value)); PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value, - png_fixed_point gamma)); + png_fixed_point gamma_value)); PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value, - png_fixed_point gamma)); + png_fixed_point gamma_value)); PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, int bit_depth)); #endif diff -ru4NwbB libpng-1.5.1/pngread.c libpng-1.5.2beta01/pngread.c --- libpng-1.5.1/pngread.c 2011-02-02 22:58:17.763092690 -0600 +++ libpng-1.5.2beta01/pngread.c 2011-02-13 07:01:38.625941818 -0600 @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.5.1 [$RDATE%] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -701,9 +701,9 @@ } #endif - if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + if (png_ptr->transformations) png_do_read_transformations(png_ptr); #ifdef PNG_READ_INTERLACING_SUPPORTED /* Blow up interlaced rows to full size */ @@ -1310,9 +1310,9 @@ voidp params) { int row; - if (png_ptr == NULL) + if (png_ptr == NULL || info_ptr == NULL) return; /* png_read_info() gives us all of the information from the * PNG file before the first IDAT (image data chunk). @@ -1425,8 +1425,13 @@ #endif /* We don't handle adding filler bytes */ + /* We use png_read_image and rely on that for interlace handling, but we also + * call png_read_update_info therefore must turn on interlace handling now: + */ + (void)png_set_interlace_handling(png_ptr); + /* Optional call to gamma correct and add the background to the palette * and update info structure. REQUIRED if you are expecting libpng to * update the palette for you (i.e., you selected such a transform above). */ diff -ru4NwbB libpng-1.5.1/pngrtran.c libpng-1.5.2beta01/pngrtran.c --- libpng-1.5.1/pngrtran.c 2011-02-02 22:58:17.782646907 -0600 +++ libpng-1.5.2beta01/pngrtran.c 2011-02-13 07:01:38.646485756 -0600 @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -136,8 +136,9 @@ if (png_ptr == NULL) return; png_ptr->transformations |= PNG_16_TO_8; + png_ptr->transformations &= ~PNG_EXPAND_16; } #endif #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED @@ -148,9 +149,9 @@ if (png_ptr == NULL) return; - png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; + png_ptr->transformations |= PNG_STRIP_ALPHA; } #endif #ifdef PNG_READ_QUANTIZE_SUPPORTED @@ -685,8 +686,27 @@ png_ptr->flags &= ~PNG_FLAG_ROW_INIT; } #endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ +#ifdef PNG_READ_EXPAND_16_SUPPORTED +/* Expand to 16 bit channels, expand the tRNS chunk too (because otherwise + * it may not work correctly.) + */ +void PNGAPI +png_set_expand_16(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand_16"); + + if (png_ptr == NULL) + return; + + png_ptr->transformations |= (PNG_EXPAND_16 | PNG_EXPAND | PNG_EXPAND_tRNS); + png_ptr->transformations &= ~PNG_16_TO_8; + + png_ptr->flags &= ~PNG_FLAG_ROW_INIT; +} +#endif + #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED void PNGAPI png_set_gray_to_rgb(png_structp png_ptr) { @@ -1072,9 +1092,9 @@ * to a simple alpha channel strip. */ png_ptr->transformations &= ~PNG_BACKGROUND; png_ptr->transformations &= ~PNG_GAMMA; - png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; + png_ptr->transformations |= PNG_STRIP_ALPHA; } /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ else @@ -1206,9 +1226,9 @@ } /* Handled alpha, still need to strip the channel. */ png_ptr->transformations &= ~PNG_BACKGROUND; - png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; + png_ptr->transformations |= PNG_STRIP_ALPHA; } #endif /* PNG_READ_BACKGROUND_SUPPORTED */ #ifdef PNG_READ_SHIFT_SUPPORTED @@ -1284,8 +1304,16 @@ } } #endif +#ifdef PNG_READ_EXPAND_16_SUPPORTED + if (png_ptr->transformations & PNG_EXPAND_16 && info_ptr->bit_depth == 8 && + info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) + { + info_ptr->bit_depth = 16; + } +#endif + #ifdef PNG_READ_BACKGROUND_SUPPORTED if (png_ptr->transformations & PNG_BACKGROUND) { info_ptr->color_type = (png_byte)(info_ptr->color_type & @@ -1352,9 +1380,9 @@ else info_ptr->channels = 1; #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED - if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) + if (png_ptr->transformations & PNG_STRIP_ALPHA) info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; #endif if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) @@ -1444,20 +1473,26 @@ if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS)) png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, &(png_ptr->trans_color)); - else + else png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, NULL); } } #endif + /* Delay the 'expand 16' step until later for efficiency, so that the + * intermediate steps work with 8 bit data. + */ + #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED - if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) - png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, - PNG_FLAG_FILLER_AFTER | (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)); + if ((png_ptr->transformations & PNG_STRIP_ALPHA) && + (png_ptr->row_info.color_type == PNG_COLOR_TYPE_RGB_ALPHA || + png_ptr->row_info.color_type == PNG_COLOR_TYPE_GRAY_ALPHA)) + png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1, + 0/*!at_start, because SWAP_ALPHA happens later*/); #endif #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED if (png_ptr->transformations & PNG_RGB_TO_GRAY) @@ -1564,8 +1599,18 @@ png_error(png_ptr, "png_do_quantize returned rowbytes=0"); } #endif /* PNG_READ_QUANTIZE_SUPPORTED */ +#ifdef PNG_READ_EXPAND_16_SUPPORTED + /* Do the expansion now, after all the arithmetic has been done. Notice + * that previous transformations can handle the PNG_EXPAND_16 flag if this + * is efficient (particularly true in the case of gamma correction, where + * better accuracy results faster!) + */ + if (png_ptr->transformations & PNG_EXPAND_16) + png_do_expand_16(&png_ptr->row_info, png_ptr->row_buf + 1); +#endif + #ifdef PNG_READ_INVERT_SUPPORTED if (png_ptr->transformations & PNG_INVERT_MONO) png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif @@ -1591,8 +1636,11 @@ png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED + /*NOTE: this must be in the wrong place - what happens if BGR is set too? + * Need pngvalid to test this combo. + */ /* If gray -> RGB, do so now only if we did not do so above */ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && (png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); @@ -4063,8 +4111,39 @@ } } #endif +#ifdef PNG_READ_EXPAND_16_SUPPORTED +/* If the bit depth is 8 and the colour type is not a palette type expand the + * whole row to 16 bits. Has no effect otherwise. + */ +void /* PRIVATE */ +png_do_expand_16(png_row_infop row_info, png_bytep row) +{ + if (row_info->bit_depth == 8 && + row_info->color_type != PNG_COLOR_TYPE_PALETTE) + { + /* The row have a sequence of bytes containing [0..255] and we need + * to turn it into another row containing [0..65535], to do this we + * calculate: + * + * (input / 255) * 65535 + * + * Which happens to be exactly input * 257 and this can be achieved + * simply by byte replication in place (copying backwards). + */ + png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */ + png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */ + while (dp > sp) + dp[-2] = dp[-1] = *--sp, dp -= 2; + + row_info->rowbytes *= 2; + row_info->bit_depth = 16; + row_info->pixel_depth = (png_byte)(row_info->channels * 16); + } +} +#endif + #ifdef PNG_READ_QUANTIZE_SUPPORTED void /* PRIVATE */ png_do_quantize(png_row_infop row_info, png_bytep row, png_const_bytep palette_lookup, png_const_bytep quantize_lookup) diff -ru4NwbB libpng-1.5.1/pngrutil.c libpng-1.5.2beta01/pngrutil.c --- libpng-1.5.1/pngrutil.c 2011-02-02 22:58:17.796148619 -0600 +++ libpng-1.5.2beta01/pngrutil.c 2011-02-13 07:01:38.660633067 -0600 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -3462,8 +3462,26 @@ } } #endif +#ifdef PNG_READ_EXPAND_16_SUPPORTED + if (png_ptr->transformations & PNG_EXPAND_16) + { +# ifdef PNG_READ_EXPAND_SUPPORTED + /* In fact it is an error if it isn't supported, but checking is + * the safe way. + */ + if (png_ptr->transformations & PNG_EXPAND) + { + if (png_ptr->bit_depth < 16) + max_pixel_depth *= 2; + } + else +# endif + png_ptr->transformations &= ~PNG_EXPAND_16; + } +#endif + #ifdef PNG_READ_FILLER_SUPPORTED if (png_ptr->transformations & (PNG_FILLER)) { if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) diff -ru4NwbB libpng-1.5.1/pngset.c libpng-1.5.2beta01/pngset.c --- libpng-1.5.1/pngset.c 2011-02-02 22:58:17.804187237 -0600 +++ libpng-1.5.2beta01/pngset.c 2011-02-13 07:01:38.668995738 -0600 @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.1 [February 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.1/pngtrans.c libpng-1.5.2beta01/pngtrans.c --- libpng-1.5.1/pngtrans.c 2011-02-02 22:58:17.819661451 -0600 +++ libpng-1.5.2beta01/pngtrans.c 2011-02-13 07:01:38.684674290 -0600 @@ -1,8 +1,8 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -423,172 +423,117 @@ #endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -/* Remove filler or alpha byte(s) */ +/* Remove a channel - this used to be 'png_do_strip_filler' but it used a + * somewhat weird combination of flags to determine what to do. All the calls + * to png_do_strip_filler are changed in 1.5.2 to call this instead with the + * correct arguments. + * + * The routine isn't general - the channel must be the channel at the start or + * end (not in the middle) of each pixel. + */ void /* PRIVATE */ -png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) +png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) { - png_debug(1, "in png_do_strip_filler"); - - { - png_bytep sp = row; - png_bytep dp = row; - png_uint_32 row_width = row_info->width; - png_uint_32 i; - - if ((row_info->color_type == PNG_COLOR_TYPE_RGB || - (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && - (flags & PNG_FLAG_STRIP_ALPHA))) && - row_info->channels == 4) + png_bytep sp = row; /* source pointer */ + png_bytep dp = row; /* destination pointer */ + png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */ + + /* At the start sp will point to the first byte to copy and dp to where + * it is copied to. ep always points just beyond the end of the row, so + * the loop simply copies (channels-1) channels until sp reaches ep. + */ + /* GA, GX, XG cases */ + if (row_info->channels == 2) { if (row_info->bit_depth == 8) { - /* This converts from RGBX or RGBA to RGB */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - dp += 3; sp += 4; - for (i = 1; i < row_width; i++) - { - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - sp++; - } - } + if (at_start) /* Skip initial filler */ + ++sp; + else /* Skip initial channels and, for sp, the filler */ + sp += 2, ++dp; + + /* For a 1 pixel wide image there is nothing to do */ + while (sp < ep) + *dp++ = *sp, sp += 2; - /* This converts from XRGB or ARGB to RGB */ - else - { - for (i = 0; i < row_width; i++) - { - sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - } - } - row_info->pixel_depth = 24; - row_info->rowbytes = row_width * 3; + row_info->pixel_depth = 8; } - else /* if (row_info->bit_depth == 16) */ - { - if (flags & PNG_FLAG_FILLER_AFTER) - { - /* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */ - sp += 8; dp += 6; - for (i = 1; i < row_width; i++) + else if (row_info->bit_depth == 16) { - /* This could be (although png_memcpy is probably slower): - png_memcpy(dp, sp, 6); - sp += 8; - dp += 6; - */ - - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; + if (at_start) sp += 2; - } + else + sp += 4, dp += 2; + + while (sp < ep) + *dp++ = *sp++, *dp++ = *sp, sp += 3; + + row_info->pixel_depth = 16; } else - { - /* This converts from XXRRGGBB or AARRGGBB to RRGGBB */ - for (i = 0; i < row_width; i++) - { - /* This could be (although png_memcpy is probably slower): - png_memcpy(dp, sp, 6); - sp += 8; - dp += 6; - */ + return; /* bad bit depth */ - sp += 2; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - } - } + row_info->channels = 1; - row_info->pixel_depth = 48; - row_info->rowbytes = row_width * 6; - } - row_info->channels = 3; + /* Finally fix the color type if it records an alpha channel */ + if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + row_info->color_type = PNG_COLOR_TYPE_GRAY; } - else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY || - (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && - (flags & PNG_FLAG_STRIP_ALPHA))) && - row_info->channels == 2) + /* RGBA, RGBX, XRGB cases */ + else if (row_info->channels == 4) { if (row_info->bit_depth == 8) { - if (flags & PNG_FLAG_FILLER_AFTER) - { - /* This converts from GX or GA to G */ - for (i = 0; i < row_width; i++) - { - *dp++ = *sp++; - sp++; - } - } + if (at_start) /* Skip initial filler */ + ++sp; + else /* Skip initial channels and, for sp, the filler */ + sp += 4, dp += 3; + + /* Note that the loop adds 3 to dp and 4 to sp each time. */ + while (sp < ep) + *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2; - else - { - /* This converts from XG or AG to G */ - for (i = 0; i < row_width; i++) - { - sp++; - *dp++ = *sp++; - } - } - - row_info->pixel_depth = 8; - row_info->rowbytes = row_width; + row_info->pixel_depth = 24; } - else /* if (row_info->bit_depth == 16) */ - { - if (flags & PNG_FLAG_FILLER_AFTER) - { - /* This converts from GGXX or GGAA to GG */ - sp += 4; dp += 2; - for (i = 1; i < row_width; i++) + else if (row_info->bit_depth == 16) { - *dp++ = *sp++; - *dp++ = *sp++; + if (at_start) sp += 2; - } - } - else + sp += 8, dp += 6; + + while (sp < ep) { - /* This converts from XXGG or AAGG to GG */ - for (i = 0; i < row_width; i++) - { - sp += 2; - *dp++ = *sp++; - *dp++ = *sp++; - } + /* Copy 6 bytes, skip 2 */ + *dp++ = *sp++, *dp++ = *sp++; + *dp++ = *sp++, *dp++ = *sp++; + *dp++ = *sp++, *dp++ = *sp, sp += 3; } - row_info->pixel_depth = 16; - row_info->rowbytes = row_width * 2; - } - row_info->channels = 1; + row_info->pixel_depth = 48; } - if (flags & PNG_FLAG_STRIP_ALPHA) - row_info->color_type = (png_byte)(row_info->color_type & - ~PNG_COLOR_MASK_ALPHA); + else + return; /* bad bit depth */ + + row_info->channels = 3; + + /* Finally fix the color type if it records an alpha channel */ + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + row_info->color_type = PNG_COLOR_TYPE_RGB; } + + else + return; /* The filler channel has gone already */ + + /* Fix the rowbytes value. */ + row_info->rowbytes = dp-row; } #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) @@ -702,13 +647,23 @@ return ((png_voidp)png_ptr->user_transform_ptr); } #endif +#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED png_uint_32 PNGAPI png_get_current_row_number(png_const_structp png_ptr) { + /* This API returns the row in output, not the input row: */ if (png_ptr != NULL) + { + if (png_ptr->interlaced == PNG_INTERLACE_NONE) return png_ptr->row_number; + else if (png_ptr->interlaced == PNG_INTERLACE_ADAM7) + return PNG_ROW_FROM_PASS_ROW(png_ptr->row_number, png_ptr->pass); + + /* Else something bad is happening: */ + } + return PNG_UINT_32_MAX; /* help the app not to fail silently */ } png_byte PNGAPI @@ -717,7 +672,8 @@ if (png_ptr != NULL) return png_ptr->pass; return 8; /* invalid */ } +#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */ #endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || PNG_WRITE_USER_TRANSFORM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff -ru4NwbB libpng-1.5.1/pngvalid.c libpng-1.5.2beta01/pngvalid.c --- libpng-1.5.1/pngvalid.c 2011-02-02 22:58:17.839843080 -0600 +++ libpng-1.5.2beta01/pngvalid.c 2011-02-13 07:01:38.705366637 -0600 @@ -1,8 +1,8 @@ /* pngvalid.c - validate libpng by constructing then reading png files. * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 2011 Glenn Randers-Pehrson * Written by John Cunningham Bowler * * This code is released under the libpng license. @@ -978,9 +978,9 @@ pool->list = next->next; next->next = NULL; fprintf(stderr, "\t%lu bytes @ %p\n", - (unsigned long)next->size, next+1); + (unsigned long)next->size, (PNG_CONST void*)(next+1)); /* The NULL means this will always return, even if the memory is * corrupted. */ store_memory_free(NULL, pool, next); @@ -3071,9 +3071,15 @@ /* In the case where the reader doesn't do the interlace it gives * us the y in the sub-image: */ if (dp->do_interlace && dp->interlace_type == PNG_INTERLACE_ADAM7) + { + if (pass != png_get_current_pass_number(pp)) + png_error(pp, "png_get_current_pass_number is broken"); y = PNG_ROW_FROM_PASS_ROW(y, pass); + if (y != png_get_current_row_number(pp)) + png_error(pp, "png_get_current_row_number is broken"); + } /* Validate this just in case. */ if (y >= dp->h) png_error(pp, "invalid y to progressive row callback"); @@ -4458,8 +4464,50 @@ bit_depth); } IT(expand_gray_1_2_4_to_8, expand); +/* png_set_expand_16 */ +static void +image_transform_png_set_expand_16_set(PNG_CONST image_transform *this, + transform_display *that, png_structp pp, png_infop pi) +{ + png_set_expand_16(pp); + this->next->set(this->next, that, pp, pi); +} + +static void +image_transform_png_set_expand_16_mod(PNG_CONST image_transform *this, + image_pixel *that, png_structp pp, PNG_CONST transform_display *display) +{ + /* Expect expand_16 to expand everything to 16 bits as a result of also + * causing 'expand' to happen. + */ + if (that->colour_type == PNG_COLOR_TYPE_PALETTE) + image_pixel_convert_PLTE(that, &display->this); + + if (that->have_tRNS) + image_pixel_add_alpha(that, &display->this); + + if (that->bit_depth < 16) + that->sample_depth = that->bit_depth = 16; + + this->next->mod(this->next, that, pp, display); +} + +static int +image_transform_png_set_expand_16_add(image_transform *this, + PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth) +{ + UNUSED(colour_type) + + this->next = *that; + *that = this; + + /* expand_16 does something unless the bit depth is already 16. */ + return bit_depth < 16; +} + +IT(expand_16, expand_gray_1_2_4_to_8); /* png_set_strip_16 */ static void image_transform_png_set_strip_16_set(PNG_CONST image_transform *this, @@ -4509,9 +4557,9 @@ return bit_depth > 8; } -IT(strip_16, expand_gray_1_2_4_to_8); +IT(strip_16, expand_16); /* png_set_strip_alpha */ static void image_transform_png_set_strip_alpha_set(PNG_CONST image_transform *this, diff -ru4NwbB libpng-1.5.1/pngwrite.c libpng-1.5.2beta01/pngwrite.c --- libpng-1.5.1/pngwrite.c 2011-02-02 22:58:17.853713669 -0600 +++ libpng-1.5.2beta01/pngwrite.c 2011-02-13 07:01:38.719658462 -0600 @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.5.1 [(PENDING RELEASE)] + * Last changed in libpng 1.5.1 [February 3, 2011] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * diff -ru4NwbB libpng-1.5.1/pngwtran.c libpng-1.5.2beta01/pngwtran.c --- libpng-1.5.1/pngwtran.c 2011-02-02 22:58:17.859790706 -0600 +++ libpng-1.5.2beta01/pngwtran.c 2011-02-13 07:01:38.725947619 -0600 @@ -1,8 +1,8 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.2 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -43,10 +43,10 @@ #endif #ifdef PNG_WRITE_FILLER_SUPPORTED if (png_ptr->transformations & PNG_FILLER) - png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->flags); + png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1, + !(png_ptr->flags & PNG_FILLER_AFTER)); #endif #ifdef PNG_WRITE_PACKSWAP_SUPPORTED if (png_ptr->transformations & PNG_PACKSWAP) diff -ru4NwbB libpng-1.5.1/scripts/pnglibconf.dfa libpng-1.5.2beta01/scripts/pnglibconf.dfa --- libpng-1.5.1/scripts/pnglibconf.dfa 2011-01-22 18:03:50.437008000 -0600 +++ libpng-1.5.2beta01/scripts/pnglibconf.dfa 2011-02-12 09:16:01.541296000 -0600 @@ -303,8 +303,9 @@ option READ_TRANSFORMS requires READ = NO_READ_TRANSFORMS READ_TRANSFORMS_NOT_SUPPORTED option READ_EXPAND requires READ_TRANSFORMS +option READ_EXPAND_16 requires READ_TRANSFORMS READ_16BIT enables READ_EXPAND option READ_SHIFT requires READ_TRANSFORMS option READ_PACK requires READ_TRANSFORMS option READ_BGR requires READ_TRANSFORMS option READ_SWAP requires READ_TRANSFORMS READ_16BIT diff -ru4NwbB libpng-1.5.1/scripts/pnglibconf.h.prebuilt libpng-1.5.2beta01/scripts/pnglibconf.h.prebuilt --- libpng-1.5.1/scripts/pnglibconf.h.prebuilt 2011-01-22 18:03:50.445714000 -0600 +++ libpng-1.5.2beta01/scripts/pnglibconf.h.prebuilt 2011-02-12 09:20:50.414618000 -0600 @@ -2,175 +2,180 @@ /* libpng STANDARD API DEFINITION */ /* pnglibconf.h - library build configuration */ -/* libpng version 1.5.0 - last changed on January 6, 2011 */ +/* libpng version 1.5.0 - last changed on February 11, 2011 */ /* Copyright (c) 1998-2011 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ /* For conditions of distribution and use, see the disclaimer */ /* and license in png.h */ /* pnglibconf.h */ -/* Machine generated file: DO NOT EDIT */ /* Derived from: scripts/pnglibconf.dfa */ +/* If you edit this file by hand you must obey the rules expressed in */ +/* pnglibconf.dfa with respect to the dependencies between the following */ +/* symbols. It is much better to generate a new file using */ +/* scripts/libpngconf.mak */ + #ifndef PNGLCONF_H #define PNGLCONF_H /* settings */ -#define PNG_MAX_GAMMA_8 11 -#define PNG_CALLOC_SUPPORTED -#define PNG_QUANTIZE_RED_BITS 5 -#define PNG_USER_WIDTH_MAX 1000000L -#define PNG_QUANTIZE_GREEN_BITS 5 #define PNG_API_RULE 0 +#define PNG_CALLOC_SUPPORTED +#define PNG_COST_SHIFT 3 +#define PNG_DEFAULT_READ_MACROS 1 +#define PNG_GAMMA_THRESHOLD_FIXED 5000 +#define PNG_MAX_GAMMA_8 11 #define PNG_QUANTIZE_BLUE_BITS 5 +#define PNG_QUANTIZE_GREEN_BITS 5 +#define PNG_QUANTIZE_RED_BITS 5 +#define PNG_sCAL_PRECISION 5 #define PNG_USER_CHUNK_CACHE_MAX 0 +#define PNG_USER_CHUNK_MALLOC_MAX 0 #define PNG_USER_HEIGHT_MAX 1000000L -#define PNG_sCAL_PRECISION 5 -#define PNG_COST_SHIFT 3 +#define PNG_USER_WIDTH_MAX 1000000L #define PNG_WEIGHT_SHIFT 8 -#define PNG_USER_CHUNK_MALLOC_MAX 0 -#define PNG_DEFAULT_READ_MACROS 1 #define PNG_ZBUF_SIZE 8192 -#define PNG_GAMMA_THRESHOLD_FIXED 5000 /* end of settings */ /* options */ -#define PNG_INFO_IMAGE_SUPPORTED -#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -#define PNG_POINTER_INDEXING_SUPPORTED -#define PNG_WARNINGS_SUPPORTED -#define PNG_FLOATING_ARITHMETIC_SUPPORTED -#define PNG_WRITE_SUPPORTED -#define PNG_WRITE_INTERLACING_SUPPORTED -#define PNG_WRITE_16BIT_SUPPORTED -#define PNG_EASY_ACCESS_SUPPORTED +#define PNG_16BIT_SUPPORTED #define PNG_ALIGN_MEMORY_SUPPORTED -#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED -#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_USER_LIMITS_SUPPORTED -#define PNG_FIXED_POINT_SUPPORTED -/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ -#define PNG_ERROR_TEXT_SUPPORTED -#define PNG_READ_SUPPORTED -/*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/ #define PNG_BENIGN_ERRORS_SUPPORTED -#define PNG_SETJMP_SUPPORTED -#define PNG_WRITE_FLUSH_SUPPORTED -#define PNG_MNG_FEATURES_SUPPORTED +#define PNG_bKGD_SUPPORTED +#define PNG_CHECK_cHRM_SUPPORTED +#define PNG_cHRM_SUPPORTED +#define PNG_CONSOLE_IO_SUPPORTED +#define PNG_CONVERT_tIME_SUPPORTED +#define PNG_EASY_ACCESS_SUPPORTED +#define PNG_ERROR_TEXT_SUPPORTED +#define PNG_FIXED_POINT_SUPPORTED +#define PNG_FLOATING_ARITHMETIC_SUPPORTED #define PNG_FLOATING_POINT_SUPPORTED +#define PNG_gAMA_SUPPORTED +#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +#define PNG_hIST_SUPPORTED +#define PNG_iCCP_SUPPORTED #define PNG_INCH_CONVERSIONS_SUPPORTED -#define PNG_STDIO_SUPPORTED -#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_USER_MEM_SUPPORTED +#define PNG_INFO_IMAGE_SUPPORTED #define PNG_IO_STATE_SUPPORTED -#define PNG_SET_USER_LIMITS_SUPPORTED +#define PNG_iTXt_SUPPORTED +#define PNG_MNG_FEATURES_SUPPORTED +#define PNG_oFFs_SUPPORTED +#define PNG_pCAL_SUPPORTED +#define PNG_pHYs_SUPPORTED +#define PNG_POINTER_INDEXING_SUPPORTED +#define PNG_PROGRESSIVE_READ_SUPPORTED +#define PNG_READ_16BIT_SUPPORTED +#define PNG_READ_16_TO_8_SUPPORTED #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED -#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED -#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED -#define PNG_WRITE_FILTER_SUPPORTED -#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED -#define PNG_WRITE_iCCP_SUPPORTED -#define PNG_READ_TRANSFORMS_SUPPORTED -#define PNG_READ_GAMMA_SUPPORTED +#define PNG_READ_BACKGROUND_SUPPORTED +#define PNG_READ_BGR_SUPPORTED #define PNG_READ_bKGD_SUPPORTED -#define PNG_UNKNOWN_CHUNKS_SUPPORTED -#define PNG_READ_sCAL_SUPPORTED -#define PNG_WRITE_hIST_SUPPORTED -#define PNG_READ_OPT_PLTE_SUPPORTED -#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED -#define PNG_WRITE_gAMA_SUPPORTED +#define PNG_READ_cHRM_SUPPORTED +#define PNG_READ_COMPOSITE_NODIV_SUPPORTED +#define PNG_READ_EXPAND_16_SUPPORTED +#define PNG_READ_EXPAND_SUPPORTED +#define PNG_READ_FILLER_SUPPORTED +#define PNG_READ_gAMA_SUPPORTED +#define PNG_READ_GAMMA_SUPPORTED #define PNG_READ_GRAY_TO_RGB_SUPPORTED -#define PNG_WRITE_pCAL_SUPPORTED +#define PNG_READ_hIST_SUPPORTED +#define PNG_READ_iCCP_SUPPORTED +#define PNG_READ_INTERLACING_SUPPORTED +#define PNG_READ_INT_FUNCTIONS_SUPPORTED #define PNG_READ_INVERT_ALPHA_SUPPORTED -#define PNG_WRITE_TRANSFORMS_SUPPORTED -#define PNG_READ_sBIT_SUPPORTED +#define PNG_READ_INVERT_SUPPORTED +#define PNG_READ_iTXt_SUPPORTED +#define PNG_READ_oFFs_SUPPORTED +#define PNG_READ_OPT_PLTE_SUPPORTED #define PNG_READ_PACK_SUPPORTED -#define PNG_WRITE_SWAP_SUPPORTED -#define PNG_READ_cHRM_SUPPORTED -#define PNG_WRITE_tIME_SUPPORTED -#define PNG_READ_INTERLACING_SUPPORTED -#define PNG_READ_tRNS_SUPPORTED -#define PNG_WRITE_pHYs_SUPPORTED -#define PNG_WRITE_INVERT_SUPPORTED +#define PNG_READ_PACKSWAP_SUPPORTED +#define PNG_READ_pCAL_SUPPORTED +#define PNG_READ_pHYs_SUPPORTED +#define PNG_READ_QUANTIZE_SUPPORTED #define PNG_READ_RGB_TO_GRAY_SUPPORTED -#define PNG_WRITE_sRGB_SUPPORTED -#define PNG_READ_oFFs_SUPPORTED -#define PNG_WRITE_FILLER_SUPPORTED -#define PNG_WRITE_TEXT_SUPPORTED -#define PNG_WRITE_SHIFT_SUPPORTED -#define PNG_PROGRESSIVE_READ_SUPPORTED +#define PNG_READ_sBIT_SUPPORTED +#define PNG_READ_sCAL_SUPPORTED #define PNG_READ_SHIFT_SUPPORTED -#define PNG_CONVERT_tIME_SUPPORTED -#define PNG_READ_USER_TRANSFORM_SUPPORTED -#define PNG_READ_INT_FUNCTIONS_SUPPORTED -#define PNG_READ_USER_CHUNKS_SUPPORTED -#define PNG_READ_hIST_SUPPORTED -#define PNG_READ_16BIT_SUPPORTED -#define PNG_READ_SWAP_ALPHA_SUPPORTED -#define PNG_READ_COMPOSITE_NODIV_SUPPORTED -#define PNG_SEQUENTIAL_READ_SUPPORTED -#define PNG_READ_BACKGROUND_SUPPORTED -#define PNG_READ_QUANTIZE_SUPPORTED -#define PNG_READ_iCCP_SUPPORTED -#define PNG_READ_STRIP_ALPHA_SUPPORTED -#define PNG_READ_PACKSWAP_SUPPORTED +#define PNG_READ_sPLT_SUPPORTED #define PNG_READ_sRGB_SUPPORTED -#define PNG_WRITE_tEXt_SUPPORTED -#define PNG_READ_gAMA_SUPPORTED -#define PNG_READ_pCAL_SUPPORTED -#define PNG_READ_EXPAND_SUPPORTED -#define PNG_WRITE_sPLT_SUPPORTED +#define PNG_READ_STRIP_ALPHA_SUPPORTED +#define PNG_READ_SUPPORTED +#define PNG_READ_SWAP_ALPHA_SUPPORTED #define PNG_READ_SWAP_SUPPORTED +#define PNG_READ_tEXt_SUPPORTED +#define PNG_READ_TEXT_SUPPORTED #define PNG_READ_tIME_SUPPORTED -#define PNG_READ_pHYs_SUPPORTED -#define PNG_WRITE_SWAP_ALPHA_SUPPORTED +#define PNG_READ_TRANSFORMS_SUPPORTED +#define PNG_READ_tRNS_SUPPORTED +#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_READ_USER_CHUNKS_SUPPORTED +#define PNG_READ_USER_TRANSFORM_SUPPORTED +#define PNG_READ_zTXt_SUPPORTED +#define PNG_SAVE_INT_32_SUPPORTED +#define PNG_sBIT_SUPPORTED +#define PNG_sCAL_SUPPORTED +#define PNG_SEQUENTIAL_READ_SUPPORTED +#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED +#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED +#define PNG_SETJMP_SUPPORTED +#define PNG_SET_USER_LIMITS_SUPPORTED +#define PNG_sPLT_SUPPORTED +#define PNG_sRGB_SUPPORTED +#define PNG_STDIO_SUPPORTED +#define PNG_tEXt_SUPPORTED +#define PNG_TEXT_SUPPORTED #define PNG_TIME_RFC1123_SUPPORTED -#define PNG_READ_TEXT_SUPPORTED -#define PNG_WRITE_BGR_SUPPORTED +#define PNG_tIME_SUPPORTED +#define PNG_tRNS_SUPPORTED +#define PNG_UNKNOWN_CHUNKS_SUPPORTED #define PNG_USER_CHUNKS_SUPPORTED -#define PNG_CONSOLE_IO_SUPPORTED -#define PNG_WRITE_PACK_SUPPORTED -#define PNG_READ_FILLER_SUPPORTED +#define PNG_USER_LIMITS_SUPPORTED +#define PNG_USER_MEM_SUPPORTED +#define PNG_USER_TRANSFORM_INFO_SUPPORTED +#define PNG_USER_TRANSFORM_PTR_SUPPORTED +#define PNG_WARNINGS_SUPPORTED +#define PNG_WRITE_16BIT_SUPPORTED +#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#define PNG_WRITE_BGR_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED -#define PNG_WRITE_tRNS_SUPPORTED -#define PNG_READ_sPLT_SUPPORTED -#define PNG_WRITE_sCAL_SUPPORTED +#define PNG_WRITE_cHRM_SUPPORTED +#define PNG_WRITE_FILLER_SUPPORTED +#define PNG_WRITE_FILTER_SUPPORTED +#define PNG_WRITE_FLUSH_SUPPORTED +#define PNG_WRITE_gAMA_SUPPORTED +#define PNG_WRITE_hIST_SUPPORTED +#define PNG_WRITE_iCCP_SUPPORTED +#define PNG_WRITE_INTERLACING_SUPPORTED +#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED +#define PNG_WRITE_INVERT_ALPHA_SUPPORTED +#define PNG_WRITE_INVERT_SUPPORTED +#define PNG_WRITE_iTXt_SUPPORTED #define PNG_WRITE_oFFs_SUPPORTED -#define PNG_READ_tEXt_SUPPORTED +#define PNG_WRITE_PACK_SUPPORTED +#define PNG_WRITE_PACKSWAP_SUPPORTED +#define PNG_WRITE_pCAL_SUPPORTED +#define PNG_WRITE_pHYs_SUPPORTED #define PNG_WRITE_sBIT_SUPPORTED -#define PNG_READ_INVERT_SUPPORTED -#define PNG_READ_16_TO_8_SUPPORTED -#define PNG_WRITE_cHRM_SUPPORTED -#define PNG_16BIT_SUPPORTED +#define PNG_WRITE_sCAL_SUPPORTED +#define PNG_WRITE_SHIFT_SUPPORTED +#define PNG_WRITE_sPLT_SUPPORTED +#define PNG_WRITE_sRGB_SUPPORTED +#define PNG_WRITE_SUPPORTED +#define PNG_WRITE_SWAP_ALPHA_SUPPORTED +#define PNG_WRITE_SWAP_SUPPORTED +#define PNG_WRITE_tEXt_SUPPORTED +#define PNG_WRITE_TEXT_SUPPORTED +#define PNG_WRITE_tIME_SUPPORTED +#define PNG_WRITE_TRANSFORMS_SUPPORTED +#define PNG_WRITE_tRNS_SUPPORTED +#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_WRITE_USER_TRANSFORM_SUPPORTED -#define PNG_READ_BGR_SUPPORTED -#define PNG_WRITE_PACKSWAP_SUPPORTED -#define PNG_WRITE_INVERT_ALPHA_SUPPORTED -#define PNG_sCAL_SUPPORTED +#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_zTXt_SUPPORTED -#define PNG_sBIT_SUPPORTED -#define PNG_cHRM_SUPPORTED -#define PNG_bKGD_SUPPORTED -#define PNG_tRNS_SUPPORTED -#define PNG_WRITE_iTXt_SUPPORTED -#define PNG_oFFs_SUPPORTED -#define PNG_USER_TRANSFORM_PTR_SUPPORTED -#define PNG_USER_TRANSFORM_INFO_SUPPORTED -#define PNG_hIST_SUPPORTED -#define PNG_iCCP_SUPPORTED -#define PNG_sRGB_SUPPORTED -#define PNG_READ_zTXt_SUPPORTED -#define PNG_gAMA_SUPPORTED -#define PNG_pCAL_SUPPORTED -#define PNG_CHECK_cHRM_SUPPORTED -#define PNG_tIME_SUPPORTED -#define PNG_pHYs_SUPPORTED -#define PNG_READ_iTXt_SUPPORTED -#define PNG_TEXT_SUPPORTED -#define PNG_SAVE_INT_32_SUPPORTED -#define PNG_sPLT_SUPPORTED -#define PNG_tEXt_SUPPORTED #define PNG_zTXt_SUPPORTED -#define PNG_iTXt_SUPPORTED +/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ +/*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/ /* end of options */ #endif /* PNGLCONF_H */ diff -ru4NwbB libpng-1.5.1/scripts/symbols.def libpng-1.5.2beta01/scripts/symbols.def --- libpng-1.5.1/scripts/symbols.def 2011-02-02 22:58:20.937934664 -0600 +++ libpng-1.5.2beta01/scripts/symbols.def 2011-02-13 07:01:40.789826232 -0600 @@ -225,4 +225,5 @@ png_get_current_row_number @217 png_get_current_pass_number @218 png_process_data_pause @219 png_process_data_skip @220 + png_set_expand_16 @221