updated libpng to 1.2.18, thanks Fredrik!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21367 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e652af1f63
commit
53fa6fbc76
@ -1,15 +1,15 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.2.12 - June 27, 2006
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* libpng version 1.2.18 - May 15, 2007
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*
|
||||
* 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.2.12 - June 27, 2006: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.2.18 - May 15, 2007: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -126,6 +126,30 @@
|
||||
* 1.2.11 13 10211 12.so.0.11[.0]
|
||||
* 1.0.20 10 10020 10.so.0.20[.0]
|
||||
* 1.2.12 13 10212 12.so.0.12[.0]
|
||||
* 1.2.13beta1 13 10213 12.so.0.13[.0]
|
||||
* 1.0.21 10 10021 10.so.0.21[.0]
|
||||
* 1.2.13 13 10213 12.so.0.13[.0]
|
||||
* 1.2.14beta1-2 13 10214 12.so.0.14[.0]
|
||||
* 1.0.22rc1 10 10022 10.so.0.22[.0]
|
||||
* 1.2.14rc1 13 10214 12.so.0.14[.0]
|
||||
* 1.0.22 10 10022 10.so.0.22[.0]
|
||||
* 1.2.14 13 10214 12.so.0.14[.0]
|
||||
* 1.2.15beta1-6 13 10215 12.so.0.15[.0]
|
||||
* 1.0.23rc1-5 10 10023 10.so.0.23[.0]
|
||||
* 1.2.15rc1-5 13 10215 12.so.0.15[.0]
|
||||
* 1.0.23 10 10023 10.so.0.23[.0]
|
||||
* 1.2.15 13 10215 12.so.0.15[.0]
|
||||
* 1.2.16beta1-2 13 10216 12.so.0.16[.0]
|
||||
* 1.2.16rc1 13 10216 12.so.0.16[.0]
|
||||
* 1.0.24 10 10024 10.so.0.24[.0]
|
||||
* 1.2.16 13 10216 12.so.0.16[.0]
|
||||
* 1.2.17beta1-2 13 10217 12.so.0.17[.0]
|
||||
* 1.0.25rc1 10 10025 10.so.0.25[.0]
|
||||
* 1.2.17rc1-3 13 10217 12.so.0.17[.0]
|
||||
* 1.0.25 10 10025 10.so.0.25[.0]
|
||||
* 1.2.17 13 10217 12.so.0.17[.0]
|
||||
* 1.0.26 10 10026 10.so.0.26[.0]
|
||||
* 1.2.18 13 10218 12.so.0.18[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -155,8 +179,8 @@
|
||||
* If you modify libpng you may insert additional notices immediately following
|
||||
* this sentence.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.2.12, June 27, 2006, are
|
||||
* Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are
|
||||
* Copyright (c) 2004, 2006-2007 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:
|
||||
*
|
||||
@ -267,13 +291,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* June 27, 2006
|
||||
* May 15, 2007
|
||||
*
|
||||
* 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.2.12 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.2.18 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
|
||||
@ -329,9 +353,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.2.12"
|
||||
#define PNG_LIBPNG_VER_STRING "1.2.18"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.2.12 - June 27, 2006 (header)\n"
|
||||
" libpng version 1.2.18 - May 15, 2007 (header)\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 0
|
||||
#define PNG_LIBPNG_VER_DLLNUM 13
|
||||
@ -339,7 +363,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 2
|
||||
#define PNG_LIBPNG_VER_RELEASE 12
|
||||
#define PNG_LIBPNG_VER_RELEASE 18
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||
|
||||
@ -367,7 +391,7 @@
|
||||
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
||||
* 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 10212 /* 1.2.12 */
|
||||
#define PNG_LIBPNG_VER 10218 /* 1.2.18 */
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* include the compression library's header */
|
||||
@ -1334,10 +1358,14 @@ struct png_struct_def
|
||||
#endif
|
||||
|
||||
/* New members added in libpng-1.2.0 */
|
||||
#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
# if !defined(PNG_1_0_X)
|
||||
# if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
png_byte mmx_bitdepth_threshold;
|
||||
png_uint_32 mmx_rowbytes_threshold;
|
||||
# endif
|
||||
png_uint_32 asm_flags;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
|
||||
@ -1367,13 +1395,18 @@ struct png_struct_def
|
||||
png_uint_32 user_height_max;
|
||||
#endif
|
||||
|
||||
/* New member added in libpng-1.0.25 and 1.2.17 */
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* storage for unknown chunk that the library doesn't recognize. */
|
||||
png_unknown_chunk unknown_chunk;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* 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_2_12;
|
||||
typedef png_structp version_1_2_18;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@ -2369,7 +2402,7 @@ extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
|
||||
handling or default unknown chunk handling is not desired. Any chunks not
|
||||
listed will be handled in the default manner. The IHDR and IEND chunks
|
||||
must not be listed.
|
||||
keep = 0: follow default behavour
|
||||
keep = 0: follow default behaviour
|
||||
= 1: do not keep
|
||||
= 2: keep only if safe-to-copy
|
||||
= 3: keep even if unsafe-to-copy
|
||||
@ -2479,6 +2512,7 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
|
||||
|
||||
/* Added to version 1.2.0 */
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
|
||||
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
|
||||
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
|
||||
@ -2504,6 +2538,7 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
|
||||
|
||||
#define PNG_SELECT_READ 1
|
||||
#define PNG_SELECT_WRITE 2
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
/* pngget.c */
|
||||
@ -2536,11 +2571,11 @@ extern PNG_EXPORT(void,png_set_mmx_thresholds)
|
||||
png_uint_32 mmx_rowbytes_threshold));
|
||||
|
||||
#endif /* PNG_1_0_X */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
/* png.c, pnggccrd.c, or pngvcrd.c */
|
||||
extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
/* Strip the prepended error numbers ("#nnn ") from error and warning
|
||||
* messages before passing them to the error or warning handler. */
|
||||
@ -2648,16 +2683,21 @@ extern PNG_EXPORT(void,png_save_uint_16)
|
||||
* be found in the files where the functions are located.
|
||||
*/
|
||||
|
||||
#if defined(PNG_INTERNAL)
|
||||
|
||||
/* Various modes of operation. Note that after an init, mode is set to
|
||||
* zero automatically when the structure is created.
|
||||
/* Various modes of operation, that are visible to applications because
|
||||
* they are used for unknown chunk location.
|
||||
*/
|
||||
#define PNG_HAVE_IHDR 0x01
|
||||
#define PNG_HAVE_PLTE 0x02
|
||||
#define PNG_HAVE_IDAT 0x04
|
||||
#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
|
||||
#define PNG_HAVE_IEND 0x10
|
||||
|
||||
#if defined(PNG_INTERNAL)
|
||||
|
||||
/* More modes of operation. Note that after an init, mode is set to
|
||||
* zero automatically when the structure is created.
|
||||
*/
|
||||
#define PNG_HAVE_gAMA 0x20
|
||||
#define PNG_HAVE_cHRM 0x40
|
||||
#define PNG_HAVE_sRGB 0x80
|
||||
@ -3442,9 +3482,11 @@ PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
|
||||
#endif
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
/* png.c */ /* PRIVATE */
|
||||
PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.2.12 - June 27, 2006
|
||||
* libpng version 1.2.18 - May 15, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*/
|
||||
@ -721,11 +721,22 @@
|
||||
#endif
|
||||
|
||||
/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
|
||||
even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
|
||||
* even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined.
|
||||
*
|
||||
* PNG_NO_ASSEMBLER_CODE disables use of all assembler code and optimized C,
|
||||
* and removes or includes several functions in the API.
|
||||
*
|
||||
* PNG_NO_MMX_CODE disables the use of MMX code without changing the API.
|
||||
* When MMX code is off, then optimized C replacement functions are used.
|
||||
*/
|
||||
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
|
||||
# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
# define PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
# endif
|
||||
# if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE)
|
||||
/* work around Intel-Mac compiler bug */
|
||||
# define PNG_NO_MMX_CODE
|
||||
# endif
|
||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \
|
||||
defined(__MMX__)
|
||||
# define PNG_MMX_CODE_SUPPORTED
|
||||
@ -1447,9 +1458,9 @@ typedef z_stream FAR * png_zstreamp;
|
||||
* MMX will be detected at run time and used if present.
|
||||
*/
|
||||
#ifdef PNG_USE_PNGVCRD
|
||||
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
# define PNG_HAVE_MMX_COMBINE_ROW
|
||||
# define PNG_HAVE_MMX_READ_INTERLACE
|
||||
# define PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
#endif
|
||||
|
||||
/* Set this in the makefile for gcc/as on Pentium, not here. */
|
||||
@ -1457,9 +1468,9 @@ typedef z_stream FAR * png_zstreamp;
|
||||
* MMX will be detected at run time and used if present.
|
||||
*/
|
||||
#ifdef PNG_USE_PNGGCCRD
|
||||
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
# define PNG_HAVE_MMX_COMBINE_ROW
|
||||
# define PNG_HAVE_MMX_READ_INTERLACE
|
||||
# define PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
#endif
|
||||
/* - see pnggccrd.c for info about what is currently enabled */
|
||||
|
||||
|
@ -3,7 +3,7 @@ SubDir HAIKU_TOP src libs png ;
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UseLibraryHeaders zlib ;
|
||||
UseLibraryHeaders png zlib ;
|
||||
|
||||
local shared_files =
|
||||
png.c
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.17 May 15, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*/
|
||||
@ -13,7 +13,7 @@
|
||||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_2_12 Your_png_h_is_not_version_1_2_12;
|
||||
typedef version_1_2_18 Your_png_h_is_not_version_1_2_18;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
@ -68,7 +68,7 @@ const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* width of interlace block (used in assembler routines only) */
|
||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
#ifdef PNG_HAVE_MMX_COMBINE_ROW
|
||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
||||
#endif
|
||||
|
||||
@ -97,6 +97,7 @@ const int FARDATA png_pass_dsp_mask[]
|
||||
void PNGAPI
|
||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_debug(1, "in png_set_sig_bytes\n");
|
||||
if (num_bytes > 8)
|
||||
png_error(png_ptr, "Too many bytes for PNG signature.");
|
||||
@ -153,13 +154,14 @@ voidpf /* private */
|
||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
{
|
||||
png_voidp ptr;
|
||||
png_structp p=png_ptr;
|
||||
png_structp p=(png_structp)png_ptr;
|
||||
png_uint_32 save_flags=p->flags;
|
||||
png_uint_32 num_bytes;
|
||||
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
if (items > PNG_UINT_32_MAX/size)
|
||||
{
|
||||
png_warning (png_ptr, "Potential overflow in png_zalloc()");
|
||||
png_warning (p, "Potential overflow in png_zalloc()");
|
||||
return (NULL);
|
||||
}
|
||||
num_bytes = (png_uint_32)items * size;
|
||||
@ -266,6 +268,7 @@ void PNGAPI
|
||||
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
||||
{
|
||||
png_infop info_ptr = NULL;
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
png_debug(1, "in png_destroy_info_struct\n");
|
||||
if (info_ptr_ptr != NULL)
|
||||
@ -304,6 +307,8 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
||||
{
|
||||
png_infop info_ptr = *ptr_ptr;
|
||||
|
||||
if(info_ptr == NULL) return;
|
||||
|
||||
png_debug(1, "in png_info_init_3\n");
|
||||
|
||||
if(png_sizeof(png_info) > png_info_struct_size)
|
||||
@ -485,6 +490,11 @@ if (mask & PNG_FREE_SPLT)
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if(png_ptr->unknown_chunk.data)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
#ifdef PNG_FREE_ME_SUPPORTED
|
||||
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
|
||||
#else
|
||||
@ -611,6 +621,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
||||
png_voidp PNGAPI
|
||||
png_get_io_ptr(png_structp png_ptr)
|
||||
{
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
return (png_ptr->io_ptr);
|
||||
}
|
||||
|
||||
@ -626,6 +637,7 @@ void PNGAPI
|
||||
png_init_io(png_structp png_ptr, png_FILE_p fp)
|
||||
{
|
||||
png_debug(1, "in png_init_io\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->io_ptr = (png_voidp)fp;
|
||||
}
|
||||
#endif
|
||||
@ -641,6 +653,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
if (png_ptr->time_buffer == NULL)
|
||||
{
|
||||
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
||||
@ -693,8 +706,8 @@ png_charp PNGAPI
|
||||
png_get_copyright(png_structp png_ptr)
|
||||
{
|
||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) "\n libpng version 1.2.12 - June 27, 2006\n\
|
||||
Copyright (c) 1998-2006 Glenn Randers-Pehrson\n\
|
||||
return ((png_charp) "\n libpng version 1.2.18 - May 15, 2007\n\
|
||||
Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\n\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||
return ((png_charp) "");
|
||||
@ -757,6 +770,7 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
||||
int PNGAPI
|
||||
png_reset_zstream(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr == NULL) return Z_STREAM_ERROR;
|
||||
return (inflateReset(&png_ptr->zstream));
|
||||
}
|
||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||
@ -770,14 +784,14 @@ png_access_version_number(void)
|
||||
}
|
||||
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED)
|
||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if !defined(PNG_1_0_X)
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
/* this INTERNAL function was added to libpng 1.2.0 */
|
||||
void /* PRIVATE */
|
||||
png_init_mmx_flags (png_structp png_ptr)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->mmx_rowbytes_threshold = 0;
|
||||
png_ptr->mmx_bitdepth_threshold = 0;
|
||||
|
||||
@ -787,13 +801,13 @@ png_init_mmx_flags (png_structp png_ptr)
|
||||
|
||||
if (png_mmx_support() > 0) {
|
||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||
# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
# ifdef PNG_HAVE_MMX_COMBINE_ROW
|
||||
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
||||
# endif
|
||||
# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||
# ifdef PNG_HAVE_MMX_READ_INTERLACE
|
||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE
|
||||
# endif
|
||||
# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
# ifndef PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
;
|
||||
# else
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
||||
@ -810,7 +824,7 @@ png_init_mmx_flags (png_structp png_ptr)
|
||||
| PNG_MMX_WRITE_FLAGS );
|
||||
}
|
||||
|
||||
# else /* !((PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */
|
||||
# else /* !(PNGVCRD || PNGGCCRD) */
|
||||
|
||||
/* clear all MMX flags; no support is compiled in */
|
||||
png_ptr->asm_flags &= ~( PNG_MMX_FLAGS );
|
||||
@ -818,18 +832,18 @@ png_init_mmx_flags (png_structp png_ptr)
|
||||
# endif /* ?(PNGVCRD || PNGGCCRD) */
|
||||
}
|
||||
|
||||
#endif /* !(PNG_ASSEMBLER_CODE_SUPPORTED) */
|
||||
#endif /* !(PNG_MMX_CODE_SUPPORTED) */
|
||||
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
#if !defined(PNG_USE_PNGGCCRD) && \
|
||||
!(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
||||
!(defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
||||
int PNGAPI
|
||||
png_mmx_support(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
#endif /* PNG_1_0_X && PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||
|
3481
src/libs/png/png.h
3481
src/libs/png/png.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -113,7 +113,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||
* if the character is invalid.
|
||||
*/
|
||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||
static PNG_CONST char png_digit[16] = {
|
||||
const static PNG_CONST char png_digit[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'A', 'B', 'C', 'D', 'E', 'F'
|
||||
};
|
||||
@ -157,8 +157,11 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
||||
char msg[18+64];
|
||||
if (png_ptr == NULL)
|
||||
png_error(png_ptr, error_message);
|
||||
png_format_buffer(png_ptr, msg, error_message);
|
||||
png_error(png_ptr, msg);
|
||||
else
|
||||
{
|
||||
png_format_buffer(png_ptr, msg, error_message);
|
||||
png_error(png_ptr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
@ -167,8 +170,11 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||
char msg[18+64];
|
||||
if (png_ptr == NULL)
|
||||
png_warning(png_ptr, warning_message);
|
||||
png_format_buffer(png_ptr, msg, warning_message);
|
||||
png_warning(png_ptr, msg);
|
||||
else
|
||||
{
|
||||
png_format_buffer(png_ptr, msg, warning_message);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* This is the default error handling function. Note that replacements for
|
||||
@ -206,6 +212,8 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
if (png_ptr)
|
||||
{
|
||||
# ifdef USE_FAR_KEYWORD
|
||||
{
|
||||
jmp_buf jmpbuf;
|
||||
@ -214,10 +222,9 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
}
|
||||
# else
|
||||
longjmp(png_ptr->jmpbuf, 1);
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
/* make compiler happy */ ;
|
||||
if (png_ptr)
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
#ifdef PNG_NO_CONSOLE_IO
|
||||
|
@ -7,9 +7,9 @@
|
||||
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
|
||||
* for Intel's performance analysis of the MMX vs. non-MMX code.
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998, Intel Corporation
|
||||
*
|
||||
* Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998.
|
||||
@ -245,17 +245,17 @@
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
#if defined(PNG_USE_PNGGCCRD)
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD)
|
||||
|
||||
int PNGAPI png_mmx_support(void);
|
||||
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
static const int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
|
||||
const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
const static int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
|
||||
#endif
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
/* djgpp, Win32, Cygwin, and OS2 add their own underscores to global variables,
|
||||
* so define them without: */
|
||||
#if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__) || \
|
||||
@ -311,30 +311,30 @@ static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
|
||||
static int _unmask;
|
||||
#endif
|
||||
|
||||
static unsigned long long _mask8_0 = 0x0102040810204080LL;
|
||||
const static unsigned long long _mask8_0 = 0x0102040810204080LL;
|
||||
|
||||
static unsigned long long _mask16_1 = 0x0101020204040808LL;
|
||||
static unsigned long long _mask16_0 = 0x1010202040408080LL;
|
||||
const static unsigned long long _mask16_1 = 0x0101020204040808LL;
|
||||
const static unsigned long long _mask16_0 = 0x1010202040408080LL;
|
||||
|
||||
static unsigned long long _mask24_2 = 0x0101010202020404LL;
|
||||
static unsigned long long _mask24_1 = 0x0408080810101020LL;
|
||||
static unsigned long long _mask24_0 = 0x2020404040808080LL;
|
||||
const static unsigned long long _mask24_2 = 0x0101010202020404LL;
|
||||
const static unsigned long long _mask24_1 = 0x0408080810101020LL;
|
||||
const static unsigned long long _mask24_0 = 0x2020404040808080LL;
|
||||
|
||||
static unsigned long long _mask32_3 = 0x0101010102020202LL;
|
||||
static unsigned long long _mask32_2 = 0x0404040408080808LL;
|
||||
static unsigned long long _mask32_1 = 0x1010101020202020LL;
|
||||
static unsigned long long _mask32_0 = 0x4040404080808080LL;
|
||||
const static unsigned long long _mask32_3 = 0x0101010102020202LL;
|
||||
const static unsigned long long _mask32_2 = 0x0404040408080808LL;
|
||||
const static unsigned long long _mask32_1 = 0x1010101020202020LL;
|
||||
const static unsigned long long _mask32_0 = 0x4040404080808080LL;
|
||||
|
||||
static unsigned long long _mask48_5 = 0x0101010101010202LL;
|
||||
static unsigned long long _mask48_4 = 0x0202020204040404LL;
|
||||
static unsigned long long _mask48_3 = 0x0404080808080808LL;
|
||||
static unsigned long long _mask48_2 = 0x1010101010102020LL;
|
||||
static unsigned long long _mask48_1 = 0x2020202040404040LL;
|
||||
static unsigned long long _mask48_0 = 0x4040808080808080LL;
|
||||
const static unsigned long long _mask48_5 = 0x0101010101010202LL;
|
||||
const static unsigned long long _mask48_4 = 0x0202020204040404LL;
|
||||
const static unsigned long long _mask48_3 = 0x0404080808080808LL;
|
||||
const static unsigned long long _mask48_2 = 0x1010101010102020LL;
|
||||
const static unsigned long long _mask48_1 = 0x2020202040404040LL;
|
||||
const static unsigned long long _mask48_0 = 0x4040808080808080LL;
|
||||
|
||||
static unsigned long long _const4 = 0x0000000000FFFFFFLL;
|
||||
//static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED
|
||||
static unsigned long long _const6 = 0x00000000000000FFLL;
|
||||
const static unsigned long long _const4 = 0x0000000000FFFFFFLL;
|
||||
//const static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED
|
||||
const static unsigned long long _const6 = 0x00000000000000FFLL;
|
||||
|
||||
// These are used in the row-filter routines and should/would be local
|
||||
// variables if not for gcc addressing limitations.
|
||||
@ -378,7 +378,7 @@ png_squelch_warnings(void)
|
||||
_mask48_1 = _mask48_1;
|
||||
_mask48_0 = _mask48_0;
|
||||
}
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
|
||||
|
||||
static int _mmx_supported = 2;
|
||||
@ -389,7 +389,7 @@ static int _mmx_supported = 2;
|
||||
/* */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW)
|
||||
#if defined(PNG_HAVE_MMX_COMBINE_ROW)
|
||||
|
||||
#define BPP2 2
|
||||
#define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */
|
||||
@ -416,7 +416,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
{
|
||||
png_debug(1, "in png_combine_row (pnggccrd.c)\n");
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
if (_mmx_supported == 2) {
|
||||
#if !defined(PNG_1_0_X)
|
||||
/* this should have happened in png_init_mmx_flags() already */
|
||||
@ -607,7 +607,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
png_bytep srcptr;
|
||||
png_bytep dstptr;
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||
/* && _mmx_supported */ )
|
||||
@ -700,7 +700,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
);
|
||||
}
|
||||
else /* mmx _not supported - Use modified C routine */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
register png_uint_32 i;
|
||||
png_uint_32 initial_val = png_pass_start[png_ptr->pass];
|
||||
@ -745,7 +745,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
png_bytep srcptr;
|
||||
png_bytep dstptr;
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||
/* && _mmx_supported */ )
|
||||
@ -854,7 +854,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
);
|
||||
}
|
||||
else /* mmx _not supported - Use modified C routine */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
register png_uint_32 i;
|
||||
png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass];
|
||||
@ -898,7 +898,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
png_bytep srcptr;
|
||||
png_bytep dstptr;
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||
/* && _mmx_supported */ )
|
||||
@ -1022,7 +1022,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
);
|
||||
}
|
||||
else /* mmx _not supported - Use modified C routine */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
register png_uint_32 i;
|
||||
png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass];
|
||||
@ -1066,7 +1066,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
png_bytep srcptr;
|
||||
png_bytep dstptr;
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||
/* && _mmx_supported */ )
|
||||
@ -1197,7 +1197,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
);
|
||||
}
|
||||
else /* mmx _not supported - Use modified C routine */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
register png_uint_32 i;
|
||||
png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass];
|
||||
@ -1241,7 +1241,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
png_bytep srcptr;
|
||||
png_bytep dstptr;
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||
/* && _mmx_supported */ )
|
||||
@ -1389,7 +1389,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
);
|
||||
}
|
||||
else /* mmx _not supported - Use modified C routine */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
register png_uint_32 i;
|
||||
png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass];
|
||||
@ -1480,7 +1480,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
|
||||
} /* end png_combine_row() */
|
||||
|
||||
#endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */
|
||||
#endif /* PNG_HAVE_MMX_COMBINE_ROW */
|
||||
|
||||
|
||||
|
||||
@ -1492,7 +1492,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
/*===========================================================================*/
|
||||
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED)
|
||||
#if defined(PNG_HAVE_ASSEMBLER_READ_INTERLACE)
|
||||
#if defined(PNG_HAVE_MMX_READ_INTERLACE)
|
||||
|
||||
/* png_do_read_interlace() is called after any 16-bit to 8-bit conversion
|
||||
* has taken place. [GRR: what other steps come before and/or after?]
|
||||
@ -1510,7 +1510,7 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
|
||||
png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n");
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
if (_mmx_supported == 2) {
|
||||
#if !defined(PNG_1_0_X)
|
||||
/* this should have happened in png_init_mmx_flags() already */
|
||||
@ -1723,7 +1723,7 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
|
||||
/* New code by Nirav Chhatrapati - Intel Corporation */
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)
|
||||
/* && _mmx_supported */ )
|
||||
@ -2628,7 +2628,7 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
/* GRR 19991007: does it? or should pixel_bytes in each
|
||||
* block be replaced with immediate value (e.g., 1)? */
|
||||
/* GRR 19991017: replaced with constants in each case */
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
if (pixel_bytes == 1)
|
||||
{
|
||||
@ -2753,13 +2753,13 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
|
||||
} /* end png_do_read_interlace() */
|
||||
|
||||
#endif /* PNG_HAVE_ASSEMBLER_READ_INTERLACE */
|
||||
#endif /* PNG_HAVE_MMX_READ_INTERLACE */
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
|
||||
|
||||
|
||||
#if defined(PNG_HAVE_ASSEMBLER_READ_FILTER_ROW)
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_HAVE_MMX_READ_FILTER_ROW)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
|
||||
// These variables are utilized in the functions below. They are declared
|
||||
// globally here to ensure alignment on 8-byte boundaries.
|
||||
@ -5066,7 +5066,7 @@ png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
|
||||
|
||||
} // end of png_read_filter_row_mmx_up()
|
||||
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
|
||||
|
||||
|
||||
@ -5088,7 +5088,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
char filnm[10];
|
||||
#endif
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
/* GRR: these are superseded by png_ptr->asm_flags: */
|
||||
#define UseMMX_sub 1 // GRR: converted 20000730
|
||||
#define UseMMX_up 1 // GRR: converted 20000729
|
||||
@ -5102,7 +5102,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
#endif
|
||||
png_mmx_support();
|
||||
}
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
|
||||
#ifdef PNG_DEBUG
|
||||
png_debug(1, "in png_read_filter_row (pnggccrd.c)\n");
|
||||
@ -5111,7 +5111,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
case 0: sprintf(filnm, "none");
|
||||
break;
|
||||
case 1: sprintf(filnm, "sub-%s",
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" :
|
||||
#endif
|
||||
@ -5119,7 +5119,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
"x86");
|
||||
break;
|
||||
case 2: sprintf(filnm, "up-%s",
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
#if !defined(PNG_1_0_X)
|
||||
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" :
|
||||
#endif
|
||||
@ -5127,7 +5127,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
"x86");
|
||||
break;
|
||||
case 3: sprintf(filnm, "avg-%s",
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" :
|
||||
#endif
|
||||
@ -5135,7 +5135,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
"x86");
|
||||
break;
|
||||
case 4: sprintf(filnm, "Paeth-%s",
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":
|
||||
#endif
|
||||
@ -5158,7 +5158,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
break;
|
||||
|
||||
case PNG_FILTER_VALUE_SUB:
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
|
||||
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||
@ -5170,7 +5170,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
png_read_filter_row_mmx_sub(row_info, row);
|
||||
}
|
||||
else
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
png_uint_32 i;
|
||||
png_uint_32 istop = row_info->rowbytes;
|
||||
@ -5187,7 +5187,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
break;
|
||||
|
||||
case PNG_FILTER_VALUE_UP:
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
|
||||
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||
@ -5199,7 +5199,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
png_read_filter_row_mmx_up(row_info, row, prev_row);
|
||||
}
|
||||
else
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
png_uint_32 i;
|
||||
png_uint_32 istop = row_info->rowbytes;
|
||||
@ -5215,7 +5215,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
break;
|
||||
|
||||
case PNG_FILTER_VALUE_AVG:
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
|
||||
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||
@ -5227,7 +5227,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
png_read_filter_row_mmx_avg(row_info, row, prev_row);
|
||||
}
|
||||
else
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
png_uint_32 i;
|
||||
png_bytep rp = row;
|
||||
@ -5253,7 +5253,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
break;
|
||||
|
||||
case PNG_FILTER_VALUE_PAETH:
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK)
|
||||
#if !defined(PNG_1_0_X)
|
||||
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
|
||||
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||
@ -5265,7 +5265,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
png_read_filter_row_mmx_paeth(row_info, row, prev_row);
|
||||
}
|
||||
else
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
{
|
||||
png_uint_32 i;
|
||||
png_bytep rp = row;
|
||||
@ -5326,7 +5326,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
|
||||
#endif /* PNG_HAVE_MMX_READ_FILTER_ROW */
|
||||
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*/
|
||||
@ -829,19 +829,24 @@ png_get_compression_buffer_size(png_structp png_ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PNG_1_0_X
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
#ifndef PNG_1_0_X
|
||||
/* this function was added to libpng 1.2.0 and should exist by default */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_asm_flags (png_structp png_ptr)
|
||||
{
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L);
|
||||
#else
|
||||
return (png_ptr? 0L: 0L);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* this function was added to libpng 1.2.0 and should exist by default */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_asm_flagmask (int flag_select)
|
||||
{
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_uint_32 settable_asm_flags = 0;
|
||||
|
||||
if (flag_select & PNG_SELECT_READ)
|
||||
@ -862,16 +867,18 @@ png_get_asm_flagmask (int flag_select)
|
||||
#endif /* 0 */
|
||||
|
||||
return settable_asm_flags; /* _theoretically_ settable capabilities only */
|
||||
#else
|
||||
return (0L);
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
|
||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_mmx_flagmask (int flag_select, int *compilerID)
|
||||
{
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
png_uint_32 settable_mmx_flags = 0;
|
||||
|
||||
if (flag_select & PNG_SELECT_READ)
|
||||
@ -902,23 +909,34 @@ png_get_mmx_flagmask (int flag_select, int *compilerID)
|
||||
}
|
||||
|
||||
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
|
||||
#else
|
||||
return (0L);
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
png_byte PNGAPI
|
||||
png_get_mmx_bitdepth_threshold (png_structp png_ptr)
|
||||
{
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0);
|
||||
#else
|
||||
return (png_ptr? 0: 0);
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
png_uint_32 PNGAPI
|
||||
png_get_mmx_rowbytes_threshold (png_structp png_ptr)
|
||||
{
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
|
||||
#else
|
||||
return (png_ptr? 0L: 0L);
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* ?PNG_1_0_X */
|
||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
/* these functions were added to libpng 1.2.6 */
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -137,6 +137,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||
png_voidp ret;
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
if (png_ptr == NULL || size == 0)
|
||||
return (NULL);
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (size > (png_uint_32)65536L)
|
||||
{
|
||||
@ -290,6 +293,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
if (png_ptr->offset_table != NULL)
|
||||
{
|
||||
int i;
|
||||
@ -536,8 +541,10 @@ png_voidp PNGAPI
|
||||
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
|
||||
{
|
||||
png_voidp ptr;
|
||||
png_uint_32 save_flags=png_ptr->flags;
|
||||
png_uint_32 save_flags;
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
|
||||
save_flags=png_ptr->flags;
|
||||
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
|
||||
png_ptr->flags=save_flags;
|
||||
@ -580,9 +587,11 @@ void PNGAPI
|
||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||
malloc_fn, png_free_ptr free_fn)
|
||||
{
|
||||
if(png_ptr != NULL) {
|
||||
png_ptr->mem_ptr = mem_ptr;
|
||||
png_ptr->malloc_fn = malloc_fn;
|
||||
png_ptr->free_fn = free_fn;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function returns a pointer to the mem_ptr associated with the user
|
||||
@ -592,6 +601,7 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||
png_voidp PNGAPI
|
||||
png_get_mem_ptr(png_structp png_ptr)
|
||||
{
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
return ((png_voidp)png_ptr->mem_ptr);
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.2.11 - June 7, 2004
|
||||
* Last changed in libpng 1.2.17 May 15, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*/
|
||||
@ -28,6 +28,7 @@ void PNGAPI
|
||||
png_process_data(png_structp png_ptr, png_infop info_ptr,
|
||||
png_bytep buffer, png_size_t buffer_size)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_push_restore_buffer(png_ptr, buffer, buffer_size);
|
||||
|
||||
while (png_ptr->buffer_size)
|
||||
@ -42,6 +43,7 @@ png_process_data(png_structp png_ptr, png_infop info_ptr,
|
||||
void /* PRIVATE */
|
||||
png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
switch (png_ptr->process_mode)
|
||||
{
|
||||
case PNG_READ_SIG_MODE:
|
||||
@ -561,6 +563,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
{
|
||||
png_bytep ptr;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
ptr = buffer;
|
||||
if (png_ptr->save_buffer_size)
|
||||
{
|
||||
@ -1485,8 +1488,6 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
|
||||
{
|
||||
png_unknown_chunk chunk;
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (length > (png_uint_32)65535L)
|
||||
{
|
||||
@ -1495,28 +1496,35 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length = (png_uint_32)65535L;
|
||||
}
|
||||
#endif
|
||||
|
||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||
png_crc_read(png_ptr, chunk.data, length);
|
||||
chunk.size = length;
|
||||
png_strcpy((png_charp)png_ptr->unknown_chunk.name,
|
||||
(png_charp)png_ptr->chunk_name);
|
||||
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
if(png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
/* callback to user unknown chunk handler */
|
||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||
int ret;
|
||||
ret = (*(png_ptr->read_user_chunk_fn))
|
||||
(png_ptr, &png_ptr->unknown_chunk);
|
||||
if (ret < 0)
|
||||
png_chunk_error(png_ptr, "error in user chunk");
|
||||
if (ret == 0)
|
||||
{
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS)
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
}
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
}
|
||||
else
|
||||
#else
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
|
||||
#endif
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
png_free(png_ptr, chunk.data);
|
||||
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -1554,6 +1562,7 @@ png_progressive_combine_row (png_structp png_ptr,
|
||||
const int FARDATA png_pass_dsp_mask[7] =
|
||||
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
#endif
|
||||
if(png_ptr == NULL) return;
|
||||
if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */
|
||||
png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
|
||||
}
|
||||
@ -1563,6 +1572,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
||||
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
||||
png_progressive_end_ptr end_fn)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->info_fn = info_fn;
|
||||
png_ptr->row_fn = row_fn;
|
||||
png_ptr->end_fn = end_fn;
|
||||
@ -1573,6 +1583,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
||||
png_voidp PNGAPI
|
||||
png_get_progressive_ptr(png_structp png_ptr)
|
||||
{
|
||||
if(png_ptr == NULL) return (NULL);
|
||||
return png_ptr->io_ptr;
|
||||
}
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.11 June 7, 2006
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*
|
||||
@ -56,7 +56,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
return (NULL);
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
@ -188,6 +188,7 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_size_t png_struct_size, png_size_t png_info_size)
|
||||
{
|
||||
/* We only come here via pre-1.0.12-compiled applications */
|
||||
if(png_ptr == NULL) return;
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
if(png_sizeof(png_struct) > png_struct_size ||
|
||||
png_sizeof(png_info) > png_info_size)
|
||||
@ -239,6 +240,8 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
|
||||
png_structp png_ptr=*ptr_ptr;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
do
|
||||
{
|
||||
if(user_png_ver[i] != png_libpng_ver[i])
|
||||
@ -317,6 +320,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
void PNGAPI
|
||||
png_read_info(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_debug(1, "in png_read_info\n");
|
||||
/* If we haven't checked all of the PNG signature bytes, do so now. */
|
||||
if (png_ptr->sig_bytes < 8)
|
||||
@ -533,6 +537,7 @@ void PNGAPI
|
||||
png_read_update_info(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
png_debug(1, "in png_read_update_info\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
|
||||
png_read_start_row(png_ptr);
|
||||
else
|
||||
@ -551,6 +556,7 @@ void PNGAPI
|
||||
png_start_read_image(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_start_read_image\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
|
||||
png_read_start_row(png_ptr);
|
||||
}
|
||||
@ -566,6 +572,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
#endif
|
||||
int ret;
|
||||
if(png_ptr == NULL) return;
|
||||
png_debug2(1, "in png_read_row (row %lu, pass %d)\n",
|
||||
png_ptr->row_number, png_ptr->pass);
|
||||
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
|
||||
@ -824,6 +831,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
||||
png_bytepp dp;
|
||||
|
||||
png_debug(1, "in png_read_rows\n");
|
||||
if(png_ptr == NULL) return;
|
||||
rp = row;
|
||||
dp = display_row;
|
||||
if (rp != NULL && dp != NULL)
|
||||
@ -872,6 +880,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
|
||||
png_bytepp rp;
|
||||
|
||||
png_debug(1, "in png_read_image\n");
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
pass = png_set_interlace_handling(png_ptr);
|
||||
@ -910,6 +919,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
|
||||
png_uint_32 length;
|
||||
|
||||
png_debug(1, "in png_read_end\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
|
||||
|
||||
do
|
||||
@ -1300,6 +1310,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
||||
void PNGAPI
|
||||
png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->read_row_fn = read_row_fn;
|
||||
}
|
||||
|
||||
@ -1313,6 +1324,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
{
|
||||
int row;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
|
||||
/* invert the alpha channel from opacity to transparency
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -46,6 +46,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
@ -76,6 +77,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_byte *n_data;
|
||||
png_FILE_p io_ptr;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
/* Check if data really is near. If so, use usual code. */
|
||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||
@ -136,6 +138,7 @@ void PNGAPI
|
||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||
png_rw_ptr read_data_fn)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->io_ptr = io_ptr;
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.2.11 June 15, 2006
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*
|
||||
@ -24,6 +24,7 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
|
||||
{
|
||||
png_debug(1, "in png_set_crc_action\n");
|
||||
/* Tell libpng how we react to CRC errors in critical chunks */
|
||||
if(png_ptr == NULL) return;
|
||||
switch (crit_action)
|
||||
{
|
||||
case PNG_CRC_NO_CHANGE: /* leave setting as is */
|
||||
@ -80,6 +81,7 @@ png_set_background(png_structp png_ptr,
|
||||
int need_expand, double background_gamma)
|
||||
{
|
||||
png_debug(1, "in png_set_background\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
|
||||
{
|
||||
png_warning(png_ptr, "Application must supply a known background gamma");
|
||||
@ -92,17 +94,6 @@ png_set_background(png_structp png_ptr,
|
||||
png_ptr->background_gamma = (float)background_gamma;
|
||||
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
|
||||
png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0);
|
||||
|
||||
/* Note: if need_expand is set and color_type is either RGB or RGB_ALPHA
|
||||
* (in which case need_expand is superfluous anyway), the background color
|
||||
* might actually be gray yet not be flagged as such. This is not a problem
|
||||
* for the current code, which uses PNG_BACKGROUND_IS_GRAY only to
|
||||
* decide when to do the png_do_gray_to_rgb() transformation.
|
||||
*/
|
||||
if ((need_expand && !(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) ||
|
||||
(!need_expand && background_color->red == background_color->green &&
|
||||
background_color->red == background_color->blue))
|
||||
png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -112,6 +103,7 @@ void PNGAPI
|
||||
png_set_strip_16(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_strip_16\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_16_TO_8;
|
||||
}
|
||||
#endif
|
||||
@ -121,6 +113,7 @@ void PNGAPI
|
||||
png_set_strip_alpha(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_strip_alpha\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
|
||||
}
|
||||
#endif
|
||||
@ -150,6 +143,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
int full_dither)
|
||||
{
|
||||
png_debug(1, "in png_set_dither\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_DITHER;
|
||||
|
||||
if (!full_dither)
|
||||
@ -533,6 +527,7 @@ void PNGAPI
|
||||
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
|
||||
{
|
||||
png_debug(1, "in png_set_gamma\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
|
||||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
|
||||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
|
||||
@ -551,6 +546,7 @@ void PNGAPI
|
||||
png_set_expand(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_expand\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
||||
}
|
||||
|
||||
@ -576,6 +572,7 @@ void PNGAPI
|
||||
png_set_palette_to_rgb(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_palette_to_rgb\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
||||
}
|
||||
|
||||
@ -585,7 +582,8 @@ void PNGAPI
|
||||
png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n");
|
||||
png_ptr->transformations |= PNG_EXPAND_tRNS;
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_EXPAND;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -596,6 +594,7 @@ void PNGAPI
|
||||
png_set_gray_1_2_4_to_8(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_gray_1_2_4_to_8\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
||||
}
|
||||
#endif
|
||||
@ -631,6 +630,7 @@ png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
|
||||
{
|
||||
int red_fixed = (int)((float)red*100000.0 + 0.5);
|
||||
int green_fixed = (int)((float)green*100000.0 + 0.5);
|
||||
if(png_ptr == NULL) return;
|
||||
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
|
||||
}
|
||||
#endif
|
||||
@ -640,6 +640,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
|
||||
png_fixed_point red, png_fixed_point green)
|
||||
{
|
||||
png_debug(1, "in png_set_rgb_to_gray\n");
|
||||
if(png_ptr == NULL) return;
|
||||
switch(error_action)
|
||||
{
|
||||
case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY;
|
||||
@ -690,6 +691,7 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
|
||||
read_user_transform_fn)
|
||||
{
|
||||
png_debug(1, "in png_set_read_user_transform_fn\n");
|
||||
if(png_ptr == NULL) return;
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
png_ptr->transformations |= PNG_USER_TRANSFORM;
|
||||
png_ptr->read_user_transform_fn = read_user_transform_fn;
|
||||
@ -719,6 +721,32 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
|
||||
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
||||
/* Detect gray background and attempt to enable optimization
|
||||
* for gray --> RGB case */
|
||||
/* Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or
|
||||
* RGB_ALPHA (in which case need_expand is superfluous anyway), the
|
||||
* background color might actually be gray yet not be flagged as such.
|
||||
* This is not a problem for the current code, which uses
|
||||
* PNG_BACKGROUND_IS_GRAY only to decide when to do the
|
||||
* png_do_gray_to_rgb() transformation.
|
||||
*/
|
||||
if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
|
||||
!(color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
|
||||
} else if ((png_ptr->transformations & PNG_BACKGROUND) &&
|
||||
!(png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
|
||||
(png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
png_ptr->background.red == png_ptr->background.green &&
|
||||
png_ptr->background.red == png_ptr->background.blue)
|
||||
{
|
||||
png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
|
||||
png_ptr->background.gray = png_ptr->background.red;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
|
||||
(png_ptr->transformations & PNG_EXPAND))
|
||||
{
|
||||
@ -1265,9 +1293,9 @@ png_do_read_transformations(png_structp png_ptr)
|
||||
if(rgb_error)
|
||||
{
|
||||
png_ptr->rgb_to_gray_status=1;
|
||||
if(png_ptr->transformations == PNG_RGB_TO_GRAY_WARN)
|
||||
if(png_ptr->transformations & PNG_RGB_TO_GRAY_WARN)
|
||||
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
if(png_ptr->transformations == PNG_RGB_TO_GRAY_ERR)
|
||||
if(png_ptr->transformations & PNG_RGB_TO_GRAY_ERR)
|
||||
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
}
|
||||
}
|
||||
@ -3937,7 +3965,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||
static int png_gamma_shift[] =
|
||||
const static int png_gamma_shift[] =
|
||||
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
|
||||
|
||||
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.11 June 4, 2006
|
||||
* Last changed in libpng 1.2.17 May 15, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*
|
||||
@ -16,27 +16,29 @@
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED)
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
# if defined(_WIN32_WCE)
|
||||
/* strtod() function is not supported on WindowsCE */
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
__inline double strtod(const char *nptr, char **endptr)
|
||||
__inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr)
|
||||
{
|
||||
double result = 0;
|
||||
int len;
|
||||
wchar_t *str, *end;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, nptr, -1, NULL, 0);
|
||||
str = (wchar_t *)malloc(len * sizeof(wchar_t));
|
||||
str = (wchar_t *)png_malloc(png_ptr, len * sizeof(wchar_t));
|
||||
if ( NULL != str )
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len);
|
||||
result = wcstod(str, &end);
|
||||
len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL);
|
||||
*endptr = (char *)nptr + (png_strlen(nptr) - len + 1);
|
||||
free(str);
|
||||
png_free(str);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
# else
|
||||
# define png_strtod(p,a,b) strtod(a,b)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -90,6 +92,7 @@ png_get_uint_16(png_bytep buf)
|
||||
void /* PRIVATE */
|
||||
png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_read_data(png_ptr, buf, length);
|
||||
png_calculate_crc(png_ptr, buf, length);
|
||||
}
|
||||
@ -178,7 +181,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
png_charp chunkdata, png_size_t chunklength,
|
||||
png_size_t prefix_size, png_size_t *newlength)
|
||||
{
|
||||
static char msg[] = "Error decoding compressed text";
|
||||
const static char msg[] = "Error decoding compressed text";
|
||||
png_charp text;
|
||||
png_size_t text_size;
|
||||
|
||||
@ -1311,7 +1314,10 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
}
|
||||
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
{
|
||||
png_ptr->num_trans = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
|
||||
&(png_ptr->trans_values));
|
||||
@ -1730,7 +1736,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
ep = buffer + 1; /* skip unit byte */
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
width = strtod(ep, &vp);
|
||||
width = png_strtod(png_ptr, ep, &vp);
|
||||
if (*vp)
|
||||
{
|
||||
png_warning(png_ptr, "malformed width string in sCAL chunk");
|
||||
@ -1753,7 +1759,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
ep++;
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
height = strtod(ep, &vp);
|
||||
height = png_strtod(png_ptr, ep, &vp);
|
||||
if (*vp)
|
||||
{
|
||||
png_warning(png_ptr, "malformed height string in sCAL chunk");
|
||||
@ -2170,8 +2176,6 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) ||
|
||||
(png_ptr->read_user_chunk_fn != NULL))
|
||||
{
|
||||
png_unknown_chunk chunk;
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (length > (png_uint_32)65535L)
|
||||
{
|
||||
@ -2180,30 +2184,35 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
length = (png_uint_32)65535L;
|
||||
}
|
||||
#endif
|
||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||
chunk.size = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)chunk.data, length);
|
||||
png_strcpy((png_charp)png_ptr->unknown_chunk.name,
|
||||
(png_charp)png_ptr->chunk_name);
|
||||
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
if(png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
/* callback to user unknown chunk handler */
|
||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||
int ret;
|
||||
ret = (*(png_ptr->read_user_chunk_fn))
|
||||
(png_ptr, &png_ptr->unknown_chunk);
|
||||
if (ret < 0)
|
||||
png_chunk_error(png_ptr, "error in user chunk");
|
||||
if (ret == 0)
|
||||
{
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS)
|
||||
{
|
||||
png_free(png_ptr, chunk.data);
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
}
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
#else
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
|
||||
#endif
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||
png_free(png_ptr, chunk.data);
|
||||
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -2246,7 +2255,7 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
|
||||
a zero indicates the pixel is to be skipped. This is in addition
|
||||
to any alpha or transparency value associated with the pixel. If
|
||||
you want all pixels to be combined, pass 0xff (255) in mask. */
|
||||
#ifndef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
#ifndef PNG_HAVE_MMX_COMBINE_ROW
|
||||
void /* PRIVATE */
|
||||
png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
{
|
||||
@ -2447,10 +2456,10 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !PNG_HAVE_ASSEMBLER_COMBINE_ROW */
|
||||
#endif /* !PNG_HAVE_MMX_COMBINE_ROW */
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
#ifndef PNG_HAVE_ASSEMBLER_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */
|
||||
#ifndef PNG_HAVE_MMX_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */
|
||||
/* OLD pre-1.0.9 interface:
|
||||
void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
png_uint_32 transformations)
|
||||
@ -2676,10 +2685,10 @@ png_do_read_interlace(png_structp png_ptr)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
#endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */
|
||||
#endif /* !PNG_HAVE_MMX_READ_INTERLACE */
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
|
||||
#ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
#ifndef PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
void /* PRIVATE */
|
||||
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
||||
png_bytep prev_row, int filter)
|
||||
@ -2802,7 +2811,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* !PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
|
||||
#endif /* !PNG_HAVE_MMX_READ_FILTER_ROW */
|
||||
|
||||
void /* PRIVATE */
|
||||
png_read_finish_row(png_structp png_ptr)
|
||||
@ -3104,7 +3113,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
|
||||
png_error(png_ptr, "This image requires a row greater than 64KB");
|
||||
#endif
|
||||
if ((png_uint_32)png_ptr->rowbytes > PNG_SIZE_MAX - 1)
|
||||
if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1))
|
||||
png_error(png_ptr, "Row has too many bytes to allocate in memory.");
|
||||
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
|
||||
png_ptr->rowbytes + 1));
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.17 May 15, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*
|
||||
@ -877,7 +877,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
||||
textp->itxt_length = 0;
|
||||
#endif
|
||||
}
|
||||
#if 0 /* appears to be redundant; */
|
||||
info_ptr->text[info_ptr->num_text]= *textp;
|
||||
#endif
|
||||
info_ptr->num_text++;
|
||||
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
|
||||
}
|
||||
@ -976,10 +978,10 @@ png_set_sPLT(png_structp png_ptr,
|
||||
/* TODO: use png_malloc_warn */
|
||||
png_strcpy(to->name, from->name);
|
||||
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
||||
from->nentries * png_sizeof(png_sPLT_t));
|
||||
from->nentries * png_sizeof(png_sPLT_entry));
|
||||
/* TODO: use png_malloc_warn */
|
||||
png_memcpy(to->entries, from->entries,
|
||||
from->nentries * png_sizeof(png_sPLT_t));
|
||||
from->nentries * png_sizeof(png_sPLT_entry));
|
||||
to->nentries = from->nentries;
|
||||
to->depth = from->depth;
|
||||
}
|
||||
@ -1191,20 +1193,22 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
||||
void PNGAPI
|
||||
png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
|
||||
{
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_uint_32 settable_asm_flags;
|
||||
png_uint_32 settable_mmx_flags;
|
||||
|
||||
#endif
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
|
||||
settable_mmx_flags =
|
||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
#ifdef PNG_HAVE_MMX_COMBINE_ROW
|
||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||
#endif
|
||||
#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||
#ifdef PNG_HAVE_MMX_READ_INTERLACE
|
||||
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||
#endif
|
||||
#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
#ifdef PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||
@ -1224,15 +1228,14 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
|
||||
}
|
||||
|
||||
/* we're replacing the settable bits with those passed in by the user,
|
||||
* so first zero them out of the master copy, then logical-OR in the
|
||||
* so first zero them out of the master copy, then bitwise-OR in the
|
||||
* allowed subset that was requested */
|
||||
|
||||
png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */
|
||||
png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
void PNGAPI
|
||||
png_set_mmx_thresholds (png_structp png_ptr,
|
||||
@ -1241,8 +1244,10 @@ png_set_mmx_thresholds (png_structp png_ptr,
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_ptr->mmx_bitdepth_threshold = mmx_bitdepth_threshold;
|
||||
png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold;
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
@ -1256,6 +1261,7 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
|
||||
* rejected by png_set_IHDR(). To accept any PNG datastream
|
||||
* regardless of dimensions, set both limits to 0x7ffffffL.
|
||||
*/
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->user_width_max = user_width_max;
|
||||
png_ptr->user_height_max = user_height_max;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -18,6 +18,7 @@ void PNGAPI
|
||||
png_set_bgr(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_bgr\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_BGR;
|
||||
}
|
||||
#endif
|
||||
@ -28,6 +29,7 @@ void PNGAPI
|
||||
png_set_swap(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_swap\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if (png_ptr->bit_depth == 16)
|
||||
png_ptr->transformations |= PNG_SWAP_BYTES;
|
||||
}
|
||||
@ -39,6 +41,7 @@ void PNGAPI
|
||||
png_set_packing(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_packing\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if (png_ptr->bit_depth < 8)
|
||||
{
|
||||
png_ptr->transformations |= PNG_PACK;
|
||||
@ -53,6 +56,7 @@ void PNGAPI
|
||||
png_set_packswap(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_packswap\n");
|
||||
if(png_ptr == NULL) return;
|
||||
if (png_ptr->bit_depth < 8)
|
||||
png_ptr->transformations |= PNG_PACKSWAP;
|
||||
}
|
||||
@ -63,6 +67,7 @@ void PNGAPI
|
||||
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
||||
{
|
||||
png_debug(1, "in png_set_shift\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_SHIFT;
|
||||
png_ptr->shift = *true_bits;
|
||||
}
|
||||
@ -74,7 +79,7 @@ int PNGAPI
|
||||
png_set_interlace_handling(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_interlace handling\n");
|
||||
if (png_ptr->interlaced)
|
||||
if (png_ptr && png_ptr->interlaced)
|
||||
{
|
||||
png_ptr->transformations |= PNG_INTERLACE;
|
||||
return (7);
|
||||
@ -94,6 +99,7 @@ void PNGAPI
|
||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||
{
|
||||
png_debug(1, "in png_set_filler\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_FILLER;
|
||||
png_ptr->filler = (png_byte)filler;
|
||||
if (filler_loc == PNG_FILLER_AFTER)
|
||||
@ -126,6 +132,7 @@ void PNGAPI
|
||||
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||
{
|
||||
png_debug(1, "in png_set_add_alpha\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_set_filler(png_ptr, filler, filler_loc);
|
||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||
}
|
||||
@ -139,6 +146,7 @@ void PNGAPI
|
||||
png_set_swap_alpha(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_swap_alpha\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
||||
}
|
||||
#endif
|
||||
@ -149,6 +157,7 @@ void PNGAPI
|
||||
png_set_invert_alpha(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_invert_alpha\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
||||
}
|
||||
#endif
|
||||
@ -158,6 +167,7 @@ void PNGAPI
|
||||
png_set_invert_mono(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_invert_mono\n");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
||||
}
|
||||
|
||||
@ -242,7 +252,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||
static PNG_CONST png_byte onebppswaptable[256] = {
|
||||
const static PNG_CONST png_byte onebppswaptable[256] = {
|
||||
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
|
||||
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
|
||||
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
|
||||
@ -277,7 +287,7 @@ static PNG_CONST png_byte onebppswaptable[256] = {
|
||||
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
|
||||
};
|
||||
|
||||
static PNG_CONST png_byte twobppswaptable[256] = {
|
||||
const static PNG_CONST png_byte twobppswaptable[256] = {
|
||||
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
|
||||
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
|
||||
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
|
||||
@ -312,7 +322,7 @@ static PNG_CONST png_byte twobppswaptable[256] = {
|
||||
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
|
||||
};
|
||||
|
||||
static PNG_CONST png_byte fourbppswaptable[256] = {
|
||||
const static PNG_CONST png_byte fourbppswaptable[256] = {
|
||||
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
|
||||
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
|
||||
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
|
||||
@ -621,6 +631,7 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||
{
|
||||
png_debug(1, "in png_set_user_transform_info\n");
|
||||
if(png_ptr == NULL) return;
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||
@ -642,10 +653,9 @@ png_voidp PNGAPI
|
||||
png_get_user_transform_ptr(png_structp png_ptr)
|
||||
{
|
||||
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
if (png_ptr == NULL) return (NULL);
|
||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||
#else
|
||||
if(png_ptr)
|
||||
return (NULL);
|
||||
return (NULL);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Last changed in libpng 1.2.3 - May 21, 2002
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -45,6 +45,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
png_uint_32 check;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
#if defined(_WIN32_WCE)
|
||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
||||
check = 0;
|
||||
@ -70,6 +71,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
||||
png_FILE_p io_ptr;
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
/* Check if data really is near. If so, use usual code. */
|
||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||
@ -131,6 +133,9 @@ png_default_flush(png_structp png_ptr)
|
||||
{
|
||||
#if !defined(_WIN32_WCE)
|
||||
png_FILE_p io_ptr;
|
||||
#endif
|
||||
if(png_ptr == NULL) return;
|
||||
#if !defined(_WIN32_WCE)
|
||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||
if (io_ptr != NULL)
|
||||
fflush(io_ptr);
|
||||
@ -165,6 +170,7 @@ void PNGAPI
|
||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->io_ptr = io_ptr;
|
||||
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.9 April 14, 2006
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*/
|
||||
@ -461,8 +461,10 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||
#endif
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* added at libpng-1.2.6 */
|
||||
@ -576,6 +578,7 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||
png_size_t png_struct_size, png_size_t png_info_size)
|
||||
{
|
||||
/* We only come here via pre-1.0.12-compiled applications */
|
||||
if(png_ptr == NULL) return;
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
if(png_sizeof(png_struct) > png_struct_size ||
|
||||
png_sizeof(png_info) > png_info_size)
|
||||
@ -670,8 +673,10 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||
#endif
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.11 June 4, 2006
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2007 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.)
|
||||
*/
|
||||
@ -62,6 +62,7 @@ void PNGAPI
|
||||
png_write_chunk(png_structp png_ptr, png_bytep chunk_name,
|
||||
png_bytep data, png_size_t length)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length);
|
||||
png_write_chunk_data(png_ptr, data, length);
|
||||
png_write_chunk_end(png_ptr);
|
||||
@ -77,6 +78,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
|
||||
{
|
||||
png_byte buf[4];
|
||||
png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length);
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
/* write the length */
|
||||
png_save_uint_32(buf, length);
|
||||
@ -98,6 +100,7 @@ void PNGAPI
|
||||
png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
/* write the data, and run the CRC over it */
|
||||
if(png_ptr == NULL) return;
|
||||
if (data != NULL && length > 0)
|
||||
{
|
||||
png_calculate_crc(png_ptr, data, length);
|
||||
@ -111,6 +114,8 @@ png_write_chunk_end(png_structp png_ptr)
|
||||
{
|
||||
png_byte buf[4];
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
/* write the crc */
|
||||
png_save_uint_32(buf, png_ptr->crc);
|
||||
|
||||
@ -518,9 +523,10 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
png_ptr->zlib_window_bits = 15;
|
||||
if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD))
|
||||
png_ptr->zlib_method = 8;
|
||||
deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
|
||||
if (deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
|
||||
png_ptr->zlib_method, png_ptr->zlib_window_bits,
|
||||
png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
|
||||
png_ptr->zlib_mem_level, png_ptr->zlib_strategy) != Z_OK)
|
||||
png_error(png_ptr, "zlib failed to initialize compressor");
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
/* libpng is not interested in zstream.data_type */
|
||||
@ -728,6 +734,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
||||
png_size_t name_len;
|
||||
png_charp new_name;
|
||||
compression_state comp;
|
||||
int embedded_profile_len = 0;
|
||||
|
||||
png_debug(1, "in png_write_iCCP\n");
|
||||
|
||||
@ -750,6 +757,27 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
||||
if (profile == NULL)
|
||||
profile_len = 0;
|
||||
|
||||
if (profile_len > 3)
|
||||
embedded_profile_len =
|
||||
((*( (png_bytep)profile ))<<24) |
|
||||
((*( (png_bytep)profile+1))<<16) |
|
||||
((*( (png_bytep)profile+2))<< 8) |
|
||||
((*( (png_bytep)profile+3)) );
|
||||
|
||||
if (profile_len < embedded_profile_len)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Embedded profile length too large in iCCP chunk");
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile_len > embedded_profile_len)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Truncating profile to actual length in iCCP chunk");
|
||||
profile_len = embedded_profile_len;
|
||||
}
|
||||
|
||||
if (profile_len)
|
||||
profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len,
|
||||
PNG_COMPRESSION_TYPE_BASE, &comp);
|
||||
|
Loading…
Reference in New Issue
Block a user