зеркало из https://github.com/mozilla/pjs.git
Bug 386585 - "Update libpng to version 1.2.21" [p=glennrp@gmail.com (Glenn Randers-Pehrson) r=tor sr=stuart a=blocking1.9+]
This commit is contained in:
Родитель
1461d8807c
Коммит
275c0b92f1
|
@ -1480,7 +1480,7 @@ version 1.2.9beta5 [March 4, 2006]
|
|||
Restored scripts/makefile.elf which was inadvertently deleted.
|
||||
|
||||
version 1.2.9beta6 [March 6, 2006]
|
||||
Fixed typo (12) in configuration files.
|
||||
Fixed typo (21) in configuration files.
|
||||
|
||||
version 1.2.9beta7 [March 7, 2006]
|
||||
Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am
|
||||
|
@ -1615,6 +1615,357 @@ version 1.0.20, 1.2.12 [June 27, 2006]
|
|||
Really increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
|
||||
buffer overflow.
|
||||
|
||||
version 1.2.13beta1 [October 2, 2006]
|
||||
Removed AC_FUNC_MALLOC from configure.ac
|
||||
Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
|
||||
Change "logical" to "bitwise" throughout documentation.
|
||||
Detect and fix attempt to write wrong iCCP profile length.
|
||||
|
||||
version 1.0.21, 1.2.13 [November 14, 2006]
|
||||
Fix potential buffer overflow in sPLT chunk handler.
|
||||
Fix Makefile.am to not try to link to noexistent files.
|
||||
Check all exported functions for NULL png_ptr.
|
||||
|
||||
version 1.2.14beta1 [November 17, 2006]
|
||||
Relocated three misplaced tests for NULL png_ptr.
|
||||
Built Makefile.in with automake-1.9.6 instead of 1.9.2.
|
||||
Build configure with autoconf-2.60 instead of 2.59
|
||||
|
||||
version 1.2.14beta2 [November 17, 2006]
|
||||
Added some typecasts in png_zalloc().
|
||||
|
||||
version 1.2.14rc1 [November 20, 2006]
|
||||
Changed "strtod" to "png_strtod" in pngrutil.c
|
||||
|
||||
version 1.0.22, 1.2.14 [November 27, 2006]
|
||||
Added missing "$(srcdir)" in Makefile.am and Makefile.in
|
||||
|
||||
version 1.2.15beta1 [December 3, 2006]
|
||||
Generated configure with autoconf-2.61 instead of 2.60
|
||||
Revised configure.ac to update libpng.pc and libpng-config.
|
||||
|
||||
version 1.2.15beta2 [December 3, 2006]
|
||||
Always export MMX asm functions, just stubs if not building pnggccrd.c
|
||||
|
||||
version 1.2.15beta3 [December 4, 2006]
|
||||
Add "png_bytep" typecast to profile while calculating length in pngwutil.c
|
||||
|
||||
version 1.2.15beta4 [December 7, 2006]
|
||||
Added scripts/CMakeLists.txt
|
||||
Changed PNG_NO_ASSEMBLER_CODE to PNG_NO_MMX_CODE in scripts, like 1.4.0beta
|
||||
|
||||
version 1.2.15beta5 [December 7, 2006]
|
||||
Changed some instances of PNG_ASSEMBLER_* to PNG_MMX_* in pnggccrd.c
|
||||
Revised scripts/CMakeLists.txt
|
||||
|
||||
version 1.2.15beta6 [December 13, 2006]
|
||||
Revised scripts/CMakeLists.txt and configure.ac
|
||||
|
||||
version 1.2.15rc1 [December 18, 2006]
|
||||
Revised scripts/CMakeLists.txt
|
||||
|
||||
version 1.2.15rc2 [December 21, 2006]
|
||||
Added conditional #undef jmpbuf in pngtest.c to undo #define in AIX headers.
|
||||
Added scripts/makefile.nommx
|
||||
|
||||
version 1.2.15rc3 [December 25, 2006]
|
||||
Fixed shared library numbering error that was intruduced in 1.2.15beta6.
|
||||
|
||||
version 1.2.15rc4 [December 27, 2006]
|
||||
Fixed handling of rgb_to_gray when png_ptr->color.gray isn't set.
|
||||
|
||||
version 1.2.15rc5 [December 31, 2006]
|
||||
Revised handling of rgb_to_gray.
|
||||
|
||||
version 1.0.23, 1.2.15 [January 5, 2007]
|
||||
Added some (unsigned long) typecasts in pngtest.c to avoid printing errors.
|
||||
|
||||
version 1.2.16beta1 [January 6, 2007]
|
||||
Fix bugs in makefile.nommx
|
||||
|
||||
version 1.2.16beta2 [January 16, 2007]
|
||||
Revised scripts/CMakeLists.txt
|
||||
|
||||
version 1.0.24, 1.2.16 [January 31, 2007]
|
||||
No changes.
|
||||
|
||||
version 1.2.17beta1 [March 6, 2007]
|
||||
Revised scripts/CMakeLists.txt to install both shared and static libraries.
|
||||
Deleted a redundant line from pngset.c.
|
||||
|
||||
version 1.2.17beta2 [April 26, 2007]
|
||||
Relocated misplaced test for png_ptr == NULL in pngpread.c
|
||||
Change "==" to "&" for testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN
|
||||
flags.
|
||||
Changed remaining instances of PNG_ASSEMBLER_* to PNG_MMX_*
|
||||
Added pngerror() when write_IHDR fails in deflateInit2().
|
||||
Added "const" to some array declarations.
|
||||
Mention examples of libpng usage in the libpng*.txt and libpng.3 documents.
|
||||
|
||||
version 1.2.17rc1 [May 4, 2007]
|
||||
No changes.
|
||||
|
||||
version 1.2.17rc2 [May 8, 2007]
|
||||
Moved several PNG_HAVE_* macros out of PNG_INTERNAL because applications
|
||||
calling set_unknown_chunk_location() need them.
|
||||
Changed transformation flag from PNG_EXPAND_tRNS to PNG_EXPAND in
|
||||
png_set_expand_gray_1_2_4_to_8().
|
||||
Added png_ptr->unknown_chunk to hold working unknown chunk data, so it
|
||||
can be free'ed in case of error. Revised unknown chunk handling in
|
||||
pngrutil.c and pngpread.c to use this structure.
|
||||
|
||||
version 1.2.17rc3 [May 8, 2007]
|
||||
Revised symbol-handling in configure script.
|
||||
|
||||
version 1.2.17rc4 [May 10, 2007]
|
||||
Revised unknown chunk handling to avoid storing unknown critical chunks.
|
||||
|
||||
version 1.0.25 [May 15, 2007]
|
||||
version 1.2.17 [May 15, 2007]
|
||||
Added "png_ptr->num_trans=0" before error return in png_handle_tRNS,
|
||||
to eliminate a vulnerability (CVE-2007-2445, CERT VU#684664)
|
||||
|
||||
version 1.0.26 [May 15, 2007]
|
||||
version 1.2.18 [May 15, 2007]
|
||||
Reverted the libpng-1.2.17rc3 change to symbol-handling in configure script
|
||||
|
||||
version 1.2.19beta1 [May 18, 2007]
|
||||
Changed "const static" to "static PNG_CONST" everywhere, mostly undoing
|
||||
change of libpng-1.2.17beta2. Changed other "const" to "PNG_CONST"
|
||||
Changed some handling of unused parameters, to avoid compiler warnings.
|
||||
"if (unused == NULL) return;" becomes "unused = unused".
|
||||
|
||||
version 1.2.19beta2 [May 18, 2007]
|
||||
Only use the valid bits of tRNS value in png_do_expand() (Brian Cartier)
|
||||
|
||||
version 1.2.19beta3 [May 19, 2007]
|
||||
Add some "png_byte" typecasts in png_check_keyword() and write new_key
|
||||
instead of key in zTXt chunk (Kevin Ryde).
|
||||
|
||||
version 1.2.19beta4 [May 21, 2007]
|
||||
Add png_snprintf() function and use it in place of sprint() for improved
|
||||
defense against buffer overflows.
|
||||
|
||||
version 1.2.19beta5 [May 21, 2007]
|
||||
Fixed png_handle_tRNS() to only use the valid bits of tRNS value.
|
||||
Changed handling of more unused parameters, to avoid compiler warnings.
|
||||
Removed some PNG_CONST in pngwutil.c to avoid compiler warnings.
|
||||
|
||||
version 1.2.19beta6 [May 22, 2007]
|
||||
Added some #ifdef PNG_MMX_CODE_SUPPORTED where needed in pngvcrd.c
|
||||
Added a special "_MSC_VER" case that defines png_snprintf to _snprintf
|
||||
|
||||
version 1.2.19beta7 [May 22, 2007]
|
||||
Squelched png_squelch_warnings() in pnggccrd.c and added an
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused
|
||||
the warnings that png_squelch_warnings was squelching.
|
||||
|
||||
version 1.2.19beta8 [May 22, 2007]
|
||||
Removed __MMX__ from test in pngconf.h.
|
||||
|
||||
version 1.2.19beta9 [May 23, 2007]
|
||||
Made png_squelch_warnings() available via PNG_SQUELCH_WARNINGS macro.
|
||||
Revised png_squelch_warnings() so it might work.
|
||||
Updated makefile.sgcc and makefile.solaris; added makefile.solaris-x86.
|
||||
|
||||
version 1.2.19beta10 [May 24, 2007]
|
||||
Resquelched png_squelch_warnings(), use "__attribute__((used))" instead.
|
||||
|
||||
version 1.2.19beta11 [May 28, 2007]
|
||||
Return 0 from png_get_sPLT() and png_get_unknown_chunks() if png_ptr is NULL;
|
||||
changed three remaining instances of png_strcpy() to png_strncpy() (David
|
||||
Hill).
|
||||
Make test for NULL row_buf at the beginning of png_do_read_transformations
|
||||
unconditional.
|
||||
|
||||
version 1.2.19beta12 [May 28, 2007]
|
||||
Revised pnggccrd.c.
|
||||
|
||||
version 1.2.19beta13 [June 14, 2007]
|
||||
Prefer PNG_USE_PNGVCRD when _MSC_VER is defined in pngconf.h
|
||||
|
||||
version 1.2.19beta14 [June 16, 2007]
|
||||
Fix bug with handling of 16-bit transparency, introduced in 1.2.19beta2
|
||||
|
||||
version 1.2.19beta15 [June 17, 2007]
|
||||
Revised pnggccrd.c.
|
||||
|
||||
version 1.2.19beta16 [June 18, 2007]
|
||||
Revised pnggccrd.c again.
|
||||
Updated contrib/gregbook.
|
||||
Changed '#include "pnggccrd.c"' to 'include "$srcdir/pnggccrd.c"'
|
||||
in configure.ac
|
||||
|
||||
version 1.2.19beta17 [June 19, 2007]
|
||||
Revised many of the makefiles, to set -DPNG_NO_MMX_CODE where needed
|
||||
and to not use -O3 unless -DPNG_NO_MMX_CODE is also set.
|
||||
|
||||
version 1.2.19beta18 [June 23, 2007]
|
||||
Replaced some C++ style comments with C style comments in pnggccrd.c.
|
||||
Copied optimized C code from pnggccrd.c to pngrutil.c, removed dependency
|
||||
on pnggccrd.o from many makefiles.
|
||||
Added sl and dylib to list of extensions be installed by Makefile.am
|
||||
|
||||
version 1.2.19beta19 [June 28, 2007]
|
||||
Fixed testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN in pngrtran.c
|
||||
More cleanup of pnggccrd.c and pngvcrd.c
|
||||
|
||||
version 1.2.19beta20 [June 29, 2007]
|
||||
Rebuilt Makefile.in and configure using libtool-1.5.24.
|
||||
Fixed typo in pnggccrd.c
|
||||
|
||||
version 1.2.19beta21 [June 30, 2007]
|
||||
More revision of pnggccrd.c
|
||||
Added "test" target to Makefile.in and Makefile.am
|
||||
|
||||
version 1.2.19beta22 [July 3, 2007]
|
||||
Added info about pngrutil/pnggccrd/pngvcrd to png_get_header_version()
|
||||
Fix type definition of dummy_value_a, b in pnggccrd.c
|
||||
|
||||
version 1.2.19beta23 [July 10, 2007]
|
||||
Revert change to type definition of dummy_value_a, b in pnggccrd.c
|
||||
Make sure __PIC__ is defined in pnggccrd.c when PIC is defined.
|
||||
Require gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW on x86_64 platforms
|
||||
|
||||
version 1.2.19beta24 [July 14, 2007]
|
||||
Added PNG_NO_READ_FILTER, PNG_NO_WRITE_FILTER, PNG_NO_WARNING macros.
|
||||
Added contrib/pngminim to demonstrate building minimal encoder and decoder
|
||||
|
||||
version 1.2.19beta25 [July 15, 2007]
|
||||
Removed the new PNG_NO_READ_FILTER macro since it would make the library
|
||||
unable to read valid PNG files, and filtering is at the heart of the
|
||||
PNG format.
|
||||
|
||||
version 1.2.19beta26 [July 16, 2007]
|
||||
Changed "png_free(str)" to "png_free(png_ptr,str)" in pngrutil.c WinCE
|
||||
code (Yves Piguet). This bug was introduced in libpng-1.2.14.
|
||||
Updated scripts/CMakeLists.txt
|
||||
Relocated a misplaced #endif in pnggccrd.c
|
||||
|
||||
version 1.2.19beta27 [July 17, 2007]
|
||||
Fixed incorrect stride and number of bytes copied (was 4 instead of
|
||||
6 bytes) in the cleanup loop of pnggccrd.c and pngvcrd.c for handling
|
||||
the end of 48-bit interlaced rows (Glenn R-P).
|
||||
|
||||
version 1.2.19beta28 [July 19, 2007]
|
||||
Removed requirement for gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW
|
||||
on x86_64 platforms
|
||||
Added png_warning() in pngrutil.c for short iCCP, iTXt, sPLT, or zTXT chunks.
|
||||
Revised pngtest.c so warnings are displayed regardless of PNG_NO_STDIO.
|
||||
|
||||
version 1.2.19beta29 [July 20, 2007]
|
||||
Fix typo in pnggccrd.c (%%eax should be %%ax in secondloop48)
|
||||
|
||||
version 1.2.19beta30 [July 26, 2007]
|
||||
Revised pnggccrd.c
|
||||
|
||||
version 1.2.19beta31 [July 27, 2007]
|
||||
Fix typos in pnggccrd.c
|
||||
|
||||
version 1.0.27rc1 and 1.2.19rc1 [July 31, 2007]
|
||||
Disable PNG_MMX_CODE_SUPPORTED when PNG_ASSEMBLER_CODE_SUPPORTED is off.
|
||||
Enable PNG_MMX_READ_FILTER_* by default, except when gcc-3.x is being
|
||||
used (they were inadvertently disabled in libpng-1.2.19beta23).
|
||||
Fix some debugging statements in pnggccrd.c and pngrutil.c
|
||||
Added information about disabling the MMX code in libpng documentation.
|
||||
|
||||
version 1.0.27rc2 and 1.2.19rc2 [August 4, 2007]
|
||||
Removed some "#if 0" blocks.
|
||||
Made a global struct local in pngvcrd.c to make it thread safe.
|
||||
Issue a png_error() if application attempts to transform a row tht
|
||||
has not been initialized.
|
||||
|
||||
version 1.0.27rc3 and 1.2.19rc3 [August 9, 2007]
|
||||
Slightly revised pngvcrd.c
|
||||
|
||||
version 1.0.27rc4 and 1.2.19rc4 [August 9, 2007]
|
||||
Revised pnggccrd.c debugging change of rc1, which was broken.
|
||||
Revised scripts/CMakeLists.txt
|
||||
Change default to PNG_NO_GLOBAL_ARRAYS for MSVC.
|
||||
Turn off PNG_FLAG_ROW_INIT flag when setting transforms that expand pixels.
|
||||
|
||||
version 1.0.27rc5 and 1.2.19rc5 [August 10, 2007]
|
||||
Fix typo (missing '"') in pnggccrd.c
|
||||
Revise handling of png_strtod in recent versions of WINCE
|
||||
|
||||
version 1.0.27rc6 and 1.2.19rc6 [August 15, 2007]
|
||||
Fix typo (missing ',') in contrib/gregbook/readpng2.c
|
||||
Undid row initialization error exit added to rc2 and rc4.
|
||||
|
||||
version 1.0.27 and 1.2.19 [August 18, 2007]
|
||||
Conditionally restored row initialization error exit.
|
||||
|
||||
version 1.2.20beta01 [August 19, 2007]
|
||||
Fixed problem with compiling pnggccrd.c on Intel-Apple platforms.
|
||||
Added PNG_NO_ERROR_TEXT feature, with demo in contrib/pngminim
|
||||
Removed define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */
|
||||
because it caused some trouble.
|
||||
|
||||
version 1.2.20beta02 [August 20, 2007]
|
||||
Avoid compiling pnggccrd.c on Intel-Apple platforms.
|
||||
|
||||
version 1.2.20beta03 [August 20, 2007]
|
||||
Added "/D PNG_NO_MMX_CODE" to the non-mmx builds of projects/visualc6
|
||||
and visualc71.
|
||||
|
||||
version 1.2.20beta04 [August 21, 2007]
|
||||
Revised pngvcrd.c for improved efficiency (Steve Snyder).
|
||||
|
||||
version 1.2.20rc1 [August 23, 2007]
|
||||
Revised pngconf.h to set PNG_NO_MMX_CODE for gcc-3.x compilers.
|
||||
|
||||
version 1.2.20rc2 [August 27, 2007]
|
||||
Revised scripts/CMakeLists.txt
|
||||
Revised #ifdefs to ensure one and only one of pnggccrd.c, pngvcrd.c,
|
||||
or part of pngrutil.c is selected.
|
||||
|
||||
version 1.2.20rc3 [August 30, 2007]
|
||||
Remove a little more code in pngwutil.c when PNG_NO_WRITE_FILTER is selected.
|
||||
Added /D _CRT_SECURE_NO_WARNINGS to visual6c and visualc71 projects.
|
||||
Compile png_mmx_support() in png.c even when PNG_NO_MMX_CODE is defined.
|
||||
Restored a "superfluous" #ifdef that was removed from 1.2.20rc2 pnggccrd.c,
|
||||
breaking the png_mmx_support() function.
|
||||
|
||||
version 1.2.20rc4 [September 1, 2007]
|
||||
Removed Intel contributions (MMX, Optimized C).
|
||||
|
||||
version 1.2.20rc5 [September 2, 2007]
|
||||
Restored configure and Makefile.in to rc3 and put a snippet of code in
|
||||
pnggccrd.c, to ensure configure makes the same PNG_NO_MMX_CODE selection
|
||||
|
||||
version 1.2.20rc6 [September 2, 2007]
|
||||
Fixed bugs in scripts/CMakeLists.txt
|
||||
Removed pngvcrd.c references from msvc projects.
|
||||
|
||||
version 1.0.28 and 1.2.20 [September 8, 2007]
|
||||
Removed "(NO READ SUPPORT)" from png_get_header_version() string.
|
||||
|
||||
version 1.2.21beta1 [September 14, 2007]
|
||||
Fixed various mistakes reported by George Cook and Jeff Phillips:
|
||||
logical vs bitwise NOT in pngrtran.c, bug introduced in 1.2.19rc2
|
||||
16-bit cheap transparency expansion, bug introduced in 1.2.19beta2
|
||||
errors with sizeof(unknown_chunk.name), bugs introduced in 1.2.19beta11
|
||||
<= compare with unsigned var in pngset.c, should be ==.
|
||||
|
||||
version 1.2.21beta2 [September 18, 2007]
|
||||
Removed some extraneous typecasts.
|
||||
|
||||
version 1.2.21rc1 [September 25, 2007]
|
||||
Fixed potential out-of-bounds reads in png_handle_pCAL() and
|
||||
png_handle_ztXt() ("flayer" results reported by Tavis Ormandy).
|
||||
|
||||
version 1.2.21rc2 [September 26, 2007]
|
||||
Fixed potential out-of-bounds reads in png_handle_sCAL(),
|
||||
png_handle_iTXt(), and png_push_read_tEXt().
|
||||
Remove some PNG_CONST declarations from pngwutil.c to avoid compiler warnings
|
||||
Revised makefiles to update paths in libpng.pc properly.
|
||||
|
||||
version 1.2.21rc3 [September 27, 2007]
|
||||
Revised makefiles to update "Libs" in libpng.pc properly.
|
||||
|
||||
version 1.0.29 and 1.2.21rc3 [October 4, 2007]
|
||||
No changes.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
|
|
@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
|||
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.21, October 4, 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
|
||||
|
||||
|
@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
|
|||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
June 27, 2006
|
||||
October 4, 2007
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
|
||||
Changes made to pristine png source by mozilla.org developers.
|
||||
|
||||
2007/05/05 -- Zero png_ptr->num_trans on CRC error (bug 374810)
|
||||
2007/10/04 -- Sync with libpng-1.2.21 (removes MMX support) (bug #386585)
|
||||
|
||||
2007/04/19 -- Synced with libpng-1.2.16 tree
|
||||
2007/07/27 -- Enable cHRM and iCCP chunks for color management (bug #16769)
|
||||
|
||||
2007/03/20 -- Added support for APNG
|
||||
2007/05/05 -- Zero png_ptr->num_trans on CRC error (bug #374810)
|
||||
|
||||
2006/06/27 -- Synced with libpng-1.2.12 tree
|
||||
2007/04/19 -- Synced with libpng-1.2.16 tree (bug #373249)
|
||||
|
||||
2004/10/07 -- Synced with libpng-1.2.7 tree
|
||||
2007/03/20 -- Added support for APNG (bug #257197)
|
||||
|
||||
2004/10/07 -- add mozpngconf.h (bug 208607)
|
||||
2006/06/27 -- Synced with libpng-1.2.12 tree (bug #334110)
|
||||
|
||||
2004/10/07 -- Synced with libpng-1.2.7 tree (bug #261922)
|
||||
|
||||
2004/10/07 -- add mozpngconf.h (bug #208607)
|
||||
|
|
|
@ -69,6 +69,7 @@ CSRCS = \
|
|||
pngwtran.c \
|
||||
pngrtran.c \
|
||||
pngwutil.c \
|
||||
pngvcrd.c \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = png.h pngconf.h mozpngconf.h
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
README for libpng version 1.2.12 - June 27, 2006 (shared library 12.0)
|
||||
README for libpng version 1.2.21 - October 4, 2007 (shared library 12.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
@ -190,11 +190,11 @@ Files in this distribution:
|
|||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||
gcc, creates libpng12.so.0.1.2.12)
|
||||
gcc, creates libpng12.so.0.1.2.21)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng12.so.0.1.2.12)
|
||||
(gcc, creates libpng12.so.0.1.2.21)
|
||||
makefile.gcmmx => Linux/ELF makefile
|
||||
(gcc, creates libpng12.so.0.1.2.12,
|
||||
(gcc, creates libpng12.so.0.1.2.21,
|
||||
uses assembler code tuned for Intel MMX platform)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
|
@ -216,12 +216,12 @@ Files in this distribution:
|
|||
makefile.openbsd => OpenBSD makefile
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics
|
||||
(gcc, creates libpng12.so.0.1.2.12)
|
||||
(gcc, creates libpng12.so.0.1.2.21)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng12.so.0.1.2.12)
|
||||
(gcc, creates libpng12.so.0.1.2.21)
|
||||
makefile.so9 => Solaris 9 makefile
|
||||
(gcc, creates libpng12.so.0.1.2.12)
|
||||
(gcc, creates libpng12.so.0.1.2.21)
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.2.12 - June 27, 2006
|
||||
libpng version 1.2.21 - October 4, 2007
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
For conditions of distribution and use, see copyright
|
||||
notice in png.h.
|
||||
|
||||
|
@ -33,6 +33,10 @@ it is heavily commented and should include everything most people
|
|||
will need. We assume that libpng is already installed; see the
|
||||
INSTALL file for instructions on how to install libpng.
|
||||
|
||||
For examples of libpng usage, see the files "example.c", "pngtest.c",
|
||||
and the files in the "contrib" directory, all of which are included in the
|
||||
libpng distribution.
|
||||
|
||||
Libpng was written as a companion to the PNG specification, as a way
|
||||
of reducing the amount of time and effort it takes to support the PNG
|
||||
file format in application programs.
|
||||
|
@ -82,9 +86,7 @@ Libpng is thread safe, provided the threads are using different
|
|||
instances of the structures. Each thread should have its own
|
||||
png_struct and png_info instances, and thus its own image.
|
||||
Libpng does not protect itself against two threads using the
|
||||
same instance of a structure. Note: thread safety may be defeated
|
||||
by use of some of the MMX assembler code in pnggccrd.c, which is only
|
||||
compiled when the user defines PNG_THREAD_UNSAFE_OK.
|
||||
same instance of a structure.
|
||||
|
||||
II. Structures
|
||||
|
||||
|
@ -392,7 +394,7 @@ dithering, and setting filler.) If this is the case, simply do this:
|
|||
|
||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||
|
||||
where png_transforms is an integer containing the logical OR of
|
||||
where png_transforms is an integer containing the bitwise OR of
|
||||
some set of transformation flags. This call is equivalent to png_read_info(),
|
||||
followed the set of transformations indicated by the transform mask,
|
||||
then png_read_image(), and finally png_read_end().
|
||||
|
@ -1272,7 +1274,7 @@ point to libpng-allocated storage with the following function:
|
|||
|
||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||
mask - identifies data to be freed, a mask
|
||||
containing the logical OR of one or
|
||||
containing the bitwise OR of one or
|
||||
more of
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
|
@ -1334,7 +1336,7 @@ application instead of by libpng, you can use
|
|||
|
||||
png_set_invalid(png_ptr, info_ptr, mask);
|
||||
mask - identifies the chunks to be made invalid,
|
||||
containing the logical OR of one or
|
||||
containing the bitwise OR of one or
|
||||
more of
|
||||
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
||||
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
||||
|
@ -1646,7 +1648,7 @@ types.
|
|||
|
||||
/* turn on or off filtering, and/or choose
|
||||
specific filters. You can use either a single
|
||||
PNG_FILTER_VALUE_NAME or the logical OR of one
|
||||
PNG_FILTER_VALUE_NAME or the bitwise OR of one
|
||||
or more PNG_FILTER_NAME masks. */
|
||||
png_set_filter(png_ptr, 0,
|
||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||
|
@ -2019,7 +2021,7 @@ png_set_rows() to put image data in the info structure), simply do this:
|
|||
|
||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL)
|
||||
|
||||
where png_transforms is an integer containing the logical OR of some set of
|
||||
where png_transforms is an integer containing the bitwise OR of some set of
|
||||
transformation flags. This call is equivalent to png_write_info(),
|
||||
followed the set of transformations indicated by the transform mask,
|
||||
then png_write_image(), and finally png_write_end().
|
||||
|
@ -2279,7 +2281,7 @@ point to libpng-allocated storage with the following function:
|
|||
|
||||
png_free_data(png_ptr, info_ptr, mask, seq)
|
||||
mask - identifies data to be freed, a mask
|
||||
containing the logical OR of one or
|
||||
containing the bitwise OR of one or
|
||||
more of
|
||||
PNG_FREE_PLTE, PNG_FREE_TRNS,
|
||||
PNG_FREE_HIST, PNG_FREE_ICCP,
|
||||
|
@ -2351,17 +2353,13 @@ For a more compact example of writing a PNG image, see the file example.c.
|
|||
|
||||
V. Modifying/Customizing libpng:
|
||||
|
||||
There are three issues here. The first is changing how libpng does
|
||||
There are two issues here. The first is changing how libpng does
|
||||
standard things like memory allocation, input/output, and error handling.
|
||||
The second deals with more complicated things like adding new chunks,
|
||||
adding new transformations, and generally changing how libpng works.
|
||||
Both of those are compile-time issues; that is, they are generally
|
||||
determined at the time the code is written, and there is rarely a need
|
||||
to provide the user with a means of changing them. The third is a
|
||||
run-time issue: choosing between and/or tuning one or more alternate
|
||||
versions of computationally intensive routines; specifically, optimized
|
||||
assembly-language (and therefore compiler- and platform-dependent)
|
||||
versions.
|
||||
to provide the user with a means of changing them.
|
||||
|
||||
Memory allocation, input/output, and error handling
|
||||
|
||||
|
@ -2722,125 +2720,6 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
|||
having level = 0 will be printed. There aren't any such statements in
|
||||
this version of libpng, but if you insert some they will be printed.
|
||||
|
||||
VI. Runtime optimization
|
||||
|
||||
A new feature in libpng 1.2.0 is the ability to dynamically switch between
|
||||
standard and optimized versions of some routines. Currently these are
|
||||
limited to three computationally intensive tasks when reading PNG files:
|
||||
decoding row filters, expanding interlacing, and combining interlaced or
|
||||
transparent row data with previous row data. Currently the optimized
|
||||
versions are available only for x86 (Intel, AMD, etc.) platforms with
|
||||
MMX support, though this may change in future versions. (For example,
|
||||
the non-MMX assembler optimizations for zlib might become similarly
|
||||
runtime-selectable in future releases, in which case libpng could be
|
||||
extended to support them. Alternatively, the compile-time choice of
|
||||
floating-point versus integer routines for gamma correction might become
|
||||
runtime-selectable.)
|
||||
|
||||
Because such optimizations tend to be very platform- and compiler-dependent,
|
||||
both in how they are written and in how they perform, the new runtime code
|
||||
in libpng has been written to allow programs to query, enable, and disable
|
||||
either specific optimizations or all such optimizations. For example, to
|
||||
enable all possible optimizations (bearing in mind that some "optimizations"
|
||||
may actually run more slowly in rare cases):
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
png_uint_32 mask, flags;
|
||||
|
||||
flags = png_get_asm_flags(png_ptr);
|
||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
||||
png_set_asm_flags(png_ptr, flags | mask);
|
||||
#endif
|
||||
|
||||
To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
|
||||
by itself when calling png_get_asm_flagmask(); similarly for optimizing
|
||||
only writing. To disable all optimizations:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
flags = png_get_asm_flags(png_ptr);
|
||||
mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
|
||||
png_set_asm_flags(png_ptr, flags & ~mask);
|
||||
#endif
|
||||
|
||||
To enable or disable only MMX-related features, use png_get_mmx_flagmask()
|
||||
in place of png_get_asm_flagmask(). The mmx version takes one additional
|
||||
parameter:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
|
||||
int compilerID;
|
||||
|
||||
mask = png_get_mmx_flagmask(selection, &compilerID);
|
||||
#endif
|
||||
|
||||
On return, compilerID will indicate which version of the MMX assembler
|
||||
optimizations was compiled. Currently two flavors exist: Microsoft
|
||||
Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
|
||||
On non-x86 platforms or on systems compiled without MMX optimizations, a
|
||||
value of -1 is used.
|
||||
|
||||
Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
|
||||
all valid, settable optimization bits for the version of the library that's
|
||||
currently in use. In the case of shared (dynamically linked) libraries,
|
||||
this may include optimizations that did not exist at the time the code was
|
||||
written and compiled. It is also possible, of course, to enable only known,
|
||||
specific optimizations; for example:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
flags = PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||
png_set_asm_flags(png_ptr, flags);
|
||||
#endif
|
||||
|
||||
This method would enable only the MMX read-optimizations available at the
|
||||
time of libpng 1.2.0's release, regardless of whether a later version of
|
||||
the DLL were actually being used. (Also note that these functions did not
|
||||
exist in versions older than 1.2.0, so any attempt to run a dynamically
|
||||
linked app on such an older version would fail.)
|
||||
|
||||
To determine whether the processor supports MMX instructions at all, use
|
||||
the png_mmx_support() function:
|
||||
|
||||
#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||
mmxsupport = png_mmx_support();
|
||||
#endif
|
||||
|
||||
It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
|
||||
is compiled but MMX is not supported by the processor, or 1 if MMX support
|
||||
is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
|
||||
and png_get_asm_flagmask() all may be called without allocating and ini-
|
||||
tializing any PNG structures (for example, as part of a usage screen or
|
||||
"about" box).
|
||||
|
||||
The following code can be used to prevent an application from using the
|
||||
thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
|
||||
defined:
|
||||
|
||||
#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
|
||||
&& defined(PNG_THREAD_UNSAFE_OK)
|
||||
/* Disable thread-unsafe features of pnggccrd */
|
||||
if (png_access_version_number() >= 10200)
|
||||
{
|
||||
png_uint_32 mmx_disable_mask = 0;
|
||||
png_uint_32 asm_flags;
|
||||
|
||||
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||
asm_flags = png_get_asm_flags(png_ptr);
|
||||
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
For more extensive examples of runtime querying, enabling and disabling
|
||||
of optimized features, see contrib/gregbook/readpng2.c in the libpng
|
||||
source-code distribution.
|
||||
|
||||
VII. MNG support
|
||||
|
||||
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
||||
|
@ -2849,12 +2728,12 @@ Libpng can support some of these extensions. To enable them, use the
|
|||
png_permit_mng_features() function:
|
||||
|
||||
feature_set = png_permit_mng_features(png_ptr, mask)
|
||||
mask is a png_uint_32 containing the logical OR of the
|
||||
mask is a png_uint_32 containing the bitwise OR of the
|
||||
features you want to enable. These include
|
||||
PNG_FLAG_MNG_EMPTY_PLTE
|
||||
PNG_FLAG_MNG_FILTER_64
|
||||
PNG_ALL_MNG_FEATURES
|
||||
feature_set is a png_uint_32 that is the logical AND of
|
||||
feature_set is a png_uint_32 that is the bitwise AND of
|
||||
your mask with the set of MNG features that is
|
||||
supported by the version of libpng that you are using.
|
||||
|
||||
|
@ -2917,13 +2796,13 @@ application:
|
|||
|
||||
IX. Y2K Compliance in libpng
|
||||
|
||||
June 27, 2006
|
||||
October 4, 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.21 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 that
|
||||
|
|
|
@ -42,9 +42,7 @@
|
|||
#ifndef MOZ_PNG_READ
|
||||
#define PNG_NO_READ_SUPPORTED
|
||||
#endif
|
||||
#if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE)
|
||||
#define PNG_NO_MMX_CODE
|
||||
#endif
|
||||
#define PNG_NO_WARN_UNINITIALIZED_ROW
|
||||
#define PNG_NO_READ_BACKGROUND
|
||||
#define PNG_NO_READ_DITHER
|
||||
#define PNG_NO_READ_INVERT
|
||||
|
@ -71,6 +69,7 @@
|
|||
#define PNG_NO_READ_OPT_PLTE
|
||||
#define PNG_NO_READ_STRIP_ALPHA
|
||||
#define PNG_NO_READ_oFFs
|
||||
#define PNG_NO_SEQUENTIAL_READ_SUPPORTED
|
||||
|
||||
#ifndef MOZ_PNG_WRITE
|
||||
#define PNG_NO_WRITE_SUPPORTED
|
||||
|
@ -104,6 +103,7 @@
|
|||
#define PNG_NO_WRITE_USER_CHUNKS
|
||||
#define PNG_NO_WRITE_EMPTY_PLTE
|
||||
#define PNG_NO_WRITE_OPT_PLTE
|
||||
#define PNG_NO_WRITE_FILTER
|
||||
#define PNG_NO_WRITE_WEIGHTED_FILTER
|
||||
#define PNG_NO_WRITE_INTERLACING_SUPPORTED /* effective libpng-1.3.0 */
|
||||
#endif
|
||||
|
@ -118,7 +118,6 @@
|
|||
#define PNG_NO_ZALLOC_ZERO
|
||||
#define PNG_NO_ERROR_NUMBERS
|
||||
#define PNG_NO_EASY_ACCESS
|
||||
#define PNG_NO_SEQUENTIAL_READ_SUPPORTED
|
||||
|
||||
|
||||
/* Mangle names of exported libpng functions so different libpng versions
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* Last changed in libpng 1.2.21 [October 4, 2007]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -13,20 +13,20 @@
|
|||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_2_16 Your_png_h_is_not_version_1_2_16;
|
||||
typedef version_1_2_21 Your_png_h_is_not_version_1_2_21;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||
const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
|
||||
PNG_CONST char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* png_sig was changed to a function in version 1.0.5c */
|
||||
/* Place to hold the signature string for a PNG file. */
|
||||
const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
PNG_CONST png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
/* Invoke global declarations for constant strings for known chunk types */
|
||||
|
@ -59,32 +59,27 @@ PNG_fdAT;
|
|||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* start of interlace block */
|
||||
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||
PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* offset to next interlace block */
|
||||
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* start of interlace block in the y direction */
|
||||
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* offset to next interlace block in the y direction */
|
||||
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
|
||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
||||
#endif
|
||||
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* Height of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
*/
|
||||
|
||||
/* Mask to determine which pixels are valid in a pass */
|
||||
const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
PNG_CONST int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
|
||||
/* Mask to determine which pixels to overwrite while displaying */
|
||||
const int FARDATA png_pass_dsp_mask[]
|
||||
PNG_CONST int FARDATA png_pass_dsp_mask[]
|
||||
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
@ -137,7 +132,7 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
|
|||
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
|
||||
/* (Obsolete) function to check signature bytes. It does not allow one
|
||||
* to check a partial signature. This function might be removed in the
|
||||
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG.
|
||||
* future - use png_sig_cmp(). Returns true (nonzero) if the file is PNG.
|
||||
*/
|
||||
int PNGAPI
|
||||
png_check_sig(png_bytep sig, int num)
|
||||
|
@ -493,6 +488,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
|
||||
|
@ -672,7 +672,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||
#ifdef USE_FAR_KEYWORD
|
||||
{
|
||||
char near_time_buf[29];
|
||||
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
||||
png_snprintf6(near_time_buf,29,"%d %s %d %02d:%02d:%02d +0000",
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||
ptime->second % 61);
|
||||
|
@ -680,7 +680,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||
29*png_sizeof(char));
|
||||
}
|
||||
#else
|
||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
||||
png_snprintf6(png_ptr->time_buffer,29,"%d %s %d %02d:%02d:%02d +0000",
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||
ptime->second % 61);
|
||||
|
@ -690,25 +690,16 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||
}
|
||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||
|
||||
#if 0
|
||||
/* Signature string for a PNG file. */
|
||||
png_bytep PNGAPI
|
||||
png_sig_bytes(void)
|
||||
{
|
||||
return ((png_bytep)"\211\120\116\107\015\012\032\012");
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||
|
||||
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.16 - January 31, 2007\n\
|
||||
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) "\n libpng version 1.2.21 - October 4, 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) "");
|
||||
}
|
||||
|
||||
/* The following return the library version as a short string in the
|
||||
|
@ -723,27 +714,28 @@ png_charp PNGAPI
|
|||
png_get_libpng_ver(png_structp png_ptr)
|
||||
{
|
||||
/* Version of *.c files used when building libpng */
|
||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
||||
return ((png_charp) "");
|
||||
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
||||
}
|
||||
|
||||
png_charp PNGAPI
|
||||
png_get_header_ver(png_structp png_ptr)
|
||||
{
|
||||
/* Version of *.h files used when building libpng */
|
||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
||||
return ((png_charp) "");
|
||||
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) PNG_LIBPNG_VER_STRING);
|
||||
}
|
||||
|
||||
png_charp PNGAPI
|
||||
png_get_header_version(png_structp png_ptr)
|
||||
{
|
||||
/* Returns longer string containing both version and date */
|
||||
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) PNG_HEADER_VERSION_STRING);
|
||||
return ((png_charp) "");
|
||||
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
|
||||
return ((png_charp) PNG_HEADER_VERSION_STRING
|
||||
#ifndef PNG_READ_SUPPORTED
|
||||
" (NO READ SUPPORT)"
|
||||
#endif
|
||||
"\n");
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||
|
@ -754,7 +746,7 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
|||
/* check chunk_name and return "keep" value if it's on the list, else 0 */
|
||||
int i;
|
||||
png_bytep p;
|
||||
if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0)
|
||||
if(png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0)
|
||||
return 0;
|
||||
p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5;
|
||||
for (i = png_ptr->num_chunk_list; i; i--, p-=5)
|
||||
|
@ -784,65 +776,15 @@ png_access_version_number(void)
|
|||
|
||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||
#if !defined(PNG_1_0_X)
|
||||
#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;
|
||||
|
||||
# if (defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD))
|
||||
|
||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_COMPILED;
|
||||
|
||||
if (png_mmx_support() > 0) {
|
||||
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||
# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
||||
# endif
|
||||
# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE
|
||||
# endif
|
||||
# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
;
|
||||
# else
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG
|
||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||
|
||||
png_ptr->mmx_rowbytes_threshold = PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT;
|
||||
png_ptr->mmx_bitdepth_threshold = PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT;
|
||||
# endif
|
||||
} else {
|
||||
png_ptr->asm_flags &= ~( PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||
| PNG_MMX_READ_FLAGS
|
||||
| PNG_MMX_WRITE_FLAGS );
|
||||
}
|
||||
|
||||
# else /* !(PNGVCRD || PNGGCCRD) */
|
||||
|
||||
/* clear all MMX flags; no support is compiled in */
|
||||
png_ptr->asm_flags &= ~( PNG_MMX_FLAGS );
|
||||
|
||||
# endif /* ?(PNGVCRD || PNGGCCRD) */
|
||||
}
|
||||
|
||||
#endif /* !(PNG_MMX_CODE_SUPPORTED) */
|
||||
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
#if !defined(PNG_USE_PNGGCCRD) && \
|
||||
!(defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
||||
int PNGAPI
|
||||
png_mmx_support(void)
|
||||
{
|
||||
/* obsolete, to be removed from libpng-1.4.0 */
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_1_0_X && PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* PNG_1_0_X */
|
||||
#endif /* PNG_READ_SUPPORTED && PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||
#ifdef PNG_SIZE_T
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.2.16 - January 31, 2007
|
||||
* libpng version 1.2.21 - October 4, 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.)
|
||||
|
@ -9,7 +9,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.2.16 - January 31, 2007: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.2.21 - October 4, 2007: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
|
@ -143,6 +143,27 @@
|
|||
* 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]
|
||||
* 1.2.19beta1-31 13 10219 12.so.0.19[.0]
|
||||
* 1.0.27rc1-6 10 10027 10.so.0.27[.0]
|
||||
* 1.2.19rc1-6 13 10219 12.so.0.19[.0]
|
||||
* 1.0.27 10 10027 10.so.0.27[.0]
|
||||
* 1.2.19 13 10219 12.so.0.19[.0]
|
||||
* 1.2.20beta01-04 13 10220 12.so.0.20[.0]
|
||||
* 1.0.28rc1-6 10 10028 10.so.0.28[.0]
|
||||
* 1.2.20rc1-6 13 10220 12.so.0.20[.0]
|
||||
* 1.0.28 10 10028 10.so.0.28[.0]
|
||||
* 1.2.20 13 10220 12.so.0.20[.0]
|
||||
* 1.2.21beta1-2 13 10221 12.so.0.21[.0]
|
||||
* 1.2.21rc1-3 13 10221 12.so.0.21[.0]
|
||||
* 1.0.29 10 10029 10.so.0.29[.0]
|
||||
* 1.2.21 13 10221 12.so.0.21[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
|
@ -172,8 +193,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.16, January 31, 2007, are
|
||||
* Copyright (c) 2004, 2007 Glenn Randers-Pehrson, and are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.2.21, October 4, 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:
|
||||
*
|
||||
|
@ -284,13 +305,13 @@
|
|||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* January 31, 2007
|
||||
* October 4, 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.16 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.2.21 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
|
||||
|
@ -346,9 +367,9 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.2.16"
|
||||
#define PNG_LIBPNG_VER_STRING "1.2.21"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.2.16 - January 31, 2007 (header)\n"
|
||||
" libpng version 1.2.21 - October 4, 2007\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 0
|
||||
#define PNG_LIBPNG_VER_DLLNUM 13
|
||||
|
@ -356,7 +377,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 16
|
||||
#define PNG_LIBPNG_VER_RELEASE 21
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||
|
||||
|
@ -384,7 +405,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 10216 /* 1.2.16 */
|
||||
#define PNG_LIBPNG_VER 10221 /* 1.2.21 */
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* include the compression library's header */
|
||||
|
@ -472,7 +493,7 @@ extern "C" {
|
|||
* the version above.
|
||||
*/
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
PNG_EXPORT_VAR (const char) png_libpng_ver[18];
|
||||
PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
|
||||
/* need room for 99.99.99beta99z */
|
||||
#else
|
||||
#define png_libpng_ver png_get_header_ver(NULL)
|
||||
|
@ -481,17 +502,14 @@ PNG_EXPORT_VAR (const char) png_libpng_ver[18];
|
|||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
/* This was removed in version 1.0.5c */
|
||||
/* Structures to facilitate easy interlacing. See png.c for more details */
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7];
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7];
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7];
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7];
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7];
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7];
|
||||
#ifdef PNG_USE_PNGGCCRD
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7];
|
||||
#endif
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
|
||||
/* This isn't currently used. If you need it, see png.c for more details.
|
||||
PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7];
|
||||
PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
@ -1281,8 +1299,7 @@ struct png_struct_def
|
|||
png_size_t current_text_left; /* how much text left to read in input */
|
||||
png_charp current_text; /* current text chunk buffer */
|
||||
png_charp current_text_ptr; /* current location in current_text */
|
||||
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
|
||||
|
||||
# endif /* PNG_TEXT_SUPPORTED */
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||
|
@ -1364,7 +1381,7 @@ struct png_struct_def
|
|||
png_byte filter_type;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))
|
||||
#if defined(PNG_1_0_X)
|
||||
/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
|
||||
png_uint_32 row_buf_size;
|
||||
#endif
|
||||
|
@ -1412,7 +1429,6 @@ struct png_struct_def
|
|||
png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */
|
||||
png_uint_32 first_frame_width;
|
||||
png_uint_32 first_frame_height;
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_APNG_SUPPORTED)
|
||||
png_uint_32 num_frames_read; /* incremented after all image data of */
|
||||
|
@ -1427,8 +1443,7 @@ struct png_struct_def
|
|||
png_uint_32 num_frames_to_write;
|
||||
png_uint_32 num_frames_written;
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
/* For png_struct.apng_flags: */
|
||||
#define PNG_FIRST_FRAME_HIDDEN 0x0001
|
||||
|
@ -1442,10 +1457,18 @@ struct png_struct_def
|
|||
#define PNG_BLEND_OP_SOURCE 0x00
|
||||
#define PNG_BLEND_OP_OVER 0x01
|
||||
|
||||
/* 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_16;
|
||||
typedef png_structp version_1_2_21;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
|
@ -2110,6 +2133,7 @@ extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
|
|||
int check));
|
||||
#endif /* USE_FAR_KEYWORD */
|
||||
|
||||
#ifndef PNG_NO_ERROR_TEXT
|
||||
/* Fatal error in PNG image of libpng - can't continue */
|
||||
extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
|
||||
png_const_charp error_message));
|
||||
|
@ -2117,14 +2141,22 @@ extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
|
|||
/* The same, but the chunk name is prepended to the error string. */
|
||||
extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
|
||||
png_const_charp error_message));
|
||||
#else
|
||||
/* Fatal error in PNG image of libpng - can't continue */
|
||||
extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#ifndef PNG_NO_WARNINGS
|
||||
/* Non-fatal error in libpng. Can continue, but may have a problem. */
|
||||
extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
|
||||
png_const_charp warning_message));
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* Non-fatal error in libpng, chunk name is prepended to message. */
|
||||
extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
|
||||
png_const_charp warning_message));
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* PNG_NO_WARNINGS */
|
||||
|
||||
/* The png_set_<chunk> functions are for storing values in the png_info_struct.
|
||||
* Similarly, the png_get_<chunk> calls are used to read values from the
|
||||
|
@ -2511,7 +2543,7 @@ extern PNG_EXPORT(void,png_read_frame_head) 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
|
||||
|
@ -2599,10 +2631,6 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
|
|||
#define png_debug2(l, m, p1, p2)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void));
|
||||
#endif
|
||||
|
||||
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));
|
||||
|
@ -2792,16 +2820,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
|
||||
|
@ -2923,11 +2956,8 @@ extern PNG_EXPORT(void,png_save_uint_16)
|
|||
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
||||
/* place to hold the signature string for a PNG file. */
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];
|
||||
PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
|
||||
#else
|
||||
#if 0
|
||||
#define png_sig png_sig_bytes(NULL)
|
||||
#endif
|
||||
#endif
|
||||
#endif /* PNG_NO_EXTERN */
|
||||
|
||||
|
@ -2935,56 +2965,56 @@ extern PNG_EXPORT(void,png_save_uint_16)
|
|||
* define the name here, and add an invocation of the macro in png.c and
|
||||
* wherever it's needed.
|
||||
*/
|
||||
#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
|
||||
#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
|
||||
#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
|
||||
#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
|
||||
#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
|
||||
#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
|
||||
#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
|
||||
#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
|
||||
#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
|
||||
#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
|
||||
#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
|
||||
#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
|
||||
#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
|
||||
#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
|
||||
#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
|
||||
#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
|
||||
#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
|
||||
#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
|
||||
#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
|
||||
#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
|
||||
#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
|
||||
#define PNG_acTL const png_byte png_acTL[5] = { 97, 99, 84, 76, '\0'}
|
||||
#define PNG_fcTL const png_byte png_fcTL[5] = {102, 99, 84, 76, '\0'}
|
||||
#define PNG_fdAT const png_byte png_fdAT[5] = {102, 100, 65, 84, '\0'}
|
||||
#define PNG_IHDR png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
|
||||
#define PNG_IDAT png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
|
||||
#define PNG_IEND png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
|
||||
#define PNG_PLTE png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
|
||||
#define PNG_bKGD png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
|
||||
#define PNG_cHRM png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
|
||||
#define PNG_gAMA png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
|
||||
#define PNG_hIST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
|
||||
#define PNG_iCCP png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
|
||||
#define PNG_iTXt png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
|
||||
#define PNG_oFFs png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
|
||||
#define PNG_pCAL png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
|
||||
#define PNG_sCAL png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
|
||||
#define PNG_pHYs png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
|
||||
#define PNG_sBIT png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
|
||||
#define PNG_sPLT png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
|
||||
#define PNG_sRGB png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
|
||||
#define PNG_tEXt png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
|
||||
#define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
|
||||
#define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
|
||||
#define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
|
||||
#define PNG_acTL png_byte png_acTL[5] = { 97, 99, 84, 76, '\0'}
|
||||
#define PNG_fcTL png_byte png_fcTL[5] = {102, 99, 84, 76, '\0'}
|
||||
#define PNG_fdAT png_byte png_fdAT[5] = {102, 100, 65, 84, '\0'}
|
||||
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_acTL[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_fcTL[5];
|
||||
PNG_EXPORT_VAR (const png_byte FARDATA) png_fdAT[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_acTL[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_fcTL[5];
|
||||
PNG_EXPORT_VAR (png_byte FARDATA) png_fdAT[5];
|
||||
#endif /* PNG_USE_GLOBAL_ARRAYS */
|
||||
|
||||
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.2.16 - January 31, 2007
|
||||
* libpng version 1.2.21 - October 4, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -77,6 +77,11 @@
|
|||
|
||||
/* End of material added to libpng-1.2.8 */
|
||||
|
||||
/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
|
||||
Restored at libpng-1.2.21 */
|
||||
/* # define PNG_WARN_UNINITIALIZED_ROW 1 */
|
||||
/* End of material added at libpng-1.2.19/1.2.21 */
|
||||
|
||||
/* This is the size of the compression buffer, and thus the size of
|
||||
* an IDAT chunk. Make this whatever size you feel is best for your
|
||||
* machine. One of these will be allocated per png_struct. When this
|
||||
|
@ -278,6 +283,7 @@
|
|||
# define PNGARG(arglist) arglist
|
||||
#endif /* _NO_PROTO */
|
||||
|
||||
|
||||
#endif /* OF */
|
||||
|
||||
#endif /* PNGARG */
|
||||
|
@ -596,16 +602,16 @@
|
|||
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
||||
|
||||
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
|
||||
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
|
||||
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
|
||||
#endif /* about interlacing capability! You'll */
|
||||
/* still have interlacing unless you change the following line: */
|
||||
!defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */
|
||||
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
|
||||
#endif /* about interlacing capability! You'll */
|
||||
/* still have interlacing unless you change the following line: */
|
||||
|
||||
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
|
||||
#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
|
||||
|
||||
#ifndef PNG_NO_READ_COMPOSITE_NODIV
|
||||
# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
|
||||
# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
|
||||
# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -723,37 +729,46 @@
|
|||
#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.
|
||||
*
|
||||
* 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.
|
||||
* and removed from version 1.2.20. The following will be removed
|
||||
* from libpng-1.4.0
|
||||
*/
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
|
||||
# ifndef PNG_OPTIMIZED_CODE_SUPPORTED
|
||||
# define PNG_OPTIMIZED_CODE_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
# if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
|
||||
/* work around 64-bit gcc compiler bugs in gcc-3.x */
|
||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
|
||||
# define PNG_NO_MMX_CODE
|
||||
# endif
|
||||
# endif
|
||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \
|
||||
defined(__MMX__)
|
||||
|
||||
# if defined(__APPLE__)
|
||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
|
||||
# define PNG_NO_MMX_CODE
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
|
||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
|
||||
# define PNG_NO_MMX_CODE
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
|
||||
# define PNG_MMX_CODE_SUPPORTED
|
||||
# endif
|
||||
# if !defined(PNG_USE_PNGGCCRD) && !defined(PNG_NO_MMX_CODE) && \
|
||||
!defined(PNG_USE_PNGVCRD) && defined(__MMX__)
|
||||
# define PNG_USE_PNGGCCRD
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If you are sure that you don't need thread safety and you are compiling
|
||||
with PNG_USE_PNGCCRD for an MMX application, you can define this for
|
||||
faster execution. See pnggccrd.c.
|
||||
#define PNG_THREAD_UNSAFE_OK
|
||||
*/
|
||||
#endif
|
||||
/* end of obsolete code to be removed from libpng-1.4.0 */
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
|
||||
|
@ -1285,7 +1300,8 @@ typedef z_stream FAR * png_zstreamp;
|
|||
* but might be required for some pre-1.0.5c applications.
|
||||
*/
|
||||
#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
|
||||
# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
|
||||
# if defined(PNG_NO_GLOBAL_ARRAYS) || \
|
||||
(defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
|
||||
# define PNG_USE_LOCAL_ARRAYS
|
||||
# else
|
||||
# define PNG_USE_GLOBAL_ARRAYS
|
||||
|
@ -1422,6 +1438,7 @@ typedef z_stream FAR * png_zstreamp;
|
|||
# define NOCHECK 0
|
||||
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
|
||||
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
|
||||
# define png_snprintf _fsnprintf /* Added to v 1.2.19 */
|
||||
# define png_strcpy _fstrcpy
|
||||
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
|
||||
# define png_strlen _fstrlen
|
||||
|
@ -1431,6 +1448,27 @@ typedef z_stream FAR * png_zstreamp;
|
|||
#else /* use the usual functions */
|
||||
# define CVT_PTR(ptr) (ptr)
|
||||
# define CVT_PTR_NOCHECK(ptr) (ptr)
|
||||
# ifndef PNG_NO_SNPRINTF
|
||||
# ifdef _MSC_VER
|
||||
# define png_snprintf _snprintf /* Added to v 1.2.19 */
|
||||
# define png_snprintf2 _snprintf
|
||||
# define png_snprintf6 _snprintf
|
||||
# else
|
||||
# define png_snprintf snprintf /* Added to v 1.2.19 */
|
||||
# define png_snprintf2 snprintf
|
||||
# define png_snprintf6 snprintf
|
||||
# endif
|
||||
# else
|
||||
/* You don't have or don't want to use snprintf(). Caution: Using
|
||||
* sprintf instead of snprintf exposes your application to accidental
|
||||
* or malevolent buffer overflows. If you don't have snprintf()
|
||||
* as a general rule you should provide one (you can get one from
|
||||
* Portable OpenSSH). */
|
||||
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
|
||||
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
|
||||
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
|
||||
sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
|
||||
# endif
|
||||
# define png_strcpy strcpy
|
||||
# define png_strncpy strncpy /* Added to v 1.2.6 */
|
||||
# define png_strlen strlen
|
||||
|
@ -1448,47 +1486,6 @@ typedef z_stream FAR * png_zstreamp;
|
|||
# define PNG_ZBUF_SIZE 65536L
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
|
||||
#if defined(PNG_INTERNAL)
|
||||
|
||||
/* These are the default thresholds before the MMX code kicks in; if either
|
||||
* rowbytes or bitdepth is below the threshold, plain C code is used. These
|
||||
* can be overridden at runtime via the png_set_mmx_thresholds() call in
|
||||
* libpng 1.2.0 and later. The values below were chosen by Intel.
|
||||
*/
|
||||
|
||||
#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
|
||||
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
|
||||
#endif
|
||||
#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
|
||||
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
|
||||
#endif
|
||||
|
||||
/* Set this in the makefile for VC++ on Pentium, not here. */
|
||||
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
|
||||
* 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
|
||||
#endif
|
||||
|
||||
/* Set this in the makefile for gcc/as on Pentium, not here. */
|
||||
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
|
||||
* 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
|
||||
#endif
|
||||
/* - see pnggccrd.c for info about what is currently enabled */
|
||||
|
||||
#endif /* PNG_INTERNAL */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
/* Added at libpng-1.2.8 */
|
||||
#endif /* PNG_VERSION_INFO_ONLY */
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* Last changed in libpng 1.2.20 October 4, 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.)
|
||||
*
|
||||
|
@ -20,15 +20,18 @@
|
|||
static void /* PRIVATE */
|
||||
png_default_error PNGARG((png_structp png_ptr,
|
||||
png_const_charp error_message));
|
||||
#ifndef PNG_NO_WARNINGS
|
||||
static void /* PRIVATE */
|
||||
png_default_warning PNGARG((png_structp png_ptr,
|
||||
png_const_charp warning_message));
|
||||
#endif /* PNG_NO_WARNINGS */
|
||||
|
||||
/* This function is called whenever there is a fatal error. This function
|
||||
* should not be changed. If there is a need to handle errors differently,
|
||||
* you should supply a replacement error function and use png_set_error_fn()
|
||||
* to replace the error function at run-time.
|
||||
*/
|
||||
#ifndef PNG_NO_ERROR_TEXT
|
||||
void PNGAPI
|
||||
png_error(png_structp png_ptr, png_const_charp error_message)
|
||||
{
|
||||
|
@ -75,7 +78,20 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||
use the default handler, which will not return. */
|
||||
png_default_error(png_ptr, error_message);
|
||||
}
|
||||
#else
|
||||
void PNGAPI
|
||||
png_err(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||
(*(png_ptr->error_fn))(png_ptr, '\0');
|
||||
|
||||
/* If the custom handler doesn't exist, or if it returns,
|
||||
use the default handler, which will not return. */
|
||||
png_default_error(png_ptr, '\0');
|
||||
}
|
||||
#endif /* PNG_NO_ERROR_TEXT */
|
||||
|
||||
#ifndef PNG_NO_WARNINGS
|
||||
/* This function is called whenever there is a non-fatal error. This function
|
||||
* should not be changed. If there is a need to handle warnings differently,
|
||||
* you should supply a replacement warning function and use
|
||||
|
@ -105,6 +121,8 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||
else
|
||||
png_default_warning(png_ptr, warning_message+offset);
|
||||
}
|
||||
#endif /* PNG_NO_WARNINGS */
|
||||
|
||||
|
||||
/* These utilities are used internally to build an error message that relates
|
||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||
|
@ -118,6 +136,7 @@ static PNG_CONST char png_digit[16] = {
|
|||
'A', 'B', 'C', 'D', 'E', 'F'
|
||||
};
|
||||
|
||||
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
|
||||
static void /* PRIVATE */
|
||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||
error_message)
|
||||
|
@ -151,6 +170,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
void PNGAPI
|
||||
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
||||
{
|
||||
|
@ -163,7 +183,10 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
|||
png_error(png_ptr, msg);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */
|
||||
|
||||
#ifndef PNG_NO_WARNINGS
|
||||
void PNGAPI
|
||||
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
||||
{
|
||||
|
@ -176,6 +199,8 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||
png_warning(png_ptr, msg);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_NO_WARNINGS */
|
||||
|
||||
|
||||
/* This is the default error handling function. Note that replacements for
|
||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
||||
|
@ -217,7 +242,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||
# ifdef USE_FAR_KEYWORD
|
||||
{
|
||||
jmp_buf jmpbuf;
|
||||
png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf));
|
||||
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||
longjmp(jmpbuf, 1);
|
||||
}
|
||||
# else
|
||||
|
@ -228,12 +253,11 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||
PNG_ABORT();
|
||||
#endif
|
||||
#ifdef PNG_NO_CONSOLE_IO
|
||||
/* make compiler happy */ ;
|
||||
if (&error_message != NULL)
|
||||
return;
|
||||
error_message = error_message; /* make compiler happy */
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef PNG_NO_WARNINGS
|
||||
/* This function is called when there is a warning, but the library thinks
|
||||
* it can continue anyway. Replacement functions don't have to do anything
|
||||
* here if you don't want them to. In the default configuration, png_ptr is
|
||||
|
@ -267,14 +291,11 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||
# endif
|
||||
fprintf(stderr, "libpng warning: %s\n", warning_message);
|
||||
#else
|
||||
/* make compiler happy */ ;
|
||||
if (warning_message)
|
||||
return;
|
||||
warning_message = warning_message; /* make compiler happy */
|
||||
#endif
|
||||
/* make compiler happy */ ;
|
||||
if (png_ptr)
|
||||
return;
|
||||
png_ptr = png_ptr; /* make compiler happy */
|
||||
}
|
||||
#endif /* PNG_NO_WARNINGS */
|
||||
|
||||
/* This function is called when the application wants to use another method
|
||||
* of handling errors and warnings. Note that the error function MUST NOT
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -512,8 +512,11 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
|||
png_sPLT_tpp spalettes)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
||||
{
|
||||
*spalettes = info_ptr->splt_palettes;
|
||||
return ((png_uint_32)info_ptr->splt_palettes_num);
|
||||
return ((png_uint_32)info_ptr->splt_palettes_num);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -949,7 +952,7 @@ png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
|
|||
png_debug(1, "in png_first_frame_is_hidden()\n");
|
||||
|
||||
if (png_ptr != NULL)
|
||||
return png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN;
|
||||
return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -961,8 +964,11 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
|||
png_unknown_chunkpp unknowns)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
|
||||
{
|
||||
*unknowns = info_ptr->unknown_chunks;
|
||||
return ((png_uint_32)info_ptr->unknown_chunks_num);
|
||||
return ((png_uint_32)info_ptr->unknown_chunks_num);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -996,105 +1002,44 @@ png_get_compression_buffer_size(png_structp png_ptr)
|
|||
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
|
||||
/* obsolete, to be removed from libpng-1.4.0 */
|
||||
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)
|
||||
settable_asm_flags |=
|
||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||
/* no non-MMX flags yet */
|
||||
|
||||
#if 0
|
||||
/* GRR: no write-flags yet, either, but someday... */
|
||||
if (flag_select & PNG_SELECT_WRITE)
|
||||
settable_asm_flags |=
|
||||
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
||||
#endif /* 0 */
|
||||
|
||||
return settable_asm_flags; /* _theoretically_ settable capabilities only */
|
||||
#else
|
||||
return (0L);
|
||||
#endif /* PNG_MMX_CODE_SUPPORTED */
|
||||
/* obsolete, to be removed from libpng-1.4.0 */
|
||||
flag_select=flag_select;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
/* 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)
|
||||
settable_mmx_flags |=
|
||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||
#if 0
|
||||
/* GRR: no MMX write support yet, but someday... */
|
||||
if (flag_select & PNG_SELECT_WRITE)
|
||||
settable_mmx_flags |=
|
||||
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
||||
#endif /* 0 */
|
||||
|
||||
if (compilerID != NULL) {
|
||||
#ifdef PNG_USE_PNGVCRD
|
||||
*compilerID = 1; /* MSVC */
|
||||
#else
|
||||
#ifdef PNG_USE_PNGGCCRD
|
||||
*compilerID = 2; /* gcc/gas */
|
||||
#else
|
||||
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
|
||||
#else
|
||||
return (0L);
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
/* obsolete, to be removed from libpng-1.4.0 */
|
||||
flag_select=flag_select;
|
||||
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/* 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
|
||||
/* obsolete, to be removed from libpng-1.4.0 */
|
||||
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
|
||||
/* obsolete, to be removed from libpng-1.4.0 */
|
||||
return (png_ptr? 0L: 0L);
|
||||
#endif /* ?PNG_MMX_CODE_SUPPORTED */
|
||||
}
|
||||
#endif /* ?PNG_1_0_X */
|
||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||
|
@ -1112,5 +1057,6 @@ png_get_user_height_max (png_structp png_ptr)
|
|||
return (png_ptr? png_ptr->user_height_max : 0);
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
|
||||
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* Last changed in libpng 1.2.21 October 4, 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.)
|
||||
*/
|
||||
|
@ -137,65 +137,65 @@ void /* PRIVATE */
|
|||
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
PNG_IHDR;
|
||||
PNG_IDAT;
|
||||
PNG_IEND;
|
||||
PNG_PLTE;
|
||||
PNG_CONST PNG_IHDR;
|
||||
PNG_CONST PNG_IDAT;
|
||||
PNG_CONST PNG_IEND;
|
||||
PNG_CONST PNG_PLTE;
|
||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||
PNG_bKGD;
|
||||
PNG_CONST PNG_bKGD;
|
||||
#endif
|
||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
||||
PNG_cHRM;
|
||||
PNG_CONST PNG_cHRM;
|
||||
#endif
|
||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||
PNG_gAMA;
|
||||
PNG_CONST PNG_gAMA;
|
||||
#endif
|
||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||
PNG_hIST;
|
||||
PNG_CONST PNG_hIST;
|
||||
#endif
|
||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||
PNG_iCCP;
|
||||
PNG_CONST PNG_iCCP;
|
||||
#endif
|
||||
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||
PNG_iTXt;
|
||||
PNG_CONST PNG_iTXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
||||
PNG_oFFs;
|
||||
PNG_CONST PNG_oFFs;
|
||||
#endif
|
||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||
PNG_pCAL;
|
||||
PNG_CONST PNG_pCAL;
|
||||
#endif
|
||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||
PNG_pHYs;
|
||||
PNG_CONST PNG_pHYs;
|
||||
#endif
|
||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
||||
PNG_sBIT;
|
||||
PNG_CONST PNG_sBIT;
|
||||
#endif
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||
PNG_sCAL;
|
||||
PNG_CONST PNG_sCAL;
|
||||
#endif
|
||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||
PNG_sRGB;
|
||||
PNG_CONST PNG_sRGB;
|
||||
#endif
|
||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||
PNG_sPLT;
|
||||
PNG_CONST PNG_sPLT;
|
||||
#endif
|
||||
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||
PNG_tEXt;
|
||||
PNG_CONST PNG_tEXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
||||
PNG_tIME;
|
||||
PNG_CONST PNG_tIME;
|
||||
#endif
|
||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||
PNG_tRNS;
|
||||
PNG_CONST PNG_tRNS;
|
||||
#endif
|
||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||
PNG_zTXt;
|
||||
PNG_CONST PNG_zTXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_APNG_SUPPORTED)
|
||||
PNG_acTL;
|
||||
PNG_fcTL;
|
||||
PNG_fdAT;
|
||||
PNG_CONST PNG_acTL;
|
||||
PNG_CONST PNG_fcTL;
|
||||
PNG_CONST PNG_fdAT;
|
||||
#endif
|
||||
#endif /* PNG_USE_LOCAL_ARRAYS */
|
||||
/* First we make sure we have enough data for the 4 byte chunk name
|
||||
|
@ -318,7 +318,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
}
|
||||
#endif /* PNG_READ_APNG_SUPPORTED */
|
||||
|
||||
if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
|
||||
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||
if(png_ptr->mode & PNG_AFTER_IDAT)
|
||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||
|
||||
|
@ -375,7 +375,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
}
|
||||
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
|
||||
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||
{
|
||||
/* If we reach an IDAT chunk, this means we have read all of the
|
||||
* header chunks, and we can start reading the image (or if this
|
||||
|
@ -846,7 +846,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if ( png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)
|
||||
if ( png_memcmp(png_ptr->chunk_name, png_IDAT, 4)
|
||||
&& (png_ptr->num_frames_read == 0) )
|
||||
{
|
||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||
|
@ -1172,25 +1172,20 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* start of interlace block */
|
||||
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||
PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* offset to next interlace block */
|
||||
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* start of interlace block in the y direction */
|
||||
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* offset to next interlace block in the y direction */
|
||||
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* Width of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
|
||||
*/
|
||||
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
/* Height of interlace block. This is not currently used - if you need
|
||||
* it, uncomment it here and in png.h
|
||||
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
@ -1244,8 +1239,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
png_error(png_ptr, "Out of place tEXt");
|
||||
/* to quiet some compiler warnings */
|
||||
if(info_ptr == NULL) return;
|
||||
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
|
@ -1308,7 +1302,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
|||
for (text = key; *text; text++)
|
||||
/* empty loop */ ;
|
||||
|
||||
if (text != key + png_ptr->current_text_size)
|
||||
if (text < key + png_ptr->current_text_size)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||
|
@ -1341,8 +1335,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
png_error(png_ptr, "Out of place zTXt");
|
||||
/* to quiet some compiler warnings */
|
||||
if(info_ptr == NULL) return;
|
||||
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
|
@ -1404,7 +1397,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||
/* empty loop */ ;
|
||||
|
||||
/* zTXt can't have zero text */
|
||||
if (text == key + png_ptr->current_text_size)
|
||||
if (text >= key + png_ptr->current_text_size)
|
||||
{
|
||||
png_ptr->current_text = NULL;
|
||||
png_free(png_ptr, key);
|
||||
|
@ -1534,8 +1527,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
png_error(png_ptr, "Out of place iTXt");
|
||||
/* to quiet some compiler warnings */
|
||||
if(info_ptr == NULL) return;
|
||||
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
|
@ -1602,7 +1594,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||
for (lang = key; *lang; lang++)
|
||||
/* empty loop */ ;
|
||||
|
||||
if (lang != key + png_ptr->current_text_size)
|
||||
if (lang < key + png_ptr->current_text_size - 3)
|
||||
lang++;
|
||||
|
||||
comp_flag = *lang++;
|
||||
|
@ -1612,10 +1604,14 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||
/* empty loop */ ;
|
||||
lang_key++; /* skip NUL separator */
|
||||
|
||||
for (text = lang_key; *text; text++)
|
||||
/* empty loop */ ;
|
||||
text=lang_key;
|
||||
if (lang_key < key + png_ptr->current_text_size - 1)
|
||||
{
|
||||
for (; *text; text++)
|
||||
/* empty loop */ ;
|
||||
}
|
||||
|
||||
if (text != key + png_ptr->current_text_size)
|
||||
if (text < key + png_ptr->current_text_size)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||
|
@ -1653,55 +1649,58 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
|||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
{
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS
|
||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
#endif
|
||||
)
|
||||
)
|
||||
#endif
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
|
||||
/* to quiet compiler warnings about unused info_ptr */
|
||||
if (info_ptr == NULL)
|
||||
return;
|
||||
info_ptr = info_ptr; /* to quiet some compiler warnings */
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
||||
skip = length - (png_uint_32)65535L;
|
||||
length = (png_uint_32)65535L;
|
||||
}
|
||||
if (length > (png_uint_32)65535L)
|
||||
{
|
||||
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
||||
skip = length - (png_uint_32)65535L;
|
||||
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_strncpy((png_charp)png_ptr->unknown_chunk.name,
|
||||
(png_charp)png_ptr->chunk_name, 5);
|
||||
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)
|
||||
{
|
||||
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, &chunk, 1);
|
||||
}
|
||||
else
|
||||
if(png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
/* callback to user unknown chunk handler */
|
||||
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);
|
||||
}
|
||||
}
|
||||
#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
|
||||
|
@ -1736,7 +1735,7 @@ png_progressive_combine_row (png_structp png_ptr,
|
|||
png_bytep old_row, png_bytep new_row)
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
const int FARDATA png_pass_dsp_mask[7] =
|
||||
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
|
||||
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
#endif
|
||||
if(png_ptr == NULL) return;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* Last changed in libpng 1.2.20 September 7, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -55,12 +55,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
if (png_ptr == NULL)
|
||||
return (NULL);
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
#ifdef PNG_MMX_CODE_SUPPORTED
|
||||
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||
#endif
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
|
||||
|
@ -117,11 +111,13 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
char msg[80];
|
||||
if (user_png_ver)
|
||||
{
|
||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application was compiled with png.h from libpng-%.20s",
|
||||
user_png_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application is running with png.c from libpng-%.20s",
|
||||
png_libpng_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
#endif
|
||||
|
@ -197,11 +193,13 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||
png_ptr->warning_fn=NULL;
|
||||
if (user_png_ver)
|
||||
{
|
||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application was compiled with png.h from libpng-%.20s",
|
||||
user_png_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application is running with png.c from libpng-%.20s",
|
||||
png_libpng_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
|
@ -346,65 +344,65 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
|
|||
for(;;)
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
PNG_IHDR;
|
||||
PNG_IDAT;
|
||||
PNG_IEND;
|
||||
PNG_PLTE;
|
||||
PNG_CONST PNG_IHDR;
|
||||
PNG_CONST PNG_IDAT;
|
||||
PNG_CONST PNG_IEND;
|
||||
PNG_CONST PNG_PLTE;
|
||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||
PNG_bKGD;
|
||||
PNG_CONST PNG_bKGD;
|
||||
#endif
|
||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
||||
PNG_cHRM;
|
||||
PNG_CONST PNG_cHRM;
|
||||
#endif
|
||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||
PNG_gAMA;
|
||||
PNG_CONST PNG_gAMA;
|
||||
#endif
|
||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||
PNG_hIST;
|
||||
PNG_CONST PNG_hIST;
|
||||
#endif
|
||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||
PNG_iCCP;
|
||||
PNG_CONST PNG_iCCP;
|
||||
#endif
|
||||
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||
PNG_iTXt;
|
||||
PNG_CONST PNG_iTXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
||||
PNG_oFFs;
|
||||
PNG_CONST PNG_oFFs;
|
||||
#endif
|
||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||
PNG_pCAL;
|
||||
PNG_CONST PNG_pCAL;
|
||||
#endif
|
||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||
PNG_pHYs;
|
||||
PNG_CONST PNG_pHYs;
|
||||
#endif
|
||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
||||
PNG_sBIT;
|
||||
PNG_CONST PNG_sBIT;
|
||||
#endif
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||
PNG_sCAL;
|
||||
PNG_CONST PNG_sCAL;
|
||||
#endif
|
||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||
PNG_sPLT;
|
||||
PNG_CONST PNG_sPLT;
|
||||
#endif
|
||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||
PNG_sRGB;
|
||||
PNG_CONST PNG_sRGB;
|
||||
#endif
|
||||
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||
PNG_tEXt;
|
||||
PNG_CONST PNG_tEXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
||||
PNG_tIME;
|
||||
PNG_CONST PNG_tIME;
|
||||
#endif
|
||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||
PNG_tRNS;
|
||||
PNG_CONST PNG_tRNS;
|
||||
#endif
|
||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||
PNG_zTXt;
|
||||
PNG_CONST PNG_zTXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_APNG_SUPPORTED)
|
||||
PNG_acTL;
|
||||
PNG_fcTL;
|
||||
PNG_fdAT;
|
||||
PNG_CONST PNG_acTL;
|
||||
PNG_CONST PNG_fcTL;
|
||||
PNG_CONST PNG_fdAT;
|
||||
#endif
|
||||
#endif /* PNG_USE_LOCAL_ARRAYS */
|
||||
png_byte chunk_length[4];
|
||||
|
@ -422,7 +420,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
|
|||
/* This should be a binary subdivision search or a hash for
|
||||
* matching the chunk name rather than a linear search.
|
||||
*/
|
||||
if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
|
||||
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||
if(png_ptr->mode & PNG_AFTER_IDAT)
|
||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||
|
||||
|
@ -660,13 +658,14 @@ void PNGAPI
|
|||
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
PNG_IDAT;
|
||||
PNG_CONST PNG_IDAT;
|
||||
#if defined(PNG_READ_APNG_SUPPORTED)
|
||||
PNG_fdAT;
|
||||
PNG_IEND;
|
||||
PNG_CONST PNG_fdAT;
|
||||
PNG_CONST PNG_IEND;
|
||||
#endif
|
||||
const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
|
||||
0xff};
|
||||
PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
|
||||
#endif
|
||||
int ret;
|
||||
if(png_ptr == NULL) return;
|
||||
|
@ -1052,65 +1051,65 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
|
|||
do
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
PNG_IHDR;
|
||||
PNG_IDAT;
|
||||
PNG_IEND;
|
||||
PNG_PLTE;
|
||||
PNG_CONST PNG_IHDR;
|
||||
PNG_CONST PNG_IDAT;
|
||||
PNG_CONST PNG_IEND;
|
||||
PNG_CONST PNG_PLTE;
|
||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||
PNG_bKGD;
|
||||
PNG_CONST PNG_bKGD;
|
||||
#endif
|
||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
||||
PNG_cHRM;
|
||||
PNG_CONST PNG_cHRM;
|
||||
#endif
|
||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||
PNG_gAMA;
|
||||
PNG_CONST PNG_gAMA;
|
||||
#endif
|
||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
||||
PNG_hIST;
|
||||
PNG_CONST PNG_hIST;
|
||||
#endif
|
||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
||||
PNG_iCCP;
|
||||
PNG_CONST PNG_iCCP;
|
||||
#endif
|
||||
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||
PNG_iTXt;
|
||||
PNG_CONST PNG_iTXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
||||
PNG_oFFs;
|
||||
PNG_CONST PNG_oFFs;
|
||||
#endif
|
||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
||||
PNG_pCAL;
|
||||
PNG_CONST PNG_pCAL;
|
||||
#endif
|
||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
||||
PNG_pHYs;
|
||||
PNG_CONST PNG_pHYs;
|
||||
#endif
|
||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
||||
PNG_sBIT;
|
||||
PNG_CONST PNG_sBIT;
|
||||
#endif
|
||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
||||
PNG_sCAL;
|
||||
PNG_CONST PNG_sCAL;
|
||||
#endif
|
||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
||||
PNG_sPLT;
|
||||
PNG_CONST PNG_sPLT;
|
||||
#endif
|
||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||
PNG_sRGB;
|
||||
PNG_CONST PNG_sRGB;
|
||||
#endif
|
||||
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||
PNG_tEXt;
|
||||
PNG_CONST PNG_tEXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
||||
PNG_tIME;
|
||||
PNG_CONST PNG_tIME;
|
||||
#endif
|
||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||
PNG_tRNS;
|
||||
PNG_CONST PNG_tRNS;
|
||||
#endif
|
||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||
PNG_zTXt;
|
||||
PNG_CONST PNG_zTXt;
|
||||
#endif
|
||||
#if defined(PNG_READ_APNG_SUPPORTED)
|
||||
PNG_acTL;
|
||||
PNG_fcTL;
|
||||
PNG_fdAT;
|
||||
PNG_CONST PNG_acTL;
|
||||
PNG_CONST PNG_fcTL;
|
||||
PNG_CONST PNG_fdAT;
|
||||
#endif
|
||||
#endif /* PNG_USE_LOCAL_ARRAYS */
|
||||
|
||||
|
@ -1604,8 +1603,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
|||
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
|
||||
if(transforms == 0 || params == NULL)
|
||||
/* quiet compiler warnings */ return;
|
||||
transforms = transforms; /* quiet compiler warnings */
|
||||
params = params;
|
||||
|
||||
}
|
||||
#endif /* PNG_INFO_IMAGE_SUPPORTED */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* Last changed in libpng 1.2.21 [October 4, 2007]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -548,6 +548,9 @@ 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);
|
||||
#ifdef PNG_WARN_UNINITIALIZED_ROW
|
||||
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* GRR 19990627: the following three functions currently are identical
|
||||
|
@ -574,6 +577,10 @@ 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);
|
||||
#ifdef PNG_WARN_UNINITIALIZED_ROW
|
||||
png_ptr->flags &= !(PNG_FLAG_ROW_INIT);
|
||||
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(PNG_1_0_X)
|
||||
|
@ -583,7 +590,10 @@ 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");
|
||||
if(png_ptr == NULL) return;
|
||||
png_ptr->transformations |= PNG_EXPAND_tRNS;
|
||||
png_ptr->transformations |= PNG_EXPAND;
|
||||
#ifdef PNG_WARN_UNINITIALIZED_ROW
|
||||
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -604,8 +614,11 @@ png_set_gray_1_2_4_to_8(png_structp png_ptr)
|
|||
void PNGAPI
|
||||
png_set_tRNS_to_alpha(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_set_expand\n");
|
||||
png_debug(1, "in png_set_tRNS_to_alpha\n");
|
||||
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
||||
#ifdef PNG_WARN_UNINITIALIZED_ROW
|
||||
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
||||
#endif
|
||||
}
|
||||
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
|
||||
|
||||
|
@ -615,6 +628,9 @@ png_set_gray_to_rgb(png_structp png_ptr)
|
|||
{
|
||||
png_debug(1, "in png_set_gray_to_rgb\n");
|
||||
png_ptr->transformations |= PNG_GRAY_TO_RGB;
|
||||
#ifdef PNG_WARN_UNINITIALIZED_ROW
|
||||
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1244,19 +1260,29 @@ void /* PRIVATE */
|
|||
png_do_read_transformations(png_structp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_do_read_transformations\n");
|
||||
#if !defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||
if (png_ptr->row_buf == NULL)
|
||||
{
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
char msg[50];
|
||||
|
||||
sprintf(msg, "NULL row buffer for row %ld, pass %d", png_ptr->row_number,
|
||||
png_snprintf2(msg, 50,
|
||||
"NULL row buffer for row %ld, pass %d", png_ptr->row_number,
|
||||
png_ptr->pass);
|
||||
png_error(png_ptr, msg);
|
||||
#else
|
||||
png_error(png_ptr, "NULL row buffer");
|
||||
#endif
|
||||
}
|
||||
#ifdef PNG_WARN_UNINITIALIZED_ROW
|
||||
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
|
||||
/* Application has failed to call either png_read_start_image()
|
||||
* or png_read_update_info() after setting transforms that expand
|
||||
* pixels. This check added to libpng-1.2.19 */
|
||||
#if (PNG_WARN_UNINITIALIZED_ROW==1)
|
||||
png_error(png_ptr, "Uninitialized row");
|
||||
#else
|
||||
png_warning(png_ptr, "Uninitialized row");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_EXPAND_SUPPORTED)
|
||||
|
@ -1269,7 +1295,8 @@ png_do_read_transformations(png_structp png_ptr)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS))
|
||||
if (png_ptr->num_trans &&
|
||||
(png_ptr->transformations & PNG_EXPAND_tRNS))
|
||||
png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
||||
&(png_ptr->trans_values));
|
||||
else
|
||||
|
@ -1293,9 +1320,11 @@ 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) ==
|
||||
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) ==
|
||||
PNG_RGB_TO_GRAY_ERR)
|
||||
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
}
|
||||
}
|
||||
|
@ -3699,7 +3728,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
gray = (png_uint_16)(gray*0xff);
|
||||
gray = (png_uint_16)((gray&0x01)*0xff);
|
||||
sp = row + (png_size_t)((row_width - 1) >> 3);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
shift = 7 - (int)((row_width + 7) & 0x07);
|
||||
|
@ -3723,7 +3752,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
gray = (png_uint_16)(gray*0x55);
|
||||
gray = (png_uint_16)((gray&0x03)*0x55);
|
||||
sp = row + (png_size_t)((row_width - 1) >> 2);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
|
||||
|
@ -3746,7 +3775,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
}
|
||||
case 4:
|
||||
{
|
||||
gray = (png_uint_16)(gray*0x11);
|
||||
gray = (png_uint_16)((gray&0x0f)*0x11);
|
||||
sp = row + (png_size_t)((row_width - 1) >> 1);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
|
||||
|
@ -3776,6 +3805,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
gray = gray & 0xff;
|
||||
sp = row + (png_size_t)row_width - 1;
|
||||
dp = row + (png_size_t)(row_width << 1) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
|
@ -3789,12 +3819,13 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
png_byte gray_high = (gray >> 8) & 0xff;
|
||||
png_byte gray_low = gray & 0xff;
|
||||
sp = row + row_info->rowbytes - 1;
|
||||
dp = row + (row_info->rowbytes << 1) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (((png_uint_16)*(sp) |
|
||||
((png_uint_16)*(sp - 1) << 8)) == gray)
|
||||
if (*(sp-1) == gray_high && *(sp) == gray_low)
|
||||
{
|
||||
*dp-- = 0;
|
||||
*dp-- = 0;
|
||||
|
@ -3819,13 +3850,14 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
png_byte red = trans_value->red & 0xff;
|
||||
png_byte green = trans_value->green & 0xff;
|
||||
png_byte blue = trans_value->blue & 0xff;
|
||||
sp = row + (png_size_t)row_info->rowbytes - 1;
|
||||
dp = row + (png_size_t)(row_width << 2) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (*(sp - 2) == trans_value->red &&
|
||||
*(sp - 1) == trans_value->green &&
|
||||
*(sp - 0) == trans_value->blue)
|
||||
if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
|
||||
*dp-- = 0;
|
||||
else
|
||||
*dp-- = 0xff;
|
||||
|
@ -3836,16 +3868,22 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
|||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
png_byte red_high = (trans_value->red >> 8) & 0xff;
|
||||
png_byte green_high = (trans_value->green >> 8) & 0xff;
|
||||
png_byte blue_high = (trans_value->blue >> 8) & 0xff;
|
||||
png_byte red_low = trans_value->red & 0xff;
|
||||
png_byte green_low = trans_value->green & 0xff;
|
||||
png_byte blue_low = trans_value->blue & 0xff;
|
||||
sp = row + row_info->rowbytes - 1;
|
||||
dp = row + (png_size_t)(row_width << 3) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if ((((png_uint_16)*(sp - 4) |
|
||||
((png_uint_16)*(sp - 5) << 8)) == trans_value->red) &&
|
||||
(((png_uint_16)*(sp - 2) |
|
||||
((png_uint_16)*(sp - 3) << 8)) == trans_value->green) &&
|
||||
(((png_uint_16)*(sp - 0) |
|
||||
((png_uint_16)*(sp - 1) << 8)) == trans_value->blue))
|
||||
if (*(sp - 5) == red_high &&
|
||||
*(sp - 4) == red_low &&
|
||||
*(sp - 3) == green_high &&
|
||||
*(sp - 2) == green_low &&
|
||||
*(sp - 1) == blue_high &&
|
||||
*(sp ) == blue_low)
|
||||
{
|
||||
*dp-- = 0;
|
||||
*dp-- = 0;
|
||||
|
@ -3965,7 +4003,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[] =
|
||||
static PNG_CONST 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,7 +1,7 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* Last changed in libpng 1.2.21 [October 4, 2007]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -16,10 +16,14 @@
|
|||
|
||||
#if defined(PNG_READ_SUPPORTED)
|
||||
|
||||
#if defined(_WIN32_WCE) && (_WIN32_WCE<0x500)
|
||||
# define WIN32_WCE_OLD
|
||||
#endif
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
# if defined(_WIN32_WCE)
|
||||
# if defined(WIN32_WCE_OLD)
|
||||
/* strtod() function is not supported on WindowsCE */
|
||||
__inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr)
|
||||
__inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, char **endptr)
|
||||
{
|
||||
double result = 0;
|
||||
int len;
|
||||
|
@ -33,7 +37,7 @@ __inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr)
|
|||
result = wcstod(str, &end);
|
||||
len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL);
|
||||
*endptr = (char *)nptr + (png_strlen(nptr) - len + 1);
|
||||
png_free(str);
|
||||
png_free(png_ptr, str);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -181,7 +185,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";
|
||||
static PNG_CONST char msg[] = "Error decoding compressed text";
|
||||
png_charp text;
|
||||
png_size_t text_size;
|
||||
|
||||
|
@ -282,13 +286,16 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||
char umsg[52];
|
||||
|
||||
if (ret == Z_BUF_ERROR)
|
||||
sprintf(umsg,"Buffer error in compressed datastream in %s chunk",
|
||||
png_snprintf(umsg, 52,
|
||||
"Buffer error in compressed datastream in %s chunk",
|
||||
png_ptr->chunk_name);
|
||||
else if (ret == Z_DATA_ERROR)
|
||||
sprintf(umsg,"Data error in compressed datastream in %s chunk",
|
||||
png_snprintf(umsg, 52,
|
||||
"Data error in compressed datastream in %s chunk",
|
||||
png_ptr->chunk_name);
|
||||
else
|
||||
sprintf(umsg,"Incomplete compressed datastream in %s chunk",
|
||||
png_snprintf(umsg, 52,
|
||||
"Incomplete compressed datastream in %s chunk",
|
||||
png_ptr->chunk_name);
|
||||
png_warning(png_ptr, umsg);
|
||||
#else
|
||||
|
@ -321,7 +328,8 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
char umsg[50];
|
||||
|
||||
sprintf(umsg, "Unknown zTXt compression type %d", comp_type);
|
||||
png_snprintf(umsg, 50,
|
||||
"Unknown zTXt compression type %d", comp_type);
|
||||
png_warning(png_ptr, umsg);
|
||||
#else
|
||||
png_warning(png_ptr, "Unknown zTXt compression type");
|
||||
|
@ -568,8 +576,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
}
|
||||
png_crc_finish(png_ptr, length);
|
||||
|
||||
if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */
|
||||
return;
|
||||
info_ptr =info_ptr; /* quiet compiler warnings about unused info_ptr */
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
||||
|
@ -1042,7 +1049,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
/* there should be at least one zero (the compression type byte)
|
||||
following the separator, and we should be on it */
|
||||
if ( profile >= chunkdata + slength)
|
||||
if ( profile >= chunkdata + slength - 1)
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
png_warning(png_ptr, "Malformed iCCP chunk");
|
||||
|
@ -1146,7 +1153,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
++entry_start;
|
||||
|
||||
/* a sample depth should follow the separator, and we should be on it */
|
||||
if (entry_start > chunkdata + slength)
|
||||
if (entry_start > chunkdata + slength - 2)
|
||||
{
|
||||
png_free(png_ptr, chunkdata);
|
||||
png_warning(png_ptr, "malformed sPLT chunk");
|
||||
|
@ -1239,9 +1246,15 @@ void /* PRIVATE */
|
|||
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
|
||||
int bit_mask;
|
||||
|
||||
png_debug(1, "in png_handle_tRNS\n");
|
||||
|
||||
/* For non-indexed color, mask off any bits in the tRNS value that
|
||||
* exceed the bit depth. Some creators were writing extra bits there.
|
||||
* This is not needed for indexed color. */
|
||||
bit_mask = (1 << png_ptr->bit_depth) - 1;
|
||||
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||
png_error(png_ptr, "Missing IHDR before tRNS");
|
||||
else if (png_ptr->mode & PNG_HAVE_IDAT)
|
||||
|
@ -1270,7 +1283,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_crc_read(png_ptr, buf, 2);
|
||||
png_ptr->num_trans = 1;
|
||||
png_ptr->trans_values.gray = png_get_uint_16(buf);
|
||||
png_ptr->trans_values.gray = png_get_uint_16(buf) & bit_mask;
|
||||
}
|
||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
||||
{
|
||||
|
@ -1284,9 +1297,9 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
}
|
||||
png_crc_read(png_ptr, buf, (png_size_t)length);
|
||||
png_ptr->num_trans = 1;
|
||||
png_ptr->trans_values.red = png_get_uint_16(buf);
|
||||
png_ptr->trans_values.green = png_get_uint_16(buf + 2);
|
||||
png_ptr->trans_values.blue = png_get_uint_16(buf + 4);
|
||||
png_ptr->trans_values.red = png_get_uint_16(buf) & bit_mask;
|
||||
png_ptr->trans_values.green = png_get_uint_16(buf + 2) & bit_mask;
|
||||
png_ptr->trans_values.blue = png_get_uint_16(buf + 4) & bit_mask;
|
||||
}
|
||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
|
@ -1665,7 +1678,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
buf++; /* Skip the null string terminator from previous parameter. */
|
||||
|
||||
png_debug1(3, "Reading pCAL parameter %d\n", i);
|
||||
for (params[i] = buf; *buf != 0x00 && buf <= endptr; buf++)
|
||||
for (params[i] = buf; buf <= endptr && *buf != 0x00; buf++)
|
||||
/* Empty loop to move past each parameter string */ ;
|
||||
|
||||
/* Make sure we haven't run out of data yet */
|
||||
|
@ -1763,6 +1776,17 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
/* empty loop */ ;
|
||||
ep++;
|
||||
|
||||
if (buffer + slength < ep)
|
||||
{
|
||||
png_warning(png_ptr, "Truncated sCAL chunk");
|
||||
#if defined(PNG_FIXED_POINT_SUPPORTED) && \
|
||||
!defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
png_free(png_ptr, swidth);
|
||||
#endif
|
||||
png_free(png_ptr, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
height = png_strtod(png_ptr, ep, &vp);
|
||||
if (*vp)
|
||||
|
@ -1986,10 +2010,11 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
/* empty loop */ ;
|
||||
|
||||
/* zTXt must have some text after the chunkdataword */
|
||||
if (text == chunkdata + slength)
|
||||
if (text >= chunkdata + slength - 2)
|
||||
{
|
||||
comp_type = PNG_TEXT_COMPRESSION_NONE;
|
||||
png_warning(png_ptr, "Zero length zTXt chunk");
|
||||
png_warning(png_ptr, "Truncated zTXt chunk");
|
||||
png_free(png_ptr, chunkdata);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2089,10 +2114,11 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
translated keyword (possibly empty), and possibly some text after the
|
||||
keyword */
|
||||
|
||||
if (lang >= chunkdata + slength)
|
||||
if (lang >= chunkdata + slength - 3)
|
||||
{
|
||||
comp_flag = PNG_TEXT_COMPRESSION_NONE;
|
||||
png_warning(png_ptr, "Zero length iTXt chunk");
|
||||
png_warning(png_ptr, "Truncated iTXt chunk");
|
||||
png_free(png_ptr, chunkdata);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2104,9 +2130,22 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
/* empty loop */ ;
|
||||
lang_key++; /* skip NUL separator */
|
||||
|
||||
if (lang_key >= chunkdata + slength)
|
||||
{
|
||||
png_warning(png_ptr, "Truncated iTXt chunk");
|
||||
png_free(png_ptr, chunkdata);
|
||||
return;
|
||||
}
|
||||
|
||||
for (text = lang_key; *text; text++)
|
||||
/* empty loop */ ;
|
||||
text++; /* skip NUL separator */
|
||||
if (text >= chunkdata + slength)
|
||||
{
|
||||
png_warning(png_ptr, "Malformed iTXt chunk");
|
||||
png_free(png_ptr, chunkdata);
|
||||
return;
|
||||
}
|
||||
|
||||
prefix_len = text - chunkdata;
|
||||
|
||||
|
@ -2318,7 +2357,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
if (png_ptr->mode & PNG_HAVE_IDAT)
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
PNG_IDAT;
|
||||
PNG_CONST PNG_IDAT;
|
||||
#endif
|
||||
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* not an IDAT */
|
||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||
|
@ -2343,8 +2382,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)
|
||||
{
|
||||
|
@ -2353,30 +2390,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_strncpy((png_charp)png_ptr->unknown_chunk.name,
|
||||
(png_charp)png_ptr->chunk_name, 5);
|
||||
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
|
||||
|
@ -2385,8 +2427,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
png_crc_finish(png_ptr, skip);
|
||||
|
||||
#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||
if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */
|
||||
return;
|
||||
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2419,7 +2460,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_MMX_COMBINE_ROW
|
||||
|
||||
void /* PRIVATE */
|
||||
png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||
{
|
||||
|
@ -2620,10 +2661,8 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* !PNG_HAVE_MMX_COMBINE_ROW */
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
#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)
|
||||
|
@ -2638,10 +2677,10 @@ png_do_read_interlace(png_structp png_ptr)
|
|||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
/* offset to next interlace block */
|
||||
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
#endif
|
||||
|
||||
png_debug(1,"in png_do_read_interlace (stock C version)\n");
|
||||
png_debug(1,"in png_do_read_interlace\n");
|
||||
if (row != NULL && row_info != NULL)
|
||||
{
|
||||
png_uint_32 final_width;
|
||||
|
@ -2845,14 +2884,11 @@ png_do_read_interlace(png_structp png_ptr)
|
|||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
|
||||
}
|
||||
#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||
if (&transformations == NULL) /* silence compiler warning */
|
||||
return;
|
||||
transformations = transformations; /* silence compiler warning */
|
||||
#endif
|
||||
}
|
||||
#endif /* !PNG_HAVE_MMX_READ_INTERLACE */
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
|
||||
#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)
|
||||
|
@ -2975,7 +3011,6 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif /* !PNG_HAVE_MMX_READ_FILTER_ROW */
|
||||
|
||||
void /* PRIVATE */
|
||||
png_read_finish_row(png_structp png_ptr)
|
||||
|
@ -2984,16 +3019,16 @@ png_read_finish_row(png_structp png_ptr)
|
|||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* start of interlace block */
|
||||
const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* offset to next interlace block */
|
||||
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* start of interlace block in the y direction */
|
||||
const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* offset to next interlace block in the y direction */
|
||||
const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
#endif
|
||||
|
||||
png_debug(1, "in png_read_finish_row\n");
|
||||
|
@ -3004,7 +3039,8 @@ png_read_finish_row(png_structp png_ptr)
|
|||
if (png_ptr->interlaced)
|
||||
{
|
||||
png_ptr->row_number = 0;
|
||||
png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||
png_memset_check(png_ptr, png_ptr->prev_row, 0,
|
||||
png_ptr->rowbytes + 1);
|
||||
do
|
||||
{
|
||||
png_ptr->pass++;
|
||||
|
@ -3038,7 +3074,7 @@ png_read_finish_row(png_structp png_ptr)
|
|||
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
|
||||
{
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
PNG_IDAT;
|
||||
PNG_CONST PNG_IDAT;
|
||||
#endif
|
||||
char extra;
|
||||
int ret;
|
||||
|
@ -3059,7 +3095,7 @@ png_read_finish_row(png_structp png_ptr)
|
|||
png_ptr->idat_size = png_get_uint_31(png_ptr, chunk_length);
|
||||
png_reset_crc(png_ptr);
|
||||
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
||||
if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
|
||||
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||
png_error(png_ptr, "Not enough image data");
|
||||
|
||||
}
|
||||
|
@ -3111,16 +3147,16 @@ png_read_start_row(png_structp png_ptr)
|
|||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* start of interlace block */
|
||||
const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
|
||||
|
||||
/* offset to next interlace block */
|
||||
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
/* start of interlace block in the y direction */
|
||||
const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
|
||||
|
||||
/* offset to next interlace block in the y direction */
|
||||
const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
#endif
|
||||
|
||||
int max_pixel_depth;
|
||||
|
@ -3271,9 +3307,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||
png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64);
|
||||
if (png_ptr->row_buf == NULL)
|
||||
png_ptr->row_buf = png_ptr->big_row_buf+32;
|
||||
#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)
|
||||
png_ptr->row_buf_size = row_bytes;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* Last changed in libpng 1.2.21 [October 4, 2007]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -222,7 +222,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
|||
png_debug1(1, "in %s storage function\n", "hIST");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
if (info_ptr->num_palette <= 0 || info_ptr->num_palette
|
||||
if (info_ptr->num_palette == 0 || info_ptr->num_palette
|
||||
> PNG_MAX_PALETTE_LENGTH)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
|
@ -353,7 +353,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
||||
/* check for potential overflow */
|
||||
if ( width > (PNG_UINT_32_MAX
|
||||
if (width > (PNG_UINT_32_MAX
|
||||
>> 3) /* 8-byte RGBA pixels */
|
||||
- 64 /* bigrowbuf hack */
|
||||
- 1 /* filter byte */
|
||||
|
@ -489,7 +489,8 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
|
||||
if (info_ptr->scal_s_width == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Memory allocation failed while processing sCAL.");
|
||||
png_warning(png_ptr,
|
||||
"Memory allocation failed while processing sCAL.");
|
||||
}
|
||||
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
||||
|
||||
|
@ -499,7 +500,8 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||
if (info_ptr->scal_s_height == NULL)
|
||||
{
|
||||
png_free (png_ptr, info_ptr->scal_s_width);
|
||||
png_warning(png_ptr, "Memory allocation failed while processing sCAL.");
|
||||
png_warning(png_ptr,
|
||||
"Memory allocation failed while processing sCAL.");
|
||||
}
|
||||
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
||||
|
||||
|
@ -693,7 +695,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|||
png_warning(png_ptr, "Insufficient memory to process iCCP chunk.");
|
||||
return;
|
||||
}
|
||||
png_strcpy(new_iccp_name, name);
|
||||
png_strncpy(new_iccp_name, name, png_strlen(new_iccp_name)+1);
|
||||
new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen);
|
||||
if (new_iccp_profile == NULL)
|
||||
{
|
||||
|
@ -882,7 +884,6 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||
textp->itxt_length = 0;
|
||||
#endif
|
||||
}
|
||||
info_ptr->text[info_ptr->num_text]= *textp;
|
||||
info_ptr->num_text++;
|
||||
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
|
||||
}
|
||||
|
@ -976,15 +977,27 @@ png_set_sPLT(png_structp png_ptr,
|
|||
png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
|
||||
png_sPLT_tp from = entries + i;
|
||||
|
||||
to->name = (png_charp)png_malloc(png_ptr,
|
||||
png_strlen(from->name) + 1);
|
||||
to->name = (png_charp)png_malloc_warn(png_ptr,
|
||||
png_strlen(from->name) + 1);
|
||||
if (to->name == NULL)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Out of memory while processing sPLT chunk");
|
||||
}
|
||||
/* TODO: use png_malloc_warn */
|
||||
png_strcpy(to->name, from->name);
|
||||
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
||||
png_strncpy(to->name, from->name, png_strlen(from->name)+1);
|
||||
to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
|
||||
from->nentries * png_sizeof(png_sPLT_entry));
|
||||
/* TODO: use png_malloc_warn */
|
||||
png_memcpy(to->entries, from->entries,
|
||||
from->nentries * png_sizeof(png_sPLT_entry));
|
||||
if (to->entries == NULL)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Out of memory while processing sPLT chunk");
|
||||
png_free(png_ptr,to->name);
|
||||
to->name = NULL;
|
||||
}
|
||||
to->nentries = from->nentries;
|
||||
to->depth = from->depth;
|
||||
}
|
||||
|
@ -1149,7 +1162,8 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||
png_sizeof(png_unknown_chunk));
|
||||
if (np == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Out of memory while processing unknown chunk.");
|
||||
png_warning(png_ptr,
|
||||
"Out of memory while processing unknown chunk.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1181,8 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||
to->data = (png_bytep)png_malloc_warn(png_ptr, from->size);
|
||||
if (to->data == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Out of memory processing unknown chunk.");
|
||||
png_warning(png_ptr,
|
||||
"Out of memory while processing unknown chunk.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1327,51 +1342,13 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
|||
|
||||
#ifndef PNG_1_0_X
|
||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
/* this function was added to libpng 1.2.0 and should always exist by default */
|
||||
/* function was added to libpng 1.2.0 and should always exist by default */
|
||||
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
|
||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||
#endif
|
||||
#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||
#endif
|
||||
#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH |
|
||||
#endif
|
||||
0;
|
||||
|
||||
/* could be some non-MMX ones in the future, but not currently: */
|
||||
settable_asm_flags = settable_mmx_flags;
|
||||
|
||||
if (!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED) ||
|
||||
!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU))
|
||||
{
|
||||
/* clear all MMX flags if MMX isn't supported */
|
||||
settable_asm_flags &= ~settable_mmx_flags;
|
||||
png_ptr->asm_flags &= ~settable_mmx_flags;
|
||||
}
|
||||
|
||||
/* we're replacing the settable bits with those passed in by the user,
|
||||
* 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 */
|
||||
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
|
||||
if (png_ptr != NULL)
|
||||
png_ptr->asm_flags = 0;
|
||||
}
|
||||
|
||||
/* this function was added to libpng 1.2.0 */
|
||||
|
@ -1380,12 +1357,9 @@ png_set_mmx_thresholds (png_structp png_ptr,
|
|||
png_byte mmx_bitdepth_threshold,
|
||||
png_uint_32 mmx_rowbytes_threshold)
|
||||
{
|
||||
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
|
||||
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 */
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.2.13 November 13, 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.)
|
||||
*/
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* 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
|
||||
* Copyright (c) 1998-2006 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.)
|
||||
*
|
||||
|
|
|
@ -399,11 +399,6 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
|||
|
||||
/* write end of PNG file */
|
||||
png_write_IEND(png_ptr);
|
||||
#if 0
|
||||
/* This flush, added in libpng-1.0.8, causes some applications to crash
|
||||
because they do not set png_ptr->output_flush_fn */
|
||||
png_flush(png_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
||||
|
@ -467,14 +462,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
if (png_ptr == NULL)
|
||||
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
|
||||
#endif /* PNG_1_0_X */
|
||||
|
||||
/* added at libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
|
||||
|
@ -525,11 +512,13 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
char msg[80];
|
||||
if (user_png_ver)
|
||||
{
|
||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application was compiled with png.h from libpng-%.20s",
|
||||
user_png_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application is running with png.c from libpng-%.20s",
|
||||
png_libpng_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
#endif
|
||||
|
@ -595,11 +584,13 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||
png_ptr->warning_fn=NULL;
|
||||
if (user_png_ver)
|
||||
{
|
||||
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application was compiled with png.h from libpng-%.20s",
|
||||
user_png_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||
png_snprintf(msg, 80,
|
||||
"Application is running with png.c from libpng-%.20s",
|
||||
png_libpng_ver);
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
|
@ -679,14 +670,6 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
|||
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
|
||||
#endif
|
||||
|
||||
#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
|
||||
/* restore jump buffer */
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
|
||||
|
@ -1145,15 +1128,26 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||
{
|
||||
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
||||
{
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
case 5:
|
||||
case 6:
|
||||
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||
case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break;
|
||||
case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break;
|
||||
case PNG_FILTER_VALUE_UP: png_ptr->do_filter=PNG_FILTER_UP; break;
|
||||
case PNG_FILTER_VALUE_AVG: png_ptr->do_filter=PNG_FILTER_AVG; break;
|
||||
case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter=PNG_FILTER_PAETH;break;
|
||||
#endif /* PNG_NO_WRITE_FILTER */
|
||||
case PNG_FILTER_VALUE_NONE:
|
||||
png_ptr->do_filter=PNG_FILTER_NONE; break;
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
case PNG_FILTER_VALUE_SUB:
|
||||
png_ptr->do_filter=PNG_FILTER_SUB; break;
|
||||
case PNG_FILTER_VALUE_UP:
|
||||
png_ptr->do_filter=PNG_FILTER_UP; break;
|
||||
case PNG_FILTER_VALUE_AVG:
|
||||
png_ptr->do_filter=PNG_FILTER_AVG; break;
|
||||
case PNG_FILTER_VALUE_PAETH:
|
||||
png_ptr->do_filter=PNG_FILTER_PAETH; break;
|
||||
default: png_ptr->do_filter = (png_byte)filters; break;
|
||||
#else
|
||||
default: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||
#endif /* PNG_NO_WRITE_FILTER */
|
||||
}
|
||||
|
||||
/* If we have allocated the row_buf, this means we have already started
|
||||
|
@ -1167,6 +1161,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||
*/
|
||||
if (png_ptr->row_buf != NULL)
|
||||
{
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
|
||||
{
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
|
@ -1221,6 +1216,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||
}
|
||||
|
||||
if (png_ptr->do_filter == PNG_NO_FILTERS)
|
||||
#endif /* PNG_NO_WRITE_FILTER */
|
||||
png_ptr->do_filter = PNG_FILTER_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -1519,8 +1515,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
|
|||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
|
||||
if(transforms == 0 || params == NULL)
|
||||
/* quiet compiler warnings */ return;
|
||||
transforms = transforms; /* quiet compiler warnings */
|
||||
params = params;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.15 January 5, 2007
|
||||
* Last changed in libpng 1.2.20 Septhember 3, 2007
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -182,7 +182,7 @@ png_text_compress(png_structp png_ptr,
|
|||
{
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
char msg[50];
|
||||
sprintf(msg, "Unknown compression type %d", compression);
|
||||
png_snprintf(msg, 50, "Unknown compression type %d", compression);
|
||||
png_warning(png_ptr, msg);
|
||||
#else
|
||||
png_warning(png_ptr, "Unknown compression type");
|
||||
|
@ -494,7 +494,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||
buf[12] = (png_byte)interlace_type;
|
||||
|
||||
/* write the chunk */
|
||||
png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13);
|
||||
png_write_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
||||
|
||||
#if defined(PNG_WRITE_APNG_SUPPORTED)
|
||||
png_ptr->first_frame_width = width;
|
||||
|
@ -528,9 +528,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 */
|
||||
|
@ -582,7 +583,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
|
|||
png_ptr->num_palette = (png_uint_16)num_pal;
|
||||
png_debug1(3, "num_palette = %d\n", png_ptr->num_palette);
|
||||
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, num_pal * 3);
|
||||
png_write_chunk_start(png_ptr, png_PLTE, num_pal * 3);
|
||||
#ifndef PNG_NO_POINTER_INDEXING
|
||||
for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
|
||||
{
|
||||
|
@ -711,7 +712,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma)
|
|||
/* file_gamma is saved in 1/100,000ths */
|
||||
igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5);
|
||||
png_save_uint_32(buf, igamma);
|
||||
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
|
||||
png_write_chunk(png_ptr, png_gAMA, buf, (png_size_t)4);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
|
@ -726,7 +727,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
|
|||
png_debug(1, "in png_write_gAMA\n");
|
||||
/* file_gamma is saved in 1/100,000ths */
|
||||
png_save_uint_32(buf, (png_uint_32)file_gamma);
|
||||
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
|
||||
png_write_chunk(png_ptr, png_gAMA, buf, (png_size_t)4);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -746,7 +747,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
|
|||
png_warning(png_ptr,
|
||||
"Invalid sRGB rendering intent specified");
|
||||
buf[0]=(png_byte)srgb_intent;
|
||||
png_write_chunk(png_ptr, (png_bytep)png_sRGB, buf, (png_size_t)1);
|
||||
png_write_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -811,7 +812,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
|||
PNG_COMPRESSION_TYPE_BASE, &comp);
|
||||
|
||||
/* make sure we include the NULL after the name and the compression type */
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
|
||||
png_write_chunk_start(png_ptr, png_iCCP,
|
||||
(png_uint_32)name_len+profile_len+2);
|
||||
new_name[name_len+1]=0x00;
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 2);
|
||||
|
@ -851,7 +852,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
|
|||
}
|
||||
|
||||
/* make sure we include the NULL after the name */
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_sPLT,
|
||||
png_write_chunk_start(png_ptr, png_sPLT,
|
||||
(png_uint_32)(name_len + 2 + palette_size));
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1);
|
||||
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1);
|
||||
|
@ -959,7 +960,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
|
|||
buf[size++] = sbit->alpha;
|
||||
}
|
||||
|
||||
png_write_chunk(png_ptr, (png_bytep)png_sBIT, buf, size);
|
||||
png_write_chunk(png_ptr, png_sBIT, buf, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1023,7 +1024,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
|
|||
itemp = (png_uint_32)(blue_y * 100000.0 + 0.5);
|
||||
png_save_uint_32(buf + 28, itemp);
|
||||
|
||||
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
|
||||
png_write_chunk(png_ptr, png_cHRM, buf, (png_size_t)32);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
|
@ -1075,7 +1076,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
|
|||
png_save_uint_32(buf + 24, (png_uint_32)blue_x);
|
||||
png_save_uint_32(buf + 28, (png_uint_32)blue_y);
|
||||
|
||||
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
|
||||
png_write_chunk(png_ptr, png_cHRM, buf, (png_size_t)32);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1100,7 +1101,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
|
|||
return;
|
||||
}
|
||||
/* write the chunk out as it is */
|
||||
png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, (png_size_t)num_trans);
|
||||
png_write_chunk(png_ptr, png_tRNS, trans, (png_size_t)num_trans);
|
||||
}
|
||||
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
{
|
||||
|
@ -1112,7 +1113,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
|
|||
return;
|
||||
}
|
||||
png_save_uint_16(buf, tran->gray);
|
||||
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2);
|
||||
png_write_chunk(png_ptr, png_tRNS, buf, (png_size_t)2);
|
||||
}
|
||||
else if (color_type == PNG_COLOR_TYPE_RGB)
|
||||
{
|
||||
|
@ -1126,7 +1127,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
|
|||
"Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
|
||||
return;
|
||||
}
|
||||
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6);
|
||||
png_write_chunk(png_ptr, png_tRNS, buf, (png_size_t)6);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1159,7 +1160,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
|
|||
return;
|
||||
}
|
||||
buf[0] = back->index;
|
||||
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)1);
|
||||
png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
|
||||
}
|
||||
else if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
{
|
||||
|
@ -1172,7 +1173,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
|
|||
"Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8");
|
||||
return;
|
||||
}
|
||||
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6);
|
||||
png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)6);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1183,7 +1184,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
|
|||
return;
|
||||
}
|
||||
png_save_uint_16(buf, back->gray);
|
||||
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2);
|
||||
png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1208,7 +1209,7 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
|
|||
return;
|
||||
}
|
||||
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_hIST, (png_uint_32)(num_hist * 2));
|
||||
png_write_chunk_start(png_ptr, png_hIST, (png_uint_32)(num_hist * 2));
|
||||
for (i = 0; i < num_hist; i++)
|
||||
{
|
||||
png_save_uint_16(buf, hist[i]);
|
||||
|
@ -1259,12 +1260,14 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||
/* Replace non-printing characters with a blank and print a warning */
|
||||
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
|
||||
{
|
||||
if (*kp < 0x20 || (*kp > 0x7E && (png_byte)*kp < 0xA1))
|
||||
if ((png_byte)*kp < 0x20 ||
|
||||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
|
||||
{
|
||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||
char msg[40];
|
||||
|
||||
sprintf(msg, "invalid keyword character 0x%02X", *kp);
|
||||
png_snprintf(msg, 40,
|
||||
"invalid keyword character 0x%02X", (png_byte)*kp);
|
||||
png_warning(png_ptr, msg);
|
||||
#else
|
||||
png_warning(png_ptr, "invalid character in keyword");
|
||||
|
@ -1372,7 +1375,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
|
|||
text_len = png_strlen(text);
|
||||
|
||||
/* make sure we include the 0 after the key */
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, (png_uint_32)key_len+text_len+1);
|
||||
png_write_chunk_start(png_ptr, png_tEXt, (png_uint_32)key_len+text_len+1);
|
||||
/*
|
||||
* We leave it to the application to meet PNG-1.0 requirements on the
|
||||
* contents of the text. PNG-1.0 through PNG-1.2 discourage the use of
|
||||
|
@ -1425,17 +1428,17 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
|
|||
|
||||
text_len = png_strlen(text);
|
||||
|
||||
png_free(png_ptr, new_key);
|
||||
|
||||
/* compute the compressed data; do it now for the length */
|
||||
text_len = png_text_compress(png_ptr, text, text_len, compression,
|
||||
&comp);
|
||||
|
||||
/* write start of chunk */
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32)
|
||||
png_write_chunk_start(png_ptr, png_zTXt, (png_uint_32)
|
||||
(key_len+text_len+2));
|
||||
/* write key */
|
||||
png_write_chunk_data(png_ptr, (png_bytep)key, key_len + 1);
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1);
|
||||
png_free(png_ptr, new_key);
|
||||
|
||||
buf[0] = (png_byte)compression;
|
||||
/* write compression */
|
||||
png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1);
|
||||
|
@ -1498,7 +1501,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
|||
/* make sure we include the compression flag, the compression byte,
|
||||
* and the NULs after the key, lang, and lang_key parts */
|
||||
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_iTXt,
|
||||
png_write_chunk_start(png_ptr, png_iTXt,
|
||||
(png_uint_32)(
|
||||
5 /* comp byte, comp flag, terminators for key, lang and lang_key */
|
||||
+ key_len
|
||||
|
@ -1555,10 +1558,9 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
|
|||
png_save_int_32(buf + 4, y_offset);
|
||||
buf[8] = (png_byte)unit_type;
|
||||
|
||||
png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9);
|
||||
png_write_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_WRITE_pCAL_SUPPORTED)
|
||||
/* write the pCAL chunk (described in the PNG extensions document) */
|
||||
void /* PRIVATE */
|
||||
|
@ -1597,7 +1599,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
|||
}
|
||||
|
||||
png_debug1(3, "pCAL total length = %d\n", (int)total_len);
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len);
|
||||
png_write_chunk_start(png_ptr, png_pCAL, (png_uint_32)total_len);
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len);
|
||||
png_save_int_32(buf, X0);
|
||||
png_save_int_32(buf + 4, X1);
|
||||
|
@ -1650,14 +1652,14 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
|
|||
total_len += wc_len;
|
||||
}
|
||||
#else
|
||||
sprintf(buf + 1, "%12.12e", width);
|
||||
png_snprintf(buf + 1, 63, "%12.12e", width);
|
||||
total_len = 1 + png_strlen(buf + 1) + 1;
|
||||
sprintf(buf + total_len, "%12.12e", height);
|
||||
png_snprintf(buf + total_len, 64-total_len, "%12.12e", height);
|
||||
total_len += png_strlen(buf + total_len);
|
||||
#endif
|
||||
|
||||
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
|
||||
png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len);
|
||||
png_write_chunk(png_ptr, png_sCAL, (png_bytep)buf, total_len);
|
||||
}
|
||||
#else
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
|
@ -1687,7 +1689,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
|
|||
png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */
|
||||
|
||||
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
|
||||
png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len);
|
||||
png_write_chunk(png_ptr, png_sCAL, buf, total_len);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1713,7 +1715,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
|
|||
png_save_uint_32(buf + 4, y_pixels_per_unit);
|
||||
buf[8] = (png_byte)unit_type;
|
||||
|
||||
png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9);
|
||||
png_write_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1745,7 +1747,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
|
|||
buf[5] = mod_time->minute;
|
||||
buf[6] = mod_time->second;
|
||||
|
||||
png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7);
|
||||
png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1817,6 +1819,7 @@ png_write_fcTL(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||
void /* PRIVATE */
|
||||
png_write_start_row(png_structp png_ptr)
|
||||
{
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
|
@ -1831,6 +1834,7 @@ png_write_start_row(png_structp png_ptr)
|
|||
|
||||
/* offset to next interlace block in the y direction */
|
||||
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
png_size_t buf_size;
|
||||
|
@ -1840,16 +1844,15 @@ png_write_start_row(png_structp png_ptr)
|
|||
png_ptr->usr_channels*png_ptr->usr_bit_depth,png_ptr->width)+1);
|
||||
|
||||
/* set up row buffer */
|
||||
if (png_ptr->row_buf == NULL)
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
||||
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
|
||||
|
||||
#ifndef PNG_NO_WRITE_FILTERING
|
||||
/* set up filtering buffer, if using this filter */
|
||||
if (png_ptr->do_filter & PNG_FILTER_SUB)
|
||||
{
|
||||
if (png_ptr->sub_row == NULL)
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
}
|
||||
|
||||
|
@ -1857,33 +1860,30 @@ png_write_start_row(png_structp png_ptr)
|
|||
if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
|
||||
{
|
||||
/* set up previous row buffer */
|
||||
if (png_ptr->prev_row == NULL)
|
||||
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
||||
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
||||
png_memset(png_ptr->prev_row, 0, buf_size);
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_UP)
|
||||
{
|
||||
if (png_ptr->up_row == NULL)
|
||||
png_ptr->up_row = (png_bytep )png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||
}
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_AVG)
|
||||
{
|
||||
if (png_ptr->avg_row == NULL)
|
||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
}
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_PAETH)
|
||||
{
|
||||
if (png_ptr->paeth_row == NULL)
|
||||
png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
}
|
||||
#endif /* PNG_NO_WRITE_FILTERING */
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
|
@ -1917,6 +1917,7 @@ png_write_start_row(png_structp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_write_finish_row(png_structp png_ptr)
|
||||
{
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
|
@ -1931,6 +1932,7 @@ png_write_finish_row(png_structp png_ptr)
|
|||
|
||||
/* offset to next interlace block in the y direction */
|
||||
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int ret;
|
||||
|
@ -2205,7 +2207,9 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||
void /* PRIVATE */
|
||||
png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_bytep prev_row, best_row, row_buf;
|
||||
png_bytep best_row;
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
png_bytep prev_row, row_buf;
|
||||
png_uint_32 mins, bpp;
|
||||
png_byte filter_to_do = png_ptr->do_filter;
|
||||
png_uint_32 row_bytes = row_info->rowbytes;
|
||||
|
@ -2218,7 +2222,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||
bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
|
||||
prev_row = png_ptr->prev_row;
|
||||
best_row = row_buf = png_ptr->row_buf;
|
||||
#endif
|
||||
best_row = png_ptr->row_buf;
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
row_buf = best_row;
|
||||
mins = PNG_MAXSUM;
|
||||
|
||||
/* The prediction method we use is to find which method provides the
|
||||
|
@ -2793,11 +2800,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||
best_row = png_ptr->paeth_row;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PNG_NO_WRITE_FILTER */
|
||||
/* Do the actual writing of the filtered row data from the chosen filter. */
|
||||
|
||||
png_write_filtered_row(png_ptr, best_row);
|
||||
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||
/* Save the type of filter we picked this time for future calculations */
|
||||
if (png_ptr->num_prev_filters > 0)
|
||||
|
@ -2810,6 +2818,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||
png_ptr->prev_filters[j] = best_row[0];
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_NO_WRITE_FILTER */
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче