mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-05 13:35:40 +00:00
Updated libpng to 1.6.19
This commit is contained in:
parent
c438479f2d
commit
ef8d3c32ab
137
hecl/extern/libpng/ANNOUNCE
vendored
137
hecl/extern/libpng/ANNOUNCE
vendored
@ -1,4 +1,4 @@
|
||||
Libpng 1.6.17 - March 26, 2015
|
||||
Libpng 1.6.19 - November 12, 2015
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
@ -7,61 +7,104 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
libpng-1.6.17.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.17.tar.gz
|
||||
libpng-1.6.19.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.19.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lpng1617.7z (LZMA-compressed, recommended)
|
||||
lpng1617.zip
|
||||
lpng1619.7z (LZMA-compressed, recommended)
|
||||
lpng1619.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.17-README.txt
|
||||
libpng-1.6.17-LICENSE.txt
|
||||
libpng-1.6.17-*.asc (armored detached GPG signatures)
|
||||
libpng-1.6.19-README.txt
|
||||
libpng-1.6.19-LICENSE.txt
|
||||
libpng-1.6.19-*.asc (armored detached GPG signatures)
|
||||
|
||||
Changes since the last public release (1.6.16):
|
||||
Changes since the last public release (1.6.18):
|
||||
|
||||
Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
|
||||
Corrected the width limit calculation in png_check_IHDR().
|
||||
Removed user limits from pngfix. Also pass NULL pointers to
|
||||
png_read_row to skip the unnecessary row de-interlace stuff.
|
||||
Added testing of png_set_packing() to pngvalid.c
|
||||
Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
|
||||
Implement previously untested cases of libpng transforms in pngvalid.c
|
||||
Fixed byte order in 2-byte filler, in png_do_read_filler().
|
||||
Made the check for out-of-range values in png_set_tRNS() detect
|
||||
values that are exactly 2^bit_depth, and work on 16-bit platforms.
|
||||
Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
|
||||
Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
|
||||
pngset.c to avoid warnings about dead code.
|
||||
Do not build png_product2() when it is unused.
|
||||
Display user limits in the output from pngtest.
|
||||
Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
|
||||
and 1-million-row default limits in pnglibconf.dfa, that can be reset
|
||||
by the user at build time or run time. This provides a more robust
|
||||
defense against DOS and as-yet undiscovered overflows.
|
||||
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
|
||||
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
|
||||
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
|
||||
Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
|
||||
of png.h.
|
||||
Avoid runtime checks when converting integer to png_byte with
|
||||
Visual Studio (Sergey Kosarevsky)
|
||||
Removed some comments that the configure script did not handle
|
||||
properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
|
||||
Free the unknown_chunks structure even when it contains no data.
|
||||
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||
Remove pnglibconf.h, pnglibconf.c, pnglibconf.pre, pnglibconf.dfn,
|
||||
and pnglibconf.out instead of pnglibconf.* in "make clean" (Cosmin).
|
||||
Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
|
||||
value was wrong. It's not clear if this affected the final stored
|
||||
value; in the obvious code path the upper and lower 8-bits of the
|
||||
alpha value were identical and the alpha was truncated to 8-bits
|
||||
rather than dividing by 257 (John Bowler).
|
||||
Updated obsolete information about the simplified API macros in the
|
||||
manual pages (Bug report by Arc Riley).
|
||||
Avoid potentially dereferencing NULL info_ptr in png_info_init_3().
|
||||
Rearranged png.h to put the major sections in the same order as
|
||||
in libpng17.
|
||||
Eliminated unused PNG_COST_SHIFT, PNG_WEIGHT_SHIFT, PNG_COST_FACTOR, and
|
||||
PNG_WEIGHT_FACTOR macros.
|
||||
Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
|
||||
(Bug report by Viktor Szakats). Several warnings remain and are
|
||||
unavoidable, where we test for overflow.
|
||||
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
||||
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
||||
Moved config.h.in~ from the "libpng_autotools_files" list to the
|
||||
"libpng_autotools_extra" list in autogen.sh because it was causing a
|
||||
false positive for missing files (bug report by Robert C. Seacord).
|
||||
Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
|
||||
to suppress clang warnings (Bug report by Viktor Szakats).
|
||||
Fixed some bad links in the man page.
|
||||
Changed "n bit" to "n-bit" in comments.
|
||||
Added signed/unsigned 16-bit safety net. This removes the dubious
|
||||
0x8000 flag definitions on 16-bit systems. They aren't supported
|
||||
yet the defs *probably* work, however it seems much safer to do this
|
||||
and be advised if anyone, contrary to advice, is building libpng 1.6
|
||||
on a 16-bit system. It also adds back various switch default clauses
|
||||
for GCC; GCC errors out if they are not present (with an appropriately
|
||||
high level of warnings).
|
||||
Safely convert num_bytes to a png_byte in png_set_sig_bytes() (Robert
|
||||
Seacord).
|
||||
Fixed the recently reported 1's complement security issue by replacing
|
||||
the value that is illegal in the PNG spec, in both signed and unsigned
|
||||
values, with 0. Illegal unsigned values (anything greater than or equal
|
||||
to 0x80000000) can still pass through, but since these are not illegal
|
||||
in ANSI-C (unlike 0x80000000 in the signed case) the checking that
|
||||
occurs later can catch them (John Bowler).
|
||||
Fixed png_save_int_32 when int is not 2's complement (John Bowler).
|
||||
Updated libpng16 with all the recent test changes from libpng17,
|
||||
including changes to pngvalid.c to ensure that the original,
|
||||
distributed, version of contrib/visupng/cexcept.h can be used
|
||||
(John Bowler).
|
||||
pngvalid contains the correction to the use of SAVE/STORE_
|
||||
UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7. More
|
||||
tests contain the --strict option to detect warnings and the
|
||||
pngvalid-standard test has been corrected so that it does not
|
||||
turn on progressive-read. There is a separate test which does
|
||||
that. (John Bowler)
|
||||
Also made some signed/unsigned fixes.
|
||||
Make pngstest error limits version specific. Splitting the machine
|
||||
generated error structs out to a file allows the values to be updated
|
||||
without changing pngstest.c itself. Since libpng 1.6 and 1.7 have
|
||||
slightly different error limits this simplifies maintenance. The
|
||||
makepngs.sh script has also been updated to more accurately reflect
|
||||
current problems in libpng 1.7 (John Bowler).
|
||||
Incorporated new test PNG files into make check. tests/pngstest-*
|
||||
are changed so that the new test files are divided into 8 groups by
|
||||
gamma and alpha channel. These tests have considerably better code
|
||||
and pixel-value coverage than contrib/pngsuite; however,coverage is
|
||||
still incomplete (John Bowler).
|
||||
Removed the '--strict' in 1.6 because of the double-gamma-correction
|
||||
warning, updated pngstest-errors.h for the errors detected with the
|
||||
new contrib/testspngs PNG test files (John Bowler).
|
||||
Worked around rgb-to-gray issues in libpng 1.6. The previous
|
||||
attempts to ignore the errors in the code aren't quite enough to
|
||||
deal with the 'channel selection' encoding added to libpng 1.7; abort.
|
||||
Fixed 'pow' macros in pngvalid.c. It is legal for 'pow' to be a
|
||||
macro, therefore the argument list cannot contain preprocessing
|
||||
directives. Make sure pow is a function where this happens. This is
|
||||
a minimal safe fix, the issue only arises in non-performance-critical
|
||||
code (bug report by Curtis Leach, fix by John Bowler).
|
||||
Added sPLT support to pngtest.c
|
||||
Prevent setting or writing over-length PLTE chunk (Cosmin Truta).
|
||||
Silently truncate over-length PLTE chunk while reading.
|
||||
Libpng incorrectly calculated the output rowbytes when the application
|
||||
decreased either the number of channels or the bit depth (or both) in
|
||||
a user transform. This was safe; libpng overallocated buffer space
|
||||
(potentially by quite a lot; up to 4 times the amount required) but,
|
||||
from 1.5.4 on, resulted in a png_error (John Bowler).
|
||||
Fixed some inconsequential cut-and-paste typos in png_set_cHRM_XYZ_fixed().
|
||||
Clarified COPYRIGHT information to state explicitly that versions
|
||||
are derived from previous versions.
|
||||
Removed much of the long list of previous versions from png.h and
|
||||
libpng.3.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
298
hecl/extern/libpng/CHANGES
vendored
298
hecl/extern/libpng/CHANGES
vendored
@ -1,11 +1,14 @@
|
||||
|
||||
#if 0
|
||||
CHANGES - changes for libpng
|
||||
|
||||
Version 0.2
|
||||
version 0.1 [March 29, 1995]
|
||||
initial work-in-progress release
|
||||
|
||||
version 0.2 [April 1, 1995]
|
||||
added reader into png.h
|
||||
fixed small problems in stub file
|
||||
|
||||
Version 0.3
|
||||
version 0.3 [April 8, 1995]
|
||||
added pull reader
|
||||
split up pngwrite.c to several files
|
||||
added pnglib.txt
|
||||
@ -14,9 +17,9 @@ Version 0.3
|
||||
fixed some bugs in writer
|
||||
interfaced with zlib 0.5
|
||||
added K&R support
|
||||
added check for 64 KB blocks for 16-bit machines
|
||||
added check for 64 KB blocks for 16 bit machines
|
||||
|
||||
Version 0.4
|
||||
version 0.4 [April 26, 1995]
|
||||
cleaned up code and commented code
|
||||
simplified time handling into png_time
|
||||
created png_color_16 and png_color_8 to handle color needs
|
||||
@ -27,28 +30,29 @@ Version 0.4
|
||||
cleaned up zTXt reader and writer (using zlib's Reset functions)
|
||||
split transformations into pngrtran.c and pngwtran.c
|
||||
|
||||
Version 0.5
|
||||
version 0.5 [April 30, 1995]
|
||||
interfaced with zlib 0.8
|
||||
fixed many reading and writing bugs
|
||||
saved using 3 spaces instead of tabs
|
||||
|
||||
Version 0.6
|
||||
version 0.6 [May 1, 1995]
|
||||
first beta release
|
||||
added png_large_malloc() and png_large_free()
|
||||
added png_size_t
|
||||
cleaned up some compiler warnings
|
||||
added png_start_read_image()
|
||||
|
||||
Version 0.7
|
||||
version 0.7 [June 24, 1995]
|
||||
cleaned up lots of bugs
|
||||
finished dithering and other stuff
|
||||
added test program
|
||||
changed name from pnglib to libpng
|
||||
|
||||
Version 0.71 [June, 1995]
|
||||
version 0.71 [June 26, 1995]
|
||||
changed pngtest.png for zlib 0.93
|
||||
fixed error in libpng.txt and example.c
|
||||
|
||||
Version 0.8
|
||||
version 0.8 [August 20, 1995]
|
||||
cleaned up some bugs
|
||||
added png_set_filler()
|
||||
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
|
||||
@ -91,7 +95,7 @@ Version 0.88 [January, 1996]
|
||||
cleaned up documentation
|
||||
added callbacks for read/write and warning/error functions
|
||||
|
||||
Version 0.89 [July, 1996]
|
||||
Version 0.89 [June 5, 1996]
|
||||
Added new initialization API to make libpng work better with shared libs
|
||||
we now have png_create_read_struct(), png_create_write_struct(),
|
||||
png_create_info_struct(), png_destroy_read_struct(), and
|
||||
@ -118,6 +122,9 @@ Version 0.89 [July, 1996]
|
||||
New pngtest image also has interlacing and zTXt
|
||||
Updated documentation to reflect new API
|
||||
|
||||
Version 0.89c [June 17, 1996]
|
||||
Bug fixes.
|
||||
|
||||
Version 0.90 [January, 1997]
|
||||
Made CRC errors/warnings on critical and ancillary chunks configurable
|
||||
libpng will use the zlib CRC routines by (compile-time) default
|
||||
@ -158,7 +165,7 @@ Version 0.95 [March, 1997]
|
||||
Added new pCAL chunk read/write support
|
||||
Added experimental filter selection weighting (Greg Roelofs)
|
||||
Removed old png_set_rgbx() and png_set_xrgb() functions that have been
|
||||
obsolete for about 2 years now (use png_set_filler() instead)
|
||||
obsolete for about 2 years now (use png_set_filler() instead)
|
||||
Added macros to read 16- and 32-bit ints directly from buffer, to be
|
||||
used only on those systems that support it (namely PowerPC and 680x0)
|
||||
With some testing, this may become the default for MACOS/PPC systems.
|
||||
@ -440,7 +447,7 @@ Version 1.0.3 [January 14, 1999]
|
||||
|
||||
Version 1.0.3a [August 12, 1999]
|
||||
Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning
|
||||
if an attempt is made to read an interlaced image when it's not supported.
|
||||
if an attempt is made to read an interlaced image when it's not supported.
|
||||
Added check if png_ptr->trans is defined before freeing it in pngread.c
|
||||
Modified the Y2K statement to include versions back to version 0.71
|
||||
Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c
|
||||
@ -448,7 +455,7 @@ Version 1.0.3a [August 12, 1999]
|
||||
Replaced leading blanks with tab characters in makefile.hux
|
||||
Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents.
|
||||
Changed (float)red and (float)green to (double)red, (double)green
|
||||
in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
|
||||
in png_set_rgb_to_gray() to avoid "promotion" problems in AIX.
|
||||
Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey).
|
||||
Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt).
|
||||
Updated documentation to refer to the PNG-1.2 specification.
|
||||
@ -491,7 +498,7 @@ Version 1.0.3d [September 4, 1999]
|
||||
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
|
||||
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
||||
|
||||
Version 1.0.4 [September 24, 1999]
|
||||
Version 1.0.4 [September 24, 1999, not distributed publicly]
|
||||
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
||||
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
||||
Made several minor corrections to pngtest.c
|
||||
@ -518,6 +525,7 @@ Version 1.0.4c [October 1, 1999]
|
||||
Added a "png_check_version" function in png.c and pngtest.c that will generate
|
||||
a helpful compiler error if an old png.h is found in the search path.
|
||||
Changed type of png_user_transform_depth|channels from int to png_byte.
|
||||
Added "Libpng is OSI Certified Open Source Software" statement to png.h
|
||||
|
||||
Version 1.0.4d [October 6, 1999]
|
||||
Changed 0.45 to 0.45455 in png_set_sRGB()
|
||||
@ -904,7 +912,7 @@ Version 1.0.7 [July 1, 2000]
|
||||
Version 1.0.8beta1 [July 8, 2000]
|
||||
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
|
||||
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
|
||||
pngwutil.c.
|
||||
pngwutil.c.
|
||||
Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h.
|
||||
Removed unused "#include <assert.h>" from png.c
|
||||
Added WindowsCE support.
|
||||
@ -912,12 +920,12 @@ Version 1.0.8beta1 [July 8, 2000]
|
||||
|
||||
Version 1.0.8beta2 [July 10, 2000]
|
||||
Added project files to the wince directory and made further revisions
|
||||
of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
|
||||
of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE.
|
||||
|
||||
Version 1.0.8beta3 [July 11, 2000]
|
||||
Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS()
|
||||
for indexed-color input files to avoid potential double-freeing trans array
|
||||
under some unusual conditions; problem was introduced in version 1.0.6f.
|
||||
for indexed-color input files to avoid potential double-freeing trans array
|
||||
under some unusual conditions; problem was introduced in version 1.0.6f.
|
||||
Further revisions to pngtest.c and files in the wince subdirectory.
|
||||
|
||||
Version 1.0.8beta4 [July 14, 2000]
|
||||
@ -1089,16 +1097,16 @@ Version 1.2.0beta3 [May 17, 2001]
|
||||
|
||||
Version 1.2.0beta4 [June 23, 2001]
|
||||
Check for missing profile length field in iCCP chunk and free chunk_data
|
||||
in case of truncated iCCP chunk.
|
||||
in case of truncated iCCP chunk.
|
||||
Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc
|
||||
Bumped dll-number from 2 to 3 in makefile.cygwin
|
||||
Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly
|
||||
if user attempts to run it on an 8-bit display.
|
||||
if user attempts to run it on an 8-bit display.
|
||||
Updated contrib/gregbook
|
||||
Use png_malloc instead of png_zalloc to allocate palette in pngset.c
|
||||
Updated makefile.ibmc
|
||||
Added some typecasts to eliminate gcc 3.0 warnings. Changed prototypes
|
||||
of png_write_oFFS width and height from png_uint_32 to png_int_32.
|
||||
of png_write_oFFS width and height from png_uint_32 to png_int_32.
|
||||
Updated example.c
|
||||
Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c
|
||||
|
||||
@ -1106,9 +1114,9 @@ Version 1.2.0beta5 [August 8, 2001]
|
||||
Revised contrib/gregbook
|
||||
Revised makefile.gcmmx
|
||||
Revised pnggccrd.c to conditionally compile some thread-unsafe code only
|
||||
when PNG_THREAD_UNSAFE_OK is defined.
|
||||
when PNG_THREAD_UNSAFE_OK is defined.
|
||||
Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with
|
||||
value exceeding 2^bit_depth-1
|
||||
value exceeding 2^bit_depth-1
|
||||
Revised makefile.sgi and makefile.sggcc
|
||||
Replaced calls to fprintf(stderr,...) with png_warning() in pnggccrd.c
|
||||
Removed restriction that do_invert_mono only operate on 1-bit opaque files
|
||||
@ -1449,8 +1457,9 @@ Version 1.2.6beta4 [July 28, 2004]
|
||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
||||
|
||||
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||
Fixed buffer overflow vulnerability in png_handle_tRNS()
|
||||
Fixed integer arithmetic overflow vulnerability in png_read_png().
|
||||
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||
Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
|
||||
Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
|
||||
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
|
||||
duplicate chunk types to go undetected.
|
||||
Fixed some timestamps in the -config version
|
||||
@ -1493,7 +1502,7 @@ Version 1.0.16rc4 and 1.2.6rc4 [August 10, 2004]
|
||||
|
||||
Version 1.0.16rc5 and 1.2.6rc5 [August 10, 2004]
|
||||
Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_ASSEMBLER_CODE_SUPPORTED
|
||||
section of png.h where they were inadvertently placed in version rc3.
|
||||
section of png.h where they were inadvertently placed in version rc3.
|
||||
|
||||
Version 1.2.6 and 1.0.16 [August 15, 2004]
|
||||
Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1.
|
||||
@ -2325,7 +2334,7 @@ Version 1.4.0beta63 [June 15, 2009]
|
||||
Version 1.4.0beta64 [June 24, 2009]
|
||||
Eliminated PNG_LEGACY_SUPPORTED code.
|
||||
Moved the various unknown chunk macro definitions outside of the
|
||||
PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
|
||||
PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
|
||||
|
||||
Version 1.4.0beta65 [June 26, 2009]
|
||||
Added a reference to the libpng license in each file.
|
||||
@ -3747,8 +3756,9 @@ Version 1.5.7beta04 [November 17, 2011]
|
||||
|
||||
Version 1.5.7beta05 [November 25, 2011]
|
||||
Removed "zTXt" from warning in generic chunk decompression function.
|
||||
Validate time settings passed to pngset() and png_convert_to_rfc1123()
|
||||
(Frank Busse).
|
||||
Validate time settings passed to png_set_tIME() and png_convert_to_rfc1123()
|
||||
(Frank Busse). Note: This prevented CVE-2015-7981 from affecting
|
||||
libpng-1.5.7 and later.
|
||||
Added MINGW support to CMakeLists.txt
|
||||
Reject invalid compression flag or method when reading the iTXt chunk.
|
||||
Backed out 'simplified' API changes. The API seems too complex and there
|
||||
@ -3794,12 +3804,13 @@ Version 1.6.0beta01 [December 15, 2011]
|
||||
(the other two required headers aren't used). Non-ANSI systems that don't
|
||||
have stddef.h or limits.h will have to provide an appropriate fake
|
||||
containing the relevant types and #defines.
|
||||
The use of FAR/far has been eliminated and the definition of png_alloc_size_t
|
||||
is now controlled by a flag so that 'small size_t' systems can select it
|
||||
if necessary. Libpng 1.6 may not currently work on such systems -- it
|
||||
seems likely that it will ask 'malloc' for more than 65535 bytes with any
|
||||
image that has a sufficiently large row size (rather than simply failing
|
||||
to read such images).
|
||||
Dropped support for 16-bit platforms. The use of FAR/far has been eliminated
|
||||
and the definition of png_alloc_size_t is now controlled by a flag so
|
||||
that 'small size_t' systems can select it if necessary. Libpng 1.6 may
|
||||
not currently work on such systems -- it seems likely that it will
|
||||
ask 'malloc' for more than 65535 bytes with any image that has a
|
||||
sufficiently large row size (rather than simply failing to read such
|
||||
images).
|
||||
New tools directory containing tools used to generate libpng code.
|
||||
Fixed race conditions in parallel make builds. With higher degrees of
|
||||
parallelism during 'make' the use of the same temporary file names such
|
||||
@ -4411,7 +4422,7 @@ Version 1.6.1beta02 [February 19, 2013]
|
||||
|
||||
Version 1.6.1beta03 [February 22, 2013]
|
||||
Fixed ALIGNED_MEMORY support.
|
||||
Allow run-time ARM NEON checking to be disabled. A new configure option:
|
||||
Added a new configure option:
|
||||
--enable-arm-neon=always will stop the run-time checks. New checks
|
||||
within arm/arm_init.c will cause the code not to be compiled unless
|
||||
__ARM_NEON__ is set. This should make it fail safe (if someone asks
|
||||
@ -4430,10 +4441,10 @@ Version 1.6.1beta05 [March 1, 2013]
|
||||
Version 1.6.1beta06 [March 4, 2013]
|
||||
Better documentation of unknown handling API interactions.
|
||||
Corrected Android builds and corrected libpng.vers with symbol
|
||||
prefixing. This adds an API to set optimization options externally,
|
||||
prefixing. It also makes those tests compile and link on Android.
|
||||
Added an API png_set_option() to set optimization options externally,
|
||||
providing an alternative and general solution for the non-portable
|
||||
run-time tests used by the ARM Neon code. It also makes those tests
|
||||
compile and link on Android.
|
||||
run-time tests used by the ARM Neon code, using the PNG_ARM_NEON option.
|
||||
The order of settings vs options in pnglibconf.h is reversed to allow
|
||||
settings to depend on options and options can now set (or override) the
|
||||
defaults for settings.
|
||||
@ -4525,13 +4536,14 @@ Version 1.6.3beta03 [April 30, 2013]
|
||||
Expanded manual paragraph about writing private chunks, particularly
|
||||
the need to call png_set_keep_unknown_chunks() when writing them.
|
||||
Avoid dereferencing NULL pointer possibly returned from
|
||||
png_create_write_struct() (Andrew Church).
|
||||
png_create_write_struct() (Andrew Church).
|
||||
|
||||
Version 1.6.3beta05 [May 9, 2013]
|
||||
Calculate our own zlib windowBits when decoding rather than trusting the
|
||||
CMF bytes in the PNG datastream.
|
||||
Added an option to force maximum window size for inflating, which was
|
||||
the behavior of libpng15 and earlier.
|
||||
the behavior of libpng15 and earlier, via a new PNG_MAXIMUM_INFLATE_WINDOW
|
||||
option for png_set_options().
|
||||
Added png-fix-itxt and png-fix-too-far-back to the built programs and
|
||||
removed warnings from the source code and timepng that are revealed as
|
||||
a result.
|
||||
@ -5134,14 +5146,16 @@ Version 1.6.17beta01 [January 29, 2015]
|
||||
Added testing of png_set_packing() to pngvalid.c
|
||||
Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
|
||||
Implement previously untested cases of libpng transforms in pngvalid.c
|
||||
Fixed byte order in 2-byte filler, in png_do_read_filler().
|
||||
Fixed byte order in png_do_read_filler() with 16-bit input. Previously
|
||||
the high and low bytes of the filler, from png_set_filler() or from
|
||||
png_set_add_alpha(), were read in the wrong order.
|
||||
Made the check for out-of-range values in png_set_tRNS() detect
|
||||
values that are exactly 2^bit_depth, and work on 16-bit platforms.
|
||||
Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
|
||||
Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
|
||||
pngset.c to avoid warnings about dead code.
|
||||
Added "& 0xff" to many instances of expressions that are typecast
|
||||
to (png_byte), to avoid Coverity gripes.
|
||||
to (png_byte), to avoid Coverity warnings.
|
||||
|
||||
Version 1.6.17beta02 [February 7, 2015]
|
||||
Work around one more Coverity-scan dead-code warning.
|
||||
@ -5205,6 +5219,201 @@ Version 1.6.17rc06 [March 23, 2015]
|
||||
Version 1.6.17 [March 26, 2015]
|
||||
No changes.
|
||||
|
||||
Version 1.6.18beta01 [April 1, 2015]
|
||||
Removed PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED macros. They
|
||||
have been combined with PNG_SET_USER_LIMITS_SUPPORTED (resolves
|
||||
bug report by Andrew Church).
|
||||
Fixed rgb_to_gray checks and added tRNS checks to pngvalid.c. This
|
||||
fixes some arithmetic errors that caused some tests to fail on
|
||||
some 32-bit platforms (Bug reports by Peter Breitenlohner [i686]
|
||||
and Petr Gajdos [i586]).
|
||||
|
||||
Version 1.6.18beta02 [April 26, 2015]
|
||||
Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
|
||||
(Bug report by Viktor Szakats).
|
||||
|
||||
Version 1.6.18beta03 [May 6, 2015]
|
||||
Replaced "unexpected" with an integer (0xabadca11) in pngset.c
|
||||
where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1.
|
||||
Added contrib/examples/simpleover.c, to demonstrate how to handle
|
||||
alpha compositing of multiple images, using the "simplified API"
|
||||
and an example PNG generation tool, contrib/examples/genpng.c
|
||||
(John Bowler).
|
||||
|
||||
Version 1.6.18beta04 [May 20, 2015]
|
||||
PNG_RELEASE_BUILD replaces tests where the code depended on the build base
|
||||
type and can be defined on the command line, allowing testing in beta
|
||||
builds (John Bowler).
|
||||
Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
|
||||
Avoid a harmless potential integer overflow in png_XYZ_from_xy() (Bug
|
||||
report from Christopher Ferris).
|
||||
|
||||
Version 1.6.18beta05 [May 31, 2015]
|
||||
Backport filter selection code from libpng-1.7.0beta51, to combine
|
||||
sub_row, up_row, avg_row, and paeth_row into try_row and tst_row.
|
||||
Changed png_voidcast(), etc., to voidcast(), etc., in contrib/tools/pngfix.c
|
||||
to avoid confusion with the libpng private macros.
|
||||
Fixed old cut&paste bug in the weighted filter selection code in
|
||||
pngwutil.c, introduced in libpng-0.95, March 1997.
|
||||
|
||||
Version 1.6.18beta06 [June 1, 2015]
|
||||
Removed WRITE_WEIGHTED_FILTERED code, to save a few kbytes of the
|
||||
compiled library size. It never worked properly and as far as we can
|
||||
tell, no one uses it. The png_set_filter_heuristics() and
|
||||
png_set_filter_heuristics_fixed() APIs are retained but deprecated
|
||||
and do nothing.
|
||||
|
||||
Version 1.6.18beta07 [June 6, 2015]
|
||||
Removed non-working progressive reader 'skip' function. This
|
||||
function has apparently never been used. It was implemented
|
||||
to support back-door modification of png_struct in libpng-1.4.x
|
||||
but (because it does nothing and cannot do anything) was apparently
|
||||
never tested (John Bowler).
|
||||
Fixed cexcept.h in which GCC 5 now reports that one of the auto
|
||||
variables in the Try macro needs to be volatile to prevent value
|
||||
being lost over the setjmp (John Bowler).
|
||||
Fixed NO_WRITE_FILTER and -Wconversion build breaks (John Bowler).
|
||||
Fix g++ build breaks (John Bowler).
|
||||
Quieted some Coverity issues in pngfix.c, png-fix-itxt.c, pngvalid.c,
|
||||
pngstest.c, and pngimage.c. Most seem harmless, but png-fix-itxt
|
||||
would only work with iTXt chunks with length 255 or less.
|
||||
Added #ifdef's to contrib/examples programs so people don't try
|
||||
to compile them without the minimum required support enabled
|
||||
(suggested by Flavio Medeiros).
|
||||
|
||||
Version 1.6.18beta08 [June 30, 2015]
|
||||
Eliminated the final two Coverity defects (insecure temporary file
|
||||
handling in contrib/libtests/pngstest.c; possible overflow of
|
||||
unsigned char in contrib/tools/png-fix-itxt.c). To use the "secure"
|
||||
file handling, define PNG_USE_MKSTEMP, otherwise "tmpfile()" will
|
||||
be used.
|
||||
Removed some unused WEIGHTED_FILTER macros from png.h and pngstruct.h
|
||||
|
||||
Version 1.6.18beta09 [July 5, 2015]
|
||||
Removed some useless typecasts from contrib/tools/png-fix-itxt.c
|
||||
Fixed a new signed-unsigned comparison in pngrtran.c (Max Stepin).
|
||||
Replaced arbitrary use of 'extern' with #define PNG_LINKAGE_*. To
|
||||
preserve API compatibility, the new defines all default to "extern"
|
||||
(requested by Jan Nijtmans).
|
||||
|
||||
Version 1.6.18rc01 [July 9, 2015]
|
||||
Belatedly added Mans Rullgard and James Yu to the list of Contributing
|
||||
Authors.
|
||||
|
||||
Version 1.6.18rc02 [July 12, 2015]
|
||||
Restored unused FILTER_HEURISTIC macros removed at libpng-1.6.18beta08
|
||||
to png.h to avoid compatibility warnings.
|
||||
|
||||
Version 1.6.18rc03 [July 15, 2015]
|
||||
Minor changes to the man page
|
||||
|
||||
Version 1.6.18 [July 23, 2015]
|
||||
No changes.
|
||||
|
||||
Version 1.6.19beta01 [July 30, 2015]
|
||||
Updated obsolete information about the simplified API macros in the
|
||||
manual pages (Bug report by Arc Riley).
|
||||
Avoid potentially dereferencing NULL info_ptr in png_info_init_3().
|
||||
Rearranged png.h to put the major sections in the same order as
|
||||
in libpng17.
|
||||
Eliminated unused PNG_COST_SHIFT, PNG_WEIGHT_SHIFT, PNG_COST_FACTOR, and
|
||||
PNG_WEIGHT_FACTOR macros.
|
||||
Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
|
||||
(Bug report by Viktor Szakats). Several warnings remain and are
|
||||
unavoidable, where we test for overflow.
|
||||
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
||||
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
||||
|
||||
Version 1.6.19beta02 [August 19, 2015]
|
||||
Moved config.h.in~ from the "libpng_autotools_files" list to the
|
||||
"libpng_autotools_extra" list in autogen.sh because it was causing a
|
||||
false positive for missing files (bug report by Robert C. Seacord).
|
||||
Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c
|
||||
to suppress clang warnings (Bug report by Viktor Szakats).
|
||||
Fixed some bad links in the man page.
|
||||
Changed "n bit" to "n-bit" in comments.
|
||||
Added signed/unsigned 16-bit safety net. This removes the dubious
|
||||
0x8000 flag definitions on 16-bit systems. They aren't supported
|
||||
yet the defs *probably* work, however it seems much safer to do this
|
||||
and be advised if anyone, contrary to advice, is building libpng 1.6
|
||||
on a 16-bit system. It also adds back various switch default clauses
|
||||
for GCC; GCC errors out if they are not present (with an appropriately
|
||||
high level of warnings).
|
||||
Safely convert num_bytes to a png_byte in png_set_sig_bytes() (Robert
|
||||
Seacord).
|
||||
Fixed the recently reported 1's complement security issue by replacing
|
||||
the value that is illegal in the PNG spec, in both signed and unsigned
|
||||
values, with 0. Illegal unsigned values (anything greater than or equal
|
||||
to 0x80000000) can still pass through, but since these are not illegal
|
||||
in ANSI-C (unlike 0x80000000 in the signed case) the checking that
|
||||
occurs later can catch them (John Bowler).
|
||||
|
||||
Version 1.6.19beta03 [September 26, 2015]
|
||||
Fixed png_save_int_32 when int is not 2's complement (John Bowler).
|
||||
Updated libpng16 with all the recent test changes from libpng17,
|
||||
including changes to pngvalid.c to ensure that the original,
|
||||
distributed, version of contrib/visupng/cexcept.h can be used
|
||||
(John Bowler).
|
||||
pngvalid contains the correction to the use of SAVE/STORE_
|
||||
UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7. More
|
||||
tests contain the --strict option to detect warnings and the
|
||||
pngvalid-standard test has been corrected so that it does not
|
||||
turn on progressive-read. There is a separate test which does
|
||||
that. (John Bowler)
|
||||
Also made some signed/unsigned fixes.
|
||||
Make pngstest error limits version specific. Splitting the machine
|
||||
generated error structs out to a file allows the values to be updated
|
||||
without changing pngstest.c itself. Since libpng 1.6 and 1.7 have
|
||||
slightly different error limits this simplifies maintenance. The
|
||||
makepngs.sh script has also been updated to more accurately reflect
|
||||
current problems in libpng 1.7 (John Bowler).
|
||||
Incorporated new test PNG files into make check. tests/pngstest-*
|
||||
are changed so that the new test files are divided into 8 groups by
|
||||
gamma and alpha channel. These tests have considerably better code
|
||||
and pixel-value coverage than contrib/pngsuite; however,coverage is
|
||||
still incomplete (John Bowler).
|
||||
Removed the '--strict' in 1.6 because of the double-gamma-correction
|
||||
warning, updated pngstest-errors.h for the errors detected with the
|
||||
new contrib/testspngs PNG test files (John Bowler).
|
||||
|
||||
Version 1.6.19beta04 [October 15, 2015]
|
||||
Worked around rgb-to-gray issues in libpng 1.6. The previous
|
||||
attempts to ignore the errors in the code aren't quite enough to
|
||||
deal with the 'channel selection' encoding added to libpng 1.7; abort.
|
||||
pngvalid.c is changed to drop this encoding in prior versions.
|
||||
Fixed 'pow' macros in pngvalid.c. It is legal for 'pow' to be a
|
||||
macro, therefore the argument list cannot contain preprocessing
|
||||
directives. Make sure pow is a function where this happens. This is
|
||||
a minimal safe fix, the issue only arises in non-performance-critical
|
||||
code (bug report by Curtis Leach, fix by John Bowler).
|
||||
Added sPLT support to pngtest.c
|
||||
|
||||
Version 1.6.19rc01 [October 23, 2015]
|
||||
No changes.
|
||||
|
||||
Version 1.6.19rc02 [October 31, 2015]
|
||||
Prevent setting or writing over-length PLTE chunk (Cosmin Truta).
|
||||
Silently truncate over-length PLTE chunk while reading.
|
||||
Libpng incorrectly calculated the output rowbytes when the application
|
||||
decreased either the number of channels or the bit depth (or both) in
|
||||
a user transform. This was safe; libpng overallocated buffer space
|
||||
(potentially by quite a lot; up to 4 times the amount required) but,
|
||||
from 1.5.4 on, resulted in a png_error (John Bowler).
|
||||
|
||||
Version 1.6.19rc03 [November 3, 2015]
|
||||
Fixed some inconsequential cut-and-paste typos in png_set_cHRM_XYZ_fixed().
|
||||
Clarified COPYRIGHT information to state explicitly that versions
|
||||
are derived from previous versions.
|
||||
Removed much of the long list of previous versions from png.h and
|
||||
libpng.3.
|
||||
|
||||
Version 1.6.19rc04 [November 5, 2015]
|
||||
Fixed new bug with CRC error after reading an over-length palette
|
||||
(bug report by Cosmin Truta).
|
||||
|
||||
Version 1.6.19 [November 12, 2015]
|
||||
Cleaned up coding style in png_handle_PLTE().
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
@ -5212,3 +5421,4 @@ to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
|
||||
Glenn R-P
|
||||
#endif
|
||||
|
4
hecl/extern/libpng/README
vendored
4
hecl/extern/libpng/README
vendored
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.17 - March 26, 2015 (shared library 16.0)
|
||||
README for libpng version 1.6.19 - November 12, 2015 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
@ -134,7 +134,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for nineteen years now, and it is official and
|
||||
been discussing PNG for twenty years now, and it is official and
|
||||
finished. If you have suggestions for libpng, however, I'll
|
||||
gladly listen. Even if your suggestion is not used immediately,
|
||||
it may be used later.
|
||||
|
164
hecl/extern/libpng/png.c
vendored
164
hecl/extern/libpng/png.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -14,7 +14,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_17 Your_png_h_is_not_version_1_6_17;
|
||||
typedef png_libpng_version_1_6_19 Your_png_h_is_not_version_1_6_19;
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
@ -26,15 +26,20 @@ typedef png_libpng_version_1_6_17 Your_png_h_is_not_version_1_6_17;
|
||||
void PNGAPI
|
||||
png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
|
||||
{
|
||||
unsigned int nb = (unsigned int)num_bytes;
|
||||
|
||||
png_debug(1, "in png_set_sig_bytes");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_bytes > 8)
|
||||
if (num_bytes < 0)
|
||||
nb = 0;
|
||||
|
||||
if (nb > 8)
|
||||
png_error(png_ptr, "Too many bytes for PNG signature");
|
||||
|
||||
png_ptr->sig_bytes = (png_byte)((num_bytes < 0 ? 0 : num_bytes) & 0xff);
|
||||
png_ptr->sig_bytes = (png_byte)nb;
|
||||
}
|
||||
|
||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||
@ -101,7 +106,7 @@ png_zfree(voidpf png_ptr, voidpf ptr)
|
||||
void /* PRIVATE */
|
||||
png_reset_crc(png_structrp png_ptr)
|
||||
{
|
||||
/* The cast is safe because the crc is a 32 bit value. */
|
||||
/* The cast is safe because the crc is a 32-bit value. */
|
||||
png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
|
||||
}
|
||||
|
||||
@ -129,7 +134,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
|
||||
}
|
||||
|
||||
/* 'uLong' is defined in zlib.h as unsigned long; this means that on some
|
||||
* systems it is a 64 bit value. crc32, however, returns 32 bits so the
|
||||
* systems it is a 64-bit value. crc32, however, returns 32 bits so the
|
||||
* following cast is safe. 'uInt' may be no more than 16 bits, so it is
|
||||
* necessary to perform a loop here.
|
||||
*/
|
||||
@ -243,15 +248,15 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
|
||||
|
||||
# ifdef PNG_USER_CHUNK_CACHE_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.0 */
|
||||
create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
||||
/* Added at libpng-1.2.43 and 1.4.0 */
|
||||
create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
||||
# endif
|
||||
|
||||
# ifdef PNG_USER_CHUNK_MALLOC_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
|
||||
* in png_struct regardless.
|
||||
*/
|
||||
create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
/* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
|
||||
* in png_struct regardless.
|
||||
*/
|
||||
create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@ -275,7 +280,9 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
|
||||
# ifdef PNG_SETJMP_SUPPORTED
|
||||
if (!setjmp(create_jmp_buf))
|
||||
# endif
|
||||
{
|
||||
# ifdef PNG_SETJMP_SUPPORTED
|
||||
/* Temporarily fake out the longjmp information until we have
|
||||
* successfully completed this function. This only works if we have
|
||||
* setjmp() support compiled in, but it is safe - this stuff should
|
||||
@ -284,8 +291,6 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
create_struct.jmp_buf_ptr = &create_jmp_buf;
|
||||
create_struct.jmp_buf_size = 0; /*stack allocation*/
|
||||
create_struct.longjmp_fn = longjmp;
|
||||
# else
|
||||
{
|
||||
# endif
|
||||
/* Call the general version checker (shared with read and write code):
|
||||
*/
|
||||
@ -304,10 +309,10 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
create_struct.zstream.opaque = png_ptr;
|
||||
|
||||
# ifdef PNG_SETJMP_SUPPORTED
|
||||
/* Eliminate the local error handling: */
|
||||
create_struct.jmp_buf_ptr = NULL;
|
||||
create_struct.jmp_buf_size = 0;
|
||||
create_struct.longjmp_fn = 0;
|
||||
/* Eliminate the local error handling: */
|
||||
create_struct.jmp_buf_ptr = NULL;
|
||||
create_struct.jmp_buf_size = 0;
|
||||
create_struct.longjmp_fn = 0;
|
||||
# endif
|
||||
|
||||
*png_ptr = create_struct;
|
||||
@ -413,6 +418,8 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
|
||||
free(info_ptr);
|
||||
info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
|
||||
(sizeof *info_ptr)));
|
||||
if (info_ptr == NULL)
|
||||
return;
|
||||
*ptr_ptr = info_ptr;
|
||||
}
|
||||
|
||||
@ -664,19 +671,20 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp)
|
||||
# endif
|
||||
|
||||
# ifdef PNG_SAVE_INT_32_SUPPORTED
|
||||
/* The png_save_int_32 function assumes integers are stored in two's
|
||||
* complement format. If this isn't the case, then this routine needs to
|
||||
* be modified to write data in two's complement format. Note that,
|
||||
* the following works correctly even if png_int_32 has more than 32 bits
|
||||
* (compare the more complex code required on read for sign extension.)
|
||||
/* PNG signed integers are saved in 32-bit 2's complement format. ANSI C-90
|
||||
* defines a cast of a signed integer to an unsigned integer either to preserve
|
||||
* the value, if it is positive, or to calculate:
|
||||
*
|
||||
* (UNSIGNED_MAX+1) + integer
|
||||
*
|
||||
* Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the
|
||||
* negative integral value is added the result will be an unsigned value
|
||||
* correspnding to the 2's complement representation.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||
{
|
||||
buf[0] = (png_byte)((i >> 24) & 0xff);
|
||||
buf[1] = (png_byte)((i >> 16) & 0xff);
|
||||
buf[2] = (png_byte)((i >> 8) & 0xff);
|
||||
buf[3] = (png_byte)(i & 0xff);
|
||||
png_save_uint_32(buf, i);
|
||||
}
|
||||
# endif
|
||||
|
||||
@ -722,6 +730,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
|
||||
APPEND(':');
|
||||
APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->second);
|
||||
APPEND_STRING(" +0000"); /* This reliably terminates the buffer */
|
||||
PNG_UNUSED (pos)
|
||||
|
||||
# undef APPEND
|
||||
# undef APPEND_NUMBER
|
||||
@ -766,13 +775,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.17 - March 26, 2015" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
"libpng version 1.6.19 - November 12, 2015" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.17 - March 26, 2015\
|
||||
return "libpng version 1.6.19 - November 12, 2015\
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@ -811,9 +820,9 @@ png_get_header_version(png_const_structrp png_ptr)
|
||||
#ifdef __STDC__
|
||||
return PNG_HEADER_VERSION_STRING
|
||||
# ifndef PNG_READ_SUPPORTED
|
||||
" (NO READ SUPPORT)"
|
||||
" (NO READ SUPPORT)"
|
||||
# endif
|
||||
PNG_STRING_NEWLINE;
|
||||
PNG_STRING_NEWLINE;
|
||||
#else
|
||||
return PNG_HEADER_VERSION_STRING;
|
||||
#endif
|
||||
@ -1086,10 +1095,10 @@ png_colorspace_set_gamma(png_const_structrp png_ptr,
|
||||
errmsg = "gamma value out of range";
|
||||
|
||||
# ifdef PNG_READ_gAMA_SUPPORTED
|
||||
/* Allow the application to set the gamma value more than once */
|
||||
else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||
(colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
|
||||
errmsg = "duplicate";
|
||||
/* Allow the application to set the gamma value more than once */
|
||||
else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||
(colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
|
||||
errmsg = "duplicate";
|
||||
# endif
|
||||
|
||||
/* Do nothing if the colorspace is already invalid */
|
||||
@ -1130,31 +1139,31 @@ png_colorspace_sync_info(png_const_structrp png_ptr, png_inforp info_ptr)
|
||||
PNG_INFO_iCCP);
|
||||
|
||||
# ifdef PNG_COLORSPACE_SUPPORTED
|
||||
/* Clean up the iCCP profile now if it won't be used. */
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
|
||||
/* Clean up the iCCP profile now if it won't be used. */
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
|
||||
# else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(png_ptr)
|
||||
# endif
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
# ifdef PNG_COLORSPACE_SUPPORTED
|
||||
/* Leave the INFO_iCCP flag set if the pngset.c code has already set
|
||||
* it; this allows a PNG to contain a profile which matches sRGB and
|
||||
* yet still have that profile retrievable by the application.
|
||||
*/
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
|
||||
info_ptr->valid |= PNG_INFO_sRGB;
|
||||
/* Leave the INFO_iCCP flag set if the pngset.c code has already set
|
||||
* it; this allows a PNG to contain a profile which matches sRGB and
|
||||
* yet still have that profile retrievable by the application.
|
||||
*/
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
|
||||
info_ptr->valid |= PNG_INFO_sRGB;
|
||||
|
||||
else
|
||||
info_ptr->valid &= ~PNG_INFO_sRGB;
|
||||
else
|
||||
info_ptr->valid &= ~PNG_INFO_sRGB;
|
||||
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||
info_ptr->valid |= PNG_INFO_cHRM;
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||
info_ptr->valid |= PNG_INFO_cHRM;
|
||||
|
||||
else
|
||||
info_ptr->valid &= ~PNG_INFO_cHRM;
|
||||
else
|
||||
info_ptr->valid &= ~PNG_INFO_cHRM;
|
||||
# endif
|
||||
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0)
|
||||
@ -1235,16 +1244,17 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
||||
|
||||
/* Check xy and, implicitly, z. Note that wide gamut color spaces typically
|
||||
* have end points with 0 tristimulus values (these are impossible end
|
||||
* points, but they are used to cover the possible colors.)
|
||||
* points, but they are used to cover the possible colors). We check
|
||||
* xy->whitey against 5, not 0, to avoid a possible integer overflow.
|
||||
*/
|
||||
if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
|
||||
if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
|
||||
if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
|
||||
if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
|
||||
if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
|
||||
if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
|
||||
if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
|
||||
if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
|
||||
if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
|
||||
if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
|
||||
if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
|
||||
if (xy->whitey < 0 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
|
||||
if (xy->whitey < 5 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
|
||||
|
||||
/* The reverse calculation is more difficult because the original tristimulus
|
||||
* value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
|
||||
@ -1702,7 +1712,6 @@ png_colorspace_set_chromaticities(png_const_structrp png_ptr,
|
||||
*/
|
||||
colorspace->flags |= PNG_COLORSPACE_INVALID;
|
||||
png_error(png_ptr, "internal error checking chromaticities");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0; /* failed */
|
||||
@ -1730,7 +1739,6 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr,
|
||||
default:
|
||||
colorspace->flags |= PNG_COLORSPACE_INVALID;
|
||||
png_error(png_ptr, "internal error checking chromaticities");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0; /* failed */
|
||||
@ -2056,8 +2064,8 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
temp = png_get_uint_32(profile+12); /* profile/device class */
|
||||
switch (temp)
|
||||
{
|
||||
case 0x73636E72: /* 'scnr' */
|
||||
case 0x6D6E7472: /* 'mntr' */
|
||||
case 0x73636e72: /* 'scnr' */
|
||||
case 0x6d6e7472: /* 'mntr' */
|
||||
case 0x70727472: /* 'prtr' */
|
||||
case 0x73706163: /* 'spac' */
|
||||
/* All supported */
|
||||
@ -2068,7 +2076,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, temp,
|
||||
"invalid embedded Abstract ICC profile");
|
||||
|
||||
case 0x6C696E6B: /* 'link' */
|
||||
case 0x6c696e6b: /* 'link' */
|
||||
/* DeviceLink profiles cannot be interpreted in a non-device specific
|
||||
* fashion, if an app uses the AToB0Tag in the profile the results are
|
||||
* undefined unless the result is sent to the intended device,
|
||||
@ -2078,7 +2086,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, temp,
|
||||
"unexpected DeviceLink ICC profile class");
|
||||
|
||||
case 0x6E6D636C: /* 'nmcl' */
|
||||
case 0x6e6d636c: /* 'nmcl' */
|
||||
/* A NamedColor profile is also device specific, however it doesn't
|
||||
* contain an AToB0 tag that is open to misinterpretation. Almost
|
||||
* certainly it will fail the tests below.
|
||||
@ -2104,8 +2112,8 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
temp = png_get_uint_32(profile+20);
|
||||
switch (temp)
|
||||
{
|
||||
case 0x58595A20: /* 'XYZ ' */
|
||||
case 0x4C616220: /* 'Lab ' */
|
||||
case 0x58595a20: /* 'XYZ ' */
|
||||
case 0x4c616220: /* 'Lab ' */
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2275,8 +2283,8 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
|
||||
}
|
||||
|
||||
/* Length *and* intent must match */
|
||||
if (length == png_sRGB_checks[i].length &&
|
||||
intent == png_sRGB_checks[i].intent)
|
||||
if (length == (png_uint_32) png_sRGB_checks[i].length &&
|
||||
intent == (png_uint_32) png_sRGB_checks[i].intent)
|
||||
{
|
||||
/* Now calculate the adler32 if not done already. */
|
||||
if (adler == 0)
|
||||
@ -2843,7 +2851,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
|
||||
if (fp >= DBL_MIN && fp <= DBL_MAX)
|
||||
{
|
||||
int exp_b10; /* A base 10 exponent */
|
||||
int exp_b10; /* A base 10 exponent */
|
||||
double base; /* 10^exp_b10 */
|
||||
|
||||
/* First extract a base 10 exponent of the number,
|
||||
@ -2891,7 +2899,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
|
||||
{
|
||||
int czero, clead, cdigits;
|
||||
unsigned int czero, clead, cdigits;
|
||||
char exponent[10];
|
||||
|
||||
/* Allow up to two leading zeros - this will not lengthen
|
||||
@ -2921,7 +2929,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
* of the loop don't break the number into parts so
|
||||
* that the final digit is rounded.
|
||||
*/
|
||||
if (cdigits+czero-clead+1 < (int)precision)
|
||||
if (cdigits+czero+1 < precision+clead)
|
||||
fp = modf(fp, &d);
|
||||
|
||||
else
|
||||
@ -3027,7 +3035,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*ascii++ = (char)(48 + (int)d), ++cdigits;
|
||||
}
|
||||
}
|
||||
while (cdigits+czero-clead < (int)precision && fp > DBL_MIN);
|
||||
while (cdigits+czero < precision+clead && fp > DBL_MIN);
|
||||
|
||||
/* The total output count (max) is now 4+precision */
|
||||
|
||||
@ -3095,7 +3103,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
/* Need another size check here for the exponent digits, so
|
||||
* this need not be considered above.
|
||||
*/
|
||||
if ((int)size > cdigits)
|
||||
if (size > cdigits)
|
||||
{
|
||||
while (cdigits > 0) *ascii++ = exponent[--cdigits];
|
||||
|
||||
@ -3143,7 +3151,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||
|
||||
/* Avoid overflow here on the minimum integer. */
|
||||
if (fp < 0)
|
||||
*ascii++ = 45, --size, num = -fp;
|
||||
*ascii++ = 45, num = -fp;
|
||||
else
|
||||
num = fp;
|
||||
|
||||
@ -3674,7 +3682,7 @@ png_exp(png_fixed_point x)
|
||||
if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */
|
||||
{
|
||||
/* Obtain a 4-bit approximation */
|
||||
png_uint_32 e = png_32bit_exp[(x >> 12) & 0xf];
|
||||
png_uint_32 e = png_32bit_exp[(x >> 12) & 0x0f];
|
||||
|
||||
/* Incorporate the low 12 bits - these decrease the returned value by
|
||||
* multiplying by a number less than 1 if the bit is set. The multiplier
|
||||
@ -4236,7 +4244,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
|
||||
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
|
||||
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
|
||||
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
|
||||
* The sRGB to linear table is exact (to the nearest 16 bit linear fraction).
|
||||
* The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
|
||||
* The inverse (linear to sRGB) table has accuracies as follows:
|
||||
*
|
||||
* For all possible (255*65535+1) input values:
|
||||
|
571
hecl/extern/libpng/png.h
vendored
571
hecl/extern/libpng/png.h
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.17, March 26, 2015
|
||||
* libpng version 1.6.19, November 12, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -11,17 +11,136 @@
|
||||
*
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.17, March 26, 2015: Glenn
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.19, November 12, 2015: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
* If you modify libpng you may insert additional notices immediately following
|
||||
* this sentence.
|
||||
*
|
||||
* Due to various miscommunications, unforeseen code incompatibilities
|
||||
* and occasional factors outside the authors' control, version numbering
|
||||
* on the library has not always been consistent and straightforward.
|
||||
* The following table summarizes matters since version 0.89c, which was
|
||||
* the first widely used release:
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.19, November 12, 2015, are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
|
||||
* derived from libpng-1.0.6, and are distributed according to the same
|
||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
* added to the list of Contributing Authors:
|
||||
*
|
||||
* Simon-Pierre Cadieux
|
||||
* Eric S. Raymond
|
||||
* Mans Rullgard
|
||||
* Cosmin Truta
|
||||
* Gilles Vollant
|
||||
* James Yu
|
||||
*
|
||||
* and with the following additions to the disclaimer:
|
||||
*
|
||||
* There is no warranty against interference with your enjoyment of the
|
||||
* library or against infringement. There is no warranty that our
|
||||
* efforts or the library will fulfill any of your particular purposes
|
||||
* or needs. This library is provided with all faults, and the entire
|
||||
* risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
* the user.
|
||||
*
|
||||
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||
* libpng-0.96, and are distributed according to the same disclaimer and
|
||||
* license as libpng-0.96, with the following individuals added to the list
|
||||
* of Contributing Authors:
|
||||
*
|
||||
* Tom Lane
|
||||
* Glenn Randers-Pehrson
|
||||
* Willem van Schaik
|
||||
*
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
* Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||
* and are distributed according to the same disclaimer and license as
|
||||
* libpng-0.88, with the following individuals added to the list of
|
||||
* Contributing Authors:
|
||||
*
|
||||
* John Bowler
|
||||
* Kevin Bracey
|
||||
* Sam Bushell
|
||||
* Magnus Holmgren
|
||||
* Greg Roelofs
|
||||
* Tom Tanner
|
||||
*
|
||||
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
*
|
||||
* For the purposes of this copyright and license, "Contributing Authors"
|
||||
* is defined as the following set of individuals:
|
||||
*
|
||||
* Andreas Dilger
|
||||
* Dave Martindale
|
||||
* Guy Eric Schalnat
|
||||
* Paul Schmidt
|
||||
* Tim Wegner
|
||||
*
|
||||
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
* and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
* including, without limitation, the warranties of merchantability and of
|
||||
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
* assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
* or consequential damages, which may result from the use of the PNG
|
||||
* Reference Library, even if advised of the possibility of such damage.
|
||||
*
|
||||
* Permission is hereby granted to use, copy, modify, and distribute this
|
||||
* source code, or portions hereof, for any purpose, without fee, subject
|
||||
* to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this source code must not be misrepresented.
|
||||
*
|
||||
* 2. Altered versions must be plainly marked as such and must not
|
||||
* be misrepresented as being the original source.
|
||||
*
|
||||
* 3. This Copyright notice may not be removed or altered from any
|
||||
* source or altered source distribution.
|
||||
*
|
||||
* The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
* fee, and encourage the use of this source code as a component to
|
||||
* supporting the PNG file format in commercial products. If you use this
|
||||
* source code in a product, acknowledgment is not required but would be
|
||||
* appreciated.
|
||||
*
|
||||
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A "png_get_copyright" function is available, for convenient use in "about"
|
||||
* boxes and the like:
|
||||
*
|
||||
* printf("%s", png_get_copyright(NULL));
|
||||
*
|
||||
* Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||
* a certification mark of the Open Source Initiative. OSI has not addressed
|
||||
* the additional disclaimers inserted at version 1.0.7.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The contributing authors would like to thank all those who helped
|
||||
* with testing, bug fixes, and patience. This wouldn't have been
|
||||
* possible without all of you.
|
||||
*
|
||||
* Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
*/
|
||||
|
||||
/* Note about libpng version numbers:
|
||||
*
|
||||
* Due to various miscommunications, unforeseen code incompatibilities
|
||||
* and occasional factors outside the authors' control, version numbering
|
||||
* on the library has not always been consistent and straightforward.
|
||||
* The following table summarizes matters since version 0.89c, which was
|
||||
* the first widely used release:
|
||||
*
|
||||
* source png.h png.h shared-lib
|
||||
* version string int version
|
||||
@ -59,313 +178,48 @@
|
||||
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
||||
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
||||
* 1.0.7 1 10007 (still compatible)
|
||||
* 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
|
||||
* 1.0.8rc1 1 10008 2.1.0.8rc1
|
||||
* 1.0.8 1 10008 2.1.0.8
|
||||
* 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
|
||||
* 1.0.9rc1 1 10009 2.1.0.9rc1
|
||||
* 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
|
||||
* 1.0.9rc2 1 10009 2.1.0.9rc2
|
||||
* 1.0.9 1 10009 2.1.0.9
|
||||
* 1.0.10beta1 1 10010 2.1.0.10beta1
|
||||
* 1.0.10rc1 1 10010 2.1.0.10rc1
|
||||
* 1.0.10 1 10010 2.1.0.10
|
||||
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||
* 1.0.11rc1 1 10011 2.1.0.11rc1
|
||||
* 1.0.11 1 10011 2.1.0.11
|
||||
* 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
|
||||
* 1.0.12rc1 2 10012 2.1.0.12rc1
|
||||
* 1.0.12 2 10012 2.1.0.12
|
||||
* 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
|
||||
* 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
|
||||
* 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
|
||||
* 1.2.0rc1 3 10200 3.1.2.0rc1
|
||||
* 1.2.0 3 10200 3.1.2.0
|
||||
* 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
|
||||
* 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
|
||||
* 1.2.1 3 10201 3.1.2.1
|
||||
* 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
|
||||
* 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
|
||||
* 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
|
||||
* 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
|
||||
* 1.0.13 10 10013 10.so.0.1.0.13
|
||||
* 1.2.2 12 10202 12.so.0.1.2.2
|
||||
* 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
|
||||
* 1.2.3 12 10203 12.so.0.1.2.3
|
||||
* 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
|
||||
* 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
|
||||
* 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
|
||||
* 1.0.14 10 10014 10.so.0.1.0.14
|
||||
* 1.2.4 13 10204 12.so.0.1.2.4
|
||||
* 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
|
||||
* 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
|
||||
* 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
|
||||
* 1.0.15 10 10015 10.so.0.1.0.15
|
||||
* 1.2.5 13 10205 12.so.0.1.2.5
|
||||
* 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
|
||||
* 1.0.16 10 10016 10.so.0.1.0.16
|
||||
* 1.2.6 13 10206 12.so.0.1.2.6
|
||||
* 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
|
||||
* 1.0.17rc1 10 10017 12.so.0.1.0.17rc1
|
||||
* 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
|
||||
* 1.0.17 10 10017 12.so.0.1.0.17
|
||||
* 1.2.7 13 10207 12.so.0.1.2.7
|
||||
* 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
|
||||
* 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5
|
||||
* 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
|
||||
* 1.0.18 10 10018 12.so.0.1.0.18
|
||||
* 1.2.8 13 10208 12.so.0.1.2.8
|
||||
* 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
|
||||
* 1.2.9beta4-11 13 10209 12.so.0.9[.0]
|
||||
* 1.2.9rc1 13 10209 12.so.0.9[.0]
|
||||
* 1.2.9 13 10209 12.so.0.9[.0]
|
||||
* 1.2.10beta1-7 13 10210 12.so.0.10[.0]
|
||||
* 1.2.10rc1-2 13 10210 12.so.0.10[.0]
|
||||
* 1.2.10 13 10210 12.so.0.10[.0]
|
||||
* 1.4.0beta1-5 14 10400 14.so.0.0[.0]
|
||||
* 1.2.11beta1-4 13 10211 12.so.0.11[.0]
|
||||
* 1.4.0beta7-8 14 10400 14.so.0.0[.0]
|
||||
* 1.2.11 13 10211 12.so.0.11[.0]
|
||||
* 1.2.12 13 10212 12.so.0.12[.0]
|
||||
* 1.4.0beta9-14 14 10400 14.so.0.0[.0]
|
||||
* 1.2.13 13 10213 12.so.0.13[.0]
|
||||
* 1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||
* 1.4.0beta37-87 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc01 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0beta88-109 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc02-08 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0 14 10400 14.so.14.0[.0]
|
||||
* 1.4.1beta01-03 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1rc01 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1beta04-12 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1 14 10401 14.so.14.1[.0]
|
||||
* 1.4.2 14 10402 14.so.14.2[.0]
|
||||
* 1.4.3 14 10403 14.so.14.3[.0]
|
||||
* 1.4.4 14 10404 14.so.14.4[.0]
|
||||
* 1.5.0beta01-58 15 10500 15.so.15.0[.0]
|
||||
* 1.5.0rc01-07 15 10500 15.so.15.0[.0]
|
||||
* 1.5.0 15 10500 15.so.15.0[.0]
|
||||
* 1.5.1beta01-11 15 10501 15.so.15.1[.0]
|
||||
* 1.5.1rc01-02 15 10501 15.so.15.1[.0]
|
||||
* 1.5.1 15 10501 15.so.15.1[.0]
|
||||
* 1.5.2beta01-03 15 10502 15.so.15.2[.0]
|
||||
* 1.5.2rc01-03 15 10502 15.so.15.2[.0]
|
||||
* 1.5.2 15 10502 15.so.15.2[.0]
|
||||
* 1.5.3beta01-10 15 10503 15.so.15.3[.0]
|
||||
* 1.5.3rc01-02 15 10503 15.so.15.3[.0]
|
||||
* 1.5.3beta11 15 10503 15.so.15.3[.0]
|
||||
* 1.5.3 [omitted]
|
||||
* 1.5.4beta01-08 15 10504 15.so.15.4[.0]
|
||||
* 1.5.4rc01 15 10504 15.so.15.4[.0]
|
||||
* 1.5.4 15 10504 15.so.15.4[.0]
|
||||
* 1.5.5beta01-08 15 10505 15.so.15.5[.0]
|
||||
* 1.5.5rc01 15 10505 15.so.15.5[.0]
|
||||
* 1.5.5 15 10505 15.so.15.5[.0]
|
||||
* 1.5.6beta01-07 15 10506 15.so.15.6[.0]
|
||||
* 1.5.6rc01-03 15 10506 15.so.15.6[.0]
|
||||
* 1.5.6 15 10506 15.so.15.6[.0]
|
||||
* 1.5.7beta01-05 15 10507 15.so.15.7[.0]
|
||||
* 1.5.7rc01-03 15 10507 15.so.15.7[.0]
|
||||
* 1.5.7 15 10507 15.so.15.7[.0]
|
||||
* 1.6.0beta01-40 16 10600 16.so.16.0[.0]
|
||||
* 1.6.0rc01-08 16 10600 16.so.16.0[.0]
|
||||
* 1.6.0 16 10600 16.so.16.0[.0]
|
||||
* 1.6.1beta01-09 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1rc01 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1 16 10601 16.so.16.1[.0]
|
||||
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
||||
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
||||
* 1.6.2 16 10602 16.so.16.2[.0]
|
||||
* 1.6.3beta01-11 16 10603 16.so.16.3[.0]
|
||||
* 1.6.3rc01 16 10603 16.so.16.3[.0]
|
||||
* 1.6.3 16 10603 16.so.16.3[.0]
|
||||
* 1.6.4beta01-02 16 10604 16.so.16.4[.0]
|
||||
* 1.6.4rc01 16 10604 16.so.16.4[.0]
|
||||
* 1.6.4 16 10604 16.so.16.4[.0]
|
||||
* 1.6.5 16 10605 16.so.16.5[.0]
|
||||
* 1.6.6 16 10606 16.so.16.6[.0]
|
||||
* 1.6.7beta01-04 16 10607 16.so.16.7[.0]
|
||||
* 1.6.7rc01-03 16 10607 16.so.16.7[.0]
|
||||
* 1.6.7 16 10607 16.so.16.7[.0]
|
||||
* 1.6.8beta01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8rc01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8 16 10608 16.so.16.8[.0]
|
||||
* 1.6.9beta01-04 16 10609 16.so.16.9[.0]
|
||||
* 1.6.9rc01-02 16 10609 16.so.16.9[.0]
|
||||
* 1.6.9 16 10609 16.so.16.9[.0]
|
||||
* 1.6.10beta01-03 16 10610 16.so.16.10[.0]
|
||||
* 1.6.10rc01-03 16 10610 16.so.16.10[.0]
|
||||
* 1.6.10 16 10610 16.so.16.10[.0]
|
||||
* 1.6.11beta01-06 16 10611 16.so.16.11[.0]
|
||||
* 1.6.11rc01-02 16 10611 16.so.16.11[.0]
|
||||
* 1.6.11 16 10611 16.so.16.11[.0]
|
||||
* 1.6.12rc01-03 16 10612 16.so.16.12[.0]
|
||||
* 1.6.12 16 10612 16.so.16.12[.0]
|
||||
* 1.6.13beta01-04 16 10613 16.so.16.13[.0]
|
||||
* 1.6.13rc01-02 16 10613 16.so.16.13[.0]
|
||||
* 1.6.13 16 10613 16.so.16.13[.0]
|
||||
* 1.6.14beta01-07 16 10614 16.so.16.14[.0]
|
||||
* 1.6.14rc01-02 16 10614 16.so.16.14[.0]
|
||||
* 1.6.14 16 10614 16.so.16.14[.0]
|
||||
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15 16 10615 16.so.16.15[.0]
|
||||
* 1.6.16beta01-03 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||
* 1.6.17beta01-06 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17rc01-06 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17 16 10617 16.so.16.17[.0]
|
||||
* ...
|
||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||
* ...
|
||||
* 1.2.53 13 10253 12.so.0.53[.0]
|
||||
* ...
|
||||
* 1.5.23 15 10523 15.so.15.23[.0]
|
||||
* ...
|
||||
* 1.6.19 16 10619 16.so.16.19[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
* used for changes in backward compatibility, as it is intended. The
|
||||
* PNG_LIBPNG_VER macro, which is not used within libpng but is available
|
||||
* for applications, is an unsigned integer of the form xyyzz corresponding
|
||||
* to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
* were given the previous public release number plus a letter, until
|
||||
* version 1.0.6j; from then on they were given the upcoming public
|
||||
* release number plus "betaNN" or "rcNN".
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
* used for changes in backward compatibility, as it is intended. The
|
||||
* PNG_LIBPNG_VER macro, which is not used within libpng but is available
|
||||
* for applications, is an unsigned integer of the form xyyzz corresponding
|
||||
* to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
* were given the previous public release number plus a letter, until
|
||||
* version 1.0.6j; from then on they were given the upcoming public
|
||||
* release number plus "betaNN" or "rcNN".
|
||||
*
|
||||
* Binary incompatibility exists only when applications make direct access
|
||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||
* application is loaded with a different version of the library.
|
||||
* Binary incompatibility exists only when applications make direct access
|
||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||
* application is loaded with a different version of the library.
|
||||
*
|
||||
* DLLNUM will change each time there are forward or backward changes
|
||||
* in binary compatibility (e.g., when a new feature is added).
|
||||
* DLLNUM will change each time there are forward or backward changes
|
||||
* in binary compatibility (e.g., when a new feature is added).
|
||||
*
|
||||
* See libpng-manual.txt or libpng.3 for more information. The PNG
|
||||
* specification is available as a W3C Recommendation and as an ISO
|
||||
* Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
*
|
||||
* If you modify libpng you may insert additional notices immediately following
|
||||
* this sentence.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.17, March 26, 2015, are
|
||||
* Copyright (c) 2004, 2006-2015 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:
|
||||
*
|
||||
* Cosmin Truta
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
|
||||
* Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
* with the following individuals added to the list of Contributing Authors:
|
||||
*
|
||||
* Simon-Pierre Cadieux
|
||||
* Eric S. Raymond
|
||||
* Gilles Vollant
|
||||
*
|
||||
* and with the following additions to the disclaimer:
|
||||
*
|
||||
* There is no warranty against interference with your enjoyment of the
|
||||
* library or against infringement. There is no warranty that our
|
||||
* efforts or the library will fulfill any of your particular purposes
|
||||
* or needs. This library is provided with all faults, and the entire
|
||||
* risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
* the user.
|
||||
*
|
||||
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-0.96,
|
||||
* with the following individuals added to the list of Contributing Authors:
|
||||
*
|
||||
* Tom Lane
|
||||
* Glenn Randers-Pehrson
|
||||
* Willem van Schaik
|
||||
*
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
* Distributed according to the same disclaimer and license as libpng-0.88,
|
||||
* with the following individuals added to the list of Contributing Authors:
|
||||
*
|
||||
* John Bowler
|
||||
* Kevin Bracey
|
||||
* Sam Bushell
|
||||
* Magnus Holmgren
|
||||
* Greg Roelofs
|
||||
* Tom Tanner
|
||||
*
|
||||
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
*
|
||||
* For the purposes of this copyright and license, "Contributing Authors"
|
||||
* is defined as the following set of individuals:
|
||||
*
|
||||
* Andreas Dilger
|
||||
* Dave Martindale
|
||||
* Guy Eric Schalnat
|
||||
* Paul Schmidt
|
||||
* Tim Wegner
|
||||
*
|
||||
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
* and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
* including, without limitation, the warranties of merchantability and of
|
||||
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
* assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
* or consequential damages, which may result from the use of the PNG
|
||||
* Reference Library, even if advised of the possibility of such damage.
|
||||
*
|
||||
* Permission is hereby granted to use, copy, modify, and distribute this
|
||||
* source code, or portions hereof, for any purpose, without fee, subject
|
||||
* to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this source code must not be misrepresented.
|
||||
*
|
||||
* 2. Altered versions must be plainly marked as such and must not
|
||||
* be misrepresented as being the original source.
|
||||
*
|
||||
* 3. This Copyright notice may not be removed or altered from
|
||||
* any source or altered source distribution.
|
||||
*
|
||||
* The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
* fee, and encourage the use of this source code as a component to
|
||||
* supporting the PNG file format in commercial products. If you use this
|
||||
* source code in a product, acknowledgment is not required but would be
|
||||
* appreciated.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A "png_get_copyright" function is available, for convenient use in "about"
|
||||
* boxes and the like:
|
||||
*
|
||||
* printf("%s", png_get_copyright(NULL));
|
||||
*
|
||||
* Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Libpng is OSI Certified Open Source Software. OSI Certified is a
|
||||
* certification mark of the Open Source Initiative.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The contributing authors would like to thank all those who helped
|
||||
* with testing, bug fixes, and patience. This wouldn't have been
|
||||
* possible without all of you.
|
||||
*
|
||||
* Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
* See libpng.txt or libpng.3 for more information. The PNG specification
|
||||
* is available as a W3C Recommendation and as an ISO Specification,
|
||||
* <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 26, 2015
|
||||
* November 12, 2015
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.17 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.19 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -427,9 +281,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.17"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.19"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.17 - March 26, 2015\n"
|
||||
" libpng version 1.6.19 - November 12, 2015\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -437,7 +291,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 17
|
||||
#define PNG_LIBPNG_VER_RELEASE 19
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@ -468,7 +322,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10617 /* 1.6.17 */
|
||||
#define PNG_LIBPNG_VER 10619 /* 1.6.19 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -525,17 +379,22 @@ extern "C" {
|
||||
|
||||
/* This file is arranged in several sections:
|
||||
*
|
||||
* 1. Any configuration options that can be specified by for the application
|
||||
* 1. [omitted]
|
||||
* 2. Any configuration options that can be specified by for the application
|
||||
* code when it is built. (Build time configuration is in pnglibconf.h)
|
||||
* 2. Type definitions (base types are defined in pngconf.h), structure
|
||||
* 3. Type definitions (base types are defined in pngconf.h), structure
|
||||
* definitions.
|
||||
* 3. Exported library functions.
|
||||
* 4. Simplified API.
|
||||
* 4. Exported library functions.
|
||||
* 5. Simplified API.
|
||||
* 6. Implementation options.
|
||||
*
|
||||
* The library source code has additional files (principally pngpriv.h) that
|
||||
* allow configuration of the library.
|
||||
*/
|
||||
/* Section 1: run time configuration
|
||||
|
||||
/* Section 1: [omitted] */
|
||||
|
||||
/* Section 2: run time configuration
|
||||
* See pnglibconf.h for build time configuration
|
||||
*
|
||||
* Run time configuration allows the application to choose between
|
||||
@ -565,7 +424,7 @@ extern "C" {
|
||||
* Otherwise the calls are mapped to png_error.
|
||||
*/
|
||||
|
||||
/* Section 2: type definitions, including structures and compile time
|
||||
/* Section 3: type definitions, including structures and compile time
|
||||
* constants.
|
||||
* See pngconf.h for base types that vary by machine/system
|
||||
*/
|
||||
@ -573,7 +432,7 @@ extern "C" {
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_17;
|
||||
typedef char* png_libpng_version_1_6_19;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@ -889,7 +748,9 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
||||
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
|
||||
#if INT_MAX >= 0x8000 /* else this might break */
|
||||
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
|
||||
#endif
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
@ -993,7 +854,9 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
|
||||
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
|
||||
/* Added to libpng-1.5.4 */
|
||||
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
|
||||
#if INT_MAX >= 0x8000 /* else this might break */
|
||||
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
|
||||
#endif
|
||||
|
||||
/* Flags for MNG supported features */
|
||||
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
|
||||
@ -1010,7 +873,7 @@ typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp,
|
||||
png_alloc_size_t));
|
||||
typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
|
||||
|
||||
/* Section 3: exported functions
|
||||
/* Section 4: exported functions
|
||||
* Here are the function definitions most commonly used. This is not
|
||||
* the place to find out how to use libpng. See libpng-manual.txt for the
|
||||
* full explanation, see example.c for the summary. This just provides
|
||||
@ -1383,13 +1246,13 @@ PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
|
||||
/* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
|
||||
PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
|
||||
int flags));
|
||||
/* The values of the PNG_FILLER_ defines should NOT be changed */
|
||||
# define PNG_FILLER_BEFORE 0
|
||||
# define PNG_FILLER_AFTER 1
|
||||
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
|
||||
/* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
|
||||
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
|
||||
png_uint_32 filler, int flags));
|
||||
#endif /* READ_FILLER || WRITE_FILLER */
|
||||
@ -1623,35 +1486,7 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
||||
#define PNG_FILTER_VALUE_LAST 5
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
|
||||
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
|
||||
* defines, either the default (minimum-sum-of-absolute-differences), or
|
||||
* the experimental method (weighted-minimum-sum-of-absolute-differences).
|
||||
*
|
||||
* Weights are factors >= 1.0, indicating how important it is to keep the
|
||||
* filter type consistent between rows. Larger numbers mean the current
|
||||
* filter is that many times as likely to be the same as the "num_weights"
|
||||
* previous filters. This is cumulative for each previous row with a weight.
|
||||
* There needs to be "num_weights" values in "filter_weights", or it can be
|
||||
* NULL if the weights aren't being specified. Weights have no influence on
|
||||
* the selection of the first row filter. Well chosen weights can (in theory)
|
||||
* improve the compression for a given image.
|
||||
*
|
||||
* Costs are factors >= 1.0 indicating the relative decoding costs of a
|
||||
* filter type. Higher costs indicate more decoding expense, and are
|
||||
* therefore less likely to be selected over a filter with lower computational
|
||||
* costs. There needs to be a value in "filter_costs" for each valid filter
|
||||
* type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
|
||||
* setting the costs. Costs try to improve the speed of decompression without
|
||||
* unduly increasing the compressed image size.
|
||||
*
|
||||
* A negative weight or cost indicates the default value is to be used, and
|
||||
* values in the range [0.0, 1.0) indicate the value is to remain unchanged.
|
||||
* The default values for both weights and costs are currently 1.0, but may
|
||||
* change if good general weighting/cost heuristics can be found. If both
|
||||
* the weights and costs are set to 1.0, this degenerates the WEIGHTED method
|
||||
* to the UNWEIGHTED method, but with added encoding time/computation.
|
||||
*/
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
|
||||
PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
|
||||
int heuristic_method, int num_weights, png_const_doublep filter_weights,
|
||||
png_const_doublep filter_costs))
|
||||
@ -1661,9 +1496,7 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
|
||||
png_const_fixed_point_p filter_costs))
|
||||
#endif /* WRITE_WEIGHTED_FILTER */
|
||||
|
||||
/* Heuristic used for row filter selection. These defines should NOT be
|
||||
* changed.
|
||||
*/
|
||||
/* The following are no longer used and will be removed from libpng-1.7: */
|
||||
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
|
||||
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
|
||||
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
|
||||
@ -2744,7 +2577,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
||||
|
||||
# define PNG_get_int_32(buf) \
|
||||
((png_int_32)((*(buf) & 0x80) \
|
||||
? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
|
||||
? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
|
||||
: (png_int_32)png_get_uint_32(buf)))
|
||||
|
||||
/* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
|
||||
@ -2764,10 +2597,17 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
||||
(png_structrp png_ptr, int allowed));
|
||||
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||
PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
png_const_infop info_ptr));
|
||||
# endif
|
||||
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||
|
||||
/*******************************************************************************
|
||||
* SIMPLIFIED API
|
||||
* Section 5: SIMPLIFIED API
|
||||
*******************************************************************************
|
||||
*
|
||||
* Please read the documentation in libpng-manual.txt (TODO: write said
|
||||
@ -2783,8 +2623,9 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
||||
*
|
||||
* To read a PNG file using the simplified API:
|
||||
*
|
||||
* 1) Declare a 'png_image' structure (see below) on the stack and set the
|
||||
* version field to PNG_IMAGE_VERSION.
|
||||
* 1) Declare a 'png_image' structure (see below) on the stack, set the
|
||||
* version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
|
||||
* (this is REQUIRED, your program may crash if you don't do it.)
|
||||
* 2) Call the appropriate png_image_begin_read... function.
|
||||
* 3) Set the png_image 'format' member to the required sample format.
|
||||
* 4) Allocate a buffer for the image and, if required, the color-map.
|
||||
@ -2811,6 +2652,9 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
||||
* when it is being read or defines the in-memory format of an image that you
|
||||
* need to write:
|
||||
*/
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
|
||||
#define PNG_IMAGE_VERSION 1
|
||||
|
||||
typedef struct png_control *png_controlp;
|
||||
@ -2910,7 +2754,7 @@ typedef struct
|
||||
* called to read or write the color-map and set the format correctly for the
|
||||
* image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
|
||||
*
|
||||
* NOTE: libpng can be built with particular features disabled, if you see
|
||||
* NOTE: libpng can be built with particular features disabled. If you see
|
||||
* compiler errors because the definition of one of the following flags has been
|
||||
* compiled out it is because libpng does not have the required support. It is
|
||||
* possible, however, for the libpng configuration to enable the format on just
|
||||
@ -2922,7 +2766,7 @@ typedef struct
|
||||
*/
|
||||
#define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */
|
||||
#define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */
|
||||
#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */
|
||||
#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2-byte channels else 1-byte */
|
||||
#define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
|
||||
|
||||
#ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
@ -3209,9 +3053,11 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
||||
*
|
||||
* With all APIs row_stride is handled as in the read APIs - it is the spacing
|
||||
* from one row to the next in component sized units (1 or 2 bytes) and if
|
||||
* negative indicates a bottom-up row layout in the buffer.
|
||||
* negative indicates a bottom-up row layout in the buffer. If row_stride is zero,
|
||||
* libpng will calculate it for you from the image width and number of channels.
|
||||
*
|
||||
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
||||
* Note that the write API does not support interlacing, sub-8-bit pixels, indexed
|
||||
* PNG (color_type 3) or most ancillary chunks.
|
||||
*/
|
||||
#endif /* STDIO */
|
||||
#endif /* SIMPLIFIED_WRITE */
|
||||
@ -3220,17 +3066,8 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
||||
******************************************************************************/
|
||||
#endif /* SIMPLIFIED_{READ|WRITE} */
|
||||
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
||||
(png_structrp png_ptr, int allowed));
|
||||
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||
PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
png_const_infop info_ptr));
|
||||
# endif
|
||||
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||
|
||||
/*******************************************************************************
|
||||
* IMPLEMENTATION OPTIONS
|
||||
* Section 6: IMPLEMENTATION OPTIONS
|
||||
*******************************************************************************
|
||||
*
|
||||
* Support for arbitrary implementation-specific optimizations. The API allows
|
||||
|
24
hecl/extern/libpng/pngconf.h
vendored
24
hecl/extern/libpng/pngconf.h
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.17, March 26, 2015
|
||||
* libpng version 1.6.19, July 23, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -63,7 +63,7 @@
|
||||
*/
|
||||
#define PNG_CONST const /* backward compatibility only */
|
||||
|
||||
/* This controls optimization of the reading of 16 and 32 bit values
|
||||
/* This controls optimization of the reading of 16-bit and 32-bit values
|
||||
* from PNG files. It can be set on a per-app-file basis - it
|
||||
* just changes whether a macro is used when the function is called.
|
||||
* The library builder sets the default; if read functions are not
|
||||
@ -295,11 +295,11 @@
|
||||
* table entries, so we discard it here. See the .dfn files in the
|
||||
* scripts directory.
|
||||
*/
|
||||
#ifndef PNG_EXPORTA
|
||||
|
||||
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||
PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
|
||||
extern attributes)
|
||||
#ifndef PNG_EXPORTA
|
||||
# define PNG_EXPORTA(ordinal, type, name, args, attributes) \
|
||||
PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \
|
||||
PNG_LINKAGE_API attributes)
|
||||
#endif
|
||||
|
||||
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
|
||||
@ -307,7 +307,7 @@
|
||||
*/
|
||||
#define PNG_EMPTY /*empty list*/
|
||||
|
||||
#define PNG_EXPORT(ordinal, type, name, args)\
|
||||
#define PNG_EXPORT(ordinal, type, name, args) \
|
||||
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
|
||||
|
||||
/* Use PNG_REMOVED to comment out a removed interface. */
|
||||
@ -480,7 +480,7 @@
|
||||
#if CHAR_BIT == 8 && UCHAR_MAX == 255
|
||||
typedef unsigned char png_byte;
|
||||
#else
|
||||
# error "libpng requires 8 bit bytes"
|
||||
# error "libpng requires 8-bit bytes"
|
||||
#endif
|
||||
|
||||
#if INT_MIN == -32768 && INT_MAX == 32767
|
||||
@ -488,7 +488,7 @@
|
||||
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
|
||||
typedef short png_int_16;
|
||||
#else
|
||||
# error "libpng requires a signed 16 bit type"
|
||||
# error "libpng requires a signed 16-bit type"
|
||||
#endif
|
||||
|
||||
#if UINT_MAX == 65535
|
||||
@ -496,7 +496,7 @@
|
||||
#elif USHRT_MAX == 65535
|
||||
typedef unsigned short png_uint_16;
|
||||
#else
|
||||
# error "libpng requires an unsigned 16 bit type"
|
||||
# error "libpng requires an unsigned 16-bit type"
|
||||
#endif
|
||||
|
||||
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
|
||||
@ -504,7 +504,7 @@
|
||||
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
|
||||
typedef long int png_int_32;
|
||||
#else
|
||||
# error "libpng requires a signed 32 bit (or more) type"
|
||||
# error "libpng requires a signed 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
#if UINT_MAX > 4294967294
|
||||
@ -512,7 +512,7 @@
|
||||
#elif ULONG_MAX > 4294967294
|
||||
typedef unsigned long int png_uint_32;
|
||||
#else
|
||||
# error "libpng requires an unsigned 32 bit (or more) type"
|
||||
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
||||
|
14
hecl/extern/libpng/pnglibconf.h
vendored
14
hecl/extern/libpng/pnglibconf.h
vendored
@ -1,10 +1,10 @@
|
||||
/* libpng 1.6.17 STANDARD API DEFINITION */
|
||||
/* libpng 1.6.19 STANDARD API DEFINITION */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng version 1.6.17 - March 26, 2015 */
|
||||
/* Libpng version 1.6.19 - November 12, 2015 */
|
||||
|
||||
/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
|
||||
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
|
||||
|
||||
/* This code is released under the libpng license. */
|
||||
/* For conditions of distribution and use, see the disclaimer */
|
||||
@ -101,8 +101,6 @@
|
||||
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
#define PNG_SETJMP_SUPPORTED
|
||||
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
#define PNG_SET_OPTION_SUPPORTED
|
||||
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
@ -187,11 +185,14 @@
|
||||
/* end of options */
|
||||
/* settings */
|
||||
#define PNG_API_RULE 0
|
||||
#define PNG_COST_SHIFT 3
|
||||
#define PNG_DEFAULT_READ_MACROS 1
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
||||
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
|
||||
#define PNG_INFLATE_BUF_SIZE 1024
|
||||
#define PNG_LINKAGE_API extern
|
||||
#define PNG_LINKAGE_CALLBACK extern
|
||||
#define PNG_LINKAGE_DATA extern
|
||||
#define PNG_LINKAGE_FUNCTION extern
|
||||
#define PNG_MAX_GAMMA_8 11
|
||||
#define PNG_QUANTIZE_BLUE_BITS 5
|
||||
#define PNG_QUANTIZE_GREEN_BITS 5
|
||||
@ -202,7 +203,6 @@
|
||||
#define PNG_USER_CHUNK_MALLOC_MAX 8000000
|
||||
#define PNG_USER_HEIGHT_MAX 1000000
|
||||
#define PNG_USER_WIDTH_MAX 1000000
|
||||
#define PNG_WEIGHT_SHIFT 8
|
||||
#define PNG_ZBUF_SIZE 8192
|
||||
#define PNG_ZLIB_VERNUM 0 /* unknown */
|
||||
#define PNG_Z_DEFAULT_COMPRESSION (-1)
|
||||
|
3
hecl/extern/libpng/pngmem.c
vendored
3
hecl/extern/libpng/pngmem.c
vendored
@ -77,6 +77,9 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||
PNG_UNUSED(png_ptr)
|
||||
#endif
|
||||
|
||||
/* Some compilers complain that this is always true. However, it
|
||||
* can be false when integer overflow happens.
|
||||
*/
|
||||
if (size > 0 && size <= PNG_SIZE_MAX
|
||||
# ifdef PNG_MAX_MALLOC_64K
|
||||
&& size <= 65536U
|
||||
|
113
hecl/extern/libpng/pngpread.c
vendored
113
hecl/extern/libpng/pngpread.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -19,7 +19,6 @@
|
||||
#define PNG_READ_SIG_MODE 0
|
||||
#define PNG_READ_CHUNK_MODE 1
|
||||
#define PNG_READ_IDAT_MODE 2
|
||||
#define PNG_SKIP_MODE 3
|
||||
#define PNG_READ_tEXt_MODE 4
|
||||
#define PNG_READ_zTXt_MODE 5
|
||||
#define PNG_READ_DONE_MODE 6
|
||||
@ -78,32 +77,14 @@ png_process_data_pause(png_structrp png_ptr, int save)
|
||||
png_uint_32 PNGAPI
|
||||
png_process_data_skip(png_structrp png_ptr)
|
||||
{
|
||||
png_uint_32 remaining = 0;
|
||||
|
||||
if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE &&
|
||||
png_ptr->skip_length > 0)
|
||||
{
|
||||
/* At the end of png_process_data the buffer size must be 0 (see the loop
|
||||
* above) so we can detect a broken call here:
|
||||
*/
|
||||
if (png_ptr->buffer_size != 0)
|
||||
png_error(png_ptr,
|
||||
"png_process_data_skip called inside png_process_data");
|
||||
|
||||
/* If is impossible for there to be a saved buffer at this point -
|
||||
* otherwise we could not be in SKIP mode. This will also happen if
|
||||
* png_process_skip is called inside png_process_data (but only very
|
||||
* rarely.)
|
||||
*/
|
||||
if (png_ptr->save_buffer_size != 0)
|
||||
png_error(png_ptr, "png_process_data_skip called with saved data");
|
||||
|
||||
remaining = png_ptr->skip_length;
|
||||
png_ptr->skip_length = 0;
|
||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||
}
|
||||
|
||||
return remaining;
|
||||
/* TODO: Deprecate and remove this API.
|
||||
* Somewhere the implementation of this seems to have been lost,
|
||||
* or abandoned. It was only to support some internal back-door access
|
||||
* to png_struct) in libpng-1.4.x.
|
||||
*/
|
||||
png_app_warning(png_ptr,
|
||||
"png_process_data_skip is not implemented in any current version of libpng");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* What we do with the incoming data depends on what we were previously
|
||||
@ -135,12 +116,6 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
||||
break;
|
||||
}
|
||||
|
||||
case PNG_SKIP_MODE:
|
||||
{
|
||||
png_push_crc_finish(png_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
png_ptr->buffer_size = 0;
|
||||
@ -159,7 +134,7 @@ void /* PRIVATE */
|
||||
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||
num_to_check = 8 - num_checked;
|
||||
num_to_check = 8 - num_checked;
|
||||
|
||||
if (png_ptr->buffer_size < num_to_check)
|
||||
{
|
||||
@ -439,69 +414,6 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
|
||||
{
|
||||
png_ptr->process_mode = PNG_SKIP_MODE;
|
||||
png_ptr->skip_length = skip;
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_crc_finish(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->save_buffer_size;
|
||||
png_uint_32 skip_length = png_ptr->skip_length;
|
||||
|
||||
/* We want the smaller of 'skip_length' and 'save_buffer_size', but
|
||||
* they are of different types and we don't know which variable has the
|
||||
* fewest bits. Carefully select the smaller and cast it to the type of
|
||||
* the larger - this cannot overflow. Do not cast in the following test
|
||||
* - it will break on either 16 or 64 bit platforms.
|
||||
*/
|
||||
if (skip_length < save_size)
|
||||
save_size = (png_size_t)skip_length;
|
||||
|
||||
else
|
||||
skip_length = (png_uint_32)save_size;
|
||||
|
||||
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
|
||||
|
||||
png_ptr->skip_length -= skip_length;
|
||||
png_ptr->buffer_size -= save_size;
|
||||
png_ptr->save_buffer_size -= save_size;
|
||||
png_ptr->save_buffer_ptr += save_size;
|
||||
}
|
||||
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->current_buffer_size;
|
||||
png_uint_32 skip_length = png_ptr->skip_length;
|
||||
|
||||
/* We want the smaller of 'skip_length' and 'current_buffer_size', here,
|
||||
* the same problem exists as above and the same solution.
|
||||
*/
|
||||
if (skip_length < save_size)
|
||||
save_size = (png_size_t)skip_length;
|
||||
|
||||
else
|
||||
skip_length = (png_uint_32)save_size;
|
||||
|
||||
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
|
||||
|
||||
png_ptr->skip_length -= skip_length;
|
||||
png_ptr->buffer_size -= save_size;
|
||||
png_ptr->current_buffer_size -= save_size;
|
||||
png_ptr->current_buffer_ptr += save_size;
|
||||
}
|
||||
if (png_ptr->skip_length == 0)
|
||||
{
|
||||
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||
png_crc_finish(png_ptr, 0);
|
||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
void PNGCBAPI
|
||||
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
{
|
||||
@ -584,13 +496,11 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
png_free(png_ptr, old_buffer);
|
||||
old_buffer = NULL;
|
||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||
}
|
||||
|
||||
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
png_free(png_ptr, old_buffer);
|
||||
old_buffer = NULL;
|
||||
png_ptr->save_buffer_max = new_max;
|
||||
}
|
||||
if (png_ptr->current_buffer_size)
|
||||
@ -653,7 +563,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
* are of different types and we don't know which variable has the fewest
|
||||
* bits. Carefully select the smaller and cast it to the type of the
|
||||
* larger - this cannot overflow. Do not cast in the following test - it
|
||||
* will break on either 16 or 64 bit platforms.
|
||||
* will break on either 16-bit or 64-bit platforms.
|
||||
*/
|
||||
if (idat_size < save_size)
|
||||
save_size = (png_size_t)idat_size;
|
||||
@ -696,6 +606,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
png_ptr->current_buffer_size -= save_size;
|
||||
png_ptr->current_buffer_ptr += save_size;
|
||||
}
|
||||
|
||||
if (png_ptr->idat_size == 0)
|
||||
{
|
||||
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||
|
45
hecl/extern/libpng/pngpriv.h
vendored
45
hecl/extern/libpng/pngpriv.h
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -118,8 +118,12 @@
|
||||
* to compile with an appropriate #error if ALIGNED_MEMORY has been turned
|
||||
* off.
|
||||
*
|
||||
* Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
|
||||
* check both variants.
|
||||
* Note that gcc-4.9 defines __ARM_NEON instead of the deprecated
|
||||
* __ARM_NEON__, so we check both variants.
|
||||
*
|
||||
* To disable ARM_NEON optimizations entirely, and skip compiling the
|
||||
* associated assembler code, pass --enable-arm-neon=no to configure
|
||||
* or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS.
|
||||
*/
|
||||
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
|
||||
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||
@ -248,17 +252,18 @@
|
||||
* always be used to declare an extern data or function object in this file.
|
||||
*/
|
||||
#ifndef PNG_INTERNAL_DATA
|
||||
# define PNG_INTERNAL_DATA(type, name, array) extern type name array
|
||||
# define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array
|
||||
#endif
|
||||
|
||||
#ifndef PNG_INTERNAL_FUNCTION
|
||||
# define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
|
||||
extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
|
||||
PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
|
||||
#endif
|
||||
|
||||
#ifndef PNG_INTERNAL_CALLBACK
|
||||
# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
|
||||
extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
|
||||
PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\
|
||||
PNG_EMPTY attributes)
|
||||
#endif
|
||||
|
||||
/* If floating or fixed point APIs are disabled they may still be compiled
|
||||
@ -296,6 +301,22 @@
|
||||
# define PNG_DLL_EXPORT
|
||||
#endif
|
||||
|
||||
/* This is a global switch to set the compilation for an installed system
|
||||
* (a release build). It can be set for testing debug builds to ensure that
|
||||
* they will compile when the build type is switched to RC or STABLE, the
|
||||
* default is just to use PNG_LIBPNG_BUILD_BASE_TYPE. Set this in CPPFLAGS
|
||||
* with either:
|
||||
*
|
||||
* -DPNG_RELEASE_BUILD Turns on the release compile path
|
||||
* -DPNG_RELEASE_BUILD=0 Turns it off
|
||||
* or in your pngusr.h with
|
||||
* #define PNG_RELEASE_BUILD=1 Turns on the release compile path
|
||||
* #define PNG_RELEASE_BUILD=0 Turns it off
|
||||
*/
|
||||
#ifndef PNG_RELEASE_BUILD
|
||||
# define PNG_RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
|
||||
#endif
|
||||
|
||||
/* SECURITY and SAFETY:
|
||||
*
|
||||
* libpng is built with support for internal limits on image dimensions and
|
||||
@ -554,10 +575,6 @@
|
||||
#define PNG_STRUCT_PNG 0x0001
|
||||
#define PNG_STRUCT_INFO 0x0002
|
||||
|
||||
/* Scaling factor for filter heuristic weighting calculations */
|
||||
#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
|
||||
#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
|
||||
|
||||
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
|
||||
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
|
||||
@ -648,7 +665,7 @@
|
||||
/* The fixed point conversion performs range checking and evaluates
|
||||
* its argument multiple times, so must be used with care. The
|
||||
* range checking uses the PNG specification values for a signed
|
||||
* 32 bit fixed point value except that the values are deliberately
|
||||
* 32-bit fixed point value except that the values are deliberately
|
||||
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
|
||||
* (2^31-1) * 100000). 's' is a string that describes the value being
|
||||
* converted.
|
||||
@ -795,7 +812,7 @@
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
||||
/* This is used for 16-bit gamma tables -- only the top level pointers are
|
||||
* const; this could be changed:
|
||||
*/
|
||||
typedef const png_uint_16p * png_const_uint_16pp;
|
||||
@ -1372,10 +1389,6 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr,
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
|
||||
png_inforp info_ptr),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_crc_skip,(png_structrp png_ptr,
|
||||
png_uint_32 length),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_crc_finish,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
|
||||
|
31
hecl/extern/libpng/pngread.c
vendored
31
hecl/extern/libpng/pngread.c
vendored
@ -63,7 +63,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
/* In stable builds only warn if an application error can be completely
|
||||
* handled.
|
||||
*/
|
||||
# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
# if PNG_RELEASE_BUILD
|
||||
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
|
||||
# endif
|
||||
# endif
|
||||
@ -1043,9 +1043,9 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
/* Tell libpng to strip 16-bit/color files down to 8 bits per color.
|
||||
*/
|
||||
if ((transforms & PNG_TRANSFORM_SCALE_16) != 0)
|
||||
/* Added at libpng-1.5.4. "strip_16" produces the same result that it
|
||||
* did in earlier versions, while "scale_16" is now more accurate.
|
||||
*/
|
||||
/* Added at libpng-1.5.4. "strip_16" produces the same result that it
|
||||
* did in earlier versions, while "scale_16" is now more accurate.
|
||||
*/
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
png_set_scale_16(png_ptr);
|
||||
#else
|
||||
@ -1209,7 +1209,7 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
for (iptr = 0; iptr < info_ptr->height; iptr++)
|
||||
info_ptr->row_pointers[iptr] = png_voidcast(png_bytep,
|
||||
png_malloc(png_ptr, info_ptr->rowbytes));
|
||||
png_malloc(png_ptr, info_ptr->rowbytes));
|
||||
}
|
||||
|
||||
png_read_image(png_ptr, info_ptr->row_pointers);
|
||||
@ -1683,10 +1683,11 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
|
||||
value *= 257;
|
||||
break;
|
||||
|
||||
#ifdef __GNUC__
|
||||
default:
|
||||
png_error(display->image->opaque->png_ptr,
|
||||
"unexpected encoding (internal error)");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -2847,10 +2848,6 @@ png_image_read_colormap(png_voidp argument)
|
||||
|
||||
switch (data_encoding)
|
||||
{
|
||||
default:
|
||||
png_error(png_ptr, "bad data option (internal error)");
|
||||
break;
|
||||
|
||||
case P_sRGB:
|
||||
/* Change to 8-bit sRGB */
|
||||
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
|
||||
@ -2860,6 +2857,11 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (png_ptr->bit_depth > 8)
|
||||
png_set_scale_16(png_ptr);
|
||||
break;
|
||||
|
||||
#ifdef __GNUC__
|
||||
default:
|
||||
png_error(png_ptr, "bad data option (internal error)");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cmap_entries > 256 || cmap_entries > image->colormap_entries)
|
||||
@ -3410,10 +3412,6 @@ png_image_read_background(png_voidp argument)
|
||||
*/
|
||||
switch (info_ptr->bit_depth)
|
||||
{
|
||||
default:
|
||||
png_error(png_ptr, "unexpected bit depth");
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/* 8-bit sRGB gray values with an alpha channel; the alpha channel is
|
||||
* to be removed by composing on a background: either the row if
|
||||
@ -3631,6 +3629,11 @@ png_image_read_background(png_voidp argument)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef __GNUC__
|
||||
default:
|
||||
png_error(png_ptr, "unexpected bit depth");
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
2
hecl/extern/libpng/pngrio.c
vendored
2
hecl/extern/libpng/pngrio.c
vendored
@ -26,7 +26,7 @@
|
||||
* reads from a file pointer. Note that this routine sometimes gets called
|
||||
* with very small lengths, so you should implement some kind of simple
|
||||
* buffering if you are using unbuffered reads. This should never be asked
|
||||
* to read more than 64K on a 16 bit machine.
|
||||
* to read more than 64K on a 16-bit machine.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
|
30
hecl/extern/libpng/pngrtran.c
vendored
30
hecl/extern/libpng/pngrtran.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -976,7 +976,6 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
|
||||
|
||||
default:
|
||||
png_error(png_ptr, "invalid error action to rgb_to_gray");
|
||||
break;
|
||||
}
|
||||
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
@ -1997,7 +1996,7 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
||||
# endif
|
||||
|
||||
# else
|
||||
/* No 16 bit support: force chopping 16-bit input down to 8, in this case
|
||||
/* No 16-bit support: force chopping 16-bit input down to 8, in this case
|
||||
* the app program can chose if both APIs are available by setting the
|
||||
* correct scaling to use.
|
||||
*/
|
||||
@ -2098,10 +2097,10 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
||||
defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||
{
|
||||
if (info_ptr->bit_depth < png_ptr->user_transform_depth)
|
||||
if (png_ptr->user_transform_depth != 0)
|
||||
info_ptr->bit_depth = png_ptr->user_transform_depth;
|
||||
|
||||
if (info_ptr->channels < png_ptr->user_transform_channels)
|
||||
if (png_ptr->user_transform_channels != 0)
|
||||
info_ptr->channels = png_ptr->user_transform_channels;
|
||||
}
|
||||
#endif
|
||||
@ -2382,8 +2381,8 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
||||
|
||||
while (sp < ep)
|
||||
{
|
||||
/* The input is an array of 16 bit components, these must be scaled to
|
||||
* 8 bits each. For a 16 bit value V the required value (from the PNG
|
||||
/* The input is an array of 16-bit components, these must be scaled to
|
||||
* 8 bits each. For a 16-bit value V the required value (from the PNG
|
||||
* specification) is:
|
||||
*
|
||||
* (V * 255) / 65535
|
||||
@ -2404,7 +2403,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
||||
*
|
||||
* The approximate differs from the exact answer only when (vlo-vhi) is
|
||||
* 128; it then gives a correction of +1 when the exact correction is
|
||||
* 0. This gives 128 errors. The exact answer (correct for all 16 bit
|
||||
* 0. This gives 128 errors. The exact answer (correct for all 16-bit
|
||||
* input values) is:
|
||||
*
|
||||
* error = (vlo-vhi+128)*65535 >> 24;
|
||||
@ -3148,9 +3147,9 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
if (red != green || red != blue)
|
||||
rgb_error |= 1;
|
||||
|
||||
/* From 1.5.5 in the 16 bit case do the accurate conversion even
|
||||
/* From 1.5.5 in the 16-bit case do the accurate conversion even
|
||||
* in the 'fast' case - this is because this is where the code
|
||||
* ends up when handling linear 16 bit data.
|
||||
* ends up when handling linear 16-bit data.
|
||||
*/
|
||||
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
|
||||
15);
|
||||
@ -3315,7 +3314,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
if ((png_uint_16)((*sp >> shift) & 0x0f)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0xf0f >> (4 - shift));
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
@ -3325,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
unsigned int p = (*sp >> shift) & 0x0f;
|
||||
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
|
||||
0x0f;
|
||||
unsigned int tmp = *sp & (0xf0f >> (4 - shift));
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= g << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
@ -3351,7 +3350,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
if ((png_uint_16)((*sp >> shift) & 0x0f)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0xf0f >> (4 - shift));
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
@ -4460,7 +4459,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (*sp == gray)
|
||||
if ((*sp & 0xffU) == gray)
|
||||
*dp-- = 0;
|
||||
|
||||
else
|
||||
@ -4478,7 +4477,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
dp = row + (row_info->rowbytes << 1) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (*(sp - 1) == gray_high && *(sp) == gray_low)
|
||||
if ((*(sp - 1) & 0xffU) == gray_high &&
|
||||
(*(sp) & 0xffU) == gray_low)
|
||||
{
|
||||
*dp-- = 0;
|
||||
*dp-- = 0;
|
||||
|
384
hecl/extern/libpng/pngrutil.c
vendored
384
hecl/extern/libpng/pngrutil.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -89,7 +89,13 @@ png_get_int_32)(png_const_bytep buf)
|
||||
return uval;
|
||||
|
||||
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
|
||||
return -(png_int_32)uval;
|
||||
if ((uval & 0x80000000) == 0) /* no overflow */
|
||||
return -(png_int_32)uval;
|
||||
/* The following has to be safe; this function only gets called on PNG data
|
||||
* and if we get here that data is invalid. 0 is the most safe value and
|
||||
* if not then an attacker would surely just generate a PNG with 0 instead.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
|
||||
@ -98,7 +104,7 @@ png_get_uint_16)(png_const_bytep buf)
|
||||
{
|
||||
/* ANSI-C requires an int value to accomodate at least 16 bits so this
|
||||
* works and allows the compiler not to worry about possible narrowing
|
||||
* on 32 bit systems. (Pre-ANSI systems did not make integers smaller
|
||||
* on 32-bit systems. (Pre-ANSI systems did not make integers smaller
|
||||
* than 16 bits either.)
|
||||
*/
|
||||
unsigned int val =
|
||||
@ -341,7 +347,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
* are minimal.
|
||||
*/
|
||||
(void)png_safecat(msg, (sizeof msg), 4, " using zstream");
|
||||
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
#if PNG_RELEASE_BUILD
|
||||
png_chunk_warning(png_ptr, msg);
|
||||
png_ptr->zowner = 0;
|
||||
#else
|
||||
@ -575,7 +581,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
*/
|
||||
png_alloc_size_t limit = PNG_SIZE_MAX;
|
||||
|
||||
# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
@ -670,7 +676,6 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
* success)
|
||||
*/
|
||||
png_free(png_ptr, text);
|
||||
text = NULL;
|
||||
|
||||
/* This really is very benign, but it's still an error because
|
||||
* the extra space may otherwise be used as a Trojan Horse.
|
||||
@ -867,7 +872,7 @@ void /* PRIVATE */
|
||||
png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_color palette[PNG_MAX_PALETTE_LENGTH];
|
||||
int num, i;
|
||||
int max_palette_length, num, i;
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
png_colorp pal_ptr;
|
||||
#endif
|
||||
@ -928,6 +933,19 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
/* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
|
||||
num = (int)length / 3;
|
||||
|
||||
/* If the palette has 256 or fewer entries but is too large for the bit
|
||||
* depth, we don't issue an error, to preserve the behavior of previous
|
||||
* libpng versions. We silently truncate the unused extra palette entries
|
||||
* here.
|
||||
*/
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
max_palette_length = (1 << png_ptr->bit_depth);
|
||||
else
|
||||
max_palette_length = PNG_MAX_PALETTE_LENGTH;
|
||||
|
||||
if (num > max_palette_length)
|
||||
num = max_palette_length;
|
||||
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
||||
{
|
||||
@ -960,7 +978,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
#endif
|
||||
{
|
||||
png_crc_finish(png_ptr, 0);
|
||||
png_crc_finish(png_ptr, (int) length - num * 3);
|
||||
}
|
||||
|
||||
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
||||
@ -1147,11 +1165,13 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
return;
|
||||
|
||||
for (i=0; i<truelen; ++i)
|
||||
{
|
||||
if (buf[i] == 0 || buf[i] > sample_depth)
|
||||
{
|
||||
png_chunk_benign_error(png_ptr, "invalid");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
{
|
||||
@ -1462,10 +1482,10 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
finished = 1;
|
||||
|
||||
# ifdef PNG_sRGB_SUPPORTED
|
||||
/* Check for a match against sRGB */
|
||||
png_icc_set_sRGB(png_ptr,
|
||||
&png_ptr->colorspace, profile,
|
||||
png_ptr->zstream.adler);
|
||||
/* Check for a match against sRGB */
|
||||
png_icc_set_sRGB(png_ptr,
|
||||
&png_ptr->colorspace, profile,
|
||||
png_ptr->zstream.adler);
|
||||
# endif
|
||||
|
||||
/* Steal the profile for info_ptr. */
|
||||
@ -1675,8 +1695,8 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
if (dl > max_dl)
|
||||
{
|
||||
png_warning(png_ptr, "sPLT chunk too long");
|
||||
return;
|
||||
png_warning(png_ptr, "sPLT chunk too long");
|
||||
return;
|
||||
}
|
||||
|
||||
new_palette.nentries = (png_int_32)(data_length / entry_size);
|
||||
@ -1686,8 +1706,8 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
if (new_palette.entries == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "sPLT chunk requires too much memory");
|
||||
return;
|
||||
png_warning(png_ptr, "sPLT chunk requires too much memory");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
@ -1817,7 +1837,8 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
return;
|
||||
}
|
||||
|
||||
if (length > png_ptr->num_palette || length > PNG_MAX_PALETTE_LENGTH ||
|
||||
if (length > (unsigned int) png_ptr->num_palette ||
|
||||
length > (unsigned int) PNG_MAX_PALETTE_LENGTH ||
|
||||
length == 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
@ -1980,7 +2001,8 @@ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
num = length / 2 ;
|
||||
|
||||
if (num != png_ptr->num_palette || num > PNG_MAX_PALETTE_LENGTH)
|
||||
if (num != (unsigned int) png_ptr->num_palette ||
|
||||
num > (unsigned int) PNG_MAX_PALETTE_LENGTH)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "invalid");
|
||||
@ -2715,14 +2737,14 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
|
||||
# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
|
||||
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
|
||||
if (length <= limit)
|
||||
@ -2785,7 +2807,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
*/
|
||||
# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
|
||||
keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@ -2794,153 +2816,153 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
*/
|
||||
# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
/* The user callback takes precedence over the chunk keep value, but the
|
||||
* keep value is still required to validate a save of a critical chunk.
|
||||
*/
|
||||
if (png_ptr->read_user_chunk_fn != NULL)
|
||||
/* The user callback takes precedence over the chunk keep value, but the
|
||||
* keep value is still required to validate a save of a critical chunk.
|
||||
*/
|
||||
if (png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
if (png_cache_unknown_chunk(png_ptr, length) != 0)
|
||||
{
|
||||
if (png_cache_unknown_chunk(png_ptr, length) != 0)
|
||||
/* Callback to user unknown chunk handler */
|
||||
int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
|
||||
&png_ptr->unknown_chunk);
|
||||
|
||||
/* ret is:
|
||||
* negative: An error occurred; png_chunk_error will be called.
|
||||
* zero: The chunk was not handled, the chunk will be discarded
|
||||
* unless png_set_keep_unknown_chunks has been used to set
|
||||
* a 'keep' behavior for this particular chunk, in which
|
||||
* case that will be used. A critical chunk will cause an
|
||||
* error at this point unless it is to be saved.
|
||||
* positive: The chunk was handled, libpng will ignore/discard it.
|
||||
*/
|
||||
if (ret < 0)
|
||||
png_chunk_error(png_ptr, "error in user chunk");
|
||||
|
||||
else if (ret == 0)
|
||||
{
|
||||
/* Callback to user unknown chunk handler */
|
||||
int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
|
||||
&png_ptr->unknown_chunk);
|
||||
|
||||
/* ret is:
|
||||
* negative: An error occurred; png_chunk_error will be called.
|
||||
* zero: The chunk was not handled, the chunk will be discarded
|
||||
* unless png_set_keep_unknown_chunks has been used to set
|
||||
* a 'keep' behavior for this particular chunk, in which
|
||||
* case that will be used. A critical chunk will cause an
|
||||
* error at this point unless it is to be saved.
|
||||
* positive: The chunk was handled, libpng will ignore/discard it.
|
||||
/* If the keep value is 'default' or 'never' override it, but
|
||||
* still error out on critical chunks unless the keep value is
|
||||
* 'always' While this is weird it is the behavior in 1.4.12.
|
||||
* A possible improvement would be to obey the value set for the
|
||||
* chunk, but this would be an API change that would probably
|
||||
* damage some applications.
|
||||
*
|
||||
* The png_app_warning below catches the case that matters, where
|
||||
* the application has not set specific save or ignore for this
|
||||
* chunk or global save or ignore.
|
||||
*/
|
||||
if (ret < 0)
|
||||
png_chunk_error(png_ptr, "error in user chunk");
|
||||
|
||||
else if (ret == 0)
|
||||
if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
|
||||
{
|
||||
/* If the keep value is 'default' or 'never' override it, but
|
||||
* still error out on critical chunks unless the keep value is
|
||||
* 'always' While this is weird it is the behavior in 1.4.12.
|
||||
* A possible improvement would be to obey the value set for the
|
||||
* chunk, but this would be an API change that would probably
|
||||
* damage some applications.
|
||||
*
|
||||
* The png_app_warning below catches the case that matters, where
|
||||
* the application has not set specific save or ignore for this
|
||||
* chunk or global save or ignore.
|
||||
*/
|
||||
if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
|
||||
# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
|
||||
{
|
||||
# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
|
||||
{
|
||||
png_chunk_warning(png_ptr, "Saving unknown chunk:");
|
||||
png_app_warning(png_ptr,
|
||||
"forcing save of an unhandled chunk;"
|
||||
" please call png_set_keep_unknown_chunks");
|
||||
/* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
|
||||
}
|
||||
# endif
|
||||
keep = PNG_HANDLE_CHUNK_IF_SAFE;
|
||||
png_chunk_warning(png_ptr, "Saving unknown chunk:");
|
||||
png_app_warning(png_ptr,
|
||||
"forcing save of an unhandled chunk;"
|
||||
" please call png_set_keep_unknown_chunks");
|
||||
/* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
|
||||
}
|
||||
}
|
||||
|
||||
else /* chunk was handled */
|
||||
{
|
||||
handled = 1;
|
||||
/* Critical chunks can be safely discarded at this point. */
|
||||
keep = PNG_HANDLE_CHUNK_NEVER;
|
||||
# endif
|
||||
keep = PNG_HANDLE_CHUNK_IF_SAFE;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
|
||||
else /* chunk was handled */
|
||||
{
|
||||
handled = 1;
|
||||
/* Critical chunks can be safely discarded at this point. */
|
||||
keep = PNG_HANDLE_CHUNK_NEVER;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
/* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
|
||||
keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
|
||||
}
|
||||
|
||||
else
|
||||
/* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
|
||||
# endif /* READ_USER_CHUNKS */
|
||||
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
{
|
||||
/* keep is currently just the per-chunk setting, if there was no
|
||||
* setting change it to the global default now (not that this may
|
||||
* still be AS_DEFAULT) then obtain the cache of the chunk if required,
|
||||
* if not simply skip the chunk.
|
||||
*/
|
||||
if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
keep = png_ptr->unknown_default;
|
||||
|
||||
if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||
(keep == PNG_HANDLE_CHUNK_IF_SAFE &&
|
||||
PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
|
||||
{
|
||||
/* keep is currently just the per-chunk setting, if there was no
|
||||
* setting change it to the global default now (not that this may
|
||||
* still be AS_DEFAULT) then obtain the cache of the chunk if required,
|
||||
* if not simply skip the chunk.
|
||||
*/
|
||||
if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
keep = png_ptr->unknown_default;
|
||||
|
||||
if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||
(keep == PNG_HANDLE_CHUNK_IF_SAFE &&
|
||||
PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
|
||||
{
|
||||
if (png_cache_unknown_chunk(png_ptr, length) == 0)
|
||||
keep = PNG_HANDLE_CHUNK_NEVER;
|
||||
}
|
||||
|
||||
else
|
||||
png_crc_finish(png_ptr, length);
|
||||
if (png_cache_unknown_chunk(png_ptr, length) == 0)
|
||||
keep = PNG_HANDLE_CHUNK_NEVER;
|
||||
}
|
||||
|
||||
else
|
||||
png_crc_finish(png_ptr, length);
|
||||
}
|
||||
# else
|
||||
# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
# error no method to support READ_UNKNOWN_CHUNKS
|
||||
# endif
|
||||
|
||||
{
|
||||
/* If here there is no read callback pointer set and no support is
|
||||
* compiled in to just save the unknown chunks, so simply skip this
|
||||
* chunk. If 'keep' is something other than AS_DEFAULT or NEVER then
|
||||
* the app has erroneously asked for unknown chunk saving when there
|
||||
* is no support.
|
||||
*/
|
||||
if (keep > PNG_HANDLE_CHUNK_NEVER)
|
||||
png_app_error(png_ptr, "no unknown chunk support available");
|
||||
{
|
||||
/* If here there is no read callback pointer set and no support is
|
||||
* compiled in to just save the unknown chunks, so simply skip this
|
||||
* chunk. If 'keep' is something other than AS_DEFAULT or NEVER then
|
||||
* the app has erroneously asked for unknown chunk saving when there
|
||||
* is no support.
|
||||
*/
|
||||
if (keep > PNG_HANDLE_CHUNK_NEVER)
|
||||
png_app_error(png_ptr, "no unknown chunk support available");
|
||||
|
||||
png_crc_finish(png_ptr, length);
|
||||
}
|
||||
png_crc_finish(png_ptr, length);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Now store the chunk in the chunk list if appropriate, and if the limits
|
||||
* permit it.
|
||||
*/
|
||||
if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||
(keep == PNG_HANDLE_CHUNK_IF_SAFE &&
|
||||
PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
|
||||
/* Now store the chunk in the chunk list if appropriate, and if the limits
|
||||
* permit it.
|
||||
*/
|
||||
if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||
(keep == PNG_HANDLE_CHUNK_IF_SAFE &&
|
||||
PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
|
||||
{
|
||||
# ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
switch (png_ptr->user_chunk_cache_max)
|
||||
{
|
||||
# ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
switch (png_ptr->user_chunk_cache_max)
|
||||
{
|
||||
case 2:
|
||||
png_ptr->user_chunk_cache_max = 1;
|
||||
png_chunk_benign_error(png_ptr, "no space in chunk cache");
|
||||
/* FALL THROUGH */
|
||||
case 1:
|
||||
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
|
||||
* chunk being skipped, now there will be a hard error below.
|
||||
*/
|
||||
break;
|
||||
case 2:
|
||||
png_ptr->user_chunk_cache_max = 1;
|
||||
png_chunk_benign_error(png_ptr, "no space in chunk cache");
|
||||
/* FALL THROUGH */
|
||||
case 1:
|
||||
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
|
||||
* chunk being skipped, now there will be a hard error below.
|
||||
*/
|
||||
break;
|
||||
|
||||
default: /* not at limit */
|
||||
--(png_ptr->user_chunk_cache_max);
|
||||
/* FALL THROUGH */
|
||||
case 0: /* no limit */
|
||||
# endif /* USER_LIMITS */
|
||||
/* Here when the limit isn't reached or when limits are compiled
|
||||
* out; store the chunk.
|
||||
*/
|
||||
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
handled = 1;
|
||||
# ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
default: /* not at limit */
|
||||
--(png_ptr->user_chunk_cache_max);
|
||||
/* FALL THROUGH */
|
||||
case 0: /* no limit */
|
||||
# endif /* USER_LIMITS */
|
||||
/* Here when the limit isn't reached or when limits are compiled
|
||||
* out; store the chunk.
|
||||
*/
|
||||
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
handled = 1;
|
||||
# ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# else /* no store support: the chunk must be handled by the user callback */
|
||||
PNG_UNUSED(info_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
# endif
|
||||
|
||||
/* Regardless of the error handling below the cached data (if any) can be
|
||||
@ -3042,13 +3064,13 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
end_ptr = dp + PNG_ROWBYTES(pixel_depth, row_width) - 1;
|
||||
end_byte = *end_ptr;
|
||||
# ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||
/* little-endian byte */
|
||||
end_mask = 0xff << end_mask;
|
||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||
/* little-endian byte */
|
||||
end_mask = 0xff << end_mask;
|
||||
|
||||
else /* big-endian byte */
|
||||
else /* big-endian byte */
|
||||
# endif
|
||||
end_mask = 0xff >> end_mask;
|
||||
end_mask = 0xff >> end_mask;
|
||||
/* end_mask is now the bits to *keep* from the destination row */
|
||||
}
|
||||
|
||||
@ -3206,12 +3228,12 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
png_uint_32 mask;
|
||||
|
||||
# ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||
mask = MASK(pass, pixel_depth, display, 0);
|
||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||
mask = MASK(pass, pixel_depth, display, 0);
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
mask = MASK(pass, pixel_depth, display, 1);
|
||||
mask = MASK(pass, pixel_depth, display, 1);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -3812,15 +3834,15 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
|
||||
p = b - c;
|
||||
pc = a - c;
|
||||
|
||||
# ifdef PNG_USE_ABS
|
||||
pa = abs(p);
|
||||
pb = abs(pc);
|
||||
pc = abs(p + pc);
|
||||
# else
|
||||
pa = p < 0 ? -p : p;
|
||||
pb = pc < 0 ? -pc : pc;
|
||||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
# endif
|
||||
#ifdef PNG_USE_ABS
|
||||
pa = abs(p);
|
||||
pb = abs(pc);
|
||||
pc = abs(p + pc);
|
||||
#else
|
||||
pa = p < 0 ? -p : p;
|
||||
pb = pc < 0 ? -pc : pc;
|
||||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
#endif
|
||||
|
||||
/* Find the best predictor, the least of pa, pb, pc favoring the earlier
|
||||
* ones in the case of a tie.
|
||||
@ -3867,15 +3889,15 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
p = b - c;
|
||||
pc = a - c;
|
||||
|
||||
# ifdef PNG_USE_ABS
|
||||
pa = abs(p);
|
||||
pb = abs(pc);
|
||||
pc = abs(p + pc);
|
||||
# else
|
||||
pa = p < 0 ? -p : p;
|
||||
pb = pc < 0 ? -pc : pc;
|
||||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
# endif
|
||||
#ifdef PNG_USE_ABS
|
||||
pa = abs(p);
|
||||
pb = abs(pc);
|
||||
pc = abs(p + pc);
|
||||
#else
|
||||
pa = p < 0 ? -p : p;
|
||||
pb = pc < 0 ? -pc : pc;
|
||||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
#endif
|
||||
|
||||
if (pb < pa) pa = pb, a = b;
|
||||
if (pc < pa) a = c;
|
||||
@ -4280,18 +4302,18 @@ png_read_start_row(png_structrp png_ptr)
|
||||
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
|
||||
{
|
||||
# ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
/* In fact it is an error if it isn't supported, but checking is
|
||||
* the safe way.
|
||||
*/
|
||||
if ((png_ptr->transformations & PNG_EXPAND) != 0)
|
||||
{
|
||||
if (png_ptr->bit_depth < 16)
|
||||
max_pixel_depth *= 2;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
png_ptr->transformations &= ~PNG_EXPAND_16;
|
||||
# ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
/* In fact it is an error if it isn't supported, but checking is
|
||||
* the safe way.
|
||||
*/
|
||||
if ((png_ptr->transformations & PNG_EXPAND) != 0)
|
||||
{
|
||||
if (png_ptr->bit_depth < 16)
|
||||
max_pixel_depth *= 2;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
png_ptr->transformations &= ~PNG_EXPAND_16;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
33
hecl/extern/libpng/pngset.c
vendored
33
hecl/extern/libpng/pngset.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -123,12 +123,12 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
||||
png_fixed(png_ptr, red_X, "cHRM Red X"),
|
||||
png_fixed(png_ptr, red_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, red_Z, "cHRM Red Z"),
|
||||
png_fixed(png_ptr, green_X, "cHRM Red X"),
|
||||
png_fixed(png_ptr, green_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, green_Z, "cHRM Red Z"),
|
||||
png_fixed(png_ptr, blue_X, "cHRM Red X"),
|
||||
png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
|
||||
png_fixed(png_ptr, green_X, "cHRM Green X"),
|
||||
png_fixed(png_ptr, green_Y, "cHRM Green Y"),
|
||||
png_fixed(png_ptr, green_Z, "cHRM Green Z"),
|
||||
png_fixed(png_ptr, blue_X, "cHRM Blue X"),
|
||||
png_fixed(png_ptr, blue_Y, "cHRM Blue Y"),
|
||||
png_fixed(png_ptr, blue_Z, "cHRM Blue Z"));
|
||||
}
|
||||
# endif /* FLOATING_POINT */
|
||||
|
||||
@ -513,12 +513,17 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_const_colorp palette, int num_palette)
|
||||
{
|
||||
|
||||
png_uint_32 max_palette_length;
|
||||
|
||||
png_debug1(1, "in %s storage function", "PLTE");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
|
||||
max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
||||
(1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
||||
|
||||
if (num_palette < 0 || num_palette > (int) max_palette_length)
|
||||
{
|
||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_error(png_ptr, "Invalid palette length");
|
||||
@ -551,8 +556,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||
|
||||
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
|
||||
* of num_palette entries, in case of an invalid PNG file that has
|
||||
* too-large sample values.
|
||||
* of num_palette entries, in case of an invalid PNG file or incorrect
|
||||
* call to png_set_PLTE() with too-large sample values.
|
||||
*/
|
||||
png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
|
||||
@ -673,7 +678,6 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
if (new_iccp_profile == NULL)
|
||||
{
|
||||
png_free(png_ptr, new_iccp_name);
|
||||
new_iccp_name = NULL;
|
||||
png_benign_error(png_ptr,
|
||||
"Insufficient memory to process iCCP profile");
|
||||
|
||||
@ -710,7 +714,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %lx storage function", png_ptr == NULL ? "unexpected" :
|
||||
png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
|
||||
(unsigned long)png_ptr->chunk_name);
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
|
||||
@ -1522,6 +1526,9 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
||||
}
|
||||
|
||||
#ifndef __COVERITY__
|
||||
/* Some compilers complain that this is always false. However, it
|
||||
* can be true when integer overflow happens.
|
||||
*/
|
||||
if (size > ZLIB_IO_MAX)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
@ -1566,7 +1573,7 @@ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
|
||||
{
|
||||
/* Images with dimensions larger than these limits will be
|
||||
* rejected by png_set_IHDR(). To accept any PNG datastream
|
||||
* regardless of dimensions, set both limits to 0x7ffffffL.
|
||||
* regardless of dimensions, set both limits to 0x7ffffff.
|
||||
*/
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
32
hecl/extern/libpng/pngstruct.h
vendored
32
hecl/extern/libpng/pngstruct.h
vendored
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
*
|
||||
@ -219,16 +219,18 @@ struct png_struct_def
|
||||
png_uint_32 row_number; /* current row in interlace pass */
|
||||
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
|
||||
png_bytep prev_row; /* buffer to save previous (unfiltered) row.
|
||||
* This is a pointer into big_prev_row
|
||||
* While reading this is a pointer into
|
||||
* big_prev_row; while writing it is separately
|
||||
* allocated if needed.
|
||||
*/
|
||||
png_bytep row_buf; /* buffer to save current (unfiltered) row.
|
||||
* This is a pointer into big_row_buf
|
||||
* While reading, this is a pointer into
|
||||
* big_row_buf; while writing it is separately
|
||||
* allocated.
|
||||
*/
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_bytep sub_row; /* buffer to save "sub" row when filtering */
|
||||
png_bytep up_row; /* buffer to save "up" row when filtering */
|
||||
png_bytep avg_row; /* buffer to save "avg" row when filtering */
|
||||
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
png_bytep try_row; /* buffer to save trial row when filtering */
|
||||
png_bytep tst_row; /* buffer to save best trial row when filtering */
|
||||
#endif
|
||||
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||
|
||||
@ -346,17 +348,7 @@ struct png_struct_def
|
||||
png_bytep quantize_index; /* index translation for palette files */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
png_byte heuristic_method; /* heuristic for row filter selection */
|
||||
png_byte num_prev_filters; /* number of weights for previous rows */
|
||||
png_bytep prev_filters; /* filter type(s) of previous row(s) */
|
||||
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
|
||||
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
|
||||
png_uint_16p filter_costs; /* relative filter calculation cost */
|
||||
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
||||
#endif
|
||||
|
||||
/* Options */
|
||||
/* Options */
|
||||
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||
png_byte options; /* On/off state (up to 4 options) */
|
||||
#endif
|
||||
|
57
hecl/extern/libpng/pngtest.c
vendored
57
hecl/extern/libpng/pngtest.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -60,6 +60,7 @@
|
||||
defined PNG_READ_pHYs_SUPPORTED &&\
|
||||
defined PNG_READ_sBIT_SUPPORTED &&\
|
||||
defined PNG_READ_sCAL_SUPPORTED &&\
|
||||
defined PNG_READ_sPLT_SUPPORTED &&\
|
||||
defined PNG_READ_sRGB_SUPPORTED &&\
|
||||
defined PNG_READ_tEXt_SUPPORTED &&\
|
||||
defined PNG_READ_tIME_SUPPORTED &&\
|
||||
@ -565,6 +566,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
}
|
||||
|
||||
/* Unlink the element from the list. */
|
||||
if (pinformation != NULL)
|
||||
{
|
||||
memory_infop *ppinfo = &pinformation;
|
||||
|
||||
@ -581,8 +583,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
/* We must free the list element too, but first kill
|
||||
the memory that is to be freed. */
|
||||
memset(ptr, 0x55, pinfo->size);
|
||||
if (pinfo != NULL)
|
||||
free(pinfo);
|
||||
free(pinfo);
|
||||
pinfo = NULL;
|
||||
break;
|
||||
}
|
||||
@ -1057,7 +1058,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#ifndef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* num_pass will not be set below, set it here if the image is
|
||||
* interlaced: what happens is that write interlacing is *not* turned
|
||||
* on an the partial interlaced rows are written directly.
|
||||
* on and the partial interlaced rows are written directly.
|
||||
*/
|
||||
switch (interlace_type)
|
||||
{
|
||||
@ -1076,6 +1077,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
#ifdef PNG_cHRM_SUPPORTED
|
||||
{
|
||||
@ -1090,6 +1092,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
{
|
||||
png_fixed_point gamma;
|
||||
@ -1123,6 +1126,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
#endif /* Floating point */
|
||||
#endif /* Fixed point */
|
||||
|
||||
#ifdef PNG_iCCP_SUPPORTED
|
||||
{
|
||||
png_charp name;
|
||||
@ -1138,6 +1142,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sRGB_SUPPORTED
|
||||
{
|
||||
int intent;
|
||||
@ -1146,6 +1151,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_set_sRGB(write_ptr, write_info_ptr, intent);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
png_colorp palette;
|
||||
int num_palette;
|
||||
@ -1153,6 +1159,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette) != 0)
|
||||
png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
|
||||
}
|
||||
|
||||
#ifdef PNG_bKGD_SUPPORTED
|
||||
{
|
||||
png_color_16p background;
|
||||
@ -1163,6 +1170,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
{
|
||||
png_uint_16p hist;
|
||||
@ -1171,6 +1179,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_set_hIST(write_ptr, write_info_ptr, hist);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
{
|
||||
png_int_32 offset_x, offset_y;
|
||||
@ -1183,6 +1192,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_pCAL_SUPPORTED
|
||||
{
|
||||
png_charp purpose, units;
|
||||
@ -1198,6 +1208,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_pHYs_SUPPORTED
|
||||
{
|
||||
png_uint_32 res_x, res_y;
|
||||
@ -1208,6 +1219,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sBIT_SUPPORTED
|
||||
{
|
||||
png_color_8p sig_bit;
|
||||
@ -1216,6 +1228,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sCAL_SUPPORTED
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
|
||||
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
||||
@ -1242,9 +1255,22 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
scal_height);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* FIXED_POINT */
|
||||
#endif /* FLOATING_POINT */
|
||||
#endif /* sCAL */
|
||||
|
||||
#ifdef PNG_sPLT_SUPPORTED
|
||||
{
|
||||
png_sPLT_tp entries;
|
||||
|
||||
int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries);
|
||||
if (num_entries)
|
||||
{
|
||||
png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries);
|
||||
}
|
||||
}
|
||||
#endif /* sPLT */
|
||||
|
||||
#ifdef PNG_TEXT_SUPPORTED
|
||||
{
|
||||
png_textp text_ptr;
|
||||
@ -1271,7 +1297,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* TEXT */
|
||||
|
||||
#ifdef PNG_tIME_SUPPORTED
|
||||
{
|
||||
png_timep mod_time;
|
||||
@ -1293,7 +1320,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif /* TIME_RFC1123 */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* tIME */
|
||||
|
||||
#ifdef PNG_tRNS_SUPPORTED
|
||||
{
|
||||
png_bytep trans_alpha;
|
||||
@ -1315,7 +1343,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
trans_color);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* tRNS */
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
{
|
||||
png_unknown_chunkp unknowns;
|
||||
@ -1833,10 +1862,10 @@ main(int argc, char *argv[])
|
||||
k, (unsigned long)filters_used[k]);
|
||||
#endif
|
||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||
if (tIME_chunk_present != 0)
|
||||
fprintf(STDERR, " tIME = %s\n", tIME_string);
|
||||
if (tIME_chunk_present != 0)
|
||||
fprintf(STDERR, " tIME = %s\n", tIME_string);
|
||||
|
||||
tIME_chunk_present = 0;
|
||||
tIME_chunk_present = 0;
|
||||
#endif /* TIME_RFC1123 */
|
||||
}
|
||||
|
||||
@ -2028,4 +2057,4 @@ main(void)
|
||||
#endif
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_17 Your_png_h_is_not_version_1_6_17;
|
||||
typedef png_libpng_version_1_6_19 Your_png_h_is_not_version_1_6_19;
|
||||
|
8
hecl/extern/libpng/pngtrans.c
vendored
8
hecl/extern/libpng/pngtrans.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -30,7 +30,7 @@ png_set_bgr(png_structrp png_ptr)
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* Turn on 16 bit byte swapping */
|
||||
/* Turn on 16-bit byte swapping */
|
||||
void PNGAPI
|
||||
png_set_swap(png_structrp png_ptr)
|
||||
{
|
||||
@ -313,7 +313,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* Swaps byte order on 16 bit depth images */
|
||||
/* Swaps byte order on 16-bit depth images */
|
||||
void /* PRIVATE */
|
||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
@ -704,7 +704,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||
*/
|
||||
for (; rp > png_ptr->row_buf; rp--)
|
||||
{
|
||||
if (*rp >> padding != 0)
|
||||
if ((*rp >> padding) != 0)
|
||||
png_ptr->num_palette_max = 1;
|
||||
padding = 0;
|
||||
}
|
||||
|
2
hecl/extern/libpng/pngwio.c
vendored
2
hecl/extern/libpng/pngwio.c
vendored
@ -26,7 +26,7 @@
|
||||
* writes to a file pointer. Note that this routine sometimes gets called
|
||||
* with very small lengths, so you should implement some kind of simple
|
||||
* buffering if you are using unbuffered writes. This should never be asked
|
||||
* to write more than 64K on a 16 bit machine.
|
||||
* to write more than 64K on a 16-bit machine.
|
||||
*/
|
||||
|
||||
void /* PRIVATE */
|
||||
|
615
hecl/extern/libpng/pngwrite.c
vendored
615
hecl/extern/libpng/pngwrite.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -90,43 +90,44 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
|
||||
|
||||
if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
|
||||
{
|
||||
/* Write PNG signature */
|
||||
png_write_sig(png_ptr);
|
||||
/* Write PNG signature */
|
||||
png_write_sig(png_ptr);
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
|
||||
png_ptr->mng_features_permitted != 0)
|
||||
{
|
||||
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
|
||||
png_ptr->mng_features_permitted = 0;
|
||||
}
|
||||
if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
|
||||
png_ptr->mng_features_permitted != 0)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"MNG features are not allowed in a PNG datastream");
|
||||
png_ptr->mng_features_permitted = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Write IHDR information. */
|
||||
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
|
||||
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
|
||||
info_ptr->filter_type,
|
||||
/* Write IHDR information. */
|
||||
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
|
||||
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
|
||||
info_ptr->filter_type,
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
info_ptr->interlace_type
|
||||
info_ptr->interlace_type
|
||||
#else
|
||||
0
|
||||
0
|
||||
#endif
|
||||
);
|
||||
);
|
||||
|
||||
/* The rest of these check to see if the valid field has the appropriate
|
||||
* flag set, and if it does, writes the chunk.
|
||||
*
|
||||
* 1.6.0: COLORSPACE support controls the writing of these chunks too, and
|
||||
* the chunks will be written if the WRITE routine is there and information
|
||||
* is available in the COLORSPACE. (See png_colorspace_sync_info in png.c
|
||||
* for where the valid flags get set.)
|
||||
*
|
||||
* Under certain circumstances the colorspace can be invalidated without
|
||||
* syncing the info_struct 'valid' flags; this happens if libpng detects and
|
||||
* error and calls png_error while the color space is being set, yet the
|
||||
* application continues writing the PNG. So check the 'invalid' flag here
|
||||
* too.
|
||||
*/
|
||||
/* The rest of these check to see if the valid field has the appropriate
|
||||
* flag set, and if it does, writes the chunk.
|
||||
*
|
||||
* 1.6.0: COLORSPACE support controls the writing of these chunks too, and
|
||||
* the chunks will be written if the WRITE routine is there and
|
||||
* information * is available in the COLORSPACE. (See
|
||||
* png_colorspace_sync_info in png.c for where the valid flags get set.)
|
||||
*
|
||||
* Under certain circumstances the colorspace can be invalidated without
|
||||
* syncing the info_struct 'valid' flags; this happens if libpng detects
|
||||
* an error and calls png_error while the color space is being set, yet
|
||||
* the application continues writing the PNG. So check the 'invalid'
|
||||
* flag here too.
|
||||
*/
|
||||
#ifdef PNG_GAMMA_SUPPORTED
|
||||
# ifdef PNG_WRITE_gAMA_SUPPORTED
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
@ -137,50 +138,50 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||
/* Write only one of sRGB or an ICC profile. If a profile was supplied
|
||||
* and it matches one of the known sRGB ones issue a warning.
|
||||
*/
|
||||
/* Write only one of sRGB or an ICC profile. If a profile was supplied
|
||||
* and it matches one of the known sRGB ones issue a warning.
|
||||
*/
|
||||
# ifdef PNG_WRITE_iCCP_SUPPORTED
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->valid & PNG_INFO_iCCP) != 0)
|
||||
{
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
|
||||
png_app_warning(png_ptr,
|
||||
"profile matches sRGB but writing iCCP instead");
|
||||
# endif
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->valid & PNG_INFO_iCCP) != 0)
|
||||
{
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
|
||||
png_app_warning(png_ptr,
|
||||
"profile matches sRGB but writing iCCP instead");
|
||||
# endif
|
||||
|
||||
png_write_iCCP(png_ptr, info_ptr->iccp_name,
|
||||
info_ptr->iccp_profile);
|
||||
}
|
||||
png_write_iCCP(png_ptr, info_ptr->iccp_name,
|
||||
info_ptr->iccp_profile);
|
||||
}
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
else
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef PNG_WRITE_sRGB_SUPPORTED
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->valid & PNG_INFO_sRGB) != 0)
|
||||
png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->valid & PNG_INFO_sRGB) != 0)
|
||||
png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
|
||||
# endif /* WRITE_sRGB */
|
||||
#endif /* COLORSPACE */
|
||||
|
||||
#ifdef PNG_WRITE_sBIT_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
|
||||
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
|
||||
if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
|
||||
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_cHRM_SUPPORTED
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
|
||||
(info_ptr->valid & PNG_INFO_cHRM) != 0)
|
||||
png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
|
||||
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
|
||||
(info_ptr->valid & PNG_INFO_cHRM) != 0)
|
||||
png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
|
||||
write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
|
||||
#endif
|
||||
|
||||
png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
|
||||
@ -205,7 +206,7 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
|
||||
png_write_PLTE(png_ptr, info_ptr->palette,
|
||||
(png_uint_32)info_ptr->num_palette);
|
||||
|
||||
else if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) !=0)
|
||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_error(png_ptr, "Valid palette required for paletted images");
|
||||
|
||||
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
@ -216,8 +217,13 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
|
||||
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0 &&
|
||||
info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j<(int)info_ptr->num_trans; j++)
|
||||
int j, jend;
|
||||
|
||||
jend = info_ptr->num_trans;
|
||||
if (jend > PNG_MAX_PALETTE_LENGTH)
|
||||
jend = PNG_MAX_PALETTE_LENGTH;
|
||||
|
||||
for (j = 0; j<jend; ++j)
|
||||
info_ptr->trans_alpha[j] =
|
||||
(png_byte)(255 - info_ptr->trans_alpha[j]);
|
||||
}
|
||||
@ -538,7 +544,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
/* App warnings are warnings in release (or release candidate) builds but
|
||||
* are errors during development.
|
||||
*/
|
||||
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
#if PNG_RELEASE_BUILD
|
||||
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
|
||||
#endif
|
||||
|
||||
@ -849,7 +855,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
|
||||
* which is also the output depth.
|
||||
*/
|
||||
if (row_info.pixel_depth != png_ptr->pixel_depth ||
|
||||
row_info.pixel_depth != png_ptr->transformed_pixel_depth)
|
||||
row_info.pixel_depth != png_ptr->transformed_pixel_depth)
|
||||
png_error(png_ptr, "internal write transform logic error");
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
@ -917,10 +923,6 @@ png_write_flush(png_structrp png_ptr)
|
||||
}
|
||||
#endif /* WRITE_FLUSH */
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
static void png_reset_filter_heuristics(png_structrp png_ptr);/* forward decl */
|
||||
#endif
|
||||
|
||||
/* Free any memory used in png_ptr struct without freeing the struct itself. */
|
||||
static void
|
||||
png_write_destroy(png_structrp png_ptr)
|
||||
@ -937,24 +939,11 @@ png_write_destroy(png_structrp png_ptr)
|
||||
png_ptr->row_buf = NULL;
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
png_free(png_ptr, png_ptr->prev_row);
|
||||
png_free(png_ptr, png_ptr->sub_row);
|
||||
png_free(png_ptr, png_ptr->up_row);
|
||||
png_free(png_ptr, png_ptr->avg_row);
|
||||
png_free(png_ptr, png_ptr->paeth_row);
|
||||
png_free(png_ptr, png_ptr->try_row);
|
||||
png_free(png_ptr, png_ptr->tst_row);
|
||||
png_ptr->prev_row = NULL;
|
||||
png_ptr->sub_row = NULL;
|
||||
png_ptr->up_row = NULL;
|
||||
png_ptr->avg_row = NULL;
|
||||
png_ptr->paeth_row = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
/* Use this to save a little code space, it doesn't free the filter_costs */
|
||||
png_reset_filter_heuristics(png_ptr);
|
||||
png_free(png_ptr, png_ptr->filter_costs);
|
||||
png_free(png_ptr, png_ptr->inv_filter_costs);
|
||||
png_ptr->filter_costs = NULL;
|
||||
png_ptr->inv_filter_costs = NULL;
|
||||
png_ptr->try_row = NULL;
|
||||
png_ptr->tst_row = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
@ -1044,6 +1033,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
#endif /* WRITE_FILTER */
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
/* If we have allocated the row_buf, this means we have already started
|
||||
* with the image and we should have allocated all of the filter buffers
|
||||
* that have been selected. If prev_row isn't already allocated, then
|
||||
@ -1052,203 +1042,76 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
* wants to start and stop using particular filters during compression,
|
||||
* it should start out with all of the filters, and then remove them
|
||||
* or add them back after the start of compression.
|
||||
*
|
||||
* NOTE: this is a nasty constraint on the code, because it means that the
|
||||
* prev_row buffer must be maintained even if there are currently no
|
||||
* 'prev_row' requiring filters active.
|
||||
*/
|
||||
if (png_ptr->row_buf != NULL)
|
||||
{
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
if ((png_ptr->do_filter & PNG_FILTER_SUB) != 0 &&
|
||||
png_ptr->sub_row == NULL)
|
||||
int num_filters;
|
||||
png_alloc_size_t buf_size;
|
||||
|
||||
/* Repeat the checks in png_write_start_row; 1 pixel high or wide
|
||||
* images cannot benefit from certain filters. If this isn't done here
|
||||
* the check below will fire on 1 pixel high images.
|
||||
*/
|
||||
if (png_ptr->height == 1)
|
||||
filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
|
||||
|
||||
if (png_ptr->width == 1)
|
||||
filters &= ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH);
|
||||
|
||||
if ((filters & (PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH)) != 0
|
||||
&& png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
/* This is the error case, however it is benign - the previous row
|
||||
* is not available so the filter can't be used. Just warn here.
|
||||
*/
|
||||
png_app_warning(png_ptr,
|
||||
"png_set_filter: UP/AVG/PAETH cannot be added after start");
|
||||
filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
|
||||
}
|
||||
|
||||
if ((png_ptr->do_filter & PNG_FILTER_UP) != 0 &&
|
||||
png_ptr->up_row == NULL)
|
||||
num_filters = 0;
|
||||
|
||||
if (filters & PNG_FILTER_SUB)
|
||||
num_filters++;
|
||||
|
||||
if (filters & PNG_FILTER_UP)
|
||||
num_filters++;
|
||||
|
||||
if (filters & PNG_FILTER_AVG)
|
||||
num_filters++;
|
||||
|
||||
if (filters & PNG_FILTER_PAETH)
|
||||
num_filters++;
|
||||
|
||||
/* Allocate needed row buffers if they have not already been
|
||||
* allocated.
|
||||
*/
|
||||
buf_size = PNG_ROWBYTES(png_ptr->usr_channels * png_ptr->usr_bit_depth,
|
||||
png_ptr->width) + 1;
|
||||
|
||||
if (png_ptr->try_row == NULL)
|
||||
png_ptr->try_row = png_voidcast(png_bytep,
|
||||
png_malloc(png_ptr, buf_size));
|
||||
|
||||
if (num_filters > 1)
|
||||
{
|
||||
if (png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Can't add Up filter after starting");
|
||||
png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
|
||||
~PNG_FILTER_UP);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
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->tst_row == NULL)
|
||||
png_ptr->tst_row = png_voidcast(png_bytep,
|
||||
png_malloc(png_ptr, buf_size));
|
||||
}
|
||||
|
||||
if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0 &&
|
||||
png_ptr->avg_row == NULL)
|
||||
{
|
||||
if (png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Can't add Average filter after starting");
|
||||
png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
|
||||
~PNG_FILTER_AVG);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
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) != 0 &&
|
||||
png_ptr->paeth_row == NULL)
|
||||
{
|
||||
if (png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Can't add Paeth filter after starting");
|
||||
png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_ptr->rowbytes + 1));
|
||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
}
|
||||
}
|
||||
|
||||
if (png_ptr->do_filter == PNG_NO_FILTERS)
|
||||
#endif /* WRITE_FILTER */
|
||||
png_ptr->do_filter = PNG_FILTER_NONE;
|
||||
}
|
||||
png_ptr->do_filter = (png_byte)filters;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
png_error(png_ptr, "Unknown custom filter method");
|
||||
}
|
||||
|
||||
/* This allows us to influence the way in which libpng chooses the "best"
|
||||
* filter for the current scanline. While the "minimum-sum-of-absolute-
|
||||
* differences metric is relatively fast and effective, there is some
|
||||
* question as to whether it can be improved upon by trying to keep the
|
||||
* filtered data going to zlib more consistent, hopefully resulting in
|
||||
* better compression.
|
||||
*/
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
|
||||
/* Convenience reset API. */
|
||||
static void
|
||||
png_reset_filter_heuristics(png_structrp png_ptr)
|
||||
{
|
||||
/* Clear out any old values in the 'weights' - this must be done because if
|
||||
* the app calls set_filter_heuristics multiple times with different
|
||||
* 'num_weights' values we would otherwise potentially have wrong sized
|
||||
* arrays.
|
||||
*/
|
||||
png_ptr->num_prev_filters = 0;
|
||||
png_ptr->heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED;
|
||||
if (png_ptr->prev_filters != NULL)
|
||||
{
|
||||
png_bytep old = png_ptr->prev_filters;
|
||||
png_ptr->prev_filters = NULL;
|
||||
png_free(png_ptr, old);
|
||||
}
|
||||
if (png_ptr->filter_weights != NULL)
|
||||
{
|
||||
png_uint_16p old = png_ptr->filter_weights;
|
||||
png_ptr->filter_weights = NULL;
|
||||
png_free(png_ptr, old);
|
||||
}
|
||||
|
||||
if (png_ptr->inv_filter_weights != NULL)
|
||||
{
|
||||
png_uint_16p old = png_ptr->inv_filter_weights;
|
||||
png_ptr->inv_filter_weights = NULL;
|
||||
png_free(png_ptr, old);
|
||||
}
|
||||
|
||||
/* Leave the filter_costs - this array is fixed size. */
|
||||
}
|
||||
|
||||
static int
|
||||
png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
|
||||
int num_weights)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return 0;
|
||||
|
||||
/* Clear out the arrays */
|
||||
png_reset_filter_heuristics(png_ptr);
|
||||
|
||||
/* Check arguments; the 'reset' function makes the correct settings for the
|
||||
* unweighted case, but we must handle the weight case by initializing the
|
||||
* arrays for the caller.
|
||||
*/
|
||||
if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (num_weights > 0)
|
||||
{
|
||||
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((sizeof (png_byte)) * num_weights));
|
||||
|
||||
/* To make sure that the weighting starts out fairly */
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->prev_filters[i] = 255;
|
||||
}
|
||||
|
||||
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)((sizeof (png_uint_16)) * num_weights));
|
||||
|
||||
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)((sizeof (png_uint_16)) * num_weights));
|
||||
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
|
||||
/* Safe to set this now */
|
||||
png_ptr->num_prev_filters = (png_byte)num_weights;
|
||||
}
|
||||
|
||||
/* If, in the future, there are other filter methods, this would
|
||||
* need to be based on png_ptr->filter.
|
||||
*/
|
||||
if (png_ptr->filter_costs == NULL)
|
||||
{
|
||||
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
|
||||
|
||||
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
|
||||
}
|
||||
|
||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
||||
{
|
||||
png_ptr->inv_filter_costs[i] =
|
||||
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
|
||||
}
|
||||
|
||||
/* All the arrays are inited, safe to set this: */
|
||||
png_ptr->heuristic_method = PNG_FILTER_HEURISTIC_WEIGHTED;
|
||||
|
||||
/* Return the 'ok' code. */
|
||||
return 1;
|
||||
}
|
||||
else if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT ||
|
||||
heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_warning(png_ptr, "Unknown filter heuristic method");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
|
||||
/* Provide floating and fixed point APIs */
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
@ -1256,52 +1119,11 @@ png_set_filter_heuristics(png_structrp png_ptr, int heuristic_method,
|
||||
int num_weights, png_const_doublep filter_weights,
|
||||
png_const_doublep filter_costs)
|
||||
{
|
||||
png_debug(1, "in png_set_filter_heuristics");
|
||||
|
||||
/* The internal API allocates all the arrays and ensures that the elements of
|
||||
* those arrays are set to the default value.
|
||||
*/
|
||||
if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
|
||||
return;
|
||||
|
||||
/* If using the weighted method copy in the weights. */
|
||||
if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
if (filter_weights[i] <= 0.0)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
(png_uint_16)(PNG_WEIGHT_FACTOR*filter_weights[i]+.5);
|
||||
|
||||
png_ptr->filter_weights[i] =
|
||||
(png_uint_16)(PNG_WEIGHT_FACTOR/filter_weights[i]+.5);
|
||||
}
|
||||
}
|
||||
|
||||
/* Here is where we set the relative costs of the different filters. We
|
||||
* should take the desired compression level into account when setting
|
||||
* the costs, so that Paeth, for instance, has a high relative cost at low
|
||||
* compression levels, while it has a lower relative cost at higher
|
||||
* compression settings. The filter types are in order of increasing
|
||||
* relative cost, so it would be possible to do this with an algorithm.
|
||||
*/
|
||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) if (filter_costs[i] >= 1.0)
|
||||
{
|
||||
png_ptr->inv_filter_costs[i] =
|
||||
(png_uint_16)(PNG_COST_FACTOR / filter_costs[i] + .5);
|
||||
|
||||
png_ptr->filter_costs[i] =
|
||||
(png_uint_16)(PNG_COST_FACTOR * filter_costs[i] + .5);
|
||||
}
|
||||
}
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(heuristic_method)
|
||||
PNG_UNUSED(num_weights)
|
||||
PNG_UNUSED(filter_weights)
|
||||
PNG_UNUSED(filter_costs)
|
||||
}
|
||||
#endif /* FLOATING_POINT */
|
||||
|
||||
@ -1311,63 +1133,11 @@ png_set_filter_heuristics_fixed(png_structrp png_ptr, int heuristic_method,
|
||||
int num_weights, png_const_fixed_point_p filter_weights,
|
||||
png_const_fixed_point_p filter_costs)
|
||||
{
|
||||
png_debug(1, "in png_set_filter_heuristics_fixed");
|
||||
|
||||
/* The internal API allocates all the arrays and ensures that the elements of
|
||||
* those arrays are set to the default value.
|
||||
*/
|
||||
if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
|
||||
return;
|
||||
|
||||
/* If using the weighted method copy in the weights. */
|
||||
if (heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
if (filter_weights[i] <= 0)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] = (png_uint_16)
|
||||
((PNG_WEIGHT_FACTOR*filter_weights[i]+PNG_FP_HALF)/PNG_FP_1);
|
||||
|
||||
png_ptr->filter_weights[i] = (png_uint_16)((PNG_WEIGHT_FACTOR*
|
||||
PNG_FP_1+(filter_weights[i]/2))/filter_weights[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Here is where we set the relative costs of the different filters. We
|
||||
* should take the desired compression level into account when setting
|
||||
* the costs, so that Paeth, for instance, has a high relative cost at low
|
||||
* compression levels, while it has a lower relative cost at higher
|
||||
* compression settings. The filter types are in order of increasing
|
||||
* relative cost, so it would be possible to do this with an algorithm.
|
||||
*/
|
||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
||||
if (filter_costs[i] >= PNG_FP_1)
|
||||
{
|
||||
png_uint_32 tmp;
|
||||
|
||||
/* Use a 32 bit unsigned temporary here because otherwise the
|
||||
* intermediate value will be a 32 bit *signed* integer (ANSI rules)
|
||||
* and this will get the wrong answer on division.
|
||||
*/
|
||||
tmp = PNG_COST_FACTOR*PNG_FP_1 + (filter_costs[i]/2);
|
||||
tmp /= filter_costs[i];
|
||||
|
||||
png_ptr->inv_filter_costs[i] = (png_uint_16)tmp;
|
||||
|
||||
tmp = PNG_COST_FACTOR * filter_costs[i] + PNG_FP_HALF;
|
||||
tmp /= PNG_FP_1;
|
||||
|
||||
png_ptr->filter_costs[i] = (png_uint_16)tmp;
|
||||
}
|
||||
}
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(heuristic_method)
|
||||
PNG_UNUSED(num_weights)
|
||||
PNG_UNUSED(filter_weights)
|
||||
PNG_UNUSED(filter_costs)
|
||||
}
|
||||
#endif /* FIXED_POINT */
|
||||
#endif /* WRITE_WEIGHTED_FILTER */
|
||||
@ -1616,14 +1386,14 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
* alpha channel.
|
||||
*/
|
||||
if ((transforms & (PNG_TRANSFORM_STRIP_FILLER_AFTER|
|
||||
PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
|
||||
PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
|
||||
{
|
||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||
if ((transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) != 0)
|
||||
{
|
||||
if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
|
||||
png_app_error(png_ptr,
|
||||
"PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
|
||||
"PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
|
||||
|
||||
/* Continue if ignored - this is the pre-1.6.10 behavior */
|
||||
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
|
||||
@ -1652,7 +1422,7 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
|
||||
#endif
|
||||
|
||||
/* Swap bits of 1, 2, 4 bit packed pixel formats */
|
||||
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
|
||||
if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
|
||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
png_set_packswap(png_ptr);
|
||||
@ -1682,13 +1452,13 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
|
||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||
#ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
|
||||
# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
|
||||
/* Initialize the write structure - general purpose utility. */
|
||||
static int
|
||||
png_image_write_init(png_imagep image)
|
||||
{
|
||||
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, image,
|
||||
png_safe_error, png_safe_warning);
|
||||
png_safe_error, png_safe_warning);
|
||||
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
@ -1697,7 +1467,7 @@ png_image_write_init(png_imagep image)
|
||||
if (info_ptr != NULL)
|
||||
{
|
||||
png_controlp control = png_voidcast(png_controlp,
|
||||
png_malloc_warn(png_ptr, (sizeof *control)));
|
||||
png_malloc_warn(png_ptr, (sizeof *control)));
|
||||
|
||||
if (control != NULL)
|
||||
{
|
||||
@ -1744,12 +1514,12 @@ static int
|
||||
png_write_image_16bit(png_voidp argument)
|
||||
{
|
||||
png_image_write_control *display = png_voidcast(png_image_write_control*,
|
||||
argument);
|
||||
argument);
|
||||
png_imagep image = display->image;
|
||||
png_structrp png_ptr = image->opaque->png_ptr;
|
||||
|
||||
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
|
||||
display->first_row);
|
||||
display->first_row);
|
||||
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
|
||||
png_uint_16p row_end;
|
||||
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
|
||||
@ -1758,17 +1528,18 @@ png_write_image_16bit(png_voidp argument)
|
||||
|
||||
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
|
||||
{
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
aindex = channels;
|
||||
# else
|
||||
aindex = channels;
|
||||
# endif
|
||||
}
|
||||
|
||||
else
|
||||
@ -1850,7 +1621,7 @@ png_write_image_16bit(png_voidp argument)
|
||||
* calculation can be done to 15 bits of accuracy; however, the output needs to
|
||||
* be scaled in the range 0..255*65535, so include that scaling here.
|
||||
*/
|
||||
#define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
|
||||
# define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
|
||||
|
||||
static png_byte
|
||||
png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
|
||||
@ -1901,12 +1672,12 @@ static int
|
||||
png_write_image_8bit(png_voidp argument)
|
||||
{
|
||||
png_image_write_control *display = png_voidcast(png_image_write_control*,
|
||||
argument);
|
||||
argument);
|
||||
png_imagep image = display->image;
|
||||
png_structrp png_ptr = image->opaque->png_ptr;
|
||||
|
||||
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
|
||||
display->first_row);
|
||||
display->first_row);
|
||||
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
|
||||
png_uint_32 y = image->height;
|
||||
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
|
||||
@ -1916,17 +1687,17 @@ png_write_image_8bit(png_voidp argument)
|
||||
png_bytep row_end;
|
||||
int aindex;
|
||||
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
|
||||
else
|
||||
# endif
|
||||
aindex = channels;
|
||||
else
|
||||
# endif
|
||||
aindex = channels;
|
||||
|
||||
/* Use row_end in place of a loop counter: */
|
||||
row_end = output_row + image->width * (channels+1);
|
||||
@ -1960,7 +1731,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
} /* while out_ptr < row_end */
|
||||
|
||||
png_write_row(png_ptr, png_voidcast(png_const_bytep,
|
||||
display->local_row));
|
||||
display->local_row));
|
||||
input_row += display->row_bytes/(sizeof (png_uint_16));
|
||||
} /* while y */
|
||||
}
|
||||
@ -1999,25 +1770,25 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
const png_imagep image = display->image;
|
||||
const void *cmap = display->colormap;
|
||||
const int entries = image->colormap_entries > 256 ? 256 :
|
||||
(int)image->colormap_entries;
|
||||
(int)image->colormap_entries;
|
||||
|
||||
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
|
||||
const png_uint_32 format = image->format;
|
||||
const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
|
||||
|
||||
# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
|
||||
# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
|
||||
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
|
||||
const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
|
||||
(format & PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||
# else
|
||||
(format & PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||
# else
|
||||
# define afirst 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
|
||||
# else
|
||||
# else
|
||||
# define bgr 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
int i, num_trans;
|
||||
png_color palette[256];
|
||||
@ -2042,11 +1813,11 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
if (channels >= 3) /* RGB */
|
||||
{
|
||||
palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[(2 ^ bgr)]);
|
||||
entry[(2 ^ bgr)]);
|
||||
palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[1]);
|
||||
entry[1]);
|
||||
palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[bgr]);
|
||||
entry[bgr]);
|
||||
}
|
||||
|
||||
else /* Gray */
|
||||
@ -2122,12 +1893,12 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef afirst
|
||||
# ifdef afirst
|
||||
# undef afirst
|
||||
# endif
|
||||
# ifdef bgr
|
||||
# endif
|
||||
# ifdef bgr
|
||||
# undef bgr
|
||||
# endif
|
||||
# endif
|
||||
|
||||
png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
|
||||
entries);
|
||||
@ -2155,10 +1926,10 @@ png_image_write_main(png_voidp argument)
|
||||
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
|
||||
int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
|
||||
|
||||
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
/* Make sure we error out on any bad situation */
|
||||
png_set_benign_errors(png_ptr, 0/*error*/);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Default the 'row_stride' parameter if required. */
|
||||
if (display->row_stride == 0)
|
||||
@ -2227,7 +1998,7 @@ png_image_write_main(png_voidp argument)
|
||||
/* Now set up the data transformations (*after* the header is written),
|
||||
* remove the handled transformations from the 'format' flags for checking.
|
||||
*
|
||||
* First check for a little endian system if writing 16 bit files.
|
||||
* First check for a little endian system if writing 16-bit files.
|
||||
*/
|
||||
if (write_16bit != 0)
|
||||
{
|
||||
@ -2237,23 +2008,23 @@ png_image_write_main(png_voidp argument)
|
||||
png_set_swap(png_ptr);
|
||||
}
|
||||
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
||||
if ((format & PNG_FORMAT_FLAG_BGR) != 0)
|
||||
{
|
||||
if (colormap == 0 && (format & PNG_FORMAT_FLAG_COLOR) != 0)
|
||||
png_set_bgr(png_ptr);
|
||||
format &= ~PNG_FORMAT_FLAG_BGR;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
{
|
||||
if (colormap == 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
|
||||
png_set_swap_alpha(png_ptr);
|
||||
format &= ~PNG_FORMAT_FLAG_AFIRST;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* If there are 16 or fewer color-map entries we wrote a lower bit depth
|
||||
* above, but the application data is still byte packed.
|
||||
@ -2289,9 +2060,9 @@ png_image_write_main(png_voidp argument)
|
||||
* it about 50 times. The speed-up in pngstest was about 10-20% of the
|
||||
* total (user) time on a heavily loaded system.
|
||||
*/
|
||||
#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
|
||||
# ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
|
||||
png_set_compression_level(png_ptr, 3);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
/* Check for the cases that currently require a pre-transform on the row
|
||||
@ -2454,6 +2225,6 @@ png_image_write_to_file(png_imagep image, const char *file_name,
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif /* STDIO */
|
||||
# endif /* STDIO */
|
||||
#endif /* SIMPLIFIED_WRITE */
|
||||
#endif /* WRITE */
|
||||
|
14
hecl/extern/libpng/pngwtran.c
vendored
14
hecl/extern/libpng/pngwtran.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@ -71,7 +71,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
case 2:
|
||||
{
|
||||
png_bytep sp, dp;
|
||||
int shift, v;
|
||||
unsigned int shift;
|
||||
int v;
|
||||
png_uint_32 i;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
|
||||
@ -110,7 +111,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
case 4:
|
||||
{
|
||||
png_bytep sp, dp;
|
||||
int shift, v;
|
||||
unsigned int shift;
|
||||
int v;
|
||||
png_uint_32 i;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
|
||||
@ -422,7 +424,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = *(sp++);
|
||||
*/
|
||||
sp+=3; dp = sp;
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*dp = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +448,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*/
|
||||
sp+=6; dp = sp;
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*dp = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* WRITE_16BIT */
|
||||
@ -484,7 +486,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*/
|
||||
sp+=2; dp = sp;
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*dp = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* WRITE_16BIT */
|
||||
|
878
hecl/extern/libpng/pngwutil.c
vendored
878
hecl/extern/libpng/pngwutil.c
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user