diff -ru4NwbB libpng-1.4.1/configure.ac libpng-1.4.2rc02/configure.ac --- libpng-1.4.1/configure.ac 2010-02-25 05:38:36.634441039 -0600 +++ libpng-1.4.2rc02/configure.ac 2010-04-16 07:38:13.159780168 -0500 @@ -23,9 +23,9 @@ dnl stop configure from automagically running automake AM_MAINTAINER_MODE PNGLIB_VERSION=1.4.2rc02 -PNGLIB_MAJOR=%RELEASE% +PNGLIB_MAJOR=1 PNGLIB_MINOR=4 PNGLIB_RELEASE=%RELEASE% dnl End of version number stuff diff -ru4NwbB libpng-1.4.1/contrib/pngminim/decoder/pngusr.h libpng-1.4.2rc02/contrib/pngminim/decoder/pngusr.h --- libpng-1.4.1/contrib/pngminim/decoder/pngusr.h 2010-02-25 05:38:31.168194019 -0600 +++ libpng-1.4.2rc02/contrib/pngminim/decoder/pngusr.h 2010-04-16 07:38:01.965410127 -0500 @@ -24,9 +24,9 @@ #define png_chunk_error(s1,s2) png_err(s1) #define PNG_NO_READ_GAMMA #define PNG_NO_READ_BACKGROUND -#define PNG_NO_READ_DITHER +#define PNG_NO_READ_QUANTIZE #define PNG_NO_READ_INVERT #define PNG_NO_READ_SHIFT #define PNG_NO_READ_PACK #define PNG_NO_READ_PACKSWAP diff -ru4NwbB libpng-1.4.1/contrib/pngminim/encoder/pngusr.h libpng-1.4.2rc02/contrib/pngminim/encoder/pngusr.h --- libpng-1.4.1/contrib/pngminim/encoder/pngusr.h 2010-02-25 05:38:31.213167117 -0600 +++ libpng-1.4.2rc02/contrib/pngminim/encoder/pngusr.h 2010-04-16 07:38:02.046320971 -0500 @@ -22,9 +22,9 @@ #define png_chunk_error(s1,s2) png_err(s1) #define PNG_NO_WRITE_BACKGROUND #define PNG_NO_WRITE_GAMMA -#define PNG_NO_WRITE_DITHER +#define PNG_NO_WRITE_QUANTIZE #define PNG_NO_WRITE_INVERT #define PNG_NO_WRITE_SHIFT #define PNG_NO_WRITE_PACK #define PNG_NO_WRITE_PACKSWAP diff -ru4NwbB libpng-1.4.1/example.c libpng-1.4.2rc02/example.c --- libpng-1.4.1/example.c 2010-02-25 05:38:30.172040389 -0600 +++ libpng-1.4.2rc02/example.c 2010-04-16 07:38:00.131787533 -0500 @@ -159,9 +159,9 @@ /* * If you have enough memory to read in the entire image at once, * and you need to specify only transforms that can be controlled * with one of the PNG_TRANSFORM_* bits (this presently excludes - * dithering, filling, setting background, and doing gamma + * quantizing, filling, setting background, and doing gamma * adjustment), then you can read the entire image (including * pixels) into the info structure with this call: */ png_read_png(png_ptr, info_ptr, png_transforms, NULL); @@ -270,9 +270,10 @@ else png_set_gamma(png_ptr, screen_gamma, 0.45455); } - /* Dither RGB files down to 8 bit palette or reduce palettes +#ifdef PNG_READ_QUANTIZE_SUPPORTED + /* Quantize RGB files down to 8 bit palette or reduce palettes * to the number of colors available on your screen. */ if (color_type & PNG_COLOR_MASK_COLOR) { @@ -281,12 +282,13 @@ /* This reduces the image to the application supplied palette */ if (/* We have our own palette */) { - /* An array of colors to which the image should be dithered */ + /* An array of colors to which the image should be quantized */ png_color std_color_cube[MAX_SCREEN_COLORS]; - png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS, + /* Prior to libpng-1.4.2, this was png_set_dither(). */ + png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS, MAX_SCREEN_COLORS, NULL, 0); } /* This reduces the image to the palette supplied in the file */ else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) @@ -294,12 +296,13 @@ png_uint_16p histogram = NULL; png_get_hIST(png_ptr, info_ptr, &histogram); - png_set_dither(png_ptr, palette, num_palette, + png_set_quantize(png_ptr, palette, num_palette, max_screen_colors, histogram, 0); } } +#endif /* PNG_READ_QUANTIZE_SUPPORTED */ /* Invert monochrome files to have 0 as white and 1 as black */ png_set_invert_mono(png_ptr); diff -ru4NwbB libpng-1.4.1/png.h libpng-1.4.2rc02/png.h --- libpng-1.4.1/png.h 2010-02-25 05:38:30.147965500 -0600 +++ libpng-1.4.2rc02/png.h 2010-04-16 07:38:00.084296320 -0500 @@ -138,8 +138,9 @@ * 1.4.1rc01 14 10401 14.so.14.1[.0] * 1.4.1beta04-12 14 10401 14.so.14.1[.0] * 1.4.1rc02-04 14 10401 14.so.14.1[.0] * 1.4.1 14 10401 14.so.14.1[.0] + * 1.4.2beta01-02 14 10402 14.so.14.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 @@ -1331,15 +1332,15 @@ png_uint_16 offset_table_count PNG_DEPSTRUCT; png_uint_16 offset_table_count_free PNG_DEPSTRUCT; #endif -#ifdef PNG_READ_DITHER_SUPPORTED - png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for dithering */ - png_bytep dither_index PNG_DEPSTRUCT; /* index translation for palette +#ifdef PNG_READ_QUANTIZE_SUPPORTED + png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for quantizing */ + png_bytep quantize_index PNG_DEPSTRUCT; /* index translation for palette files */ #endif -#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) +#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED) png_uint_16p hist PNG_DEPSTRUCT; /* histogram */ #endif #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED @@ -1421,11 +1422,11 @@ /* New member added in libpng-1.0.13 and 1.2.0 */ png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */ -#ifdef PNG_READ_DITHER_SUPPORTED +#ifdef PNG_READ_QUANTIZE_SUPPORTED /* The following three members were added at version 1.0.14 and 1.2.4 */ - png_bytep dither_sort PNG_DEPSTRUCT; /* working sort array */ + png_bytep quantize_sort PNG_DEPSTRUCT; /* working sort array */ png_bytep index_to_palette PNG_DEPSTRUCT; /* where the original index currently is in the palette */ png_bytep palette_to_index PNG_DEPSTRUCT; /* which original index @@ -1494,8 +1495,13 @@ */ extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, png_size_t num_to_check)); +/* Simple signature checking function. This is the same as calling + * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). + */ +#define png_check_sig(sig,n) !png_sig_cmp((sig), 0, (n)) + /* Allocate and initialize png_ptr struct for reading, and any other memory. */ extern PNG_EXPORT(png_structp,png_create_read_struct) PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED; @@ -1709,16 +1715,18 @@ /* Strip the second byte of information from a 16-bit depth file. */ extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); #endif -#ifdef PNG_READ_DITHER_SUPPORTED -/* Turn on dithering, and reduce the palette to the number of colors - * available. +#ifdef PNG_READ_QUANTIZE_SUPPORTED +/* Turn on quantizing, and reduce the palette to the number of colors + * available. Prior to libpng-1.4.2, this was png_set_dither(). */ -extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, +extern PNG_EXPORT(void,png_set_quantize) PNGARG((png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, - png_uint_16p histogram, int full_dither)); + png_uint_16p histogram, int full_quantize)); #endif +/* This migration aid will be removed from libpng-1.5.0 */ +#define png_set_dither png_set_quantize #ifdef PNG_READ_GAMMA_SUPPORTED /* Handle gamma correction. Screen_gamma=(display_exponent) */ #ifdef PNG_FLOATING_POINT_SUPPORTED diff -ru4NwbB libpng-1.4.1/pngconf.h libpng-1.4.2rc02/pngconf.h --- libpng-1.4.1/pngconf.h 2010-02-25 05:38:30.156747672 -0600 +++ libpng-1.4.2rc02/pngconf.h 2010-04-16 07:38:00.099585911 -0500 @@ -390,20 +390,34 @@ #endif /* Other defines for things like memory and the like can go here. */ -/* This controls how fine the dithering gets. As this allocates +/* This controls how fine the quantizing gets. As this allocates * a largish chunk of memory (32K), those who are not as concerned - * with dithering quality can decrease some or all of these. + * with quantizing quality can decrease some or all of these. */ -#ifndef PNG_DITHER_RED_BITS -# define PNG_DITHER_RED_BITS 5 + +/* Prior to libpng-1.4.2, these were PNG_DITHER_*_BITS + * These migration aids will be removed from libpng-1.5.0. + */ +#ifdef PNG_DITHER_RED_BITS +# define PNG_QUANTIZE_RED_BITS PNG_DITHER_RED_BITS #endif -#ifndef PNG_DITHER_GREEN_BITS -# define PNG_DITHER_GREEN_BITS 5 +#ifdef PNG_DITHER_GREEN_BITS +# define PNG_QUANTIZE_GREEN_BITS PNG_DITHER_GREEN_BITS #endif -#ifndef PNG_DITHER_BLUE_BITS -# define PNG_DITHER_BLUE_BITS 5 +#ifdef PNG_DITHER_BLUE_BITS +# define PNG_QUANTIZE_BLUE_BITS PNG_DITHER_BLUE_BITS +#endif + +#ifndef PNG_QUANTIZE_RED_BITS +# define PNG_QUANTIZE_RED_BITS 5 +#endif +#ifndef PNG_QUANTIZE_GREEN_BITS +# define PNG_QUANTIZE_GREEN_BITS 5 +#endif +#ifndef PNG_QUANTIZE_BLUE_BITS +# define PNG_QUANTIZE_BLUE_BITS 5 #endif /* This controls how fine the gamma correction becomes when you * are only interested in 8 bits anyway. Increasing this value @@ -498,13 +512,14 @@ # endif # ifndef PNG_NO_READ_INVERT # define PNG_READ_INVERT_SUPPORTED # endif -#if 0 /* removed from libpng-1.4.0 */ -# ifndef PNG_NO_READ_DITHER -# define PNG_READ_DITHER_SUPPORTED +# ifndef PNG_NO_READ_QUANTIZE + /* Prior to libpng-1.4.0 this was PNG_READ_DITHER_SUPPORTED */ +# ifndef PNG_NO_READ_DITHER /* This migration aid will be removed */ +# define PNG_READ_QUANTIZE_SUPPORTED +# endif # endif -#endif /* 0 */ # ifndef PNG_NO_READ_BACKGROUND # define PNG_READ_BACKGROUND_SUPPORTED # endif # ifndef PNG_NO_READ_16_TO_8 diff -ru4NwbB libpng-1.4.1/pngpriv.h libpng-1.4.2rc02/pngpriv.h --- libpng-1.4.1/pngpriv.h 2010-02-25 05:38:30.164470109 -0600 +++ libpng-1.4.2rc02/pngpriv.h 2010-04-16 07:38:00.116930174 -0500 @@ -105,9 +105,9 @@ #define PNG_PACK 0x0004 #define PNG_SHIFT 0x0008 #define PNG_SWAP_BYTES 0x0010 #define PNG_INVERT_MONO 0x0020 -#define PNG_DITHER 0x0040 +#define PNG_QUANTIZE 0x0040 /* formerly PNG_DITHER */ #define PNG_BACKGROUND 0x0080 #define PNG_BACKGROUND_EXPAND 0x0100 /* 0x0200 unused */ #define PNG_16_TO_8 0x0400 @@ -587,11 +587,11 @@ #ifdef PNG_READ_16_TO_8_SUPPORTED PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); #endif -#ifdef PNG_READ_DITHER_SUPPORTED -PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, - png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); +#ifdef PNG_READ_QUANTIZE_SUPPORTED +PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info, + png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup)); # ifdef PNG_CORRECT_PALETTE_SUPPORTED PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, png_colorp palette, int num_palette)); diff -ru4NwbB libpng-1.4.1/pngread.c libpng-1.4.2rc02/pngread.c --- libpng-1.4.1/pngread.c 2010-02-25 05:38:30.217312332 -0600 +++ libpng-1.4.2rc02/pngread.c 2010-04-16 07:38:00.226415909 -0500 @@ -1079,11 +1079,11 @@ png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->big_row_buf); png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->chunkdata); -#ifdef PNG_READ_DITHER_SUPPORTED +#ifdef PNG_READ_QUANTIZE_SUPPORTED png_free(png_ptr, png_ptr->palette_lookup); - png_free(png_ptr, png_ptr->dither_index); + png_free(png_ptr, png_ptr->quantize_index); #endif #ifdef PNG_READ_GAMMA_SUPPORTED png_free(png_ptr, png_ptr->gamma_table); #endif @@ -1256,9 +1256,9 @@ (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) png_set_expand(png_ptr); #endif - /* We don't handle background color or gamma transformation or dithering. + /* We don't handle background color or gamma transformation or quantizing. */ #ifdef PNG_READ_INVERT_SUPPORTED /* Invert monochrome files to have 0 as white and 1 as black diff -ru4NwbB libpng-1.4.1/pngrtran.c libpng-1.4.2rc02/pngrtran.c --- libpng-1.4.1/pngrtran.c 2010-02-25 05:38:30.238164331 -0600 +++ libpng-1.4.2rc02/pngrtran.c 2010-04-16 07:38:00.266813633 -0500 @@ -140,15 +140,15 @@ png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; } #endif -#ifdef PNG_READ_DITHER_SUPPORTED -/* Dither file to 8 bit. Supply a palette, the current number +#ifdef PNG_READ_QUANTIZE_SUPPORTED +/* Quantize file to 8 bit. Supply a palette, the current number * of elements in the palette, the maximum number of elements * allowed, and a histogram if possible. If the current number * of colors is greater then the maximum number, the palette will be - * modified to fit in the maximum number. "full_dither" indicates - * whether we need a dithering cube set up for RGB images, or if we + * modified to fit in the maximum number. "full_quantize" indicates + * whether we need a quantizeing cube set up for RGB images, or if we * simply are reducing the number of colors in a paletted image. */ typedef struct png_dsort_struct @@ -160,26 +160,26 @@ typedef png_dsort FAR * png_dsortp; typedef png_dsort FAR * FAR * png_dsortpp; void PNGAPI -png_set_dither(png_structp png_ptr, png_colorp palette, +png_set_quantize(png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_uint_16p histogram, - int full_dither) + int full_quantize) { - png_debug(1, "in png_set_dither"); + png_debug(1, "in png_set_quantize"); if (png_ptr == NULL) return; - png_ptr->transformations |= PNG_DITHER; + png_ptr->transformations |= PNG_QUANTIZE; - if (!full_dither) + if (!full_quantize) { int i; - png_ptr->dither_index = (png_bytep)png_malloc(png_ptr, + png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette * png_sizeof(png_byte))); for (i = 0; i < num_palette; i++) - png_ptr->dither_index[i] = (png_byte)i; + png_ptr->quantize_index[i] = (png_byte)i; } if (num_palette > maximum_colors) { @@ -191,14 +191,14 @@ int i; /* Initialize an array to sort colors */ - png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr, + png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette * png_sizeof(png_byte))); - /* Initialize the dither_sort array */ + /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) - png_ptr->dither_sort[i] = (png_byte)i; + png_ptr->quantize_sort[i] = (png_byte)i; /* Find the least used palette entries by starting a * bubble sort, and running it until we have sorted * out enough colors. Note that we don't care about @@ -213,38 +213,38 @@ done = 1; for (j = 0; j < i; j++) { - if (histogram[png_ptr->dither_sort[j]] - < histogram[png_ptr->dither_sort[j + 1]]) + if (histogram[png_ptr->quantize_sort[j]] + < histogram[png_ptr->quantize_sort[j + 1]]) { png_byte t; - t = png_ptr->dither_sort[j]; - png_ptr->dither_sort[j] = png_ptr->dither_sort[j + 1]; - png_ptr->dither_sort[j + 1] = t; + t = png_ptr->quantize_sort[j]; + png_ptr->quantize_sort[j] = png_ptr->quantize_sort[j + 1]; + png_ptr->quantize_sort[j + 1] = t; done = 0; } } if (done) break; } /* Swap the palette around, and set up a table, if necessary */ - if (full_dither) + if (full_quantize) { int j = num_palette; /* Put all the useful colors within the max, but don't * move the others. */ for (i = 0; i < maximum_colors; i++) { - if ((int)png_ptr->dither_sort[i] >= maximum_colors) + if ((int)png_ptr->quantize_sort[i] >= maximum_colors) { do j--; - while ((int)png_ptr->dither_sort[j] >= maximum_colors); + while ((int)png_ptr->quantize_sort[j] >= maximum_colors); palette[i] = palette[j]; } } } @@ -257,34 +257,34 @@ */ for (i = 0; i < maximum_colors; i++) { /* Only move the colors we need to */ - if ((int)png_ptr->dither_sort[i] >= maximum_colors) + if ((int)png_ptr->quantize_sort[i] >= maximum_colors) { png_color tmp_color; do j--; - while ((int)png_ptr->dither_sort[j] >= maximum_colors); + while ((int)png_ptr->quantize_sort[j] >= maximum_colors); tmp_color = palette[j]; palette[j] = palette[i]; palette[i] = tmp_color; /* Indicate where the color went */ - png_ptr->dither_index[j] = (png_byte)i; - png_ptr->dither_index[i] = (png_byte)j; + png_ptr->quantize_index[j] = (png_byte)i; + png_ptr->quantize_index[i] = (png_byte)j; } } /* Find closest color for those colors we are not using */ for (i = 0; i < num_palette; i++) { - if ((int)png_ptr->dither_index[i] >= maximum_colors) + if ((int)png_ptr->quantize_index[i] >= maximum_colors) { int min_d, k, min_k, d_index; /* Find the closest color to one we threw out */ - d_index = png_ptr->dither_index[i]; + d_index = png_ptr->quantize_index[i]; min_d = PNG_COLOR_DIST(palette[d_index], palette[0]); for (k = 1, min_k = 0; k < maximum_colors; k++) { int d; @@ -297,14 +297,14 @@ min_k = k; } } /* Point to closest color */ - png_ptr->dither_index[i] = (png_byte)min_k; + png_ptr->quantize_index[i] = (png_byte)min_k; } } } - png_free(png_ptr, png_ptr->dither_sort); - png_ptr->dither_sort = NULL; + png_free(png_ptr, png_ptr->quantize_sort); + png_ptr->quantize_sort = NULL; } else { /* This is much harder to do simply (and quickly). Perhaps @@ -409,21 +409,21 @@ num_new_palette--; palette[png_ptr->index_to_palette[j]] = palette[num_new_palette]; - if (!full_dither) + if (!full_quantize) { int k; for (k = 0; k < num_palette; k++) { - if (png_ptr->dither_index[k] == + if (png_ptr->quantize_index[k] == png_ptr->index_to_palette[j]) - png_ptr->dither_index[k] = + png_ptr->quantize_index[k] = png_ptr->index_to_palette[next_j]; - if ((int)png_ptr->dither_index[k] == + if ((int)png_ptr->quantize_index[k] == num_new_palette) - png_ptr->dither_index[k] = + png_ptr->quantize_index[k] = png_ptr->index_to_palette[j]; } } @@ -474,17 +474,17 @@ png_ptr->palette = palette; } png_ptr->num_palette = (png_uint_16)num_palette; - if (full_dither) + if (full_quantize) { int i; png_bytep distance; - int total_bits = PNG_DITHER_RED_BITS + PNG_DITHER_GREEN_BITS + - PNG_DITHER_BLUE_BITS; - int num_red = (1 << PNG_DITHER_RED_BITS); - int num_green = (1 << PNG_DITHER_GREEN_BITS); - int num_blue = (1 << PNG_DITHER_BLUE_BITS); + int total_bits = PNG_QUANTIZE_RED_BITS + PNG_QUANTIZE_GREEN_BITS + + PNG_QUANTIZE_BLUE_BITS; + int num_red = (1 << PNG_QUANTIZE_RED_BITS); + int num_green = (1 << PNG_QUANTIZE_GREEN_BITS); + int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS); png_size_t num_entries = ((png_size_t)1 << total_bits); png_ptr->palette_lookup = (png_bytep )png_calloc(png_ptr, (png_uint_32)(num_entries * png_sizeof(png_byte))); @@ -495,26 +495,26 @@ for (i = 0; i < num_palette; i++) { int ir, ig, ib; - int r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS)); - int g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS)); - int b = (palette[i].blue >> (8 - PNG_DITHER_BLUE_BITS)); + int r = (palette[i].red >> (8 - PNG_QUANTIZE_RED_BITS)); + int g = (palette[i].green >> (8 - PNG_QUANTIZE_GREEN_BITS)); + int b = (palette[i].blue >> (8 - PNG_QUANTIZE_BLUE_BITS)); for (ir = 0; ir < num_red; ir++) { /* int dr = abs(ir - r); */ int dr = ((ir > r) ? ir - r : r - ir); - int index_r = (ir << (PNG_DITHER_BLUE_BITS + - PNG_DITHER_GREEN_BITS)); + int index_r = (ir << (PNG_QUANTIZE_BLUE_BITS + + PNG_QUANTIZE_GREEN_BITS)); for (ig = 0; ig < num_green; ig++) { /* int dg = abs(ig - g); */ int dg = ((ig > g) ? ig - g : g - ig); int dt = dr + dg; int dm = ((dr > dg) ? dr : dg); - int index_g = index_r | (ig << PNG_DITHER_BLUE_BITS); + int index_g = index_r | (ig << PNG_QUANTIZE_BLUE_BITS); for (ib = 0; ib < num_blue; ib++) { int d_index = index_g | ib; @@ -535,9 +535,9 @@ png_free(png_ptr, distance); } } -#endif +#endif /* PNG_READ_QUANTIZE_SUPPORTED */ #if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) /* Transform the image from the file_gamma to the screen_gamma. We * only do transformations on images where the file_gamma and screen_gamma @@ -1228,10 +1228,10 @@ if (png_ptr->transformations & PNG_RGB_TO_GRAY) info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR; #endif -#ifdef PNG_READ_DITHER_SUPPORTED - if (png_ptr->transformations & PNG_DITHER) +#ifdef PNG_READ_QUANTIZE_SUPPORTED + if (png_ptr->transformations & PNG_QUANTIZE) { if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) && png_ptr->palette_lookup && info_ptr->bit_depth == 8) @@ -1450,15 +1450,15 @@ if (png_ptr->transformations & PNG_16_TO_8) png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif -#ifdef PNG_READ_DITHER_SUPPORTED - if (png_ptr->transformations & PNG_DITHER) +#ifdef PNG_READ_QUANTIZE_SUPPORTED + if (png_ptr->transformations & PNG_QUANTIZE) { - png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->palette_lookup, png_ptr->dither_index); + png_do_quantize((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->palette_lookup, png_ptr->quantize_index); if (png_ptr->row_info.rowbytes == (png_uint_32)0) - png_error(png_ptr, "png_do_dither returned rowbytes=0"); + png_error(png_ptr, "png_do_quantize returned rowbytes=0"); } #endif #ifdef PNG_READ_INVERT_SUPPORTED @@ -3789,18 +3789,18 @@ } } #endif -#ifdef PNG_READ_DITHER_SUPPORTED +#ifdef PNG_READ_QUANTIZE_SUPPORTED void /* PRIVATE */ -png_do_dither(png_row_infop row_info, png_bytep row, - png_bytep palette_lookup, png_bytep dither_lookup) +png_do_quantize(png_row_infop row_info, png_bytep row, + png_bytep palette_lookup, png_bytep quantize_lookup) { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width=row_info->width; - png_debug(1, "in png_do_dither"); + png_debug(1, "in png_do_quantize"); { if (row_info->color_type == PNG_COLOR_TYPE_RGB && palette_lookup && row_info->bit_depth == 8) @@ -3820,16 +3820,16 @@ * p = (((r >> 3) & 0x1f) << 10) | * (((g >> 3) & 0x1f) << 5) | * ((b >> 3) & 0x1f); */ - p = (((r >> (8 - PNG_DITHER_RED_BITS)) & - ((1 << PNG_DITHER_RED_BITS) - 1)) << - (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | - (((g >> (8 - PNG_DITHER_GREEN_BITS)) & - ((1 << PNG_DITHER_GREEN_BITS) - 1)) << - (PNG_DITHER_BLUE_BITS)) | - ((b >> (8 - PNG_DITHER_BLUE_BITS)) & - ((1 << PNG_DITHER_BLUE_BITS) - 1)); + p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) & + ((1 << PNG_QUANTIZE_RED_BITS) - 1)) << + (PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) | + (((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) & + ((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) << + (PNG_QUANTIZE_BLUE_BITS)) | + ((b >> (8 - PNG_QUANTIZE_BLUE_BITS)) & + ((1 << PNG_QUANTIZE_BLUE_BITS) - 1)); *dp++ = palette_lookup[p]; } row_info->color_type = PNG_COLOR_TYPE_PALETTE; @@ -3849,16 +3849,16 @@ g = *sp++; b = *sp++; sp++; - p = (((r >> (8 - PNG_DITHER_RED_BITS)) & - ((1 << PNG_DITHER_RED_BITS) - 1)) << - (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | - (((g >> (8 - PNG_DITHER_GREEN_BITS)) & - ((1 << PNG_DITHER_GREEN_BITS) - 1)) << - (PNG_DITHER_BLUE_BITS)) | - ((b >> (8 - PNG_DITHER_BLUE_BITS)) & - ((1 << PNG_DITHER_BLUE_BITS) - 1)); + p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) & + ((1 << PNG_QUANTIZE_RED_BITS) - 1)) << + (PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) | + (((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) & + ((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) << + (PNG_QUANTIZE_BLUE_BITS)) | + ((b >> (8 - PNG_QUANTIZE_BLUE_BITS)) & + ((1 << PNG_QUANTIZE_BLUE_BITS) - 1)); *dp++ = palette_lookup[p]; } row_info->color_type = PNG_COLOR_TYPE_PALETTE; @@ -3866,14 +3866,14 @@ row_info->pixel_depth = row_info->bit_depth; row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && - dither_lookup && row_info->bit_depth == 8) + quantize_lookup && row_info->bit_depth == 8) { sp = row; for (i = 0; i < row_width; i++, sp++) { - *sp = dither_lookup[*sp]; + *sp = quantize_lookup[*sp]; } } } } diff -ru4NwbB libpng-1.4.1/pngrutil.c libpng-1.4.2rc02/pngrutil.c --- libpng-1.4.1/pngrutil.c 2010-02-25 05:38:30.252231541 -0600 +++ libpng-1.4.2rc02/pngrutil.c 2010-04-16 07:38:00.291010649 -0500 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.4.1 [April 16, 2010] + * Last changed in libpng 1.4.2 [April 16, 2010] * Copyright (c) 1998-2010 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.) * @@ -333,9 +333,13 @@ * has already been output (warning) or the size really is zero * and we have nothing to do - the code will exit through the * error case below. */ - else if (expanded_size > 0) +#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \ + defined(PNG_USER_CHUNK_MALLOC_MAX) + else +#endif + if (expanded_size > 0) { /* Success (maybe) - really uncompress the chunk. */ png_size_t new_size = 0; png_charp text = png_malloc_warn(png_ptr, diff -ru4NwbB libpng-1.4.1/projects/xcode/libpng.xcodeproj/project.pbxproj libpng-1.4.2rc02/projects/xcode/libpng.xcodeproj/project.pbxproj --- libpng-1.4.1/projects/xcode/libpng.xcodeproj/project.pbxproj 2010-02-25 05:38:31.620976336 -0600 +++ libpng-1.4.2rc02/projects/xcode/libpng.xcodeproj/project.pbxproj 2010-04-16 07:38:03.099020614 -0500 @@ -225,9 +225,9 @@ buildSettings = { COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 14; DYLIB_CURRENT_VERSION = 14; - FRAMEWORK_VERSION = 1.4.1; + FRAMEWORK_VERSION = 1.4.2rc02; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; @@ -243,9 +243,9 @@ isa = XCBuildConfiguration; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 14; DYLIB_CURRENT_VERSION = 14; - FRAMEWORK_VERSION = 1.4.1; + FRAMEWORK_VERSION = 1.4.2rc02; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; diff -ru4NwbB libpng-1.4.1/scripts/png32ce.def libpng-1.4.2rc02/scripts/png32ce.def --- libpng-1.4.1/scripts/png32ce.def 2010-02-25 05:38:32.667725680 -0600 +++ libpng-1.4.2rc02/scripts/png32ce.def 2010-04-16 07:38:05.675729139 -0500 @@ -5,9 +5,9 @@ LIBRARY lpngce png_memcpy_check png_memset_check - png_set_dither + png_set_quantize png_read_init_3 png_write_init_3 png_set_strip_error_numbers png_get_uint_32 @@ -112,9 +112,9 @@ png_set_compression_method @93 png_set_compression_strategy @94 png_set_compression_window_bits @95 png_set_crc_action @96 -; png_set_dither @97 + png_set_quantize @97 png_set_error_fn @98 png_set_expand @99 png_set_filler @100 png_set_filter @101 diff -ru4NwbB libpng-1.4.1/scripts/pngos2.def libpng-1.4.2rc02/scripts/pngos2.def --- libpng-1.4.1/scripts/pngos2.def 2010-02-25 05:38:32.678461726 -0600 +++ libpng-1.4.2rc02/scripts/pngos2.def 2010-04-16 07:38:05.691992692 -0500 @@ -216,8 +216,10 @@ png_set_longjmp_fn ; Added at version 1.4.1 png_get_chunk_malloc_max png_set_chunk_malloc_max +; Added at version 1.4.2 + png_set_quantize ; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS png_libpng_ver png_pass_start diff -ru4NwbB libpng-1.4.1/scripts/pngwin.def libpng-1.4.2rc02/scripts/pngwin.def --- libpng-1.4.1/scripts/pngwin.def 2010-02-25 05:38:32.689186928 -0600 +++ libpng-1.4.2rc02/scripts/pngwin.def 2010-04-16 07:38:05.709372984 -0500 @@ -211,4 +211,6 @@ png_set_longjmp_fn ; Added at version 1.4.1 png_get_chunk_malloc_max png_set_chunk_malloc_max +; Added at version 1.4.2 + png_set_quantize