From e4dce0d8978dbbe4a9a8a19f0691a7e8d1a94679 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 13 Sep 2013 10:46:21 +0000 Subject: [PATCH] Updated included PNG library. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2826 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Changes.txt | 2 ++ src/emucore/Console.cxx | 14 ++++-------- src/libpng/png.c | 10 ++++----- src/libpng/png.h | 23 +++++++++++--------- src/libpng/pngconf.h | 2 +- src/libpng/pngpriv.h | 6 ++---- src/libpng/pngread.c | 2 +- src/libpng/pngrtran.c | 47 ++++++++++++++++++++++++----------------- src/libpng/pngrutil.c | 22 ++++++++++--------- 9 files changed, 68 insertions(+), 60 deletions(-) diff --git a/Changes.txt b/Changes.txt index b48a255b2..9030e51da 100644 --- a/Changes.txt +++ b/Changes.txt @@ -18,6 +18,8 @@ context menu item to the debugger TIA output area. This saves the current TIA image to a PNG file. + * Updated included PNG library to latest stable version. + -Have fun! diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 70d52ab59..4962758ec 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -348,17 +348,11 @@ void Console::setPalette(const string& type) { // Look at all the palettes, since we don't know which one is // currently active - uInt32* palettes[3][3] = { - { &ourNTSCPalette[0], &ourPALPalette[0], &ourSECAMPalette[0] }, - { &ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], &ourSECAMPaletteZ26[0] }, - { 0, 0, 0 } + static uInt32* palettes[3][3] = { + { &ourNTSCPalette[0], &ourPALPalette[0], &ourSECAMPalette[0] }, + { &ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], &ourSECAMPaletteZ26[0] }, + { &ourUserNTSCPalette[0], &ourUserPALPalette[0], &ourUserSECAMPalette[0] } }; - if(myUserPaletteDefined) - { - palettes[2][0] = &ourUserNTSCPalette[0]; - palettes[2][1] = &ourUserPALPalette[0]; - palettes[2][2] = &ourUserSECAMPalette[0]; - } // See which format we should be using int paletteNum = 0; diff --git a/src/libpng/png.c b/src/libpng/png.c index 734188189..09d671c69 100644 --- a/src/libpng/png.c +++ b/src/libpng/png.c @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_3 Your_png_h_is_not_version_1_6_3; +typedef png_libpng_version_1_6_4 Your_png_h_is_not_version_1_6_4; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.3 - July 18, 2013" PNG_STRING_NEWLINE \ + "libpng version 1.6.4 - September 12, 2013" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.3 - July 18, 2013\ + return "libpng version 1.6.4 - September 12, 2013\ Copyright (c) 1998-2013 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -855,7 +855,7 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name) return PNG_HANDLE_CHUNK_AS_DEFAULT; } -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED int /* PRIVATE */ png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name) { @@ -864,7 +864,7 @@ png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name) PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name); return png_handle_as_unknown(png_ptr, chunk_string); } -#endif /* READ_UNKNOWN_CHUNKS */ +#endif /* HANDLE_AS_UNKNOWN */ #endif /* SET_UNKNOWN_CHUNKS */ #ifdef PNG_READ_SUPPORTED diff --git a/src/libpng/png.h b/src/libpng/png.h index cf1a27ced..229769e0b 100644 --- a/src/libpng/png.h +++ b/src/libpng/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.3 - July 18, 2013 + * libpng version 1.6.4 - September 12, 2013 * Copyright (c) 1998-2013 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.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013: Glenn + * libpng versions 0.97, January 1998, through 1.6.4 - September 12, 2013: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -178,6 +178,9 @@ * 1.6.3beta01-11 16 10603 16.so.16.3[.0] * 1.6.3rc01 16 10603 16.so.16.3[.0] * 1.6.3 16 10603 16.so.16.3[.0] + * 1.6.4beta01-02 16 10604 16.so.16.4[.0] + * 1.6.4rc01 16 10604 16.so.16.4[.0] + * 1.6.4 16 10604 16.so.16.4[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -209,7 +212,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.6.3, July 18, 2013, are + * libpng versions 1.2.6, August 15, 2004, through 1.6.4, September 12, 2013, are * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -321,13 +324,13 @@ * Y2K compliance in libpng: * ========================= * - * July 18, 2013 + * September 12, 2013 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.3 are Y2K compliant. It is my belief that + * upward through 1.6.4 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -387,9 +390,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.3" +#define PNG_LIBPNG_VER_STRING "1.6.4" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.6.3 - July 18, 2013\n" + " libpng version 1.6.4 - September 12, 2013\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -397,7 +400,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 3 +#define PNG_LIBPNG_VER_RELEASE 4 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -428,7 +431,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10603 /* 1.6.3 */ +#define PNG_LIBPNG_VER 10604 /* 1.6.4 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -533,7 +536,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_3; +typedef char* png_libpng_version_1_6_4; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff --git a/src/libpng/pngconf.h b/src/libpng/pngconf.h index 0808c1ced..dc7bccb0f 100644 --- a/src/libpng/pngconf.h +++ b/src/libpng/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.3 - July 18, 2013 + * libpng version 1.6.4 - September 12, 2013 * * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/src/libpng/pngpriv.h b/src/libpng/pngpriv.h index 4d8051f92..fb15134c0 100644 --- a/src/libpng/pngpriv.h +++ b/src/libpng/pngpriv.h @@ -1431,15 +1431,13 @@ PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, * just skips the chunk or errors out if it is critical. */ -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED -#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling, (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY); /* Exactly as the API png_handle_as_unknown() except that the argument is a * 32-bit chunk name, not a string. */ -#endif -#endif /* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */ +#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ /* Handle the transformations for reading and writing */ diff --git a/src/libpng/pngread.c b/src/libpng/pngread.c index e32f31d54..8f96ca23e 100644 --- a/src/libpng/pngread.c +++ b/src/libpng/pngread.c @@ -3285,7 +3285,7 @@ png_image_read_background(png_voidp argument) case 8: /* 8-bit sRGB gray values with an alpha channel; the alpha channel is - * to be removed by composing on a backgroundi: either the row if + * to be removed by composing on a background: either the row if * display->background is NULL or display->background->green if not. * Unlike the code above ALPHA_OPTIMIZED has *not* been done. */ diff --git a/src/libpng/pngrtran.c b/src/libpng/pngrtran.c index e378ceba4..bc9be39fb 100644 --- a/src/libpng/pngrtran.c +++ b/src/libpng/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.2 [April 25, 2013] + * Last changed in libpng 1.6.4 [September 12, 2013] * Copyright (c) 1998-2013 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.) @@ -1116,12 +1116,18 @@ png_init_palette_transformations(png_structrp png_ptr) /* Ignore if all the entries are opaque (unlikely!) */ for (i=0; inum_trans; ++i) + { if (png_ptr->trans_alpha[i] == 255) continue; else if (png_ptr->trans_alpha[i] == 0) input_has_transparency = 1; else + { + input_has_transparency = 1; input_has_alpha = 1; + break; + } + } } /* If no alpha we can optimize. */ @@ -1878,31 +1884,34 @@ png_init_read_transformations(png_structrp png_ptr) * the number of significant bits is 0 then no shift is done (this is an * error condition which is silently ignored.) */ - if (shift > 0 && shift < 8) for (i=0; ipalette[i].red; + if (shift > 0 && shift < 8) + for (i=0; ipalette[i].red; - component >>= shift; - png_ptr->palette[i].red = (png_byte)component; - } + component >>= shift; + png_ptr->palette[i].red = (png_byte)component; + } shift = 8 - png_ptr->sig_bit.green; - if (shift > 0 && shift < 8) for (i=0; ipalette[i].green; + if (shift > 0 && shift < 8) + for (i=0; ipalette[i].green; - component >>= shift; - png_ptr->palette[i].green = (png_byte)component; - } + component >>= shift; + png_ptr->palette[i].green = (png_byte)component; + } shift = 8 - png_ptr->sig_bit.blue; - if (shift > 0 && shift < 8) for (i=0; ipalette[i].blue; + if (shift > 0 && shift < 8) + for (i=0; ipalette[i].blue; - component >>= shift; - png_ptr->palette[i].blue = (png_byte)component; - } + component >>= shift; + png_ptr->palette[i].blue = (png_byte)component; + } } #endif /* PNG_READ_SHIFT_SUPPORTED */ } diff --git a/src/libpng/pngrutil.c b/src/libpng/pngrutil.c index 0a75cd81c..587feb8a4 100644 --- a/src/libpng/pngrutil.c +++ b/src/libpng/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.3 [July 18, 2013] + * Last changed in libpng 1.6.4 [September 12, 2013] * Copyright (c) 1998-2013 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.) @@ -2764,7 +2764,6 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_debug(1, "in png_handle_unknown"); -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED /* NOTE: this code is based on the code in libpng-1.4.12 except for fixing * the bug which meant that setting a non-default behavior for a specific * chunk would be ignored (the default was always used unless a user @@ -2776,16 +2775,15 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, * This is just an optimization to avoid multiple calls to the lookup * function. */ -# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED - keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name); -# endif +# ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name); # endif /* One of the following methods will read the chunk or skip it (at least one * of these is always defined because this is the only way to switch on * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) */ +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED # ifdef PNG_READ_USER_CHUNKS_SUPPORTED /* The user callback takes precedence over the chunk keep value, but the * keep value is still required to validate a save of a critical chunk. @@ -2893,7 +2891,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_crc_finish(png_ptr, length); } -# endif +# endif /* PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED */ # ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED /* Now store the chunk in the chunk list if appropriate, and if the limits @@ -3880,7 +3878,8 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, static void png_init_filter_functions(png_structrp pp) - /* This function is called once for every PNG image to set the + /* This function is called once for every PNG image (except for PNG images + * that only use PNG_FILTER_VALUE_NONE for all rows) to set the * implementations required to reverse the filtering of PNG rows. Reversing * the filter is the first transformation performed on the row data. It is * performed in place, therefore an implementation can be selected based on @@ -3922,10 +3921,13 @@ png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row, * PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic * implementations. See png_init_filter_functions above. */ - if (pp->read_filter[0] == NULL) - png_init_filter_functions(pp); if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST) + { + if (pp->read_filter[0] == NULL) + png_init_filter_functions(pp); + pp->read_filter[filter-1](row_info, row, prev_row); + } } #ifdef PNG_SEQUENTIAL_READ_SUPPORTED