mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[CHG] libpng updated to version 1.4.1
This commit is contained in:
parent
a932d3ad7c
commit
a165aba62e
15 changed files with 653 additions and 427 deletions
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -17,7 +17,7 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_0 Your_png_h_is_not_version_1_4_0;
|
||||
typedef version_1_4_1 Your_png_h_is_not_version_1_4_1;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h.
|
||||
|
@ -551,13 +551,13 @@ png_get_copyright(png_structp png_ptr)
|
|||
#else
|
||||
#ifdef __STDC__
|
||||
return ((png_charp) PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.0 - January 3, 2010" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.1 - February 25, 2010" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2010 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 ((png_charp) "libpng version 1.4.0 - January 3, 2010\
|
||||
return ((png_charp) "libpng version 1.4.1 - February 25, 2010\
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.4.0 - January 3, 2010
|
||||
* libpng version 1.4.1 - February 25, 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.)
|
||||
|
@ -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.4.0 - January 3, 2010: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.4.1 - February 25, 2010: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
|
@ -134,6 +134,11 @@
|
|||
* 1.4.0beta88-109 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc02-08 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0 14 10400 14.so.14.0[.0]
|
||||
* 1.4.1beta01-03 14 10401 14.so.14.1[.0]
|
||||
* 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]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
|
@ -165,7 +170,7 @@
|
|||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.0, January 3, 2010, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.1, February 25, 2010, are
|
||||
* Copyright (c) 2004, 2006-2010 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:
|
||||
|
@ -277,13 +282,13 @@
|
|||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* January 3, 2010
|
||||
* February 25, 2010
|
||||
*
|
||||
* 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.4.0 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.4.1 are Y2K compliant. It is my belief that earlier
|
||||
* versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
|
@ -339,9 +344,9 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.0"
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.1"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.4.0 - January 3, 2010\n"
|
||||
" libpng version 1.4.1 - February 25, 2010\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 14
|
||||
#define PNG_LIBPNG_VER_DLLNUM 14
|
||||
|
@ -349,7 +354,7 @@
|
|||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 4
|
||||
#define PNG_LIBPNG_VER_RELEASE 0
|
||||
#define PNG_LIBPNG_VER_RELEASE 1
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
*/
|
||||
|
@ -379,17 +384,13 @@
|
|||
* 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 10400 /* 1.4.0 */
|
||||
#define PNG_LIBPNG_VER 10401 /* 1.4.1 */
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Include the compression library's header */
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifdef AIX
|
||||
#define jmpbuf __jmpbuf
|
||||
#endif
|
||||
|
||||
/* Include all user configurable info, including optional assembler routines */
|
||||
#include "pngconf.h"
|
||||
|
||||
|
@ -629,25 +630,38 @@ typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
|
|||
typedef struct png_info_struct
|
||||
{
|
||||
/* the following are necessary for every PNG file */
|
||||
png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels (from IHDR) */
|
||||
png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */
|
||||
png_uint_32 valid PNG_DEPSTRUCT; /* valid chunk data (see PNG_INFO_ below) */
|
||||
png_size_t rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed row */
|
||||
png_colorp palette PNG_DEPSTRUCT; /* array of color values (valid & PNG_INFO_PLTE) */
|
||||
png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in "palette" (PLTE) */
|
||||
png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparent palette color (tRNS) */
|
||||
png_byte bit_depth PNG_DEPSTRUCT; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
|
||||
png_byte color_type PNG_DEPSTRUCT; /* see PNG_COLOR_TYPE_ below (from IHDR) */
|
||||
png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels (from IHDR) */
|
||||
png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */
|
||||
png_uint_32 valid PNG_DEPSTRUCT; /* valid chunk data (see PNG_INFO_
|
||||
below) */
|
||||
png_size_t rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed
|
||||
row */
|
||||
png_colorp palette PNG_DEPSTRUCT; /* array of color values
|
||||
(valid & PNG_INFO_PLTE) */
|
||||
png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in
|
||||
"palette" (PLTE) */
|
||||
png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparent palette
|
||||
color (tRNS) */
|
||||
png_byte bit_depth PNG_DEPSTRUCT; /* 1, 2, 4, 8, or 16 bits/channel
|
||||
(from IHDR) */
|
||||
png_byte color_type PNG_DEPSTRUCT; /* see PNG_COLOR_TYPE_ below
|
||||
(from IHDR) */
|
||||
/* The following three should have been named *_method not *_type */
|
||||
png_byte compression_type PNG_DEPSTRUCT; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
|
||||
png_byte filter_type PNG_DEPSTRUCT; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
|
||||
png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||
png_byte compression_type PNG_DEPSTRUCT; /* must be
|
||||
PNG_COMPRESSION_TYPE_BASE (IHDR) */
|
||||
png_byte filter_type PNG_DEPSTRUCT; /* must be PNG_FILTER_TYPE_BASE
|
||||
(from IHDR) */
|
||||
png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE,
|
||||
PNG_INTERLACE_ADAM7 */
|
||||
|
||||
/* The following is informational only on read, and not used on writes. */
|
||||
png_byte channels PNG_DEPSTRUCT; /* number of data channels per pixel (1, 2, 3, 4) */
|
||||
png_byte channels PNG_DEPSTRUCT; /* number of data channels per
|
||||
pixel (1, 2, 3, 4) */
|
||||
png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
|
||||
png_byte spare_byte PNG_DEPSTRUCT; /* to align the data, and for future use */
|
||||
png_byte signature[8] PNG_DEPSTRUCT; /* magic bytes read by libpng from start of file */
|
||||
png_byte spare_byte PNG_DEPSTRUCT; /* to align the data, and for
|
||||
future use */
|
||||
png_byte signature[8] PNG_DEPSTRUCT; /* magic bytes read by libpng
|
||||
from start of file */
|
||||
|
||||
/* The rest of the data is optional. If you are reading, check the
|
||||
* valid field to see if the information in these are valid. If you
|
||||
|
@ -660,13 +674,15 @@ typedef struct png_info_struct
|
|||
* on which the image was created, normally in the range [1.0, 2.5].
|
||||
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
|
||||
*/
|
||||
float gamma PNG_DEPSTRUCT; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
|
||||
float gamma PNG_DEPSTRUCT; /* gamma value of image,
|
||||
if (valid & PNG_INFO_gAMA) */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sRGB_SUPPORTED
|
||||
/* GR-P, 0.96a */
|
||||
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
|
||||
png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent [0, 1, 2, or 3] */
|
||||
png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent
|
||||
[0, 1, 2, or 3] */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_TEXT_SUPPORTED
|
||||
|
@ -711,8 +727,10 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
* single color specified that should be treated as fully transparent.
|
||||
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
|
||||
*/
|
||||
png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for paletted image */
|
||||
png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for non-palette image */
|
||||
png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for paletted
|
||||
image */
|
||||
png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for
|
||||
non-palette image */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
|
@ -743,7 +761,8 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
*/
|
||||
png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */
|
||||
png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */
|
||||
png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see PNG_RESOLUTION_ below) */
|
||||
png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see
|
||||
PNG_RESOLUTION_ below) */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
|
@ -790,14 +809,19 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
png_charp pcal_purpose PNG_DEPSTRUCT; /* pCAL chunk description string */
|
||||
png_int_32 pcal_X0 PNG_DEPSTRUCT; /* minimum value */
|
||||
png_int_32 pcal_X1 PNG_DEPSTRUCT; /* maximum value */
|
||||
png_charp pcal_units PNG_DEPSTRUCT; /* Latin-1 string giving physical units */
|
||||
png_charpp pcal_params PNG_DEPSTRUCT; /* ASCII strings containing parameter values */
|
||||
png_byte pcal_type PNG_DEPSTRUCT; /* equation type (see PNG_EQUATION_ below) */
|
||||
png_byte pcal_nparams PNG_DEPSTRUCT; /* number of parameters given in pcal_params */
|
||||
png_charp pcal_units PNG_DEPSTRUCT; /* Latin-1 string giving physical
|
||||
units */
|
||||
png_charpp pcal_params PNG_DEPSTRUCT; /* ASCII strings containing
|
||||
parameter values */
|
||||
png_byte pcal_type PNG_DEPSTRUCT; /* equation type
|
||||
(see PNG_EQUATION_ below) */
|
||||
png_byte pcal_nparams PNG_DEPSTRUCT; /* number of parameters given
|
||||
in pcal_params */
|
||||
#endif
|
||||
|
||||
/* New members added in libpng-1.0.6 */
|
||||
png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
|
||||
png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is
|
||||
responsible for freeing */
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
|
||||
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
||||
|
@ -809,7 +833,8 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
#ifdef PNG_iCCP_SUPPORTED
|
||||
/* iCCP chunk data. */
|
||||
png_charp iccp_name PNG_DEPSTRUCT; /* profile name */
|
||||
png_charp iccp_profile PNG_DEPSTRUCT; /* International Color Consortium profile data */
|
||||
png_charp iccp_profile PNG_DEPSTRUCT; /* International Color Consortium
|
||||
profile data */
|
||||
/* Note to maintainer: should be png_bytep */
|
||||
png_uint_32 iccp_proflen PNG_DEPSTRUCT; /* ICC profile data length */
|
||||
png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */
|
||||
|
@ -841,13 +866,15 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
#endif
|
||||
|
||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
|
||||
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
|
||||
non-zero */
|
||||
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
|
||||
png_bytepp row_pointers PNG_DEPSTRUCT; /* the image bits */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
|
||||
png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image, if (valid & PNG_INFO_gAMA) */
|
||||
png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image,
|
||||
if (valid & PNG_INFO_gAMA) */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
|
||||
|
@ -994,7 +1021,8 @@ typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
|
|||
int));
|
||||
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
|
||||
typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp,
|
||||
png_infop));
|
||||
typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
|
||||
typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
|
||||
png_uint_32, int));
|
||||
|
@ -1007,7 +1035,8 @@ typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
|
|||
#endif
|
||||
|
||||
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
||||
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
|
||||
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp,
|
||||
png_unknown_chunkp));
|
||||
#endif
|
||||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
|
||||
|
@ -1059,83 +1088,128 @@ struct png_struct_def
|
|||
{
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
jmp_buf jmpbuf PNG_DEPSTRUCT; /* used in png_error */
|
||||
png_longjmp_ptr longjmp_fn PNG_DEPSTRUCT;/* setjmp non-local goto function. */
|
||||
png_longjmp_ptr longjmp_fn PNG_DEPSTRUCT;/* setjmp non-local goto
|
||||
function. */
|
||||
#endif
|
||||
png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing errors and aborting */
|
||||
png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing warnings */
|
||||
png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for error functions */
|
||||
png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing output data */
|
||||
png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading input data */
|
||||
png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct for I/O functions */
|
||||
png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing
|
||||
errors and aborting */
|
||||
png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing
|
||||
warnings */
|
||||
png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for
|
||||
error functions */
|
||||
png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing
|
||||
output data */
|
||||
png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading
|
||||
input data */
|
||||
png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct
|
||||
for I/O functions */
|
||||
|
||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read transform */
|
||||
png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read
|
||||
transform */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write transform */
|
||||
png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write
|
||||
transform */
|
||||
#endif
|
||||
|
||||
/* These were added in libpng-1.0.2 */
|
||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct for user transform */
|
||||
png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user transformed pixels */
|
||||
png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user transformed pixels */
|
||||
png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct
|
||||
for user transform */
|
||||
png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user
|
||||
transformed pixels */
|
||||
png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user
|
||||
transformed pixels */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in the PNG file */
|
||||
png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various things to libpng */
|
||||
png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations to perform */
|
||||
png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in
|
||||
the PNG file */
|
||||
png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various
|
||||
things to libpng */
|
||||
png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations
|
||||
to perform */
|
||||
|
||||
z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression structure (below) */
|
||||
z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression
|
||||
structure (below) */
|
||||
png_bytep zbuf PNG_DEPSTRUCT; /* buffer for zlib */
|
||||
png_size_t zbuf_size PNG_DEPSTRUCT; /* size of zbuf */
|
||||
int zlib_level PNG_DEPSTRUCT; /* holds zlib compression level */
|
||||
int zlib_method PNG_DEPSTRUCT; /* holds zlib compression method */
|
||||
int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window bits */
|
||||
int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory level */
|
||||
int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression strategy */
|
||||
int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window
|
||||
bits */
|
||||
int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory
|
||||
level */
|
||||
int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression
|
||||
strategy */
|
||||
|
||||
png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels */
|
||||
png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */
|
||||
png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */
|
||||
png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */
|
||||
png_size_t rowbytes PNG_DEPSTRUCT; /* size of row in bytes */
|
||||
png_size_t irowbytes PNG_DEPSTRUCT; /* size of current interlaced row in bytes */
|
||||
png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */
|
||||
#if 0 /* Replaced with the following in libpng-1.4.1 */
|
||||
png_size_t irowbytes PNG_DEPSTRUCT;
|
||||
#endif
|
||||
/* Added in libpng-1.4.1 */
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
|
||||
* can occupy when decompressed. 0 means unlimited.
|
||||
* We will change the typedef from png_size_t to png_alloc_size_t
|
||||
* in libpng-1.6.0
|
||||
*/
|
||||
png_alloc_size_t user_chunk_malloc_max PNG_DEPSTRUCT;
|
||||
#endif
|
||||
png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced
|
||||
row in pixels */
|
||||
png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */
|
||||
png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */
|
||||
png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */
|
||||
png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row when filtering */
|
||||
png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row when filtering */
|
||||
png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row when filtering */
|
||||
png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row when filtering */
|
||||
png_row_info row_info PNG_DEPSTRUCT; /* used for transformation routines */
|
||||
png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous
|
||||
(unfiltered) row */
|
||||
png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current
|
||||
(unfiltered) row */
|
||||
png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row
|
||||
when filtering */
|
||||
png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row
|
||||
when filtering */
|
||||
png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row
|
||||
when filtering */
|
||||
png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row
|
||||
when filtering */
|
||||
png_row_info row_info PNG_DEPSTRUCT; /* used for transformation
|
||||
routines */
|
||||
|
||||
png_uint_32 idat_size PNG_DEPSTRUCT; /* current IDAT size for read */
|
||||
png_uint_32 crc PNG_DEPSTRUCT; /* current chunk CRC value */
|
||||
png_colorp palette PNG_DEPSTRUCT; /* palette from the input file */
|
||||
png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in palette */
|
||||
png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in
|
||||
palette */
|
||||
png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparency values */
|
||||
png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current chunk */
|
||||
png_byte compression PNG_DEPSTRUCT; /* file compression type (always 0) */
|
||||
png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current
|
||||
chunk */
|
||||
png_byte compression PNG_DEPSTRUCT; /* file compression type
|
||||
(always 0) */
|
||||
png_byte filter PNG_DEPSTRUCT; /* file filter type (always 0) */
|
||||
png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||
png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE,
|
||||
PNG_INTERLACE_ADAM7 */
|
||||
png_byte pass PNG_DEPSTRUCT; /* current interlace pass (0 - 6) */
|
||||
png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see PNG_FILTER_ below ) */
|
||||
png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see
|
||||
PNG_FILTER_ below ) */
|
||||
png_byte color_type PNG_DEPSTRUCT; /* color type of file */
|
||||
png_byte bit_depth PNG_DEPSTRUCT; /* bit depth of file */
|
||||
png_byte usr_bit_depth PNG_DEPSTRUCT; /* bit depth of users row */
|
||||
png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
|
||||
png_byte channels PNG_DEPSTRUCT; /* number of channels in file */
|
||||
png_byte usr_channels PNG_DEPSTRUCT; /* channels at start of write */
|
||||
png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from start of file */
|
||||
png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from
|
||||
start of file */
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel expansion */
|
||||
png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel
|
||||
expansion */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_bKGD_SUPPORTED
|
||||
|
@ -1143,73 +1217,108 @@ struct png_struct_def
|
|||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
float background_gamma PNG_DEPSTRUCT;
|
||||
# endif
|
||||
png_color_16 background PNG_DEPSTRUCT; /* background color in screen gamma space */
|
||||
png_color_16 background PNG_DEPSTRUCT; /* background color in
|
||||
screen gamma space */
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized to gamma 1.0 */
|
||||
png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized
|
||||
to gamma 1.0 */
|
||||
#endif
|
||||
#endif /* PNG_bKGD_SUPPORTED */
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing output */
|
||||
png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush, 0 - no flush */
|
||||
png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since last flush */
|
||||
png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing
|
||||
output */
|
||||
png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush,
|
||||
0 - no flush */
|
||||
png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since
|
||||
last flush */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits 16-bit gamma */
|
||||
int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits
|
||||
16-bit gamma */
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
float gamma PNG_DEPSTRUCT; /* file gamma value */
|
||||
float screen_gamma PNG_DEPSTRUCT; /* screen gamma value (display_exponent) */
|
||||
float screen_gamma PNG_DEPSTRUCT; /* screen gamma value
|
||||
(display_exponent) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit depth files */
|
||||
png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit
|
||||
depth files */
|
||||
png_bytep gamma_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
|
||||
png_bytep gamma_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
|
||||
png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit depth files */
|
||||
png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
|
||||
png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit
|
||||
depth files */
|
||||
png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to
|
||||
screen */
|
||||
png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
|
||||
png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in each available channel */
|
||||
png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in each
|
||||
available channel */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||
png_color_8 shift PNG_DEPSTRUCT; /* shift for significant bit tranformation */
|
||||
png_color_8 shift PNG_DEPSTRUCT; /* shift for significant bit
|
||||
tranformation */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|
||||
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for paletted files */
|
||||
png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for non-paletted files */
|
||||
png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for
|
||||
paletted files */
|
||||
png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for
|
||||
non-paletted files */
|
||||
#endif
|
||||
|
||||
png_read_status_ptr read_row_fn PNG_DEPSTRUCT; /* called after each row is decoded */
|
||||
png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each row is encoded */
|
||||
png_read_status_ptr read_row_fn PNG_DEPSTRUCT; /* called after each
|
||||
row is decoded */
|
||||
png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each
|
||||
row is encoded */
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header data fully read */
|
||||
png_progressive_row_ptr row_fn PNG_DEPSTRUCT; /* called after each prog. row is decoded */
|
||||
png_progressive_end_ptr end_fn PNG_DEPSTRUCT; /* called after image is complete */
|
||||
png_bytep save_buffer_ptr PNG_DEPSTRUCT; /* current location in save_buffer */
|
||||
png_bytep save_buffer PNG_DEPSTRUCT; /* buffer for previously read data */
|
||||
png_bytep current_buffer_ptr PNG_DEPSTRUCT; /* current location in current_buffer */
|
||||
png_bytep current_buffer PNG_DEPSTRUCT; /* buffer for recently used data */
|
||||
png_uint_32 push_length PNG_DEPSTRUCT; /* size of current input chunk */
|
||||
png_uint_32 skip_length PNG_DEPSTRUCT; /* bytes to skip in input data */
|
||||
png_size_t save_buffer_size PNG_DEPSTRUCT; /* amount of data now in save_buffer */
|
||||
png_size_t save_buffer_max PNG_DEPSTRUCT; /* total size of save_buffer */
|
||||
png_size_t buffer_size PNG_DEPSTRUCT; /* total amount of available input data */
|
||||
png_size_t current_buffer_size PNG_DEPSTRUCT; /* amount of data now in current_buffer */
|
||||
int process_mode PNG_DEPSTRUCT; /* what push library is currently doing */
|
||||
int cur_palette PNG_DEPSTRUCT; /* current push library palette index */
|
||||
png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header
|
||||
data fully read */
|
||||
png_progressive_row_ptr row_fn PNG_DEPSTRUCT; /* called after each
|
||||
prog. row is decoded */
|
||||
png_progressive_end_ptr end_fn PNG_DEPSTRUCT; /* called after image
|
||||
is complete */
|
||||
png_bytep save_buffer_ptr PNG_DEPSTRUCT; /* current location in
|
||||
save_buffer */
|
||||
png_bytep save_buffer PNG_DEPSTRUCT; /* buffer for previously
|
||||
read data */
|
||||
png_bytep current_buffer_ptr PNG_DEPSTRUCT; /* current location in
|
||||
current_buffer */
|
||||
png_bytep current_buffer PNG_DEPSTRUCT; /* buffer for recently
|
||||
used data */
|
||||
png_uint_32 push_length PNG_DEPSTRUCT; /* size of current input
|
||||
chunk */
|
||||
png_uint_32 skip_length PNG_DEPSTRUCT; /* bytes to skip in
|
||||
input data */
|
||||
png_size_t save_buffer_size PNG_DEPSTRUCT; /* amount of data now
|
||||
in save_buffer */
|
||||
png_size_t save_buffer_max PNG_DEPSTRUCT; /* total size of
|
||||
save_buffer */
|
||||
png_size_t buffer_size PNG_DEPSTRUCT; /* total amount of
|
||||
available input data */
|
||||
png_size_t current_buffer_size PNG_DEPSTRUCT; /* amount of data now
|
||||
in current_buffer */
|
||||
int process_mode PNG_DEPSTRUCT; /* what push library
|
||||
is currently doing */
|
||||
int cur_palette PNG_DEPSTRUCT; /* current push library
|
||||
palette index */
|
||||
|
||||
# ifdef PNG_TEXT_SUPPORTED
|
||||
png_size_t current_text_size PNG_DEPSTRUCT; /* current size of text input data */
|
||||
png_size_t current_text_left PNG_DEPSTRUCT; /* how much text left to read in input */
|
||||
png_charp current_text PNG_DEPSTRUCT; /* current text chunk buffer */
|
||||
png_charp current_text_ptr PNG_DEPSTRUCT; /* current location in current_text */
|
||||
png_size_t current_text_size PNG_DEPSTRUCT; /* current size of
|
||||
text input data */
|
||||
png_size_t current_text_left PNG_DEPSTRUCT; /* how much text left
|
||||
to read in input */
|
||||
png_charp current_text PNG_DEPSTRUCT; /* current text chunk
|
||||
buffer */
|
||||
png_charp current_text_ptr PNG_DEPSTRUCT; /* current location
|
||||
in current_text */
|
||||
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
|
||||
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
@ -1224,8 +1333,9 @@ struct png_struct_def
|
|||
#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 files */
|
||||
png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for dithering */
|
||||
png_bytep dither_index PNG_DEPSTRUCT; /* index translation for palette
|
||||
files */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
||||
|
@ -1233,26 +1343,35 @@ struct png_struct_def
|
|||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row filter selection */
|
||||
png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights for previous rows */
|
||||
png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of previous row(s) */
|
||||
png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous line(s) */
|
||||
png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for previous line(s) */
|
||||
png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter calculation cost */
|
||||
png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter calculation cost */
|
||||
png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row
|
||||
filter selection */
|
||||
png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights
|
||||
for previous rows */
|
||||
png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of
|
||||
previous row(s) */
|
||||
png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous
|
||||
line(s) */
|
||||
png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for
|
||||
previous line(s) */
|
||||
png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter
|
||||
calculation cost */
|
||||
png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter
|
||||
calculation cost */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
|
||||
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
|
||||
#endif
|
||||
|
||||
/* New members added in libpng-1.0.6 */
|
||||
|
||||
png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
|
||||
png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is
|
||||
responsible for freeing */
|
||||
|
||||
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
||||
png_voidp user_chunk_ptr PNG_DEPSTRUCT;
|
||||
png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read chunk handler */
|
||||
png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read
|
||||
chunk handler */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
|
@ -1291,31 +1410,37 @@ struct png_struct_def
|
|||
|
||||
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_voidp mem_ptr PNG_DEPSTRUCT; /* user supplied struct for mem functions */
|
||||
png_malloc_ptr malloc_fn PNG_DEPSTRUCT; /* function for allocating memory */
|
||||
png_free_ptr free_fn PNG_DEPSTRUCT; /* function for freeing memory */
|
||||
png_voidp mem_ptr PNG_DEPSTRUCT; /* user supplied struct for
|
||||
mem functions */
|
||||
png_malloc_ptr malloc_fn PNG_DEPSTRUCT; /* function for
|
||||
allocating memory */
|
||||
png_free_ptr free_fn PNG_DEPSTRUCT; /* function for
|
||||
freeing memory */
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current
|
||||
(unfiltered) row */
|
||||
|
||||
#ifdef PNG_READ_DITHER_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 index_to_palette PNG_DEPSTRUCT; /* where the original index currently is */
|
||||
/* in the palette */
|
||||
png_bytep palette_to_index PNG_DEPSTRUCT; /* which original index points to this */
|
||||
/* palette color */
|
||||
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
|
||||
points to this
|
||||
palette color */
|
||||
#endif
|
||||
|
||||
/* New members added in libpng-1.0.16 and 1.2.6 */
|
||||
png_byte compression_type PNG_DEPSTRUCT;
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
png_uint_32 user_width_max PNG_DEPSTRUCT;
|
||||
png_uint_32 user_height_max PNG_DEPSTRUCT;
|
||||
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
|
||||
* chunks that can be stored (0x7fffffff means unlimited).
|
||||
* chunks that can be stored (0 means unlimited).
|
||||
*/
|
||||
png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;
|
||||
#endif
|
||||
|
@ -1333,8 +1458,8 @@ struct png_struct_def
|
|||
/* New member added in libpng-1.2.30 */
|
||||
png_charp chunkdata PNG_DEPSTRUCT; /* buffer for reading chunk data */
|
||||
|
||||
/* New member added in libpng-1.4.0 */
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
/* New member added in libpng-1.4.0 */
|
||||
png_uint_32 io_state PNG_DEPSTRUCT;
|
||||
#endif
|
||||
};
|
||||
|
@ -1343,7 +1468,7 @@ struct png_struct_def
|
|||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef png_structp version_1_4_0;
|
||||
typedef png_structp version_1_4_1;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
|
@ -1380,15 +1505,11 @@ extern PNG_EXPORT(png_structp,png_create_write_struct)
|
|||
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
extern PNG_EXPORT(png_size_t,png_get_compression_buffer_size)
|
||||
PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
extern PNG_EXPORT(void,png_set_compression_buffer_size)
|
||||
PNGARG((png_structp png_ptr, png_size_t size));
|
||||
#endif
|
||||
|
||||
/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
|
||||
* match up.
|
||||
|
@ -1402,7 +1523,8 @@ extern PNG_EXPORT(void,png_set_compression_buffer_size)
|
|||
* indicating an ABI mismatch.
|
||||
*/
|
||||
extern PNG_EXPORT(jmp_buf*, png_set_longjmp_fn)
|
||||
PNGARG((png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
|
||||
PNGARG((png_structp png_ptr, png_longjmp_ptr longjmp_fn, size_t
|
||||
jmp_buf_size));
|
||||
# define png_jmpbuf(png_ptr) \
|
||||
(*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))
|
||||
#else
|
||||
|
@ -1547,7 +1669,8 @@ extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
|
|||
extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
|
||||
defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
/* Swap packing order of pixels in bytes. */
|
||||
extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
@ -1588,7 +1711,9 @@ 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. */
|
||||
/* Turn on dithering, and reduce the palette to the number of colors
|
||||
* available.
|
||||
*/
|
||||
extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
|
||||
png_colorp palette, int num_palette, int maximum_colors,
|
||||
png_uint_16p histogram, int full_dither));
|
||||
|
@ -1805,7 +1930,8 @@ extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
|
|||
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
/* Initialize the input/output for the PNG file to the default functions. */
|
||||
extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
|
||||
extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr,
|
||||
png_FILE_p fp));
|
||||
#endif
|
||||
|
||||
/* Replace the (error and abort), and warning functions with user
|
||||
|
@ -2362,7 +2488,8 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
|
|||
|
||||
extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
|
||||
extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
|
||||
extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
|
||||
extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp
|
||||
png_ptr));
|
||||
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
|
@ -2397,6 +2524,11 @@ extern PNG_EXPORT(void,png_set_chunk_cache_max) PNGARG((png_structp
|
|||
png_ptr, png_uint_32 user_chunk_cache_max));
|
||||
extern PNG_EXPORT(png_uint_32,png_get_chunk_cache_max)
|
||||
PNGARG((png_structp png_ptr));
|
||||
/* Added in libpng-1.4.1 */
|
||||
extern PNG_EXPORT(void,png_set_chunk_malloc_max) PNGARG((png_structp
|
||||
png_ptr, png_alloc_size_t user_chunk_cache_max));
|
||||
extern PNG_EXPORT(png_alloc_size_t,png_get_chunk_malloc_max)
|
||||
PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
|
@ -2459,16 +2591,18 @@ extern PNG_EXPORT(png_bytep,png_get_io_chunk_name)
|
|||
|
||||
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
||||
|
||||
# define png_composite(composite, fg, alpha, bg) \
|
||||
{ png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
|
||||
+ (png_uint_16)(bg)*(png_uint_16)(255 - \
|
||||
(png_uint_16)(alpha)) + (png_uint_16)128); \
|
||||
# define png_composite(composite, fg, alpha, bg) \
|
||||
{ png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
|
||||
* (png_uint_16)(alpha) \
|
||||
+ (png_uint_16)(bg)*(png_uint_16)(255 \
|
||||
- (png_uint_16)(alpha)) + (png_uint_16)128); \
|
||||
(composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
|
||||
|
||||
# define png_composite_16(composite, fg, alpha, bg) \
|
||||
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
|
||||
+ (png_uint_32)(bg)*(png_uint_32)(65535L - \
|
||||
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
||||
# define png_composite_16(composite, fg, alpha, bg) \
|
||||
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
|
||||
* (png_uint_32)(alpha) \
|
||||
+ (png_uint_32)(bg)*(png_uint_32)(65535L \
|
||||
- (png_uint_32)(alpha)) + (png_uint_32)32768L); \
|
||||
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
||||
|
||||
#else /* Standard method using integer division */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.4.0 - January 3, 2010
|
||||
* libpng version 1.4.1 - February 25, 2010
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -28,7 +28,9 @@
|
|||
|
||||
/* Added at libpng-1.2.9 */
|
||||
|
||||
/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
|
||||
/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure"
|
||||
* script.
|
||||
*/
|
||||
#ifdef PNG_CONFIGURE_LIBPNG
|
||||
# ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
|
@ -672,14 +674,29 @@
|
|||
#endif
|
||||
|
||||
/* Added at libpng-1.2.6 */
|
||||
#ifndef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
# ifndef PNG_NO_SET_USER_LIMITS
|
||||
#ifndef PNG_NO_SET_USER_LIMITS
|
||||
# ifndef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
# define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
# endif
|
||||
/* Feature added at libpng-1.4.0, this flag added at 1.4.1 */
|
||||
# ifndef PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||
# define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||
# endif
|
||||
/* Feature added at libpng-1.4.1, this flag added at 1.4.1 */
|
||||
# ifndef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
# define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.2.43 */
|
||||
#ifndef PNG_USER_LIMITS_SUPPORTED
|
||||
# ifndef PNG_NO_USER_LIMITS
|
||||
# define PNG_USER_LIMITS_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter
|
||||
* how large, set these limits to 0x7fffffffL
|
||||
* how large, set these two limits to 0x7fffffffL
|
||||
*/
|
||||
#ifndef PNG_USER_WIDTH_MAX
|
||||
# define PNG_USER_WIDTH_MAX 1000000L
|
||||
|
@ -688,9 +705,16 @@
|
|||
# define PNG_USER_HEIGHT_MAX 1000000L
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.4.0 */
|
||||
/* Added at libpng-1.2.43. To accept all valid PNGs no matter
|
||||
* how large, set these two limits to 0.
|
||||
*/
|
||||
#ifndef PNG_USER_CHUNK_CACHE_MAX
|
||||
# define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL
|
||||
# define PNG_USER_CHUNK_CACHE_MAX 0
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.2.43 */
|
||||
#ifndef PNG_USER_CHUNK_MALLOC_MAX
|
||||
# define PNG_USER_CHUNK_MALLOC_MAX 0
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.4.0 */
|
||||
|
@ -861,20 +885,22 @@
|
|||
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
|
||||
|
||||
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# ifndef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# endif
|
||||
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(PNG_NO_READ_USER_CHUNKS) && \
|
||||
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
# define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# define PNG_USER_CHUNKS_SUPPORTED
|
||||
# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
# undef PNG_NO_READ_UNKNOWN_CHUNKS
|
||||
# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# endif
|
||||
# ifdef PNG_NO_HANDLE_AS_UNKNOWN
|
||||
# undef PNG_NO_HANDLE_AS_UNKNOWN
|
||||
#endif
|
||||
#ifndef PNG_NO_READ_USER_CHUNKS
|
||||
# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# endif
|
||||
# ifndef PNG_USER_CHUNKS_SUPPORTED
|
||||
# define PNG_USER_CHUNKS_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
#ifndef PNG_NO_HANDLE_AS_UNKNOWN
|
||||
|
@ -1016,8 +1042,10 @@
|
|||
|
||||
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
|
||||
|
||||
#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
|
||||
# define PNG_WRITE_FILTER_SUPPORTED
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
# ifndef PNG_WRITE_FILTER_SUPPORTED
|
||||
# define PNG_WRITE_FILTER_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -872,17 +872,16 @@ png_get_user_chunk_ptr(png_structp png_ptr)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_size_t PNGAPI
|
||||
png_get_compression_buffer_size(png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr ? png_ptr->zbuf_size : 0L);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
/* These functions were added to libpng 1.2.6 */
|
||||
/* These functions were added to libpng 1.2.6 and were enabled
|
||||
* by default in libpng-1.4.0 */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_user_width_max (png_structp png_ptr)
|
||||
{
|
||||
|
@ -897,11 +896,18 @@ png_get_user_height_max (png_structp png_ptr)
|
|||
png_uint_32 PNGAPI
|
||||
png_get_chunk_cache_max (png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr? png_ptr->user_chunk_cache_max? 0x7fffffffL :
|
||||
png_ptr->user_chunk_cache_max - 1 : 0);
|
||||
return (png_ptr? png_ptr->user_chunk_cache_max : 0);
|
||||
}
|
||||
/* This function was added to libpng 1.4.1 */
|
||||
png_alloc_size_t PNGAPI
|
||||
png_get_chunk_malloc_max (png_structp png_ptr)
|
||||
{
|
||||
return (png_ptr?
|
||||
png_ptr->user_chunk_malloc_max : 0);
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
|
||||
/* These functions were added to libpng 1.4.0 */
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_io_state (png_structp png_ptr)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.0 [February 25, 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.)
|
||||
|
@ -201,7 +201,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
|
|||
{
|
||||
#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", "M" */
|
||||
else
|
||||
png_warning(png_ptr, "Out Of Memory");
|
||||
#endif
|
||||
|
@ -229,7 +229,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
|
|||
{
|
||||
#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", "m" */
|
||||
else
|
||||
png_warning(png_ptr, "Out Of memory");
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -329,7 +329,9 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
||||
png_push_have_info(png_ptr, info_ptr);
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes;
|
||||
png_ptr->zstream.avail_out =
|
||||
(uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||
png_ptr->iwidth) + 1;
|
||||
png_ptr->zstream.next_out = png_ptr->row_buf;
|
||||
return;
|
||||
}
|
||||
|
@ -698,8 +700,13 @@ png_push_save_buffer(png_structp png_ptr)
|
|||
|
||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||
old_buffer = png_ptr->save_buffer;
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
|
||||
(png_size_t)new_max);
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||
}
|
||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_ptr->save_buffer_max = new_max;
|
||||
|
@ -797,7 +804,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||
|
||||
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
|
||||
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
|
||||
png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
|
||||
png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
|
||||
|
||||
png_ptr->idat_size -= save_size;
|
||||
png_ptr->buffer_size -= save_size;
|
||||
|
@ -869,7 +876,9 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||
break;
|
||||
}
|
||||
png_push_process_row(png_ptr);
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes;
|
||||
png_ptr->zstream.avail_out =
|
||||
(uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||
png_ptr->iwidth) + 1;
|
||||
png_ptr->zstream.next_out = png_ptr->row_buf;
|
||||
}
|
||||
|
||||
|
@ -1134,9 +1143,6 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||
png_pass_start[png_ptr->pass]) /
|
||||
png_pass_inc[png_ptr->pass];
|
||||
|
||||
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||
png_ptr->iwidth) + 1;
|
||||
|
||||
if (png_ptr->transformations & PNG_INTERLACE)
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* libpng version 1.4.0 - January 3, 2010
|
||||
* libpng version 1.4.1 - February 25, 2010
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -351,8 +351,8 @@ PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
|
|||
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));
|
||||
PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
|
||||
png_fixed_point file_gamma));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -556,7 +556,8 @@ PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
|
|||
PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
|
||||
defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -31,7 +31,9 @@ png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
warn_fn, NULL, NULL, NULL));
|
||||
}
|
||||
|
||||
/* Alternate create PNG structure for reading, and allocate any memory needed. */
|
||||
/* Alternate create PNG structure for reading, and allocate any memory
|
||||
* needed.
|
||||
*/
|
||||
png_structp PNGAPI
|
||||
png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
|
||||
|
@ -65,11 +67,17 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
return (NULL);
|
||||
|
||||
/* Added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
||||
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
||||
/* Added at libpng-1.4.0 */
|
||||
# ifdef PNG_USER_CHUNK_CACHE_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.0 */
|
||||
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
||||
# endif
|
||||
# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.1 */
|
||||
png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
|
@ -477,7 +485,8 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined");
|
||||
#endif
|
||||
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && !defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
|
||||
!defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined");
|
||||
#endif
|
||||
|
@ -580,7 +589,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||
png_error(png_ptr, "Invalid attempt to read row data");
|
||||
|
||||
png_ptr->zstream.next_out = png_ptr->row_buf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes;
|
||||
png_ptr->zstream.avail_out =
|
||||
(uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||
png_ptr->iwidth) + 1);
|
||||
do
|
||||
{
|
||||
if (!(png_ptr->zstream.avail_in))
|
||||
|
@ -1044,7 +1055,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
|
|||
|
||||
/* Free all memory used by the read (old method) */
|
||||
void /* PRIVATE */
|
||||
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
|
||||
png_read_destroy(png_structp png_ptr, png_infop info_ptr,
|
||||
png_infop end_info_ptr)
|
||||
{
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
jmp_buf tmp_jmp;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -432,8 +432,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||
png_ptr->palette_to_index[png_ptr->index_to_palette[j]]
|
||||
= png_ptr->palette_to_index[num_new_palette];
|
||||
|
||||
png_ptr->index_to_palette[j] = (png_byte)num_new_palette;
|
||||
png_ptr->palette_to_index[num_new_palette] = (png_byte)j;
|
||||
png_ptr->index_to_palette[j] =
|
||||
(png_byte)num_new_palette;
|
||||
png_ptr->palette_to_index[num_new_palette] =
|
||||
(png_byte)j;
|
||||
}
|
||||
if (num_new_palette <= maximum_colors)
|
||||
break;
|
||||
|
@ -502,7 +504,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||
{
|
||||
/* 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_DITHER_BLUE_BITS +
|
||||
PNG_DITHER_GREEN_BITS));
|
||||
|
||||
for (ig = 0; ig < num_green; ig++)
|
||||
{
|
||||
|
@ -747,8 +750,9 @@ png_init_read_transformations(png_structp png_ptr)
|
|||
png_debug(1, "in png_init_read_transformations");
|
||||
|
||||
{
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \
|
||||
|| defined(PNG_READ_GAMMA_SUPPORTED)
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||
defined(PNG_READ_SHIFT_SUPPORTED) || \
|
||||
defined(PNG_READ_GAMMA_SUPPORTED)
|
||||
int color_type = png_ptr->color_type;
|
||||
#endif
|
||||
|
||||
|
@ -945,7 +949,8 @@ png_init_read_transformations(png_structp png_ptr)
|
|||
back.red = (png_byte)(pow(
|
||||
(double)png_ptr->background.red/255.0, gs) * 255.0 + .5);
|
||||
back.green = (png_byte)(pow(
|
||||
(double)png_ptr->background.green/255.0, gs) * 255.0 + .5);
|
||||
(double)png_ptr->background.green/255.0, gs) * 255.0
|
||||
+ .5);
|
||||
back.blue = (png_byte)(pow(
|
||||
(double)png_ptr->background.blue/255.0, gs) * 255.0 + .5);
|
||||
}
|
||||
|
@ -1357,7 +1362,8 @@ png_do_read_transformations(png_structp png_ptr)
|
|||
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
|
||||
{
|
||||
int rgb_error =
|
||||
png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||
png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info),
|
||||
png_ptr->row_buf + 1);
|
||||
if (rgb_error)
|
||||
{
|
||||
png_ptr->rgb_to_gray_status=1;
|
||||
|
@ -2343,7 +2349,8 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
|||
{
|
||||
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
|
||||
png_ptr->gamma_shift][red>>8];
|
||||
png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||
png_uint_16 green_1 =
|
||||
png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||
png_ptr->gamma_shift][green>>8];
|
||||
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
|
||||
png_ptr->gamma_shift][blue>>8];
|
||||
|
@ -2439,13 +2446,14 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
|||
else
|
||||
{
|
||||
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
|
||||
png_ptr->gamma_shift][red>>8];
|
||||
png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||
png_ptr->gamma_shift][green>>8];
|
||||
png_ptr->gamma_shift][red>>8];
|
||||
png_uint_16 green_1 =
|
||||
png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||
png_ptr->gamma_shift][green>>8];
|
||||
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
|
||||
png_ptr->gamma_shift][blue>>8];
|
||||
png_ptr->gamma_shift][blue>>8];
|
||||
png_uint_16 gray16 = (png_uint_16)((rc * red_1
|
||||
+ gc * green_1 + bc * blue_1)>>15);
|
||||
+ gc * green_1 + bc * blue_1)>>15);
|
||||
w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
|
||||
png_ptr->gamma_shift][gray16 >> 8];
|
||||
rgb_error |= 1;
|
||||
|
@ -3375,10 +3383,10 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
|
|||
int d = *sp & 0x03;
|
||||
|
||||
*sp = (png_byte)(
|
||||
((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)|
|
||||
((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
|
||||
((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
|
||||
((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) ));
|
||||
((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)|
|
||||
((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
|
||||
((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
|
||||
((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) ));
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
|
@ -3392,7 +3400,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
|
|||
int lsb = *sp & 0x0f;
|
||||
|
||||
*sp = (png_byte)((((int)gamma_table[msb | (msb >> 4)]) & 0xf0)
|
||||
| (((int)gamma_table[(lsb << 4) | lsb]) >> 4));
|
||||
| (((int)gamma_table[(lsb << 4) | lsb]) >> 4));
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -201,6 +201,95 @@ png_crc_error(png_structp png_ptr)
|
|||
|
||||
#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \
|
||||
defined(PNG_READ_iCCP_SUPPORTED)
|
||||
static png_size_t
|
||||
png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
|
||||
png_bytep output, png_size_t output_size)
|
||||
{
|
||||
png_size_t count = 0;
|
||||
|
||||
png_ptr->zstream.next_in = (png_bytep)data; /* const_cast: VALID */
|
||||
png_ptr->zstream.avail_in = size;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int ret, avail;
|
||||
|
||||
/* Reset the output buffer each time round - we empty it
|
||||
* after every inflate call.
|
||||
*/
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = png_ptr->zbuf_size;
|
||||
|
||||
ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
|
||||
avail = png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
|
||||
/* First copy/count any new output - but only if we didn't
|
||||
* get an error code.
|
||||
*/
|
||||
if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
|
||||
{
|
||||
if (output != 0 && output_size > count)
|
||||
{
|
||||
int copy = output_size - count;
|
||||
if (avail < copy) copy = avail;
|
||||
png_memcpy(output + count, png_ptr->zbuf, copy);
|
||||
}
|
||||
count += avail;
|
||||
}
|
||||
|
||||
if (ret == Z_OK)
|
||||
continue;
|
||||
|
||||
/* Termination conditions - always reset the zstream, it
|
||||
* must be left in inflateInit state.
|
||||
*/
|
||||
png_ptr->zstream.avail_in = 0;
|
||||
inflateReset(&png_ptr->zstream);
|
||||
|
||||
if (ret == Z_STREAM_END)
|
||||
return count; /* NOTE: may be zero. */
|
||||
|
||||
/* Now handle the error codes - the API always returns 0
|
||||
* and the error message is dumped into the uncompressed
|
||||
* buffer if available.
|
||||
*/
|
||||
{
|
||||
char *msg, umsg[52];
|
||||
if (png_ptr->zstream.msg != 0)
|
||||
msg = png_ptr->zstream.msg;
|
||||
else
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
switch (ret)
|
||||
{
|
||||
case Z_BUF_ERROR:
|
||||
msg = "Buffer error in compressed datastream in %s chunk";
|
||||
break;
|
||||
case Z_DATA_ERROR:
|
||||
msg = "Data error in compressed datastream in %s chunk";
|
||||
break;
|
||||
default:
|
||||
msg = "Incomplete compressed datastream in %s chunk";
|
||||
break;
|
||||
}
|
||||
|
||||
png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
|
||||
msg = umsg;
|
||||
#else
|
||||
msg = "Damaged compressed datastream in chunk other than IDAT";
|
||||
#endif
|
||||
}
|
||||
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
|
||||
/* 0 means an error - notice that this code simple ignores
|
||||
* zero length compressed chunks as a result.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Decompress trailing data in a chunk. The assumption is that chunkdata
|
||||
* points at an allocated area holding the contents of a chunk with a
|
||||
|
@ -210,185 +299,107 @@ png_crc_error(png_structp png_ptr)
|
|||
*/
|
||||
void /* PRIVATE */
|
||||
png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
png_size_t chunklength,
|
||||
png_size_t prefix_size, png_size_t *newlength)
|
||||
png_size_t chunklength,
|
||||
png_size_t prefix_size, png_size_t *newlength)
|
||||
{
|
||||
static PNG_CONST char msg[] = "Error decoding compressed chunk";
|
||||
png_charp text;
|
||||
png_size_t text_size;
|
||||
|
||||
if (comp_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
/* The caller should guarantee this */
|
||||
if (prefix_size > chunklength)
|
||||
{
|
||||
int ret = Z_OK;
|
||||
png_ptr->zstream.next_in = (png_bytep)(png_ptr->chunkdata + prefix_size);
|
||||
png_ptr->zstream.avail_in = (uInt)(chunklength - prefix_size);
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
|
||||
text_size = 0;
|
||||
text = NULL;
|
||||
|
||||
while (png_ptr->zstream.avail_in)
|
||||
{
|
||||
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||
{
|
||||
if (png_ptr->zstream.msg != NULL)
|
||||
png_warning(png_ptr, png_ptr->zstream.msg);
|
||||
else
|
||||
png_warning(png_ptr, msg);
|
||||
inflateReset(&png_ptr->zstream);
|
||||
png_ptr->zstream.avail_in = 0;
|
||||
|
||||
if (text == NULL)
|
||||
{
|
||||
text_size = prefix_size + png_sizeof(msg) + 1;
|
||||
text = (png_charp)png_malloc_warn(png_ptr, text_size);
|
||||
if (text == NULL)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_error(png_ptr, "Not enough memory to decompress chunk");
|
||||
}
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
}
|
||||
|
||||
text[text_size - 1] = 0x00;
|
||||
|
||||
/* Copy what we can of the error message into the text chunk */
|
||||
text_size = (png_size_t)(chunklength -
|
||||
(text - png_ptr->chunkdata) - 1);
|
||||
if (text_size > png_sizeof(msg))
|
||||
text_size = png_sizeof(msg);
|
||||
png_memcpy(text + prefix_size, msg, text_size);
|
||||
break;
|
||||
}
|
||||
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
|
||||
{
|
||||
if (text == NULL)
|
||||
{
|
||||
text_size = prefix_size +
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
text = (png_charp)png_malloc_warn(png_ptr, text_size + 1);
|
||||
if (text == NULL)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_error(png_ptr,
|
||||
"Not enough memory to decompress chunk");
|
||||
}
|
||||
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
||||
text_size - prefix_size);
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_charp tmp;
|
||||
|
||||
tmp = text;
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if ((png_ptr->user_chunk_cache_max != 0) &&
|
||||
(--png_ptr->user_chunk_cache_max == 0))
|
||||
{
|
||||
png_warning(png_ptr, "No space in chunk cache");
|
||||
text = NULL;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
#endif
|
||||
text = (png_charp)png_malloc_warn(png_ptr,
|
||||
(png_size_t)(text_size +
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
}
|
||||
#endif
|
||||
if (text == NULL)
|
||||
{
|
||||
png_free(png_ptr, tmp);
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_error(png_ptr,
|
||||
"Not enough memory to decompress chunk");
|
||||
}
|
||||
png_memcpy(text, tmp, text_size);
|
||||
png_free(png_ptr, tmp);
|
||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||
(png_ptr->zbuf_size - png_ptr->zstream.avail_out));
|
||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
if (ret == Z_STREAM_END)
|
||||
break;
|
||||
else
|
||||
{
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
char umsg[52];
|
||||
|
||||
if (ret == Z_BUF_ERROR)
|
||||
png_snprintf(umsg, 52,
|
||||
"Buffer error in compressed datastream in %s chunk",
|
||||
png_ptr->chunk_name);
|
||||
|
||||
else if (ret == Z_DATA_ERROR)
|
||||
png_snprintf(umsg, 52,
|
||||
"Data error in compressed datastream in %s chunk",
|
||||
png_ptr->chunk_name);
|
||||
|
||||
else
|
||||
png_snprintf(umsg, 52,
|
||||
"Incomplete compressed datastream in %s chunk",
|
||||
png_ptr->chunk_name);
|
||||
|
||||
png_warning(png_ptr, umsg);
|
||||
#else
|
||||
png_warning(png_ptr,
|
||||
"Incomplete compressed datastream in chunk other than IDAT");
|
||||
#endif
|
||||
text_size = prefix_size;
|
||||
if (text == NULL)
|
||||
{
|
||||
text = (png_charp)png_malloc_warn(png_ptr, text_size+1);
|
||||
if (text == NULL)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_error(png_ptr, "Not enough memory for text");
|
||||
}
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
}
|
||||
*(text + text_size) = 0x00;
|
||||
}
|
||||
|
||||
inflateReset(&png_ptr->zstream);
|
||||
png_ptr->zstream.avail_in = 0;
|
||||
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
*newlength=text_size;
|
||||
/* The recovery is to delete the chunk. */
|
||||
png_warning(png_ptr, "invalid chunklength");
|
||||
prefix_size = 0; /* To delete everything */
|
||||
}
|
||||
|
||||
else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
{
|
||||
png_size_t expanded_size = png_inflate(png_ptr,
|
||||
(png_bytep)(png_ptr->chunkdata + prefix_size),
|
||||
chunklength - prefix_size,
|
||||
0/*output*/, 0/*output size*/);
|
||||
|
||||
/* Now check the limits on this chunk - if the limit fails the
|
||||
* compressed data will be removed, the prefix will remain.
|
||||
*/
|
||||
#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max &&
|
||||
(prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1))
|
||||
#else
|
||||
if ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
|
||||
prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
|
||||
#endif
|
||||
png_warning(png_ptr, "Exceeded size limit while expanding chunk");
|
||||
|
||||
/* If the size is zero either there was an error and a message
|
||||
* 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)
|
||||
{
|
||||
/* Success (maybe) - really uncompress the chunk. */
|
||||
png_size_t new_size = 0;
|
||||
png_charp text = png_malloc_warn(png_ptr,
|
||||
prefix_size + expanded_size + 1);
|
||||
|
||||
if (text != NULL)
|
||||
{
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
new_size = png_inflate(png_ptr,
|
||||
(png_bytep)(png_ptr->chunkdata + prefix_size),
|
||||
chunklength - prefix_size,
|
||||
(png_bytep)(text + prefix_size), expanded_size);
|
||||
text[prefix_size + expanded_size] = 0; /* just in case */
|
||||
|
||||
if (new_size == expanded_size)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
*newlength = prefix_size + expanded_size;
|
||||
return; /* The success return! */
|
||||
}
|
||||
|
||||
png_warning(png_ptr, "png_inflate logic error");
|
||||
png_free(png_ptr, text);
|
||||
}
|
||||
else
|
||||
png_warning(png_ptr, "Not enough memory to decompress chunk");
|
||||
}
|
||||
}
|
||||
|
||||
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
char umsg[50];
|
||||
|
||||
png_snprintf(umsg, 50, "Unknown zTXt compression type %d", comp_type);
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d", comp_type);
|
||||
png_warning(png_ptr, umsg);
|
||||
#else
|
||||
png_warning(png_ptr, "Unknown zTXt compression type");
|
||||
#endif
|
||||
|
||||
*(png_ptr->chunkdata + prefix_size) = 0x00;
|
||||
*newlength = prefix_size;
|
||||
/* The recovery is to simply drop the data. */
|
||||
}
|
||||
|
||||
/* Generic error return - leave the prefix, delete the compressed
|
||||
* data, reallocate the chunkdata to remove the potentially large
|
||||
* amount of compressed data.
|
||||
*/
|
||||
{
|
||||
png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
|
||||
if (text != NULL)
|
||||
{
|
||||
if (prefix_size > 0)
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
|
||||
/* This is an extra zero in the 'uncompressed' part. */
|
||||
*(png_ptr->chunkdata + prefix_size) = 0x00;
|
||||
}
|
||||
/* Ignore a malloc error here - it is safe. */
|
||||
}
|
||||
|
||||
*newlength = prefix_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1109,6 +1120,18 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = NULL;
|
||||
png_warning(png_ptr, "Ignoring truncated iCCP profile");
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
{
|
||||
char umsg[50];
|
||||
|
||||
png_snprintf(umsg, 50, "declared profile size = %lu",
|
||||
(unsigned long)profile_size);
|
||||
png_warning(png_ptr, umsg);
|
||||
png_snprintf(umsg, 50, "actual profile length = %lu",
|
||||
(unsigned long)profile_length);
|
||||
png_warning(png_ptr, umsg);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1135,7 +1158,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_debug(1, "in png_handle_sPLT");
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
|
||||
if (png_ptr->user_chunk_cache_max != 0)
|
||||
{
|
||||
|
@ -1185,7 +1208,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_ptr->chunkdata[slength] = 0x00;
|
||||
|
||||
for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; entry_start++)
|
||||
for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start;
|
||||
entry_start++)
|
||||
/* Empty loop to find end of name */ ;
|
||||
++entry_start;
|
||||
|
||||
|
@ -1939,7 +1963,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_debug(1, "in png_handle_tEXt");
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_cache_max != 0)
|
||||
{
|
||||
if (png_ptr->user_chunk_cache_max == 1)
|
||||
|
@ -2041,7 +2065,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_debug(1, "in png_handle_zTXt");
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_cache_max != 0)
|
||||
{
|
||||
if (png_ptr->user_chunk_cache_max == 1)
|
||||
|
@ -2162,7 +2186,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_debug(1, "in png_handle_iTXt");
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_cache_max != 0)
|
||||
{
|
||||
if (png_ptr->user_chunk_cache_max == 1)
|
||||
|
@ -2306,7 +2330,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_debug(1, "in png_handle_unknown");
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_cache_max != 0)
|
||||
{
|
||||
if (png_ptr->user_chunk_cache_max == 1)
|
||||
|
@ -2361,7 +2385,8 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_memcpy((png_charp)png_ptr->unknown_chunk.name,
|
||||
(png_charp)png_ptr->chunk_name,
|
||||
png_sizeof(png_ptr->unknown_chunk.name));
|
||||
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0';
|
||||
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1]
|
||||
= '\0';
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length;
|
||||
if (length == 0)
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
|
@ -2833,7 +2858,8 @@ png_do_read_interlace(png_structp png_ptr)
|
|||
default:
|
||||
{
|
||||
png_size_t pixel_bytes = (row_info->pixel_depth >> 3);
|
||||
png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes;
|
||||
png_bytep sp = row + (png_size_t)(row_info->width - 1)
|
||||
* pixel_bytes;
|
||||
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
||||
|
||||
int jstop = png_pass_inc[pass];
|
||||
|
@ -3028,9 +3054,6 @@ png_read_finish_row(png_structp png_ptr)
|
|||
png_pass_start[png_ptr->pass]) /
|
||||
png_pass_inc[png_ptr->pass];
|
||||
|
||||
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||
png_ptr->iwidth) + 1;
|
||||
|
||||
if (!(png_ptr->transformations & PNG_INTERLACE))
|
||||
{
|
||||
png_ptr->num_rows = (png_ptr->height +
|
||||
|
@ -3155,16 +3178,12 @@ png_read_start_row(png_structp png_ptr)
|
|||
png_pass_inc[png_ptr->pass] - 1 -
|
||||
png_pass_start[png_ptr->pass]) /
|
||||
png_pass_inc[png_ptr->pass];
|
||||
|
||||
png_ptr->irowbytes =
|
||||
PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1;
|
||||
}
|
||||
else
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
{
|
||||
png_ptr->num_rows = png_ptr->height;
|
||||
png_ptr->iwidth = png_ptr->width;
|
||||
png_ptr->irowbytes = png_ptr->rowbytes + 1;
|
||||
}
|
||||
max_pixel_depth = png_ptr->pixel_depth;
|
||||
|
||||
|
@ -3329,7 +3348,8 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||
png_debug1(3, "iwidth = %lu,", png_ptr->iwidth);
|
||||
png_debug1(3, "num_rows = %lu,", png_ptr->num_rows);
|
||||
png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes);
|
||||
png_debug1(3, "irowbytes = %lu", png_ptr->irowbytes);
|
||||
png_debug1(3, "irowbytes = %lu",
|
||||
PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
|
||||
|
||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -1093,7 +1093,6 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_compression_buffer_size(png_structp png_ptr,
|
||||
png_size_t size)
|
||||
|
@ -1106,7 +1105,6 @@ png_set_compression_buffer_size(png_structp png_ptr,
|
|||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
||||
|
@ -1132,18 +1130,24 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
|
|||
png_ptr->user_width_max = user_width_max;
|
||||
png_ptr->user_height_max = user_height_max;
|
||||
}
|
||||
|
||||
/* This function was added to libpng 1.4.0 */
|
||||
void PNGAPI
|
||||
png_set_chunk_cache_max (png_structp png_ptr,
|
||||
png_uint_32 user_chunk_cache_max)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
||||
if (user_chunk_cache_max == 0x7fffffffL) /* Unlimited */
|
||||
png_ptr->user_chunk_cache_max = 0;
|
||||
else
|
||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max + 1;
|
||||
if (png_ptr)
|
||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
||||
}
|
||||
|
||||
/* This function was added to libpng 1.4.1 */
|
||||
void PNGAPI
|
||||
png_set_chunk_malloc_max (png_structp png_ptr,
|
||||
png_alloc_size_t user_chunk_malloc_max)
|
||||
{
|
||||
if (png_ptr)
|
||||
png_ptr->user_chunk_malloc_max =
|
||||
(png_size_t)user_chunk_malloc_max;
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
|||
/* Write PNG signature */
|
||||
png_write_sig(png_ptr);
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
|
||||
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \
|
||||
(png_ptr->mng_features_permitted))
|
||||
{
|
||||
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
|
||||
png_ptr->mng_features_permitted = 0;
|
||||
|
@ -680,9 +681,11 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined");
|
||||
#endif
|
||||
#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
|
||||
defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined");
|
||||
png_warning(png_ptr,
|
||||
"PNG_WRITE_PACKSWAP_SUPPORTED is not defined");
|
||||
#endif
|
||||
#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
|
||||
if (png_ptr->transformations & PNG_PACK)
|
||||
|
@ -936,7 +939,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
|||
{
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||
|
||||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
if (png_ptr->num_chunk_list)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -30,7 +30,8 @@ png_do_write_transformations(png_structp png_ptr)
|
|||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
if (png_ptr->write_user_transform_fn != NULL)
|
||||
(*(png_ptr->write_user_transform_fn)) /* User write transform function */
|
||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||
function */
|
||||
(png_ptr, /* png_ptr */
|
||||
&(png_ptr->row_info), /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.1 [February 25, 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.)
|
||||
|
@ -436,7 +436,8 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||
case 4:
|
||||
case 8:
|
||||
case 16: png_ptr->channels = 1; break;
|
||||
default: png_error(png_ptr, "Invalid bit depth for grayscale image");
|
||||
default: png_error(png_ptr,
|
||||
"Invalid bit depth for grayscale image");
|
||||
}
|
||||
break;
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
|
@ -639,7 +640,9 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
|
|||
png_write_chunk_data(png_ptr, buf, (png_size_t)3);
|
||||
}
|
||||
#else
|
||||
/* This is a little slower but some buggy compilers need to do this instead */
|
||||
/* This is a little slower but some buggy compilers need to do this
|
||||
* instead
|
||||
*/
|
||||
pal_ptr=palette;
|
||||
for (i = 0; i < num_pal; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue