mirror of https://github.com/stella-emu/stella.git
Updated include PNG library to latest version.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2593 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
9aef5bdcae
commit
130e5efb37
|
@ -36,6 +36,8 @@
|
|||
* Fixed ZIP file handling in Windows when the archive contained
|
||||
multiple files; in several cases the ROM wasn't being loaded at all.
|
||||
|
||||
* Updated included PNG library to latest stable version.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -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_5_13 Your_png_h_is_not_version_1_5_13;
|
||||
typedef png_libpng_version_1_5_14 Your_png_h_is_not_version_1_5_14;
|
||||
|
||||
/* 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
|
||||
|
@ -73,13 +73,16 @@ PNG_FUNCTION(voidpf /* PRIVATE */,
|
|||
png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
|
||||
{
|
||||
png_voidp ptr;
|
||||
png_structp p=(png_structp)png_ptr;
|
||||
png_uint_32 save_flags=p->flags;
|
||||
png_structp p;
|
||||
png_uint_32 save_flags;
|
||||
png_alloc_size_t num_bytes;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return (NULL);
|
||||
|
||||
p=(png_structp)png_ptr;
|
||||
save_flags=p->flags;
|
||||
|
||||
if (items > PNG_UINT_32_MAX/size)
|
||||
{
|
||||
png_warning (p, "Potential overflow in png_zalloc()");
|
||||
|
@ -655,14 +658,14 @@ png_get_copyright(png_const_structp png_ptr)
|
|||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.5.13 - September 27, 2012" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.5.14 - January 24, 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.5.13 - September 27, 2012\
|
||||
Copyright (c) 1998-2012 Glenn Randers-Pehrson\
|
||||
return "libpng version 1.5.14 - January 24, 2013\
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
# endif
|
||||
|
@ -1458,7 +1461,7 @@ png_check_fp_string(png_const_charp string, png_size_t size)
|
|||
}
|
||||
#endif /* pCAL or sCAL */
|
||||
|
||||
#ifdef PNG_READ_sCAL_SUPPORTED
|
||||
#ifdef PNG_sCAL_SUPPORTED
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
/* Utility used below - a simple accurate power of ten from an integral
|
||||
* exponent.
|
||||
|
@ -2044,7 +2047,8 @@ png_muldiv_warn(png_structp png_ptr, png_fixed_point a, png_int_32 times,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED /* more fixed point functions for gamma */
|
||||
#if (defined PNG_READ_GAMMA_SUPPORTED) || (defined PNG_cHRM_SUPPORTED)
|
||||
/* more fixed point functions for gamma and cHRM (xy/XYZ) suport. */
|
||||
/* Calculate a reciprocal, return 0 on div-by-zero or overflow. */
|
||||
png_fixed_point
|
||||
png_reciprocal(png_fixed_point a)
|
||||
|
@ -2064,6 +2068,7 @@ png_reciprocal(png_fixed_point a)
|
|||
return 0; /* error/overflow */
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
/* A local convenience routine. */
|
||||
static png_fixed_point
|
||||
png_product2(png_fixed_point a, png_fixed_point b)
|
||||
|
@ -2085,6 +2090,7 @@ png_product2(png_fixed_point a, png_fixed_point b)
|
|||
|
||||
return 0; /* overflow */
|
||||
}
|
||||
#endif /* READ_GAMMA */
|
||||
|
||||
/* The inverse of the above. */
|
||||
png_fixed_point
|
||||
|
@ -2112,7 +2118,7 @@ png_reciprocal2(png_fixed_point a, png_fixed_point b)
|
|||
|
||||
return 0; /* overflow */
|
||||
}
|
||||
#endif /* READ_GAMMA */
|
||||
#endif /* READ_GAMMA || cHRM */
|
||||
|
||||
#ifdef PNG_CHECK_cHRM_SUPPORTED
|
||||
/* Added at libpng version 1.2.34 (Dec 8, 2008) and 1.4.0 (Jan 2,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.5.13 - September 27, 2012
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* libpng version 1.5.14 - January 24, 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.5.13 - September 27, 2012: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.5.14 - January 24, 2013: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
|
@ -181,6 +181,9 @@
|
|||
* 1.5.13beta01-02 15 10513 15.so.15.13[.0]
|
||||
* 1.5.13rc01 15 10513 15.so.15.13[.0]
|
||||
* 1.5.13 15 10513 15.so.15.13[.0]
|
||||
* 1.5.14beta01-08 15 10514 15.so.15.14[.0]
|
||||
* 1.5.14rc01-03 15 10514 15.so.15.14[.0]
|
||||
* 1.5.14 15 10514 15.so.15.14[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
|
@ -212,8 +215,8 @@
|
|||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.5.13, September 27, 2012, are
|
||||
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.5.14, January 24, 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:
|
||||
*
|
||||
|
@ -324,13 +327,13 @@
|
|||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* September 27, 2012
|
||||
* January 24, 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.5.13 are Y2K compliant. It is my belief that
|
||||
* upward through 1.5.14 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
|
||||
|
@ -389,9 +392,9 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.5.13"
|
||||
#define PNG_LIBPNG_VER_STRING "1.5.14"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.5.13 - September 27, 2012\n"
|
||||
" libpng version 1.5.14 - January 24, 2013\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 15
|
||||
#define PNG_LIBPNG_VER_DLLNUM 15
|
||||
|
@ -399,7 +402,7 @@
|
|||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 5
|
||||
#define PNG_LIBPNG_VER_RELEASE 13
|
||||
#define PNG_LIBPNG_VER_RELEASE 14
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
|
@ -430,7 +433,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 10513 /* 1.5.13 */
|
||||
#define PNG_LIBPNG_VER 10514 /* 1.5.14 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
@ -552,7 +555,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_5_13;
|
||||
typedef char* png_libpng_version_1_5_14;
|
||||
|
||||
/* Three color definitions. The order of the red, green, and blue, (and the
|
||||
* exact size) is not important, although the size of the fields need to
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.5.13 - September 27, 2012
|
||||
* libpng version 1.5.14 - January 24, 2013
|
||||
*
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
|
@ -177,18 +177,16 @@
|
|||
* ==========================
|
||||
* This code is used at build time to find PNG_IMPEXP, the API settings
|
||||
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
|
||||
* import processing is possible. On Windows/x86 systems it also sets
|
||||
* import processing is possible. On Windows systems it also sets
|
||||
* compiler-specific macros to the values required to change the calling
|
||||
* conventions of the various functions.
|
||||
*/
|
||||
#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
|
||||
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
|
||||
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
|
||||
defined(_M_X64) || defined(_M_IA64) )
|
||||
/* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
|
||||
* builds under Cygwin or MinGW. Also includes Watcom builds but these need
|
||||
* special treatment because they are not compatible with GCC or Visual C
|
||||
* because of different calling conventions.
|
||||
#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
|
||||
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
/* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or
|
||||
* MinGW on any architecture currently supported by Windows. Also includes
|
||||
* Watcom builds but these need special treatment because they are not
|
||||
* compatible with GCC or Visual C because of different calling conventions.
|
||||
*/
|
||||
# if PNG_API_RULE == 2
|
||||
/* If this line results in an error, either because __watcall is not
|
||||
|
@ -202,6 +200,9 @@
|
|||
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
|
||||
# define PNGCAPI __cdecl
|
||||
# if PNG_API_RULE == 1
|
||||
/* If this line results in an error __stdcall is not understood and
|
||||
* PNG_API_RULE should not have been set to '1'.
|
||||
*/
|
||||
# define PNGAPI __stdcall
|
||||
# endif
|
||||
# else
|
||||
|
@ -239,7 +240,7 @@
|
|||
# endif
|
||||
# endif /* compiler */
|
||||
|
||||
#else /* !Windows/x86 */
|
||||
#else /* !Windows */
|
||||
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
||||
# define PNGAPI _System
|
||||
# else /* !Windows/x86 && !OS/2 */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.5.8 [February 1, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -161,7 +161,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||
case PNG_NUMBER_FORMAT_02u:
|
||||
/* Expects at least 2 digits. */
|
||||
mincount = 2;
|
||||
/* fall through */
|
||||
/* FALL THROUGH */
|
||||
|
||||
case PNG_NUMBER_FORMAT_u:
|
||||
*--end = digits[number % 10];
|
||||
|
@ -171,7 +171,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||
case PNG_NUMBER_FORMAT_02x:
|
||||
/* This format expects at least two digits */
|
||||
mincount = 2;
|
||||
/* fall through */
|
||||
/* FALL THROUGH */
|
||||
|
||||
case PNG_NUMBER_FORMAT_x:
|
||||
*--end = digits[number & 0xf];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Last changed in libpng 1.5.14 [January 24, 2013]
|
||||
* 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.)
|
||||
|
@ -175,6 +175,9 @@ png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr)
|
|||
return ((float)((float)info_ptr->y_pixels_per_unit
|
||||
/(float)info_ptr->x_pixels_per_unit));
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return ((float)0.0);
|
||||
|
@ -203,6 +206,9 @@ png_get_pixel_aspect_ratio_fixed(png_const_structp png_ptr,
|
|||
(png_int_32)info_ptr->x_pixels_per_unit))
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -242,7 +242,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
#ifdef PNG_sPLT_SUPPORTED
|
||||
/* Data on sPLT chunks (there may be more than one). */
|
||||
png_sPLT_tp splt_palettes;
|
||||
png_uint_32 splt_palettes_num;
|
||||
int splt_palettes_num;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sCAL_SUPPORTED
|
||||
|
|
|
@ -416,7 +416,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
|
|||
#if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE
|
||||
/* This is used because in some compiler implementations non-aligned
|
||||
* structure members are supported, so the offsetof approach below fails.
|
||||
* Set PNG_ALIGN_TO_SIZE=0 for compiler combinations where unaligned access
|
||||
* Set PNG_ALIGN_SIZE=0 for compiler combinations where unaligned access
|
||||
* is good for performance. Do not do this unless you have tested the result
|
||||
* and understand it.
|
||||
*/
|
||||
|
@ -823,10 +823,8 @@ PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
|
|||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
|
||||
# endif
|
||||
# ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
|
||||
png_fixed_point file_gamma));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_sBIT_SUPPORTED
|
||||
|
@ -1491,14 +1489,16 @@ PNG_EXTERN void png_formatted_warning(png_structp png_ptr,
|
|||
/* ASCII to FP interfaces, currently only implemented if sCAL
|
||||
* support is required.
|
||||
*/
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||
#ifdef PNG_sCAL_SUPPORTED
|
||||
/* MAX_DIGITS is actually the maximum number of characters in an sCAL
|
||||
* width or height, derived from the precision (number of significant
|
||||
* digits - a build time settable option) and assumpitions about the
|
||||
* maximum ridiculous exponent.
|
||||
*/
|
||||
#define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sCAL_SUPPORTED
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii,
|
||||
png_size_t size, double fp, unsigned int precision));
|
||||
|
@ -1583,14 +1583,14 @@ PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr,
|
|||
#define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
|
||||
#define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK)
|
||||
|
||||
/* The actual parser. This can be called repeatedly, it updates
|
||||
/* The actual parser. This can be called repeatedly. It updates
|
||||
* the index into the string and the state variable (which must
|
||||
* be initialzed to 0). It returns a result code, as above. There
|
||||
* be initialized to 0). It returns a result code, as above. There
|
||||
* is no point calling the parser any more if it fails to advance to
|
||||
* the end of the string - it is stuck on an invalid character (or
|
||||
* terminated by '\0').
|
||||
*
|
||||
* Note that the pointer will consume an E or even an E+ then leave
|
||||
* Note that the pointer will consume an E or even an E+ and then leave
|
||||
* a 'maybe' state even though a preceding integer.fraction is valid.
|
||||
* The PNG_FP_WAS_VALID flag indicates that a preceding substring was
|
||||
* a valid number. It's possible to recover from this by calling
|
||||
|
@ -1629,7 +1629,7 @@ PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr,
|
|||
png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
#if (defined PNG_READ_GAMMA_SUPPORTED) || (defined PNG_cHRM_SUPPORTED)
|
||||
/* Calculate a reciprocal - used for gamma values. This returns
|
||||
* 0 if the argument is 0 in order to maintain an undefined value,
|
||||
* there are no warnings.
|
||||
|
@ -1664,7 +1664,72 @@ PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
|
|||
int bit_depth));
|
||||
#endif
|
||||
|
||||
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
|
||||
/* Missing declarations if FIXED_POINT is *not* supported - fixed properly
|
||||
* in libpng 1.6
|
||||
*/
|
||||
#ifndef PNG_FIXED_POINT_SUPPORTED
|
||||
#ifdef PNG_cHRM_SUPPORTED
|
||||
PNG_EXTERN png_uint_32 png_get_cHRM_XYZ_fixed PNGARG(
|
||||
(png_structp png_ptr, png_const_infop info_ptr,
|
||||
png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
|
||||
png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
|
||||
png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
|
||||
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
|
||||
png_fixed_point *int_blue_Z));
|
||||
PNG_EXTERN void png_set_cHRM_XYZ_fixed PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
|
||||
png_fixed_point int_red_Z, png_fixed_point int_green_X,
|
||||
png_fixed_point int_green_Y, png_fixed_point int_green_Z,
|
||||
png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
|
||||
png_fixed_point int_blue_Z));
|
||||
PNG_EXTERN void png_set_cHRM_fixed PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, png_fixed_point int_white_x,
|
||||
png_fixed_point int_white_y, png_fixed_point int_red_x,
|
||||
png_fixed_point int_red_y, png_fixed_point int_green_x,
|
||||
png_fixed_point int_green_y, png_fixed_point int_blue_x,
|
||||
png_fixed_point int_blue_y));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
PNG_EXTERN png_uint_32 png_get_gAMA_fixed PNGARG(
|
||||
(png_const_structp png_ptr, png_const_infop info_ptr,
|
||||
png_fixed_point *int_file_gamma));
|
||||
PNG_EXTERN void png_set_gAMA_fixed PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, png_fixed_point int_file_gamma));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_BACKGROUND_SUPPORTED
|
||||
PNG_EXTERN void png_set_background_fixed PNGARG((png_structp png_ptr,
|
||||
png_const_color_16p background_color, int background_gamma_code,
|
||||
int need_expand, png_fixed_point background_gamma));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
PNG_EXTERN void png_set_alpha_mode_fixed PNGARG((png_structp png_ptr,
|
||||
int mode, png_fixed_point output_gamma));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
PNG_EXTERN void png_set_gamma_fixed PNGARG((png_structp png_ptr,
|
||||
png_fixed_point screen_gamma, png_fixed_point override_file_gamma));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
PNG_EXTERN void png_set_rgb_to_gray_fixed PNGARG((png_structp png_ptr,
|
||||
int error_action, png_fixed_point red, png_fixed_point green));
|
||||
#endif
|
||||
#endif /* FIX MISSING !FIXED_POINT DECLARATIONS */
|
||||
|
||||
#ifdef PNG_FILTER_OPTIMIZATIONS
|
||||
PNG_EXTERN void PNG_FILTER_OPTIMIZATIONS(png_structp png_ptr, unsigned int bpp);
|
||||
/* This is the initialization function for hardware specific optimizations,
|
||||
* one implementation (for ARM NEON machines) is contained in
|
||||
* arm/filter_neon.c. It need not be defined - the generic code will be used
|
||||
* if not.
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Maintainer: Put new private prototypes here ^ */
|
||||
|
||||
#include "pngdebug.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||
* Last changed in libpng 1.5.14 [January 24, 2013]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -1221,7 +1221,7 @@ png_init_rgb_transformations(png_structp png_ptr)
|
|||
default:
|
||||
|
||||
case 8:
|
||||
/* Already 8 bits, fall through */
|
||||
/* FALL THROUGH (already 8 bits) */
|
||||
|
||||
case 16:
|
||||
/* Already a full 16 bits */
|
||||
|
@ -3920,7 +3920,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
|||
*sp = (png_byte)png_ptr->background.gray;
|
||||
|
||||
else if (a < 0xff)
|
||||
png_composite(*sp, *sp, a, png_ptr->background_1.gray);
|
||||
png_composite(*sp, *sp, a, png_ptr->background.gray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3989,7 +3989,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
|
|||
png_uint_16 g, v;
|
||||
|
||||
g = (png_uint_16)(((*sp) << 8) + *(sp + 1));
|
||||
png_composite_16(v, g, a, png_ptr->background_1.gray);
|
||||
png_composite_16(v, g, a, png_ptr->background.gray);
|
||||
*sp = (png_byte)((v >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(v & 0xff);
|
||||
}
|
||||
|
@ -4746,7 +4746,9 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
gray = gray & 0xff;
|
||||
/* NOTE: prior to libpng 1.5.14 this cleared out the top bits of
|
||||
* 'gray', however if those are set it is an error.
|
||||
*/
|
||||
sp = row + (png_size_t)row_width - 1;
|
||||
dp = row + (png_size_t)(row_width << 1) - 1;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -2452,7 +2452,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_textp text_ptr;
|
||||
png_charp key, lang, text, lang_key;
|
||||
int comp_flag;
|
||||
int comp_type = 0;
|
||||
int comp_type;
|
||||
int ret;
|
||||
png_size_t slength, prefix_len, data_len;
|
||||
|
||||
|
@ -2533,15 +2533,24 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
else
|
||||
comp_flag = *lang++;
|
||||
comp_type = *lang++;
|
||||
|
||||
/* 1.5.14: The spec says "for uncompressed text decoders shall ignore [the
|
||||
* compression type]". The compression flag shall be 0 (no compression) or
|
||||
* 1 (compressed with method 0 - deflate.)
|
||||
*/
|
||||
if (comp_flag != 0 && comp_flag != 1)
|
||||
{
|
||||
comp_flag = *lang++;
|
||||
comp_type = *lang++;
|
||||
png_warning(png_ptr, "invalid iTXt compression flag");
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (comp_type || (comp_flag && comp_flag != PNG_TEXT_COMPRESSION_zTXt))
|
||||
if (comp_flag/*compressed*/ && comp_type != 0)
|
||||
{
|
||||
png_warning(png_ptr, "Unknown iTXt compression type or method");
|
||||
png_warning(png_ptr, "unknown iTXt compression type");
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
return;
|
||||
|
@ -2577,7 +2586,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
key=png_ptr->chunkdata;
|
||||
|
||||
if (comp_flag)
|
||||
if (comp_flag/*compressed*/)
|
||||
png_decompress_chunk(png_ptr, comp_type,
|
||||
(size_t)length, prefix_len, &data_len);
|
||||
|
||||
|
@ -2595,7 +2604,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
text_ptr->compression = (int)comp_flag + 1;
|
||||
text_ptr->compression =
|
||||
(comp_flag ? PNG_ITXT_COMPRESSION_zTXt : PNG_ITXT_COMPRESSION_NONE);
|
||||
text_ptr->lang_key = png_ptr->chunkdata + (lang_key - key);
|
||||
text_ptr->lang = png_ptr->chunkdata + (lang - key);
|
||||
text_ptr->itxt_length = data_len;
|
||||
|
@ -3660,66 +3670,6 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_ARM_NEON
|
||||
|
||||
#ifdef __linux__
|
||||
#include <stdio.h>
|
||||
#include <elf.h>
|
||||
#include <asm/hwcap.h>
|
||||
|
||||
static int png_have_hwcap(unsigned cap)
|
||||
{
|
||||
FILE *f = fopen("/proc/self/auxv", "r");
|
||||
Elf32_auxv_t aux;
|
||||
int have_cap = 0;
|
||||
|
||||
if (!f)
|
||||
return 0;
|
||||
|
||||
while (fread(&aux, sizeof(aux), 1, f) > 0)
|
||||
{
|
||||
if (aux.a_type == AT_HWCAP &&
|
||||
aux.a_un.a_val & cap)
|
||||
{
|
||||
have_cap = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
return have_cap;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
static void
|
||||
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (!png_have_hwcap(HWCAP_NEON))
|
||||
return;
|
||||
#endif
|
||||
|
||||
pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon;
|
||||
|
||||
if (bpp == 3)
|
||||
{
|
||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth3_neon;
|
||||
}
|
||||
|
||||
else if (bpp == 4)
|
||||
{
|
||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth4_neon;
|
||||
}
|
||||
}
|
||||
#endif /* PNG_ARM_NEON */
|
||||
|
||||
static void
|
||||
png_init_filter_functions(png_structp pp)
|
||||
{
|
||||
|
@ -3735,8 +3685,16 @@ png_init_filter_functions(png_structp pp)
|
|||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth_multibyte_pixel;
|
||||
|
||||
#ifdef PNG_ARM_NEON
|
||||
png_init_filter_functions_neon(pp, bpp);
|
||||
#ifdef PNG_FILTER_OPTIMIZATIONS
|
||||
/* To use this define PNG_FILTER_OPTIMIZATIONS as the name of a function to
|
||||
* call to install hardware optimizations for the above functions; simply
|
||||
* replace whatever elements of the pp->read_filter[] array with a hardware
|
||||
* specific (or, for that matter, generic) optimization.
|
||||
*
|
||||
* To see an example of this examine what configure.ac does when
|
||||
* --enable-arm-neon is specified on the command line.
|
||||
*/
|
||||
PNG_FILTER_OPTIMIZATIONS(pp, bpp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -690,6 +690,17 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
|
|||
/* Make sure we have enough space in the "text" array in info_struct
|
||||
* to hold all of the incoming text_ptr objects.
|
||||
*/
|
||||
|
||||
if (num_text < 0 ||
|
||||
num_text > INT_MAX - info_ptr->num_text - 8 ||
|
||||
(unsigned int)/*SAFE*/(num_text +/*SAFE*/
|
||||
info_ptr->num_text + 8) >=
|
||||
PNG_SIZE_MAX/png_sizeof(png_text))
|
||||
{
|
||||
png_warning(png_ptr, "too many text chunks");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (info_ptr->num_text + num_text > info_ptr->max_text)
|
||||
{
|
||||
int old_max_text = info_ptr->max_text;
|
||||
|
@ -897,6 +908,12 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH)
|
||||
{
|
||||
png_warning(png_ptr, "Ignoring invalid num_trans value");
|
||||
return;
|
||||
}
|
||||
|
||||
if (trans_alpha != NULL)
|
||||
{
|
||||
/* It may not actually be necessary to set png_ptr->trans_alpha here;
|
||||
|
@ -963,9 +980,18 @@ png_set_sPLT(png_structp png_ptr,
|
|||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
np = (png_sPLT_tp)png_malloc_warn(png_ptr,
|
||||
(info_ptr->splt_palettes_num + nentries) *
|
||||
(png_size_t)png_sizeof(png_sPLT_t));
|
||||
if (nentries < 0 ||
|
||||
nentries > INT_MAX-info_ptr->splt_palettes_num ||
|
||||
(unsigned int)/*SAFE*/(nentries +/*SAFE*/
|
||||
info_ptr->splt_palettes_num) >=
|
||||
PNG_SIZE_MAX/png_sizeof(png_sPLT_t))
|
||||
np=NULL;
|
||||
|
||||
else
|
||||
|
||||
np = (png_sPLT_tp)png_malloc_warn(png_ptr,
|
||||
(info_ptr->splt_palettes_num + nentries) *
|
||||
(png_size_t)png_sizeof(png_sPLT_t));
|
||||
|
||||
if (np == NULL)
|
||||
{
|
||||
|
@ -1033,9 +1059,17 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||
if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0)
|
||||
return;
|
||||
|
||||
np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
|
||||
(png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) *
|
||||
png_sizeof(png_unknown_chunk));
|
||||
if (num_unknowns < 0 ||
|
||||
num_unknowns > INT_MAX-info_ptr->unknown_chunks_num ||
|
||||
(unsigned int)/*SAFE*/(num_unknowns +/*SAFE*/
|
||||
info_ptr->unknown_chunks_num) >=
|
||||
PNG_SIZE_MAX/png_sizeof(png_unknown_chunk))
|
||||
np=NULL;
|
||||
|
||||
else
|
||||
np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
|
||||
(png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) *
|
||||
png_sizeof(png_unknown_chunk));
|
||||
|
||||
if (np == NULL)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -420,7 +420,6 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
|||
}
|
||||
|
||||
#ifdef PNG_CONVERT_tIME_SUPPORTED
|
||||
/* "tm" structure is not supported on WindowsCE */
|
||||
void PNGAPI
|
||||
png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm FAR * ttime)
|
||||
{
|
||||
|
@ -1042,6 +1041,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||
case 5:
|
||||
case 6:
|
||||
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||
/* FALL THROUGH */
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
case PNG_FILTER_VALUE_NONE:
|
||||
png_ptr->do_filter = PNG_FILTER_NONE; break;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.14 [January 24, 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.)
|
||||
*
|
||||
|
@ -460,24 +460,21 @@ png_text_compress(png_structp png_ptr,
|
|||
old_ptr = comp->output_ptr;
|
||||
|
||||
comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)
|
||||
(comp->max_output_ptr * png_sizeof(png_charpp)));
|
||||
(comp->max_output_ptr * png_sizeof(png_bytep)));
|
||||
|
||||
png_memcpy(comp->output_ptr, old_ptr, old_max
|
||||
* png_sizeof(png_charp));
|
||||
* png_sizeof(png_bytep));
|
||||
|
||||
png_free(png_ptr, old_ptr);
|
||||
}
|
||||
else
|
||||
comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)
|
||||
(comp->max_output_ptr * png_sizeof(png_charp)));
|
||||
(comp->max_output_ptr * png_sizeof(png_bytep)));
|
||||
}
|
||||
|
||||
/* Save the data */
|
||||
comp->output_ptr[comp->num_output_ptr] =
|
||||
(png_bytep)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)png_ptr->zbuf_size);
|
||||
(png_bytep)png_malloc(png_ptr, png_ptr->zbuf_size);
|
||||
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
|
|
Loading…
Reference in New Issue