diff -ru4NwbB libpng-1.5.2/Makefile.am libpng-1.5.3beta04/Makefile.am --- libpng-1.5.2/Makefile.am 2011-03-31 11:23:47.610923954 -0500 +++ libpng-1.5.3beta04/Makefile.am 2011-04-27 14:58:04.594581791 -0500 @@ -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=2 - ${srcdir}/scripts/pnglibconf.dfa 1>&2 + logunsupported=3 - ${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.2/png.h libpng-1.5.3beta04/png.h --- libpng-1.5.2/png.h 2011-03-31 11:23:40.652780723 -0500 +++ libpng-1.5.3beta04/png.h 2011-04-27 14:57:57.715001860 -0500 @@ -149,8 +149,9 @@ * 1.5.1 15 10501 15.so.15.1[.0] * 1.5.2beta01-03 15 10502 15.so.15.2[.0] * 1.5.2rc01-03 15 10502 15.so.15.2[.0] * 1.5.2 15 10502 15.so.15.2[.0] + * 1.5.3beta01-04 15 10503 15.so.15.3[.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 @@ -844,27 +845,20 @@ typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); #endif #ifdef PNG_SETJMP_SUPPORTED -/* This must match the function definition in , and the - * application must include this before png.h to obtain the definition - * of jmp_buf. The function is required to be PNG_NORETURN. (Note that - * PNG_PTR_NORETURN is used here because current versions of the Microsoft - * C compiler do not support the PNG_NORETURN attribute on a pointer.) - * - * If you get a type warning from the compiler when linking against this line - * then your compiler has 'longjmp' that does not match the requirements of the - * compiler that built libpng. You will have to write a wrapper function for - * your compiler's longjmp and call png_set_longjmp_fn directly (not via the - * png_jmpbuf macro.) +/* This must match the function definition in , and the application + * must include this before png.h to obtain the definition of jmp_buf. The + * function is required to be PNG_NORETURN, but this is not checked. If the + * function does return the application will crash via an abort() or similar + * system level call. * - * If you get a warning here while building the library you will need to make + * If you get a warning here while building the library you may need to make * changes to ensure that pnglibconf.h records the calling convention used by * your compiler. This may be very difficult - try using a different compiler * to build the library! */ -typedef PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), - PNG_PTR_NORETURN); +PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef); #endif /* Transform masks for the high-level interface */ #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ @@ -1105,10 +1099,12 @@ PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp png_ptr)); #endif +#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, png_colorp palette)); +#endif #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED PNG_EXPORT(36, void, png_set_strip_alpha, (png_structp png_ptr)); #endif @@ -1412,8 +1408,26 @@ PNG_EXPORT(73, void, png_set_compression_method, (png_structp png_ptr, int method)); +#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION +/* Also set zlib parameters for compressing non-IDAT chunks */ +PNG_EXPORT(222, void, png_set_text_compression_level, + (png_structp png_ptr, int level)); + +PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structp png_ptr, + int mem_level)); + +PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structp png_ptr, + int strategy)); + +PNG_EXPORT(225, void, png_set_text_compression_window_bits, (png_structp + png_ptr, int window_bits)); + +PNG_EXPORT(226, void, png_set_text_compression_method, (png_structp png_ptr, + int method)); +#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */ + /* These next functions are called for input/output, memory, and error * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, * and call standard C I/O routines such as fread(), fwrite(), and * fprintf(). These functions can be made to use other I/O routines @@ -2296,9 +2310,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(221); + PNG_EXPORT_LAST_ORDINAL(226); #endif #ifdef __cplusplus } diff -ru4NwbB libpng-1.5.2/pngconf.h libpng-1.5.3beta04/pngconf.h --- libpng-1.5.2/pngconf.h 2011-03-31 11:23:40.659587365 -0500 +++ libpng-1.5.3beta04/pngconf.h 2011-04-27 14:57:57.721506335 -0500 @@ -1,8 +1,8 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.5.3beta04 - March 31, 2011 + * libpng version 1.5.3beta04 - April 27, 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.) @@ -352,25 +352,8 @@ # 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 @@ -381,11 +364,8 @@ # ifndef PNGLIB_BUILD # ifndef PNG_DEPRECATED # define PNG_DEPRECATED __attribute__((__deprecated__)) # endif -# ifndef PNG_DEPSTRUCT -# define PNG_DEPSTRUCT __attribute__((__deprecated__)) -# endif # ifndef PNG_PRIVATE # if 0 /* Doesn't work so we use deprecated instead*/ # define PNG_PRIVATE \ __attribute__((warning("This function is not exported by libpng."))) @@ -403,11 +383,8 @@ # endif # ifndef PNG_NORETURN # define PNG_NORETURN __declspec(noreturn) # endif -# ifndef PNG_PTR_NORETURN -# define PNG_PTR_NORETURN /* not supported */ -# endif # ifndef PNG_ALLOCATED # define PNG_ALLOCATED __declspec(restrict) # endif @@ -418,11 +395,8 @@ # ifndef PNGLIB_BUILD # ifndef PNG_DEPRECATED # define PNG_DEPRECATED __declspec(deprecated) # endif -# ifndef PNG_DEPSTRUCT -# define PNG_DEPSTRUCT __declspec(deprecated) -# endif # ifndef PNG_PRIVATE # define PNG_PRIVATE __declspec(deprecated) # endif # endif /* PNGLIB_BUILD */ @@ -437,17 +411,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 -# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */ -#endif #ifndef PNG_PRIVATE # define PNG_PRIVATE /* This is a private libpng function */ #endif #ifndef PNG_FP_EXPORT /* A floating point API. */ diff -ru4NwbB libpng-1.5.2/pngerror.c libpng-1.5.3beta04/pngerror.c --- libpng-1.5.2/pngerror.c 2011-03-31 11:23:40.707921261 -0500 +++ libpng-1.5.3beta04/pngerror.c 2011-04-27 14:57:57.769048778 -0500 @@ -271,9 +271,9 @@ if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf)) return NULL; png_ptr->longjmp_fn = longjmp_fn; - return &png_ptr->png_jmpbuf; + return &png_ptr->longjmp_buffer; } #endif /* This is the default error handling function. Note that replacements for @@ -334,15 +334,15 @@ if (png_ptr && png_ptr->longjmp_fn) { # ifdef USE_FAR_KEYWORD { - jmp_buf png_jmpbuf; - png_memcpy(png_jmpbuf, png_ptr->png_jmpbuf, png_sizeof(jmp_buf)); - png_ptr->longjmp_fn(png_jmpbuf, val); + jmp_buf tmp_jmpbuf; + png_memcpy(tmp_jmpbuf, png_ptr->longjmp_buffer, png_sizeof(jmp_buf)); + png_ptr->longjmp_fn(tmp_jmpbuf, val); } # else - png_ptr->longjmp_fn(png_ptr->png_jmpbuf, val); + png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val); # endif } #endif /* Here if not setjmp support or if png_ptr is null. */ @@ -402,9 +402,9 @@ /* This function is called when the application wants to use another method * of handling errors and warnings. Note that the error function MUST NOT * return to the calling routine or serious problems will occur. The return - * method used in the default routine calls longjmp(png_ptr->png_jmpbuf, 1) + * method used in the default routine calls longjmp(png_ptr->longjmp_buffer, 1) */ void PNGAPI png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn) diff -ru4NwbB libpng-1.5.2/pngmem.c libpng-1.5.3beta04/pngmem.c --- libpng-1.5.2/pngmem.c 2011-03-31 11:23:40.721711366 -0500 +++ libpng-1.5.3beta04/pngmem.c 2011-04-27 14:57:57.782484876 -0500 @@ -1,8 +1,8 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.5.1 [February 3, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -186,25 +186,34 @@ { int num_blocks; png_uint_32 total_size; png_bytep table; - int i; + int i, mem_level, window_bits; png_byte huge * hptr; + int window_bits if (ret != NULL) { farfree(ret); ret = NULL; } - if (png_ptr->zlib_window_bits > 14) - num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); + window_bits = + png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ? + png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits; + + if (window_bits > 14) + num_blocks = (int)(1 << (window_bits - 14)); else num_blocks = 1; - if (png_ptr->zlib_mem_level >= 7) - num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7)); + mem_level = + png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ? + png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level; + + if (mem_level >= 7) + num_blocks += (int)(1 << (mem_level - 7)); else num_blocks++; @@ -276,9 +285,9 @@ if (png_ptr->offset_table_count >= png_ptr->offset_table_number) { # ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory"); /* Note "o" and "M" */ + png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */ else png_warning(png_ptr, "Out of Memory"); # endif diff -ru4NwbB libpng-1.5.2/pngpread.c libpng-1.5.3beta04/pngpread.c --- libpng-1.5.2/pngpread.c 2011-03-31 11:23:40.730867797 -0500 +++ libpng-1.5.3beta04/pngpread.c 2011-04-27 14:57:57.791473138 -0500 @@ -1025,10 +1025,12 @@ (int)(png_ptr->row_buf[0])); png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1); +#ifdef PNG_READ_TRANSFORMS_SUPPORTED if (png_ptr->transformations) png_do_read_transformations(png_ptr); +#endif #ifdef PNG_READ_INTERLACING_SUPPORTED /* Blow up interlaced rows to full size */ if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) diff -ru4NwbB libpng-1.5.2/pngpriv.h libpng-1.5.3beta04/pngpriv.h --- libpng-1.5.2/pngpriv.h 2011-03-31 11:23:40.667851883 -0500 +++ libpng-1.5.3beta04/pngpriv.h 2011-04-27 14:57:57.729862823 -0500 @@ -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.2 [March 31, 2011] + * Last changed in libpng 1.5.3 [(PENDING RELEASE)] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h @@ -231,9 +231,9 @@ # endif #endif /* End of memory model/platform independent support */ -#ifndef PNG_NO_SNPRINTF +#if !defined(PNG_NO_SNPRINTF) && !defined(__STRICT_ANSI__) # ifdef _MSC_VER # define png_snprintf _snprintf /* Added to v 1.2.19 */ # define png_snprintf2 _snprintf # define png_snprintf6 _snprintf @@ -276,8 +276,9 @@ #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 #define PNG_BACKGROUND_IS_GRAY 0x800 #define PNG_HAVE_PNG_SIGNATURE 0x1000 #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ +#define PNG_ZLIB_READY_FOR_ZTXT 0x4000 /* 1: ready for ZTXT; 0: for IDAT */ /* Flags for the transformations the PNG library does on the image data */ #define PNG_BGR 0x0001 #define PNG_INTERLACE 0x0002 @@ -344,13 +345,13 @@ #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L /* 0x200000L unused */ /* 0x400000L unused */ #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */ - /* 0x1000000L unused */ - /* 0x2000000L unused */ - /* 0x4000000L unused */ - /* 0x8000000L unused */ - /* 0x10000000L unused */ +#define PNG_FLAG_ZTXT_CUSTOM_STRATEGY 0x1000000L /* 5 lines added */ +#define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000L /* to libpng-1.5.3 */ +#define PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL 0x4000000L +#define PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS 0x8000000L +#define PNG_FLAG_ZTXT_CUSTOM_METHOD 0x10000000L /* 0x20000000L unused */ /* 0x40000000L unused */ #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ @@ -539,10 +540,9 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, png_size_t length)); /* Decompress data in a chunk that uses compression */ -#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ - defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) +#if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED) PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr, int comp_type, png_size_t chunklength, png_size_t prefix_length, png_size_t *data_length)); #endif @@ -643,8 +643,9 @@ PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_const_uint_16p hist, int num_hist)); #endif +/* Chunks that have keywords */ #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, png_const_charp key, png_charpp new_key)); @@ -741,11 +742,14 @@ PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); /* Initialize the row buffers, etc. */ PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); + +#ifdef PNG_READ_TRANSFORMS_SUPPORTED /* Optional call to update the users info structure */ PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, png_infop info_ptr)); +#endif /* These are the functions that do the transformations */ #ifdef PNG_READ_FILLER_SUPPORTED PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, @@ -847,27 +851,15 @@ png_bytep row, png_const_color_8p bit_depth)); #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED -# ifdef PNG_READ_GAMMA_SUPPORTED PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, - png_bytep row, png_const_color_16p trans_color, - png_const_color_16p background, png_const_color_16p background_1, - png_const_bytep gamma_table, png_const_bytep gamma_from_1, - png_const_bytep gamma_to_1, png_const_uint_16pp gamma_16, - png_const_uint_16pp gamma_16_from_1, png_const_uint_16pp gamma_16_to_1, - int gamma_shift)); -# else -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, - png_bytep row, png_const_color_16p trans_color, - png_const_color_16p background)); -# endif + png_bytep row, png_structp png_ptr)); #endif #ifdef PNG_READ_GAMMA_SUPPORTED PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, - png_bytep row, png_const_bytep gamma_table, - png_const_uint_16pp gamma_16_table, int gamma_shift)); + png_bytep row, png_structp png_ptr)); #endif #ifdef PNG_READ_EXPAND_SUPPORTED PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, @@ -985,12 +977,18 @@ PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, png_const_bytep chunk_name)); /* Handle the transformations for reading and writing */ +#ifdef PNG_READ_TRANSFORMS_SUPPORTED PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); +#endif +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); +#endif +#ifdef PNG_READ_TRANSFORMS_SUPPORTED PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); +#endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, png_infop info_ptr)); diff -ru4NwbB libpng-1.5.2/pngread.c libpng-1.5.3beta04/pngread.c --- libpng-1.5.2/pngread.c 2011-03-31 11:23:40.738999129 -0500 +++ libpng-1.5.3beta04/pngread.c 2011-04-27 14:57:57.799519367 -0500 @@ -46,9 +46,9 @@ volatile int png_cleanup_needed = 0; #ifdef PNG_SETJMP_SUPPORTED #ifdef USE_FAR_KEYWORD - jmp_buf png_jmpbuf; + jmp_buf tmp_jmpbuf; #endif #endif int i; @@ -84,15 +84,15 @@ /* Applications that neglect to set up their own setjmp() and then encounter a png_error() will longjmp here. Since the jmpbuf is then meaningless we abort instead of returning. */ #ifdef USE_FAR_KEYWORD - if (setjmp(png_jmpbuf)) + if (setjmp(tmp_jmpbuf)) #else if (setjmp(png_jmpbuf(png_ptr))) /* Sets longjmp to match setjmp */ #endif PNG_ABORT(); #ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(png_ptr), png_jmpbuf, png_sizeof(jmp_buf)); + png_memcpy(png_jmpbuf(png_ptr), tmp_jmpbuf, png_sizeof(jmp_buf)); #endif #endif /* PNG_SETJMP_SUPPORTED */ #ifdef PNG_USER_MEM_SUPPORTED @@ -456,9 +456,13 @@ png_warning(png_ptr, "Ignoring extra png_read_update_info() call;" " row buffer not reallocated"); +#ifdef PNG_READ_TRANSFORMS_SUPPORTED png_read_transform_info(png_ptr, info_ptr); +#else + PNG_UNUSED(info_ptr) +#endif } #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Initialize palette, background, etc, after transformations @@ -703,10 +707,12 @@ } #endif +#ifdef PNG_READ_TRANSFORMS_SUPPORTED if (png_ptr->transformations) png_do_read_transformations(png_ptr); +#endif #ifdef PNG_READ_INTERLACING_SUPPORTED /* Blow up interlaced rows to full size */ if (png_ptr->interlaced && @@ -1268,9 +1274,9 @@ /* Save the important info out of the png_struct, in case it is * being used again. */ #ifdef PNG_SETJMP_SUPPORTED - png_memcpy(tmp_jmp, png_ptr->png_jmpbuf, png_sizeof(jmp_buf)); + png_memcpy(tmp_jmp, png_ptr->longjmp_buffer, png_sizeof(jmp_buf)); #endif error_fn = png_ptr->error_fn; warning_fn = png_ptr->warning_fn; @@ -1288,9 +1294,9 @@ png_ptr->free_fn = free_fn; #endif #ifdef PNG_SETJMP_SUPPORTED - png_memcpy(png_ptr->png_jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); + png_memcpy(png_ptr->longjmp_buffer, tmp_jmp, png_sizeof(jmp_buf)); #endif } diff -ru4NwbB libpng-1.5.2/pngrtran.c libpng-1.5.3beta04/pngrtran.c --- libpng-1.5.2/pngrtran.c 2011-03-31 11:23:40.759414573 -0500 +++ libpng-1.5.3beta04/pngrtran.c 2011-04-27 14:57:57.819800746 -0500 @@ -136,9 +136,8 @@ 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 @@ -699,10 +698,8 @@ 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 @@ -826,8 +823,9 @@ #endif } #endif +#ifdef PNG_READ_TRANSFORMS_SUPPORTED /* Initialize everything needed for the read. This includes modifying * the palette. */ void /* PRIVATE */ @@ -1490,9 +1488,9 @@ 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*/); + 0 /* at_start == false, because SWAP_ALPHA happens later */); #endif #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED if (png_ptr->transformations & PNG_RGB_TO_GRAY) @@ -1558,18 +1556,9 @@ #ifdef PNG_READ_BACKGROUND_SUPPORTED if ((png_ptr->transformations & PNG_BACKGROUND) && ((png_ptr->num_trans != 0) || (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) - png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1, - &(png_ptr->trans_color), &(png_ptr->background) -#ifdef PNG_READ_GAMMA_SUPPORTED - , &(png_ptr->background_1), - png_ptr->gamma_table, png_ptr->gamma_from_1, - png_ptr->gamma_to_1, png_ptr->gamma_16_table, - png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1, - png_ptr->gamma_shift -#endif - ); + png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr); #endif #ifdef PNG_READ_GAMMA_SUPPORTED if ((png_ptr->transformations & PNG_GAMMA) && @@ -1578,11 +1567,9 @@ ((png_ptr->num_trans != 0) || (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) && #endif (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)) - png_do_gamma(&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->gamma_table, png_ptr->gamma_16_table, - png_ptr->gamma_shift); + png_do_gamma(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr); #endif #ifdef PNG_READ_16_TO_8_SUPPORTED if (png_ptr->transformations & PNG_16_TO_8) @@ -2720,13 +2707,15 @@ } return rgb_error; } #endif +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ +#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED /* Build a grayscale palette. Palette is assumed to be 1 << bit_depth * large of png_color. This lets grayscale images be treated as * paletted. Most useful for gamma correction and simplification - * of code. + * of code. This API is not used internally. */ void PNGAPI png_build_grayscale_palette(int bit_depth, png_colorp palette) { @@ -2774,36 +2763,39 @@ palette[i].green = (png_byte)v; palette[i].blue = (png_byte)v; } } +#endif +#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_BACKGROUND_SUPPORTED /* Replace any alpha or transparency with the supplied background color. * "background" is already in the screen gamma, while "background_1" is * at a gamma of 1.0. Paletted files have already been taken care of. */ void /* PRIVATE */ -png_do_background(png_row_infop row_info, png_bytep row, - png_const_color_16p trans_color, png_const_color_16p background +png_do_background(png_row_infop row_info, png_bytep row, png_structp png_ptr) +{ #ifdef PNG_READ_GAMMA_SUPPORTED - , png_const_color_16p background_1, png_const_bytep gamma_table, - png_const_bytep gamma_from_1, png_const_bytep gamma_to_1, - png_const_uint_16pp gamma_16, png_const_uint_16pp gamma_16_from_1, - png_const_uint_16pp gamma_16_to_1, int gamma_shift + png_const_bytep gamma_table = png_ptr->gamma_table; + png_const_bytep gamma_from_1 = png_ptr->gamma_from_1; + png_const_bytep gamma_to_1 = png_ptr->gamma_to_1; + png_const_uint_16pp gamma_16 = png_ptr->gamma_16_table; + png_const_uint_16pp gamma_16_from_1 = png_ptr->gamma_16_from_1; + png_const_uint_16pp gamma_16_to_1 = png_ptr->gamma_16_to_1; + int gamma_shift = png_ptr->gamma_shift; #endif - ) -{ + png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; int shift; png_debug(1, "in png_do_background"); - if (background != NULL && - (!(row_info->color_type & PNG_COLOR_MASK_ALPHA) || - (row_info->color_type != PNG_COLOR_TYPE_PALETTE && trans_color))) + if (!(row_info->color_type & PNG_COLOR_MASK_ALPHA) || + row_info->color_type != PNG_COLOR_TYPE_PALETTE) { switch (row_info->color_type) { case PNG_COLOR_TYPE_GRAY: @@ -2816,12 +2808,12 @@ shift = 7; for (i = 0; i < row_width; i++) { if ((png_uint_16)((*sp >> shift) & 0x01) - == trans_color->gray) + == png_ptr->trans_color.gray) { *sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); + *sp |= (png_byte)(png_ptr->background.gray << shift); } if (!shift) { @@ -2844,12 +2836,12 @@ shift = 6; for (i = 0; i < row_width; i++) { if ((png_uint_16)((*sp >> shift) & 0x03) - == trans_color->gray) + == png_ptr->trans_color.gray) { *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); + *sp |= (png_byte)(png_ptr->background.gray << shift); } else { @@ -2878,12 +2870,12 @@ shift = 6; for (i = 0; i < row_width; i++) { if ((png_uint_16)((*sp >> shift) & 0x03) - == trans_color->gray) + == png_ptr->trans_color.gray) { *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); + *sp |= (png_byte)(png_ptr->background.gray << shift); } if (!shift) { @@ -2907,12 +2899,12 @@ shift = 4; for (i = 0; i < row_width; i++) { if ((png_uint_16)((*sp >> shift) & 0x0f) - == trans_color->gray) + == png_ptr->trans_color.gray) { *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); + *sp |= (png_byte)(png_ptr->background.gray << shift); } else { @@ -2941,12 +2933,12 @@ shift = 4; for (i = 0; i < row_width; i++) { if ((png_uint_16)((*sp >> shift) & 0x0f) - == trans_color->gray) + == png_ptr->trans_color.gray) { *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); + *sp |= (png_byte)(png_ptr->background.gray << shift); } if (!shift) { @@ -2968,10 +2960,10 @@ { sp = row; for (i = 0; i < row_width; i++, sp++) { - if (*sp == trans_color->gray) - *sp = (png_byte)background->gray; + if (*sp == png_ptr->trans_color.gray) + *sp = (png_byte)png_ptr->background.gray; else *sp = gamma_table[*sp]; } @@ -2981,10 +2973,10 @@ { sp = row; for (i = 0; i < row_width; i++, sp++) { - if (*sp == trans_color->gray) - *sp = (png_byte)background->gray; + if (*sp == png_ptr->trans_color.gray) + *sp = (png_byte)png_ptr->background.gray; } } break; } @@ -3000,13 +2992,13 @@ png_uint_16 v; v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - if (v == trans_color->gray) + if (v == png_ptr->trans_color.gray) { /* Background is already in screen gamma */ - *sp = (png_byte)((background->gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->gray & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } else { @@ -3025,12 +3017,12 @@ png_uint_16 v; v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - if (v == trans_color->gray) + if (v == png_ptr->trans_color.gray) { - *sp = (png_byte)((background->gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->gray & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } } } break; @@ -3051,15 +3043,15 @@ { sp = row; for (i = 0; i < row_width; i++, sp += 3) { - if (*sp == trans_color->red && - *(sp + 1) == trans_color->green && - *(sp + 2) == trans_color->blue) - { - *sp = (png_byte)background->red; - *(sp + 1) = (png_byte)background->green; - *(sp + 2) = (png_byte)background->blue; + if (*sp == png_ptr->trans_color.red && + *(sp + 1) == png_ptr->trans_color.green && + *(sp + 2) == png_ptr->trans_color.blue) + { + *sp = (png_byte)png_ptr->background.red; + *(sp + 1) = (png_byte)png_ptr->background.green; + *(sp + 2) = (png_byte)png_ptr->background.blue; } else { @@ -3074,15 +3066,15 @@ { sp = row; for (i = 0; i < row_width; i++, sp += 3) { - if (*sp == trans_color->red && - *(sp + 1) == trans_color->green && - *(sp + 2) == trans_color->blue) - { - *sp = (png_byte)background->red; - *(sp + 1) = (png_byte)background->green; - *(sp + 2) = (png_byte)background->blue; + if (*sp == png_ptr->trans_color.red && + *(sp + 1) == png_ptr->trans_color.green && + *(sp + 2) == png_ptr->trans_color.blue) + { + *sp = (png_byte)png_ptr->background.red; + *(sp + 1) = (png_byte)png_ptr->background.green; + *(sp + 2) = (png_byte)png_ptr->background.blue; } } } } @@ -3101,18 +3093,19 @@ png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8) + *(sp + 5)); - if (r == trans_color->red && g == trans_color->green && - b == trans_color->blue) + if (r == png_ptr->trans_color.red && + g == png_ptr->trans_color.green && + b == png_ptr->trans_color.blue) { /* Background is already in screen gamma */ - *sp = (png_byte)((background->red >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->red & 0xff); - *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(sp + 3) = (png_byte)(background->green & 0xff); - *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(sp + 5) = (png_byte)(background->blue & 0xff); + *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } else { @@ -3144,17 +3137,18 @@ png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8) + *(sp + 5)); - if (r == trans_color->red && g == trans_color->green && - b == trans_color->blue) - { - *sp = (png_byte)((background->red >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->red & 0xff); - *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(sp + 3) = (png_byte)(background->green & 0xff); - *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(sp + 5) = (png_byte)(background->blue & 0xff); + if (r == png_ptr->trans_color.red && + g == png_ptr->trans_color.green && + b == png_ptr->trans_color.blue) + { + *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } } } } @@ -3180,17 +3174,17 @@ else if (a == 0) { /* Background is already in screen gamma */ - *dp = (png_byte)background->gray; + *dp = (png_byte)png_ptr->background.gray; } else { png_byte v, w; v = gamma_to_1[*sp]; - png_composite(w, v, a, background_1->gray); + png_composite(w, v, a, png_ptr->background_1.gray); *dp = gamma_from_1[w]; } } } @@ -3207,15 +3201,15 @@ *dp = *sp; #ifdef PNG_READ_GAMMA_SUPPORTED else if (a == 0) - *dp = (png_byte)background->gray; + *dp = (png_byte)png_ptr->background.gray; else - png_composite(*dp, *sp, a, background_1->gray); + png_composite(*dp, *sp, a, png_ptr->background_1.gray); #else - *dp = (png_byte)background->gray; + *dp = (png_byte)png_ptr->background.gray; #endif } } } @@ -3247,19 +3241,19 @@ else #endif { /* Background is already in screen gamma */ - *dp = (png_byte)((background->gray >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->gray & 0xff); + *dp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *(dp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } #ifdef PNG_READ_GAMMA_SUPPORTED else { png_uint_16 g, v, w; g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; - png_composite_16(v, g, a, background_1->gray); + png_composite_16(v, g, a, png_ptr->background_1.gray); w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8]; *dp = (png_byte)((w >> 8) & 0xff); *(dp + 1) = (png_byte)(w & 0xff); } @@ -3284,19 +3278,19 @@ #else else #endif { - *dp = (png_byte)((background->gray >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->gray & 0xff); + *dp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *(dp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } #ifdef PNG_READ_GAMMA_SUPPORTED else { png_uint_16 g, v; g = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - png_composite_16(v, g, a, background_1->gray); + png_composite_16(v, g, a, png_ptr->background_1.gray); *dp = (png_byte)((v >> 8) & 0xff); *(dp + 1) = (png_byte)(v & 0xff); } #endif @@ -3329,27 +3323,27 @@ else if (a == 0) { /* Background is already in screen gamma */ - *dp = (png_byte)background->red; - *(dp + 1) = (png_byte)background->green; - *(dp + 2) = (png_byte)background->blue; + *dp = (png_byte)png_ptr->background.red; + *(dp + 1) = (png_byte)png_ptr->background.green; + *(dp + 2) = (png_byte)png_ptr->background.blue; } else { png_byte v, w; v = gamma_to_1[*sp]; - png_composite(w, v, a, background_1->red); + png_composite(w, v, a, png_ptr->background_1.red); *dp = gamma_from_1[w]; v = gamma_to_1[*(sp + 1)]; - png_composite(w, v, a, background_1->green); + png_composite(w, v, a, png_ptr->background_1.green); *(dp + 1) = gamma_from_1[w]; v = gamma_to_1[*(sp + 2)]; - png_composite(w, v, a, background_1->blue); + png_composite(w, v, a, png_ptr->background_1.blue); *(dp + 2) = gamma_from_1[w]; } } } @@ -3370,22 +3364,22 @@ } else if (a == 0) { - *dp = (png_byte)background->red; - *(dp + 1) = (png_byte)background->green; - *(dp + 2) = (png_byte)background->blue; + *dp = (png_byte)png_ptr->background.red; + *(dp + 1) = (png_byte)png_ptr->background.green; + *(dp + 2) = (png_byte)png_ptr->background.blue; } else { - png_composite(*dp, *sp, a, background->red); + png_composite(*dp, *sp, a, png_ptr->background.red); png_composite(*(dp + 1), *(sp + 1), a, - background->green); + png_ptr->background.green); png_composite(*(dp + 2), *(sp + 2), a, - background->blue); + png_ptr->background.blue); } } } } @@ -3421,36 +3415,36 @@ else if (a == 0) { /* Background is already in screen gamma */ - *dp = (png_byte)((background->red >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->red & 0xff); - *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(dp + 3) = (png_byte)(background->green & 0xff); - *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(dp + 5) = (png_byte)(background->blue & 0xff); + *dp = (png_byte)((png_ptr->background.red >> 8) & 0xff); + *(dp + 1) = (png_byte)(png_ptr->background.red & 0xff); + *(dp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); + *(dp + 3) = (png_byte)(png_ptr->background.green & 0xff); + *(dp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(dp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } else { png_uint_16 v, w, x; v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; - png_composite_16(w, v, a, background_1->red); + png_composite_16(w, v, a, png_ptr->background_1.red); x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; *dp = (png_byte)((x >> 8) & 0xff); *(dp + 1) = (png_byte)(x & 0xff); v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; - png_composite_16(w, v, a, background_1->green); + png_composite_16(w, v, a, png_ptr->background_1.green); x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; *(dp + 2) = (png_byte)((x >> 8) & 0xff); *(dp + 3) = (png_byte)(x & 0xff); v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; - png_composite_16(w, v, a, background_1->blue); + png_composite_16(w, v, a, png_ptr->background_1.blue); x = gamma_16_from_1[(w & 0xff) >> gamma_shift][w >> 8]; *(dp + 4) = (png_byte)((x >> 8) & 0xff); *(dp + 5) = (png_byte)(x & 0xff); @@ -3474,14 +3468,14 @@ } else if (a == 0) { - *dp = (png_byte)((background->red >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->red & 0xff); - *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(dp + 3) = (png_byte)(background->green & 0xff); - *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(dp + 5) = (png_byte)(background->blue & 0xff); + *dp = (png_byte)((png_ptr->background.red >> 8) & 0xff); + *(dp + 1) = (png_byte)(png_ptr->background.red & 0xff); + *(dp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); + *(dp + 3) = (png_byte)(png_ptr->background.green & 0xff); + *(dp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(dp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } else { @@ -3492,17 +3486,17 @@ + *(sp + 3)); png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8) + *(sp + 5)); - png_composite_16(v, r, a, background->red); + png_composite_16(v, r, a, png_ptr->background.red); *dp = (png_byte)((v >> 8) & 0xff); *(dp + 1) = (png_byte)(v & 0xff); - png_composite_16(v, g, a, background->green); + png_composite_16(v, g, a, png_ptr->background.green); *(dp + 2) = (png_byte)((v >> 8) & 0xff); *(dp + 3) = (png_byte)(v & 0xff); - png_composite_16(v, b, a, background->blue); + png_composite_16(v, b, a, png_ptr->background.blue); *(dp + 4) = (png_byte)((v >> 8) & 0xff); *(dp + 5) = (png_byte)(v & 0xff); } } @@ -3535,12 +3529,14 @@ * is 16, use gamma_16_table and gamma_shift. Build these with * build_gamma_table(). */ void /* PRIVATE */ -png_do_gamma(png_row_infop row_info, png_bytep row, - png_const_bytep gamma_table, png_const_uint_16pp gamma_16_table, - int gamma_shift) +png_do_gamma(png_row_infop row_info, png_bytep row, png_structp png_ptr) { + png_const_bytep gamma_table = png_ptr->gamma_table; + png_const_uint_16pp gamma_16_table = png_ptr->gamma_16_table; + int gamma_shift = png_ptr->gamma_shift; + png_bytep sp; png_uint_32 i; png_uint_32 row_width=row_info->width; @@ -4235,8 +4231,9 @@ } } } #endif /* PNG_READ_QUANTIZE_SUPPORTED */ +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ #ifdef PNG_MNG_FEATURES_SUPPORTED /* Undoes intrapixel differencing */ void /* PRIVATE */ diff -ru4NwbB libpng-1.5.2/pngrutil.c libpng-1.5.3beta04/pngrutil.c --- libpng-1.5.2/pngrutil.c 2011-03-31 11:23:40.773411012 -0500 +++ libpng-1.5.3beta04/pngrutil.c 2011-04-27 14:57:57.833686879 -0500 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.5.2 [March 31, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -277,10 +277,9 @@ else return (0); } -#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ - defined(PNG_READ_iCCP_SUPPORTED) +#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED static png_size_t png_inflate(png_structp png_ptr, png_bytep data, png_size_t size, png_bytep output, png_size_t output_size) { @@ -535,9 +534,9 @@ } *newlength = prefix_size; } -#endif +#endif /* PNG_READ_COMPRESSED_TEXT_SUPPORTED */ /* Read and check the IDHR chunk */ void /* PRIVATE */ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) @@ -3397,9 +3396,11 @@ png_size_t row_bytes; png_debug(1, "in png_read_start_row"); png_ptr->zstream.avail_in = 0; +#ifdef PNG_READ_TRANSFORMS_SUPPORTED png_init_read_transformations(png_ptr); +#endif #ifdef PNG_READ_INTERLACING_SUPPORTED if (png_ptr->interlaced) { if (!(png_ptr->transformations & PNG_INTERLACE)) diff -ru4NwbB libpng-1.5.2/pngstruct.h libpng-1.5.3beta04/pngstruct.h --- libpng-1.5.2/pngstruct.h 2011-03-31 11:23:40.673577111 -0500 +++ libpng-1.5.3beta04/pngstruct.h 2011-04-27 14:57:57.735607326 -0500 @@ -28,9 +28,9 @@ struct png_struct_def { #ifdef PNG_SETJMP_SUPPORTED - jmp_buf png_jmpbuf; /* used in png_error */ + jmp_buf longjmp_buffer; /* used in png_error */ png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */ #endif png_error_ptr error_fn; /* function for printing errors and aborting */ png_error_ptr warning_fn; /* function for printing warnings */ @@ -68,8 +68,18 @@ int zlib_method; /* holds zlib compression method */ int zlib_window_bits; /* holds zlib compression window bits */ int zlib_mem_level; /* holds zlib compression memory level */ int zlib_strategy; /* holds zlib compression strategy */ +/* Added at libpng 1.5.3 */ +#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \ + defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION) + int zlib_text_level; /* holds zlib compression level */ + int zlib_text_method; /* holds zlib compression method */ + int zlib_text_window_bits; /* holds zlib compression window bits */ + int zlib_text_mem_level; /* holds zlib compression memory level */ + int zlib_text_strategy; /* holds zlib compression strategy */ +#endif +/* End of material added at libpng 1.5.3 */ png_uint_32 width; /* width of image in pixels */ png_uint_32 height; /* height of image in pixels */ png_uint_32 num_rows; /* number of rows in current pass */ diff -ru4NwbB libpng-1.5.2/pngtest.c libpng-1.5.3beta04/pngtest.c --- libpng-1.5.2/pngtest.c 2011-03-31 11:23:40.790873438 -0500 +++ libpng-1.5.3beta04/pngtest.c 2011-04-27 14:57:57.850995206 -0500 @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -778,9 +778,9 @@ int num_pass, pass; int bit_depth, color_type; #ifdef PNG_SETJMP_SUPPORTED #ifdef USE_FAR_KEYWORD - jmp_buf png_jmpbuf; + jmp_buf tmp_jmpbuf; #endif #endif char inbuf[256], outbuf[256]; @@ -847,9 +847,9 @@ #ifdef PNG_SETJMP_SUPPORTED pngtest_debug("Setting jmpbuf for read struct"); #ifdef USE_FAR_KEYWORD - if (setjmp(png_jmpbuf)) + if (setjmp(tmp_jmpbuf)) #else if (setjmp(png_jmpbuf(read_ptr))) #endif { @@ -865,16 +865,16 @@ FCLOSE(fpout); return (1); } #ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(read_ptr), png_jmpbuf, png_sizeof(jmp_buf)); + png_memcpy(png_jmpbuf(read_ptr), tmp_jmpbuf, png_sizeof(jmp_buf)); #endif #ifdef PNG_WRITE_SUPPORTED pngtest_debug("Setting jmpbuf for write struct"); #ifdef USE_FAR_KEYWORD - if (setjmp(png_jmpbuf)) + if (setjmp(tmp_jmpbuf)) #else if (setjmp(png_jmpbuf(write_ptr))) #endif { @@ -889,9 +889,9 @@ return (1); } #ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(write_ptr), png_jmpbuf, png_sizeof(jmp_buf)); + png_memcpy(png_jmpbuf(write_ptr), tmp_jmpbuf, png_sizeof(jmp_buf)); #endif #endif #endif @@ -912,8 +912,16 @@ # endif # endif #endif +#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION + /* Normally one would use Z_DEFAULT_STRATEGY for text compression. + * This is here just to make pngtest replicate the results from libpng + * versions prior to 1.5.3, and to test this new API. + */ + png_set_text_compression_strategy(write_ptr, Z_FILTERED); +#endif + if (status_dots_requested == 1) { #ifdef PNG_WRITE_SUPPORTED png_set_write_status_fn(write_ptr, write_row_callback); diff -ru4NwbB libpng-1.5.2/pngtrans.c libpng-1.5.3beta04/pngtrans.c --- libpng-1.5.2/pngtrans.c 2011-03-31 11:23:40.797375493 -0500 +++ libpng-1.5.3beta04/pngtrans.c 2011-04-27 14:57:57.857163612 -0500 @@ -1,8 +1,8 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.5.2 [March 31, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -441,9 +441,13 @@ /* 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. + * + * at_start: 0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc. + * : nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc. */ + /* GA, GX, XG cases */ if (row_info->channels == 2) { if (row_info->bit_depth == 8) diff -ru4NwbB libpng-1.5.2/pngvalid.c libpng-1.5.3beta04/pngvalid.c --- libpng-1.5.2/pngvalid.c 2011-03-31 11:23:40.818304211 -0500 +++ libpng-1.5.3beta04/pngvalid.c 2011-04-27 14:57:57.877341236 -0500 @@ -107,15 +107,17 @@ sprintf(number, "%d", n); return safecat(buffer, bufsize, pos, number); } +#ifdef PNG_READ_TRANSFORMS_SUPPORTED static size_t safecatd(char *buffer, size_t bufsize, size_t pos, double d, int precision) { char number[64]; sprintf(number, "%.*f", precision, d); return safecat(buffer, bufsize, pos, number); } +#endif static PNG_CONST char invalid[] = "invalid"; static PNG_CONST char sep[] = ": "; @@ -224,8 +226,9 @@ #ifndef DO_16BIT # define READ_BDHI 3 #endif +#ifdef PNG_READ_TRANSFORMS_SUPPORTED static int next_format(png_bytep colour_type, png_bytep bit_depth) { if (*bit_depth == 0) @@ -307,8 +310,9 @@ /* Less than 8 bits per sample. */ bit_index &= 7; return (result >> (8-bit_index-bit_depth)) & ((1U<current->datacount; } +#ifdef PNG_READ_TRANSFORMS_SUPPORTED /* Return total bytes available for read. */ static size_t store_read_buffer_avail(png_store *ps) { @@ -812,8 +819,9 @@ } return 0; } +#endif static int store_read_buffer_next(png_store *ps) { @@ -1357,37 +1365,8 @@ size_t buffer_position; /* Position in buffer */ png_byte buffer[1024]; } png_modifier; -static double abserr(png_modifier *pm, png_byte bit_depth) -{ - return bit_depth == 16 ? pm->maxabs16 : pm->maxabs8; -} - -static double pcerr(png_modifier *pm, png_byte bit_depth) -{ - return (bit_depth == 16 ? pm->maxpc16 : pm->maxpc8) * .01; -} - -static double outerr(png_modifier *pm, png_byte bit_depth) -{ - /* There is a serious error in the 2 and 4 bit grayscale transform because - * the gamma table value (8 bits) is simply shifted, not rounded, so the - * error in 4 bit greyscale gamma is up to the value below. This is a hack - * to allow pngvalid to succeed: - */ - if (bit_depth == 2) - return .73182-.5; - - if (bit_depth == 4) - return .90644-.5; - - if (bit_depth == 16) - return pm->maxout16; - - return pm->maxout8; -} - /* This returns true if the test should be stopped now because it has already * failed and it is running silently. */ static int fail(png_modifier *pm) @@ -1423,8 +1402,38 @@ /* Rely on the memset for all the other fields - there are no pointers */ } +#ifdef PNG_READ_TRANSFORMS_SUPPORTED +static double abserr(png_modifier *pm, png_byte bit_depth) +{ + return bit_depth == 16 ? pm->maxabs16 : pm->maxabs8; +} + +static double pcerr(png_modifier *pm, png_byte bit_depth) +{ + return (bit_depth == 16 ? pm->maxpc16 : pm->maxpc8) * .01; +} + +static double outerr(png_modifier *pm, png_byte bit_depth) +{ + /* There is a serious error in the 2 and 4 bit grayscale transform because + * the gamma table value (8 bits) is simply shifted, not rounded, so the + * error in 4 bit greyscale gamma is up to the value below. This is a hack + * to allow pngvalid to succeed: + */ + if (bit_depth == 2) + return .73182-.5; + + if (bit_depth == 4) + return .90644-.5; + + if (bit_depth == 16) + return pm->maxout16; + + return pm->maxout8; +} + /* One modification structure must be provided for each chunk to be modified (in * fact more than one can be provided if multiple separate changes are desired * for a single chunk.) Modifications include adding a new chunk when a * suitable chunk does not exist. @@ -1812,8 +1821,9 @@ pm->buffer_position = 0; return set_store_for_read(&pm->this, ppi, id, name); } +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ /***************************** STANDARD PNG FILES *****************************/ /* Standard files - write and save standard files. */ /* There are two basic forms of standard images. Those which attempt to have @@ -2747,9 +2757,9 @@ { dp->ps = ps; dp->colour_type = COL_FROM_ID(id); dp->bit_depth = DEPTH_FROM_ID(id); - dp->alpha_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = + dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = dp->bit_depth; dp->interlace_type = INTERLACE_FROM_ID(id); dp->id = id; /* All the rest are filled in after the read_info: */ @@ -3072,14 +3081,16 @@ * us the y in the sub-image: */ if (dp->do_interlace && dp->interlace_type == PNG_INTERLACE_ADAM7) { +#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED /* Use this opportunity to validate the png 'current' APIs: */ if (y != png_get_current_row_number(pp)) png_error(pp, "png_get_current_row_number is broken"); if (pass != png_get_current_pass_number(pp)) png_error(pp, "png_get_current_pass_number is broken"); +#endif y = PNG_ROW_FROM_PASS_ROW(y, pass); } @@ -3470,8 +3481,9 @@ } /******************************* TRANSFORM TESTS ******************************/ +#ifdef PNG_READ_TRANSFORMS_SUPPORTED /* A set of tests to validate libpng image transforms. The possibilities here * are legion because the transforms can be combined in a combinatorial * fashion. To deal with this some measure of restraint is required, otherwise * the tests would take forever. @@ -4009,14 +4021,15 @@ { /* Compare the scaled, digitzed, values of our local calculation (in+-err) * with the digitized values libpng produced; 'sample_depth' is the actual * digitization depth of the libpng output colors (the bit depth except for - * palette images where it is always 8.) + * palette images where it is always 8.) The check on 'err' is to detect + * internal errors in pngvalid itself (the threshold is about 1/255.) */ unsigned int max = (1U<= in_min && out <= in_max)) + if (err > 4E-3 || !(out >= in_min && out <= in_max)) { char message[256]; size_t pos; @@ -4227,21 +4240,22 @@ } /* The transforms: */ #define ITSTRUCT(name) image_transform_##name -#define IT(name,prev)\ +#define IT(name)\ static image_transform ITSTRUCT(name) =\ {\ #name,\ 1, /*enable*/\ - &ITSTRUCT(prev), /*list*/\ + &PT, /*list*/\ 0, /*global_use*/\ 0, /*local_use*/\ 0, /*next*/\ image_transform_png_set_##name##_set,\ image_transform_png_set_##name##_mod,\ image_transform_png_set_##name##_add\ } +#define PT ITSTRUCT(end) /* stores the previous transform */ /* To save code: */ static int image_transform_default_add(image_transform *this, @@ -4255,8 +4269,9 @@ return 1; } +#ifdef PNG_READ_EXPAND_SUPPORTED /* png_set_palette_to_rgb */ static void image_transform_png_set_palette_to_rgb_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) @@ -4286,11 +4301,14 @@ return colour_type == PNG_COLOR_TYPE_PALETTE; } -IT(palette_to_rgb, end); - +IT(palette_to_rgb); +#undef PT +#define PT ITSTRUCT(palette_to_rgb) +#endif /* PNG_READ_EXPAND_SUPPORTED */ +#ifdef PNG_READ_EXPAND_SUPPORTED /* png_set_tRNS_to_alpha */ static void image_transform_png_set_tRNS_to_alpha_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) @@ -4340,10 +4358,14 @@ */ return (colour_type & PNG_COLOR_MASK_ALPHA) == 0; } -IT(tRNS_to_alpha,palette_to_rgb); +IT(tRNS_to_alpha); +#undef PT +#define PT ITSTRUCT(tRNS_to_alpha) +#endif /* PNG_READ_EXPAND_SUPPORTED */ +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED /* png_set_gray_to_rgb */ static void image_transform_png_set_gray_to_rgb_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) @@ -4394,10 +4416,14 @@ return (colour_type & PNG_COLOR_MASK_COLOR) == 0; } -IT(gray_to_rgb,tRNS_to_alpha); +IT(gray_to_rgb); +#undef PT +#define PT ITSTRUCT(gray_to_rgb) +#endif /* PNG_READ_GRAY_TO_RGB_SUPPORTED */ +#ifdef PNG_READ_EXPAND_SUPPORTED /* png_set_expand */ static void image_transform_png_set_expand_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) @@ -4436,10 +4462,14 @@ */ return (colour_type & PNG_COLOR_MASK_ALPHA) == 0; } -IT(expand,gray_to_rgb); +IT(expand); +#undef PT +#define PT ITSTRUCT(expand) +#endif /* PNG_READ_EXPAND_SUPPORTED */ +#ifdef PNG_READ_EXPAND_SUPPORTED /* png_set_expand_gray_1_2_4_to_8 * LIBPNG BUG: this just does an 'expand' */ static void @@ -4466,9 +4496,14 @@ return image_transform_png_set_expand_add(this, that, colour_type, bit_depth); } -IT(expand_gray_1_2_4_to_8, expand); +IT(expand_gray_1_2_4_to_8); +#undef PT +#define PT ITSTRUCT(expand_gray_1_2_4_to_8) +#endif /* PNG_READ_EXPAND_SUPPORTED */ + +#ifdef PNG_READ_EXPAND_16_SUPPORTED /* 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) @@ -4508,10 +4543,14 @@ /* 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); +IT(expand_16); +#undef PT +#define PT ITSTRUCT(expand_16) +#endif /* PNG_READ_EXPAND_16_SUPPORTED */ +#ifdef PNG_READ_16_TO_8_SUPPORTED /* png_set_strip_16 */ static void image_transform_png_set_strip_16_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) @@ -4560,10 +4599,14 @@ return bit_depth > 8; } -IT(strip_16, expand_16); +IT(strip_16); +#undef PT +#define PT ITSTRUCT(strip_16) +#endif /* PNG_READ_16_TO_8_SUPPORTED */ +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED /* png_set_strip_alpha */ static void image_transform_png_set_strip_alpha_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) @@ -4599,10 +4642,14 @@ return (colour_type & PNG_COLOR_MASK_ALPHA) != 0; } -IT(strip_alpha,strip_16); +IT(strip_alpha); +#undef PT +#define PT ITSTRUCT(strip_alpha) +#endif /* PNG_READ_STRIP_ALPHA_SUPPORTED */ +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED /* png_set_rgb_to_gray(png_structp, int err_action, double red, double green) * png_set_rgb_to_gray_fixed(png_structp, int err_action, png_fixed_point red, * png_fixed_point green) * png_get_rgb_to_gray_status @@ -4676,10 +4723,14 @@ return (colour_type & PNG_COLOR_MASK_COLOR) != 0; } -IT(rgb_to_gray,strip_alpha); +IT(rgb_to_gray); +#undef PT +#define PT ITSTRUCT(rgb_to_gray) +#endif /* PNG_READ_RGB_TO_GRAY_SUPPORTED */ +#ifdef PNG_READ_BACKGROUND_SUPPORTED /* png_set_background(png_structp, png_const_color_16p background_color, * int background_gamma_code, int need_expand, double background_gamma) * png_set_background_fixed(png_structp, png_const_color_16p background_color, * int background_gamma_code, int need_expand, @@ -4759,11 +4810,15 @@ } #define image_transform_png_set_background_add image_transform_default_add -IT(background,rgb_to_gray); +IT(background); +#undef PT +#define PT ITSTRUCT(background) +#endif /* PNG_READ_BACKGROUND_SUPPORTED */ -static image_transform *PNG_CONST image_transform_first = &ITSTRUCT(background); +/* This may just be 'end' if all the transforms are disabled! */ +static image_transform *PNG_CONST image_transform_first = &PT; static void transform_enable(PNG_CONST char *name) { @@ -5070,11 +5125,13 @@ if (!test_transform(pm, 6, 3, READ_BDHI, 1)) return; } +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ /********************************* GAMMA TESTS ********************************/ +#ifdef PNG_READ_GAMMA_SUPPORTED /* Gamma test images. */ typedef struct gamma_modification { png_modification this; @@ -6015,8 +6072,9 @@ } } #endif } +#endif /* PNG_READ_GAMMA_SUPPORTED */ /* INTERLACE MACRO VALIDATION */ /* This is copied verbatim from the specification, it is simply the pass * number in which each pixel in each 8x8 tile appears. The array must @@ -6466,8 +6524,9 @@ else if (strcmp(*argv, "--notransform") == 0) pm.test_transform = 0; +#ifdef PNG_READ_TRANSFORMS_SUPPORTED else if (strncmp(*argv, "--transform-disable=", sizeof "--transform-disable") == 0) { pm.test_transform = 1; @@ -6479,8 +6538,9 @@ { pm.test_transform = 1; transform_enable(*argv + sizeof "--transform-enable"); } +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ else if (strcmp(*argv, "--gamma") == 0) { /* Just do two gamma tests here (2.2 and linear) for speed: */ @@ -6619,15 +6679,19 @@ make_size_images(&pm.this); perform_size_test(&pm); } +#ifdef PNG_READ_TRANSFORMS_SUPPORTED /* Combinatorial transforms: */ if (pm.test_transform) perform_transform_test(&pm); +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ +#ifdef PNG_READ_GAMMA_SUPPORTED if (pm.ngammas > 0) perform_gamma_test(&pm, pm.this.speed != 0, summary && !pm.this.speed); +#endif } Catch(fault) { diff -ru4NwbB libpng-1.5.2/pngwrite.c libpng-1.5.3beta04/pngwrite.c --- libpng-1.5.2/pngwrite.c 2011-03-31 11:23:40.832722141 -0500 +++ libpng-1.5.3beta04/pngwrite.c 2011-04-27 14:57:57.891902223 -0500 @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.5.1 [February 3, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -461,9 +461,9 @@ #endif png_structp png_ptr; #ifdef PNG_SETJMP_SUPPORTED #ifdef USE_FAR_KEYWORD - jmp_buf png_jmpbuf; + jmp_buf tmp_jmpbuf; #endif #endif int i; @@ -488,14 +488,14 @@ /* Applications that neglect to set up their own setjmp() and then encounter a png_error() will longjmp here. Since the jmpbuf is then meaningless we abort instead of returning. */ #ifdef USE_FAR_KEYWORD - if (setjmp(png_jmpbuf)) + if (setjmp(tmp_jmpbuf)) #else if (setjmp(png_jmpbuf(png_ptr))) /* sets longjmp to match setjmp */ #endif #ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(png_ptr), png_jmpbuf, png_sizeof(jmp_buf)); + png_memcpy(png_jmpbuf(png_ptr), tmp_jmpbuf, png_sizeof(jmp_buf)); #endif PNG_ABORT(); #endif @@ -804,11 +804,13 @@ } } #endif +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED /* Handle other transformations */ if (png_ptr->transformations) png_do_write_transformations(png_ptr); +#endif #ifdef PNG_MNG_FEATURES_SUPPORTED /* Write filter_method 64 (intrapixel differencing) only if * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and @@ -1017,9 +1019,9 @@ #endif #ifdef PNG_SETJMP_SUPPORTED /* Reset structure */ - png_memcpy(tmp_jmp, png_ptr->png_jmpbuf, png_sizeof(jmp_buf)); + png_memcpy(tmp_jmp, png_ptr->longjmp_buffer, png_sizeof(jmp_buf)); #endif error_fn = png_ptr->error_fn; warning_fn = png_ptr->warning_fn; @@ -1037,9 +1039,9 @@ png_ptr->free_fn = free_fn; #endif #ifdef PNG_SETJMP_SUPPORTED - png_memcpy(png_ptr->png_jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); + png_memcpy(png_ptr->longjmp_buffer, tmp_jmp, png_sizeof(jmp_buf)); #endif } /* Allow the application to select one or more row filters to use. */ @@ -1490,8 +1492,88 @@ png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_METHOD; png_ptr->zlib_method = method; } +/* The following were added to libpng-1.5.3 */ +#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION +void PNGAPI +png_set_text_compression_level(png_structp png_ptr, int level) +{ + png_debug(1, "in png_set_text_compression_level"); + + if (png_ptr == NULL) + return; + + png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_LEVEL; + png_ptr->zlib_text_level = level; +} + +void PNGAPI +png_set_text_compression_mem_level(png_structp png_ptr, int mem_level) +{ + png_debug(1, "in png_set_text_compression_mem_level"); + + if (png_ptr == NULL) + return; + + png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL; + png_ptr->zlib_text_mem_level = mem_level; +} + +void PNGAPI +png_set_text_compression_strategy(png_structp png_ptr, int strategy) +{ + png_debug(1, "in png_set_text_compression_strategy"); + + if (png_ptr == NULL) + return; + + png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_STRATEGY; + png_ptr->zlib_text_strategy = strategy; +} + +void PNGAPI +png_set_text_compression_window_bits(png_structp png_ptr, int window_bits) +{ + if (png_ptr == NULL) + return; + + if (window_bits > 15) + png_warning(png_ptr, "Only compression windows <= 32k supported by PNG"); + + else if (window_bits < 8) + png_warning(png_ptr, "Only compression windows >= 256 supported by PNG"); + +#ifndef WBITS_8_OK + /* Avoid libpng bug with 256-byte windows */ + if (window_bits == 8) + { + png_warning(png_ptr, "Text compression window is being reset to 512"); + window_bits = 9; + } + +#endif + png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS; + png_ptr->zlib_text_window_bits = window_bits; +} + +void PNGAPI +png_set_text_compression_method(png_structp png_ptr, int method) +{ + png_debug(1, "in png_set_text_compression_method"); + + if (png_ptr == NULL) + return; + + if (method != 8) + png_warning(png_ptr, "Only compression method 8 is supported by PNG"); + + png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_METHOD; + png_ptr->zlib_text_method = method; +} +#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */ +/* end of API added to libpng-1.5.3 */ + void PNGAPI png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) { if (png_ptr == NULL) diff -ru4NwbB libpng-1.5.2/pngwtran.c libpng-1.5.3beta04/pngwtran.c --- libpng-1.5.2/pngwtran.c 2011-03-31 11:23:40.839135854 -0500 +++ libpng-1.5.3beta04/pngwtran.c 2011-04-27 14:57:57.897946334 -0500 @@ -1,8 +1,8 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.5.2 [March 31, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -14,8 +14,9 @@ #include "pngpriv.h" #ifdef PNG_WRITE_SUPPORTED +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED /* Transform the data according to the user's wishes. The order of * transformations is significant. */ void /* PRIVATE */ @@ -44,9 +45,9 @@ #ifdef PNG_WRITE_FILLER_SUPPORTED if (png_ptr->transformations & PNG_FILLER) png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1, - !(png_ptr->flags & PNG_FILLER_AFTER)); + !(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); #endif #ifdef PNG_WRITE_PACKSWAP_SUPPORTED if (png_ptr->transformations & PNG_PACKSWAP) @@ -562,8 +563,9 @@ } } } #endif +#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ #ifdef PNG_MNG_FEATURES_SUPPORTED /* Undoes intrapixel differencing */ void /* PRIVATE */ diff -ru4NwbB libpng-1.5.2/pngwutil.c libpng-1.5.3beta04/pngwutil.c --- libpng-1.5.2/pngwutil.c 2011-03-31 11:23:40.850911793 -0500 +++ libpng-1.5.3beta04/pngwutil.c 2011-04-27 14:57:57.909591880 -0500 @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.5.0 [January 6, 2011] + * Last changed in libpng 1.5.3 [(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.) * @@ -191,9 +191,9 @@ png_write_data(png_ptr, buf, (png_size_t)4); } -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) +#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED /* This pair of functions encapsulates the operation of (a) compressing a * text string, and (b) issuing it later as a series of chunk data writes. * The compression_state structure is shared context for these functions * set up by the caller in order to make the whole mess thread-safe. @@ -219,15 +219,14 @@ comp->num_output_ptr = 0; comp->max_output_ptr = 0; comp->output_ptr = NULL; comp->input = NULL; - comp->input_len = 0; + comp->input_len = text_len; /* We may just want to pass the text right through */ if (compression == PNG_TEXT_COMPRESSION_NONE) { comp->input = (png_const_bytep)text; - comp->input_len = text_len; return((int)text_len); } if (compression >= PNG_TEXT_COMPRESSION_LAST) @@ -255,11 +254,43 @@ * data, or if the input string is incredibly large (although this * wouldn't cause a failure, just a slowdown due to swapping). */ + if (!(png_ptr->mode & PNG_ZLIB_READY_FOR_ZTXT)) + { + + /* png_warning(png_ptr, "Initialize compressor for ztxt"); */ + /* Free memory from previously opened zstream */ + deflateEnd(&png_ptr->zstream); + + /* Initialize the compressor for zTXt compression. */ + ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_text_level, + png_ptr->zlib_text_method, png_ptr->zlib_text_window_bits, + png_ptr->zlib_text_mem_level, png_ptr->zlib_text_strategy); + + if (ret != Z_OK) + { + if (ret == Z_VERSION_ERROR) + png_error(png_ptr, + "zlib failed to initialize compressor for text-- version error"); + + if (ret == Z_STREAM_ERROR) + png_error(png_ptr, + "zlib failed to initialize compressor for text-- stream error"); + + if (ret == Z_MEM_ERROR) + png_error(png_ptr, + "zlib failed to initialize compressor for text-- mem error"); + + png_error(png_ptr, "zlib failed to initialize compressor for text"); + } + png_ptr->mode |= PNG_ZLIB_READY_FOR_ZTXT; + } + /* Set up the compression buffers */ /* TODO: the following cast hides a potential overflow problem. */ png_ptr->zstream.avail_in = (uInt)text_len; + /* NOTE: assume zlib doesn't overwrite the input */ png_ptr->zstream.next_in = (Bytef *)text; png_ptr->zstream.avail_out = png_ptr->zbuf_size; png_ptr->zstream.next_out = png_ptr->zbuf; @@ -417,8 +448,68 @@ return; } + if (comp->input_len >= 2 && comp->input_len < 16384) + { + unsigned int z_cmf; /* zlib compression method and flags */ + + /* Optimize the CMF field in the zlib stream. This hack of the zlib + * stream is compliant to the stream specification. + */ + + if (comp->num_output_ptr) + z_cmf = comp->output_ptr[0][0]; + else + z_cmf = png_ptr->zbuf[0]; + + if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) + { + unsigned int z_cinfo; + unsigned int half_z_window_size; + png_size_t uncompressed_idat_size = comp->input_len; + + z_cinfo = z_cmf >> 4; + half_z_window_size = 1 << (z_cinfo + 7); + + while (uncompressed_idat_size <= half_z_window_size && + half_z_window_size >= 256) + { + z_cinfo--; + half_z_window_size >>= 1; + } + + z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4); + + if (comp->num_output_ptr) + { + + if (comp->output_ptr[0][0] != z_cmf) + { + int tmp; + + comp->output_ptr[0][0] = (png_byte)z_cmf; + tmp = comp->output_ptr[0][1] & 0xe0; + tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f; + comp->output_ptr[0][1] = (png_byte)tmp; + } + } + else + { + int tmp; + + png_ptr->zbuf[0] = (png_byte)z_cmf; + tmp = png_ptr->zbuf[1] & 0xe0; + tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f; + png_ptr->zbuf[1] = (png_byte)tmp; + } + } + + else + png_error(png_ptr, + "Invalid zlib compression method or flags in non-IDAT chunk"); + } + /* Write saved output buffers, if any */ for (i = 0; i < comp->num_output_ptr; i++) { png_write_chunk_data(png_ptr, comp->output_ptr[i], @@ -436,11 +527,10 @@ (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream.avail_out)); /* Reset zlib for another zTXt/iTXt or image data */ deflateReset(&png_ptr->zstream); - png_ptr->zstream.data_type = Z_BINARY; } -#endif +#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */ /* Write the IHDR chunk, and update the png_struct with the necessary * information. Note that the rest of this code depends upon this * information being correct. @@ -631,37 +721,39 @@ if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD)) png_ptr->zlib_method = 8; - ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, - png_ptr->zlib_method, png_ptr->zlib_window_bits, - png_ptr->zlib_mem_level, png_ptr->zlib_strategy); - - if (ret != Z_OK) - { - if (ret == Z_VERSION_ERROR) - png_error(png_ptr, - "zlib failed to initialize compressor -- version error"); +#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED +#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION + if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_STRATEGY)) + png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY; + + if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_LEVEL)) + png_ptr->zlib_text_level = png_ptr->zlib_level; - if (ret == Z_STREAM_ERROR) - png_error(png_ptr, - "zlib failed to initialize compressor -- stream error"); + if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL)) + png_ptr->zlib_text_mem_level = png_ptr->zlib_mem_level; - if (ret == Z_MEM_ERROR) - png_error(png_ptr, - "zlib failed to initialize compressor -- mem error"); + if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS)) + png_ptr->zlib_text_window_bits = png_ptr->zlib_window_bits; - png_error(png_ptr, "zlib failed to initialize compressor"); - } + if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_METHOD)) + png_ptr->zlib_text_method = png_ptr->zlib_method; +#else + png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY; + png_ptr->zlib_text_level = png_ptr->zlib_level; + 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_COMPRESSED_TEXT_SUPPORTED */ - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - /* libpng is not interested in zstream.data_type, so set it - * to a predefined value, to avoid its evaluation inside zlib - */ - png_ptr->zstream.data_type = Z_BINARY; + /* Initialize the zlib compressor */ + ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, + png_ptr->zlib_method, png_ptr->zlib_window_bits, + png_ptr->zlib_mem_level, png_ptr->zlib_strategy); - png_ptr->mode = PNG_HAVE_IHDR; + png_ptr->mode = PNG_HAVE_IHDR; /* not READY_FOR_ZTXT */ } /* Write the palette. We are careful not to trust png_color to be in the * correct order for PNG, so people can redefine it to any convenient @@ -744,14 +836,58 @@ PNG_IDAT; png_debug(1, "in png_write_IDAT"); - /* Optimize the CMF field in the zlib stream. */ - /* This hack of the zlib stream is compliant to the stream specification. */ if (!(png_ptr->mode & PNG_HAVE_IDAT) && png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE) { - unsigned int z_cmf = data[0]; /* zlib compression method and flags */ + unsigned int z_cmf; /* zlib compression method and flags */ + +#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED + int ret; + + /* Reinitialize the compressor if necessary */ + if (png_ptr->mode & PNG_ZLIB_READY_FOR_ZTXT) + { + /* Free memory from previously opened zstream */ + deflateEnd(&png_ptr->zstream); + + ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, + png_ptr->zlib_method, png_ptr->zlib_window_bits, + png_ptr->zlib_mem_level, png_ptr->zlib_strategy); + + if (ret != Z_OK) + { + if (ret == Z_VERSION_ERROR) + png_error(png_ptr, + "zlib failed to initialize compressor -- version error"); + + if (ret == Z_STREAM_ERROR) + png_error(png_ptr, + "zlib failed to initialize compressor -- stream error"); + + if (ret == Z_MEM_ERROR) + png_error(png_ptr, + "zlib failed to initialize compressor -- mem error"); + + png_error(png_ptr, "zlib failed to initialize compressor"); + } + png_ptr->mode &= ~PNG_ZLIB_READY_FOR_ZTXT; /* Ready for IDAT */ + } +#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */ + + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + /* libpng is not interested in zstream.data_type, so set it + * to a predefined value, to avoid its evaluation inside zlib + */ + png_ptr->zstream.data_type = Z_BINARY; + + /* Optimize the CMF field in the zlib stream. This hack of the zlib + * stream is compliant to the stream specification. + */ + z_cmf = data[0]; + if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) { /* Avoid memory underflows and multiplication overflows. * @@ -760,13 +896,31 @@ */ if (length >= 2 && png_ptr->height < 16384 && png_ptr->width < 16384) { + /* Compute the maximum possible length of the datastream */ + + /* Number of pixels, plus for each row a filter byte and possible + * and possibly a padding byte, so increase the maximum + * size to account for these. + */ + unsigned int z_cinfo; + unsigned int half_z_window_size; png_uint_32 uncompressed_idat_size = png_ptr->height * ((png_ptr->width * png_ptr->channels * png_ptr->bit_depth + 15) >> 3); - unsigned int z_cinfo = z_cmf >> 4; - unsigned int half_z_window_size = 1 << (z_cinfo + 7); + + /* If it's interlaced, each block of 8 rows is sent as up to + * 14 rows, i.e., 6 additional rows, each with a filter byte + * and possibly a padding byte + */ + if (png_ptr->interlaced) + uncompressed_idat_size += ((png_ptr->height + 7)/8) * + (png_ptr->bit_depth < 8 ? 12 : 6); + + z_cinfo = z_cmf >> 4; + half_z_window_size = 1 << (z_cinfo + 7); + while (uncompressed_idat_size <= half_z_window_size && half_z_window_size >= 256) { z_cinfo--; @@ -917,9 +1071,12 @@ png_write_chunk_data(png_ptr, (png_bytep)new_name, (png_size_t)(name_len + 2)); if (profile_len) + { + comp.input_len = profile_len; png_write_compressed_data_out(png_ptr, &comp); + } png_write_chunk_end(png_ptr); png_free(png_ptr, new_name); } @@ -1498,8 +1655,9 @@ /* Write compression */ png_write_chunk_data(png_ptr, &buf, (png_size_t)1); /* Write the compressed data */ + comp.input_len = text_len; png_write_compressed_data_out(png_ptr, &comp); /* Close the chunk */ png_write_chunk_end(png_ptr); diff -ru4NwbB libpng-1.5.2/projects/vstudio/zlib.props libpng-1.5.3beta04/projects/vstudio/zlib.props --- libpng-1.5.2/projects/vstudio/zlib.props 2011-03-31 11:23:42.940303614 -0500 +++ libpng-1.5.3beta04/projects/vstudio/zlib.props 2011-04-27 14:57:59.990338295 -0500 @@ -3,9 +3,9 @@ * zlib.props - location of zlib source * * libpng version 1.5.3beta04 - April 27, 2011 * - * Copyright (c) 1998-2010 Glenn Randers-Pehrson + * 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 @@ -23,8 +23,12 @@ source. If you use a relative directory name (as below) then it must be relative to the project directories; these are one level deepers than the directories containing this file. + If the version of zlib you use does not match that used when the + distribution was built you will get warnings from pngtest that the zlib + versions do not match. The zlib version used in this build is recorded + below: --> - ..\..\..\..\zlib-1.2.4 + ..\..\..\..\zlib-1.2.5 diff -ru4NwbB libpng-1.5.2/scripts/pnglibconf.dfa libpng-1.5.3beta04/scripts/pnglibconf.dfa --- libpng-1.5.2/scripts/pnglibconf.dfa 2011-02-12 09:16:01.541296000 -0600 +++ libpng-1.5.3beta04/scripts/pnglibconf.dfa 2011-04-17 18:39:21.431554000 -0500 @@ -339,8 +339,12 @@ option INCH_CONVERSIONS = INCH_CONVERSIONS INCH_CONVERSIONS +# API to build a grayscale palette + +option BUILD_GRAYSCALE_PALETTE + # IN DEVELOPMENT # These are currently experimental features, define them if you want # Very little testing, not enabled by default. @@ -385,8 +389,13 @@ # apps implementing the user transforms option USER_TRANSFORM_PTR if READ_USER_TRANSFORM WRITE_USER_TRANSFORM option USER_TRANSFORM_INFO if READ_USER_TRANSFORM WRITE_USER_TRANSFORM +# This enables API to set compression parameters for compressing +# non-IDAT chunks (zTXt, iTXt, iCCP, and unknown chunks). This feature +# was added at libpng-1.5.3. +option WRITE_CUSTOMIZE_ZTXT_COMPRESSION requires WRITE + # Any chunks you are not interested in, you can undef here. The # ones that allocate memory may be expecially important (hIST, # tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info # a bit smaller. @@ -500,9 +509,9 @@ chunk cHRM chunk gAMA chunk hIST chunk iCCP -chunk iTXt requires TEXT +chunk iTXt chunk oFFs chunk pCAL chunk sCAL chunk pHYs @@ -511,9 +520,9 @@ chunk sRGB chunk tEXt requires TEXT chunk tIME chunk tRNS -chunk zTXt requires TEXT +chunk zTXt # This only affects support of the optional PLTE chunk in RGB and RGBA # images. Notice that READ_ANCILLARY_CHUNKS therefore disables part # of the regular chunk reading too. @@ -540,11 +549,21 @@ option SAVE_INT_32 requires WRITE # png_save_int_32 is required by the ancillary chunks oFFs and pCAL +option READ_iCCP enables READ_COMPRESSED_TEXT +option READ_iTXt enables READ_COMPRESSED_TEXT +option READ_zTXt enables READ_COMPRESSED_TEXT +option READ_COMPRESSED_TEXT enables READ_TEXT + option WRITE_oFFs enables SAVE_INT_32 option WRITE_pCAL enables SAVE_INT_32 +option WRITE_iCCP enables WRITE_COMPRESSED_TEXT +option WRITE_iTXt enables WRITE_COMPRESSED_TEXT +option WRITE_zTXt enables WRITE_COMPRESSED_TEXT +option WRITE_COMPRESSED_TEXT enables WRITE_TEXT + # Turn this off to disable png_read_png() and png_write_png() and # leave the row_pointers member out of the info structure. option INFO_IMAGE diff -ru4NwbB libpng-1.5.2/scripts/pnglibconf.h.prebuilt libpng-1.5.3beta04/scripts/pnglibconf.h.prebuilt --- libpng-1.5.2/scripts/pnglibconf.h.prebuilt 2011-02-12 09:20:50.414618000 -0600 +++ libpng-1.5.3beta04/scripts/pnglibconf.h.prebuilt 2011-04-17 18:39:21.439318000 -0500 @@ -42,8 +42,9 @@ #define PNG_16BIT_SUPPORTED #define PNG_ALIGN_MEMORY_SUPPORTED #define PNG_BENIGN_ERRORS_SUPPORTED #define PNG_bKGD_SUPPORTED +#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED #define PNG_CHECK_cHRM_SUPPORTED #define PNG_cHRM_SUPPORTED #define PNG_CONSOLE_IO_SUPPORTED #define PNG_CONVERT_tIME_SUPPORTED @@ -112,8 +113,9 @@ #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_READ_COMPRESSED_TEXT_SUPPORTED #define PNG_SAVE_INT_32_SUPPORTED #define PNG_sBIT_SUPPORTED #define PNG_sCAL_SUPPORTED #define PNG_SEQUENTIAL_READ_SUPPORTED @@ -150,8 +152,9 @@ #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_CUSTOMIZE_ZTXT_COMPRESSION #define PNG_WRITE_iTXt_SUPPORTED #define PNG_WRITE_oFFs_SUPPORTED #define PNG_WRITE_PACK_SUPPORTED #define PNG_WRITE_PACKSWAP_SUPPORTED @@ -174,8 +177,9 @@ #define PNG_WRITE_USER_TRANSFORM_SUPPORTED #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_zTXt_SUPPORTED #define PNG_zTXt_SUPPORTED +#define PNG_WRITE_COMPRESSED_TEXT_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.2/scripts/symbols.def libpng-1.5.3beta04/scripts/symbols.def --- libpng-1.5.2/scripts/symbols.def 2011-03-31 11:23:42.905754321 -0500 +++ libpng-1.5.3beta04/scripts/symbols.def 2011-04-27 14:57:59.956231078 -0500 @@ -226,4 +226,9 @@ png_get_current_pass_number @218 png_process_data_pause @219 png_process_data_skip @220 png_set_expand_16 @221 + png_set_text_compression_level @222 + png_set_text_compression_mem_level @223 + png_set_text_compression_strategy @224 + png_set_text_compression_window_bits @225 + png_set_text_compression_method @226