Updated included PNG library.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2826 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-09-13 10:46:21 +00:00
parent c5f011f1fe
commit e4dce0d897
9 changed files with 68 additions and 60 deletions

View File

@ -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!

View File

@ -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;

View File

@ -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

View File

@ -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.
*

View File

@ -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)

View File

@ -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 */

View File

@ -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.
*/

View File

@ -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; i<png_ptr->num_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; i<istop; ++i)
{
int component = png_ptr->palette[i].red;
if (shift > 0 && shift < 8)
for (i=0; i<istop; ++i)
{
int component = png_ptr->palette[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; i<istop; ++i)
{
int component = png_ptr->palette[i].green;
if (shift > 0 && shift < 8)
for (i=0; i<istop; ++i)
{
int component = png_ptr->palette[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; i<istop; ++i)
{
int component = png_ptr->palette[i].blue;
if (shift > 0 && shift < 8)
for (i=0; i<istop; ++i)
{
int component = png_ptr->palette[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 */
}

View File

@ -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