Merge branch 'libpng-1.6.28' of https://github.com/catalinr/wxWidgets
This brings in several bug fixes and optimizations (notably the use of SSE), see src/png/CHANGES for full details. Closes https://github.com/wxWidgets/wxWidgets/pull/384
This commit is contained in:
@@ -88,6 +88,7 @@ All (GUI):
|
|||||||
- Add support for wxAuiManager and wxAuiPaneInfo to XRC (Andrea Zanellato).
|
- Add support for wxAuiManager and wxAuiPaneInfo to XRC (Andrea Zanellato).
|
||||||
- Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius).
|
- Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius).
|
||||||
- Update Scintilla to v3.6.6 (Paul Kulchenko).
|
- Update Scintilla to v3.6.6 (Paul Kulchenko).
|
||||||
|
- Update bundled libpng to 1.6.28 (Catalin Raceanu).
|
||||||
- Fix vertical scrollbar visibility in wxStyledTextCtrl (yenwu, NewPagodi).
|
- Fix vertical scrollbar visibility in wxStyledTextCtrl (yenwu, NewPagodi).
|
||||||
- Fix bug with not being able to select AUI tab after dragging.
|
- Fix bug with not being able to select AUI tab after dragging.
|
||||||
- Make wxDataViewCtrl::Expand() expand ancestors in native ports too.
|
- Make wxDataViewCtrl::Expand() expand ancestors in native ports too.
|
||||||
|
@@ -125,3 +125,23 @@ versions there.
|
|||||||
Notice that config.h generated by libpng configure is not used, we build it
|
Notice that config.h generated by libpng configure is not used, we build it
|
||||||
without -DHAVE_CONFIG_H as it works just fine without it on any ANSI C system
|
without -DHAVE_CONFIG_H as it works just fine without it on any ANSI C system
|
||||||
(i.e. anywhere by now).
|
(i.e. anywhere by now).
|
||||||
|
|
||||||
|
|
||||||
|
Example updating libpng files under MSW:
|
||||||
|
Since configure looked for zlib, the following 2 steps were also needed:
|
||||||
|
a) get zlib source code (www.zlib.net) to a separate location;
|
||||||
|
b) in zlib root dir run: mingw32-make -fwin32/Makefile.gcc
|
||||||
|
(will generate zlib1.dll)
|
||||||
|
1) get libpng source code (libpng.sourceforge.net) to a separate location;
|
||||||
|
2) in libpng root dir run:
|
||||||
|
configure --with-libpng-prefix=wx_
|
||||||
|
Alternatively, if configure still cannot find zlib, run:
|
||||||
|
export CPPFLAGS="-I zlib-root-dir"
|
||||||
|
export LDFLAGS="-L zlib-root-dir"
|
||||||
|
configure --with-libpng-prefix=wx_
|
||||||
|
3) in libpng root dir run:
|
||||||
|
mingw32-make png.lo
|
||||||
|
(will generate pnglibconf.h and pngprefix.h, among others)
|
||||||
|
4) edit pnglibconf.h and change the value of PNG_ZLIB_VERNUM to 0.
|
||||||
|
5) copy files from libpng root dir and scripts subfolder to src/png, updating old files only (other new files were not needed);
|
||||||
|
6) commit the changes.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.21 - January 15, 2016
|
Libpng 1.6.28 - January 5, 2017
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@@ -7,49 +7,28 @@ Files available for download:
|
|||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.6.21.tar.xz (LZMA-compressed, recommended)
|
libpng-1.6.28.tar.xz (LZMA-compressed, recommended)
|
||||||
libpng-1.6.21.tar.gz
|
libpng-1.6.28.tar.gz
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
/scratch/glennrp/Libpng16/lpng1621.7z (LZMA-compressed, recommended)
|
lpng1628.7z (LZMA-compressed, recommended)
|
||||||
/scratch/glennrp/Libpng16/lpng1621.zip
|
lpng1628.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.6.21-README.txt
|
libpng-1.6.28-README.txt
|
||||||
libpng-1.6.21-LICENSE.txt
|
libpng-1.6.28-LICENSE.txt
|
||||||
libpng-1.6.21-*.asc (armored detached GPG signatures)
|
libpng-1.6.28-*.asc (armored detached GPG signatures)
|
||||||
|
|
||||||
Changes since the last public release (1.6.20):
|
Changes since the last public release (1.6.27):
|
||||||
|
Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna).
|
||||||
Fixed syntax "$(command)" in tests/pngstest that some shells other than
|
Added option to Cmake build allowing a custom location of zlib to be
|
||||||
bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
|
specified in a scenario where libpng is being built as a subproject
|
||||||
Moved png_check_keyword() from pngwutil.c to pngset.c
|
alongside zlib by another project (Sam Serrels).
|
||||||
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
|
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
|
||||||
in the BigEndian tests by not testing it, making the BE code the same
|
up to 16 options.
|
||||||
as the LE version.
|
|
||||||
Fixes to pngvalid for various reduced build configurations (eliminate unused
|
|
||||||
statics) and a fix for the case in rgb_to_gray when the digitize option
|
|
||||||
reduces graylo to 0, producing a large error.
|
|
||||||
Widened the 'limit' check on the internally calculated error limits in
|
|
||||||
the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
|
|
||||||
checks) and changed the check to only operate in non-release builds
|
|
||||||
(base build type not RC or RELEASE.)
|
|
||||||
Fixed undefined behavior in pngvalid.c, undefined because
|
|
||||||
(png_byte) << shift is undefined if it changes the signed bit
|
|
||||||
(because png_byte is promoted to int). The libpng exported functions
|
|
||||||
png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
|
|
||||||
David Drysdale as a result of reports from UBSAN in clang 3.8).
|
|
||||||
This changes pngvalid to use BE random numbers; this used to produce
|
|
||||||
errors but these should not be fixed as a result of the previous changes.
|
|
||||||
In projects/vstudio, combined readme.txt and WARNING into README.txt
|
|
||||||
Relocated assert() in contrib/tools/pngfix.c, bug found by American
|
|
||||||
Fuzzy Lop, reported by Brian Carpenter.
|
|
||||||
Marked 'limit' UNUSED in transform_range_check(). This only affects
|
|
||||||
release builds.
|
|
||||||
Worked around a false-positive Coverity issue in pngvalid.c.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
312
src/png/CHANGES
312
src/png/CHANGES
@@ -5063,7 +5063,8 @@ Version 1.6.15beta04 [November 4, 2014]
|
|||||||
Version 1.6.15beta05 [November 5, 2014]
|
Version 1.6.15beta05 [November 5, 2014]
|
||||||
Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
|
Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
|
||||||
example.c, pngtest.c, and applications in the contrib directory.
|
example.c, pngtest.c, and applications in the contrib directory.
|
||||||
Avoid out-of-bounds memory access in png_user_version_check().
|
Fixed an out-of-range read in png_user_version_check() (Bug report from
|
||||||
|
Qixue Xiao, CVE-2015-8540).
|
||||||
Simplified and future-proofed png_user_version_check().
|
Simplified and future-proofed png_user_version_check().
|
||||||
Fixed GCC unsigned int->float warnings. Various versions of GCC
|
Fixed GCC unsigned int->float warnings. Various versions of GCC
|
||||||
seem to generate warnings when an unsigned value is implicitly
|
seem to generate warnings when an unsigned value is implicitly
|
||||||
@@ -5484,6 +5485,315 @@ Version 1.6.21rc02 [January 7, 2016]
|
|||||||
Version 1.6.21 [January 15, 2016]
|
Version 1.6.21 [January 15, 2016]
|
||||||
Worked around a false-positive Coverity issue in pngvalid.c.
|
Worked around a false-positive Coverity issue in pngvalid.c.
|
||||||
|
|
||||||
|
Version 1.6.22beta01 [January 23, 2016]
|
||||||
|
Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
|
||||||
|
"tmpfile()" implementation in contrib/libtests/pngstest.c
|
||||||
|
Fixed NO_STDIO build of pngunknown.c to skip calling png_init_io()
|
||||||
|
if there is no stdio.h support.
|
||||||
|
Added a png_image_write_to_memory() API and a number of assist macros
|
||||||
|
to allow an application that uses the simplified API write to bypass
|
||||||
|
stdio and write directly to memory.
|
||||||
|
Added some warnings (png.h) and some check code to detect *possible*
|
||||||
|
overflow in the ROW_STRIDE and simplified image SIZE macros. This
|
||||||
|
disallows image width/height/format that *might* overflow. This is
|
||||||
|
a quiet API change that limits in-memory image size (uncompressed) to
|
||||||
|
less than 4GByte and image row size (stride) to less than 2GByte.
|
||||||
|
Revised workaround for false-positive Coverity issue in pngvalid.c.
|
||||||
|
|
||||||
|
Version 1.6.22beta02 [February 8, 2016]
|
||||||
|
Only use exit(77) in configure builds.
|
||||||
|
Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
|
||||||
|
the palette size because it failed to take into account that the memory
|
||||||
|
palette has to be expanded to full RGB when it is written to PNG.
|
||||||
|
Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
|
||||||
|
and test.cmake.in (Roger Leigh).
|
||||||
|
Relaxed limit checks on gamma values in pngrtran.c. As suggested in
|
||||||
|
the comments gamma values outside the range currently permitted
|
||||||
|
by png_set_alpha_mode are useful for HDR data encoding. These values
|
||||||
|
are already permitted by png_set_gamma so it is reasonable caution to
|
||||||
|
extend the png_set_alpha_mode range as HDR imaging systems are starting
|
||||||
|
to emerge.
|
||||||
|
|
||||||
|
Version 1.6.22beta03 [March 9, 2016]
|
||||||
|
Added a common-law trademark notice and export control information
|
||||||
|
to the LICENSE file, png.h, and the man page.
|
||||||
|
Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
|
||||||
|
were accidentally removed from libpng-1.6.17.
|
||||||
|
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
|
||||||
|
(Robert C. Seacord).
|
||||||
|
Removed dubious "#if INT_MAX" test from png.h that was added to
|
||||||
|
libpng-1.6.19beta02 (John Bowler).
|
||||||
|
Add ${INCLUDES} in scripts/genout.cmake.in (Bug report by Nixon Kwok).
|
||||||
|
Updated LICENSE to say files in the contrib directory are not
|
||||||
|
necessarily under the libpng license, and that some makefiles have
|
||||||
|
other copyright owners.
|
||||||
|
Added INTEL-SSE2 support (Mike Klein and Matt Sarett, Google, Inc.).
|
||||||
|
Made contrib/libtests/timepng more robust. The code no longer gives
|
||||||
|
up/fails on invalid PNG data, it just skips it (with error messages).
|
||||||
|
The code no longer fails on PNG files with data beyond IEND. Options
|
||||||
|
exist to use png_read_png (reading the whole image, not by row) and, in
|
||||||
|
that case, to apply any of the supported transforms. This makes for
|
||||||
|
more realistic testing; the decoded data actually gets used in a
|
||||||
|
meaningful fashion (John Bowler).
|
||||||
|
Fixed some misleading indentation (Krishnaraj Bhat).
|
||||||
|
|
||||||
|
Version 1.6.22beta04 [April 5, 2016]
|
||||||
|
Force GCC compilation to C89 if needed (Dagobert Michelsen).
|
||||||
|
SSE filter speed improvements for bpp=3:
|
||||||
|
memcpy-free implementations of load3() / store3().
|
||||||
|
call load3() only when needed at the end of a scanline.
|
||||||
|
|
||||||
|
Version 1.6.22beta05 [April 27, 2016]
|
||||||
|
Added PNG_FAST_FILTERS macro (defined as
|
||||||
|
PNG_FILTER_NONE|PNG_FILTER_SUB|PNG_FILTER_UP).
|
||||||
|
Various fixes for contrib/libtests/timepng.c
|
||||||
|
Moved INTEL-SSE code from pngpriv.h into contrib/intel/intel_sse.patch.
|
||||||
|
Fixed typo (missing underscore) in #define PNG_READ_16_TO_8_SUPPORTED
|
||||||
|
(Bug report by Y.Ohashik).
|
||||||
|
|
||||||
|
Version 1.6.22beta06 [May 5, 2016]
|
||||||
|
Rebased contrib/intel_sse.patch.
|
||||||
|
Quieted two Coverity issues in contrib/libtests/timepng.c.
|
||||||
|
Fixed issues with scripts/genout.cmake.in (David Capello, Nixon Kwok):
|
||||||
|
Added support to use multiple directories in ZLIBINCDIR variable,
|
||||||
|
Fixed CMAKE_C_FLAGS with multiple values when genout is compiled on MSVC,
|
||||||
|
Fixed pnglibconf.c compilation on OS X including the sysroot path.
|
||||||
|
|
||||||
|
Version 1.6.22rc01 [May 14, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.22rc02 [May 16, 2016]
|
||||||
|
Removed contrib/timepng from default build; it does not build on platforms
|
||||||
|
that don't supply clock_gettime().
|
||||||
|
|
||||||
|
Version 1.6.22rc03 [May 17, 2016]
|
||||||
|
Restored contrib/timepng to default build but check for the presence
|
||||||
|
of clock_gettime() in configure.ac and Makefile.am.
|
||||||
|
|
||||||
|
Version 1.6.22 [May 26, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.23beta01 [May 29, 2016]
|
||||||
|
Stop a potential memory leak in png_set_tRNS() (Bug report by Ted Ying).
|
||||||
|
Fixed the progressive reader to handle empty first IDAT chunk properly
|
||||||
|
(patch by Timothy Nikkel). This bug was introduced in libpng-1.6.0 and
|
||||||
|
only affected the libpng16 branch.
|
||||||
|
Added tests in pngvalid.c to check zero-length IDAT chunks in various
|
||||||
|
positions. Fixed the sequential reader to handle these more robustly
|
||||||
|
(John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.23rc01 [June 2, 2016]
|
||||||
|
Corrected progressive read input buffer in pngvalid.c. The previous version
|
||||||
|
the code invariably passed just one byte at a time to libpng. The intent
|
||||||
|
was to pass a random number of bytes in the range 0..511.
|
||||||
|
Moved sse2 prototype from pngpriv.h to contrib/intel/intel_sse.patch.
|
||||||
|
Added missing ")" in pngerror.c (Matt Sarrett).
|
||||||
|
|
||||||
|
Version 1.6.23rc02 [June 4, 2016]
|
||||||
|
Fixed undefined behavior in png_push_save_buffer(). Do not call
|
||||||
|
memcpy() with a null source, even if count is zero (Leon Scroggins III).
|
||||||
|
|
||||||
|
Version 1.6.23 [June 9, 2016]
|
||||||
|
Fixed bad link to RFC2083 in png.5 (Nikola Forro).
|
||||||
|
|
||||||
|
Version 1.6.24beta01 [June 11, 2016]
|
||||||
|
Avoid potential overflow of the PNG_IMAGE_SIZE macro. This macro
|
||||||
|
is not used within libpng, but is used in some of the examples.
|
||||||
|
|
||||||
|
Version 1.6.24beta02 [June 23, 2016]
|
||||||
|
Correct filter heuristic overflow handling. This was broken when the
|
||||||
|
write filter code was moved out-of-line; if there is a single filter and
|
||||||
|
the heuristic sum overflows the calculation of the filtered line is not
|
||||||
|
completed. In versions prior to 1.6 the code was duplicated in-line
|
||||||
|
and the check not performed, so the filter operation completed; however,
|
||||||
|
in the multi-filter case where the sum is performed the 'none' filter would
|
||||||
|
be selected if all the sums overflowed, even if it wasn't in the filter
|
||||||
|
list. The fix to the first problem is simply to provide PNG_SIZE_MAX as
|
||||||
|
the current lmins sum value; this means the sum can never exceed it and
|
||||||
|
overflows silently. A reasonable compiler that does choose to inline
|
||||||
|
the code will simply eliminate the sum check.
|
||||||
|
The fix to the second problem is to use high precision arithmetic (this is
|
||||||
|
implemented in 1.7), however a simple safe fix here is to chose the lowest
|
||||||
|
numbered filter in the list from png_set_filter (this only works if the
|
||||||
|
first problem is also fixed) (John Bowler).
|
||||||
|
Use a more efficient absolute value calculation on SSE2 (Matthieu Darbois).
|
||||||
|
Fixed the case where PNG_IMAGE_BUFFER_SIZE can overflow in the application
|
||||||
|
as a result of the application using an increased 'row_stride'; previously
|
||||||
|
png_image_finish_read only checked for overflow on the base calculation of
|
||||||
|
components. (I.e. it checked for overflow of a 32-bit number on the total
|
||||||
|
number of pixel components in the output format, not the possibly padded row
|
||||||
|
length and not the number of bytes, which for linear formats is twice the
|
||||||
|
number of components.)
|
||||||
|
MSVC does not like '-(unsigned)', so replaced it with 0U-(unsigned)
|
||||||
|
MSVC does not like (uInt) = -(unsigned) (i.e. as an initializer), unless
|
||||||
|
the conversion is explicitly invoked by a cast.
|
||||||
|
Put the SKIP definition in the correct place. It needs to come after the
|
||||||
|
png.h include (see all the other .c files in contrib/libtests) because it
|
||||||
|
depends on PNG_LIBPNG_VER.
|
||||||
|
Removed the three compile warning options from the individual project
|
||||||
|
files into the zlib.props globals. It increases the warning level from 4
|
||||||
|
to All and adds a list of the warnings that need to be turned off. This is
|
||||||
|
semi-documentary; the intent is to tell libpng users which warnings have
|
||||||
|
been examined and judged non-fixable at present. The warning about
|
||||||
|
structure padding is fixable, but it would be a signficant change (moving
|
||||||
|
structure members around).
|
||||||
|
|
||||||
|
Version 1.6.24beta03 [July 4, 2016]
|
||||||
|
Optimized absolute value calculation in filter selection, similar to
|
||||||
|
code in the PAETH decoder in pngrutil.c. Build with PNG_USE_ABS to
|
||||||
|
use this.
|
||||||
|
Added pngcp to the build together with a pngcp.dfa configuration test.
|
||||||
|
Added high resolution timing to pngcp.
|
||||||
|
Added "Common linking failures" section to INSTALL.
|
||||||
|
Relocated misplaced #endif in png.c sRGB profile checking.
|
||||||
|
Fixed two Coverity issues in pngcp.c.
|
||||||
|
|
||||||
|
Version 1.6.24beta04 [July 8, 2016]
|
||||||
|
Avoid filter-selection heuristic sum calculations in cases where only one
|
||||||
|
filter is a candidate for selection. This trades off code size (added
|
||||||
|
private png_setup_*_row_only() functions) for speed.
|
||||||
|
|
||||||
|
Version 1.6.24beta05 [July 13, 2016]
|
||||||
|
Fixed some indentation to comply with our coding style.
|
||||||
|
Added contrib/tools/reindent.
|
||||||
|
|
||||||
|
Version 1.6.24beta06 [July 18, 2016]
|
||||||
|
Fixed more indentation to comply with our coding style.
|
||||||
|
Eliminated unnecessary tests of boolean png_isaligned() vs 0.
|
||||||
|
|
||||||
|
Version 1.6.24rc01 [July 25, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.24rc02 [August 1, 2016]
|
||||||
|
Conditionally compile SSE2 headers in contrib/intel/intel_sse.patch
|
||||||
|
Conditionally compile png_decompress_chunk().
|
||||||
|
|
||||||
|
Version 1.6.24rc03 [August 2, 2016]
|
||||||
|
Conditionally compile ARM_NEON headers in pngpriv.h
|
||||||
|
Updated contrib/intel/intel_sse.patch
|
||||||
|
|
||||||
|
Version 1.6.24[August 4, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.25beta01 [August 12, 2016]
|
||||||
|
Reject oversized iCCP profile immediately.
|
||||||
|
Cleaned up PNG_DEBUG compile of pngtest.c.
|
||||||
|
Conditionally compile png_inflate().
|
||||||
|
|
||||||
|
Version 1.6.25beta02 [August 18, 2016]
|
||||||
|
Don't install pngcp; it conflicts with pngcp in the pngtools package.
|
||||||
|
Minor editing of INSTALL, (whitespace, added copyright line)
|
||||||
|
|
||||||
|
Version 1.6.25rc01 [August 24, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.25rc02 [August 29, 2016]
|
||||||
|
Added MIPS support (Mandar Sahastrabuddhe <Mandar.Sahastrabuddhe@imgtec.com>).
|
||||||
|
Only the UP filter is currently implemented.
|
||||||
|
|
||||||
|
Version 1.6.25rc03 [August 29, 2016]
|
||||||
|
Rebased contrib/intel/intel_sse.patch after the MIPS implementation.
|
||||||
|
|
||||||
|
Version 1.6.25rc04 [August 30, 2016]
|
||||||
|
Added MIPS support for SUB, AVG, and PAETH filters (Mandar Sahastrabuddhe).
|
||||||
|
|
||||||
|
Version 1.6.25rc05 [August 30, 2016]
|
||||||
|
Rebased contrib/intel/intel_sse.patch after the MIPS implementation update..
|
||||||
|
|
||||||
|
Version 1.6.25 [September 1, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.26beta01 [September 26, 2016]
|
||||||
|
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
||||||
|
bugfix by John Bowler).
|
||||||
|
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
||||||
|
has allocated memory that libpng needs to free.
|
||||||
|
Conditionally compile png_set_benign_errors() in pngread.c and pngtest.c
|
||||||
|
Issue a png_benign_error instead of a png_error on ADLER32 mismatch
|
||||||
|
while decoding compressed data chunks.
|
||||||
|
Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngpriv.h, pngstruct.h, and
|
||||||
|
pngrutil.c.
|
||||||
|
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
||||||
|
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
||||||
|
Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error().
|
||||||
|
Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
|
||||||
|
Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
|
||||||
|
|
||||||
|
Version 1.6.26beta02 [October 1, 2016]
|
||||||
|
Updated the documentation about CRC and ADLER32 handling.
|
||||||
|
Quieted 117 warnings from clang-3.8 in pngtrans.c, pngread.c,
|
||||||
|
pngwrite.c, pngunknown.c, and pngvalid.c.
|
||||||
|
Quieted 58 (out of 144) -Wconversion compiler warnings by changing
|
||||||
|
flag definitions in pngpriv.h from 0xnnnn to 0xnnnnU and trivial changes
|
||||||
|
in png.c, pngread.c, and pngwutil.c.
|
||||||
|
|
||||||
|
Version 1.6.26beta03 [October 2, 2016]
|
||||||
|
Removed contrib/libtests/*.orig and *.rej that slipped into the tarballs.
|
||||||
|
Quieted the 86 remaining -Wconversion compiler warnings by
|
||||||
|
revising the png_isaligned() macro and trivial changes in png.c,
|
||||||
|
pngerror.c, pngget.c, pngmem.c, pngset.c, pngrtran.c, pngrutil.c,
|
||||||
|
pngwtran.c, pngwrite.c, and pngwutil.c.
|
||||||
|
|
||||||
|
Version 1.6.26beta04 [October 3, 2016]
|
||||||
|
Quieted (bogus?) clang warnings about "absolute value has no effect"
|
||||||
|
when PNG_USE_ABS is defined.
|
||||||
|
Fixed offsets in contrib/intel/intel_sse.patch
|
||||||
|
|
||||||
|
Version 1.6.26beta05 [October 6, 2016]
|
||||||
|
Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h
|
||||||
|
to avoid a signed/unsigned compare in the preprocessor.
|
||||||
|
|
||||||
|
Version 1.6.26beta06 [October 7, 2016]
|
||||||
|
Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to
|
||||||
|
optionally avoid ADLER32 evaluation.
|
||||||
|
|
||||||
|
Version 1.6.26rc01 [October 12, 2016]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.26 [October 20, 2016]
|
||||||
|
Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
|
||||||
|
Despammed email addresses (replaced "@" with " at ").
|
||||||
|
|
||||||
|
Version 1.6.27beta01 [November 2, 2016]
|
||||||
|
Restrict the new ADLER32-skipping to IDAT chunks. It broke iCCP chunk
|
||||||
|
handling: an erroneous iCCP chunk would throw a png_error and reject the
|
||||||
|
entire PNG image instead of rejecting just the iCCP chunk with a warning,
|
||||||
|
if built with zlib-1.2.8.1.
|
||||||
|
|
||||||
|
Version 1.6.27rc01 [December 27, 2016]
|
||||||
|
Control ADLER32 checking with new PNG_IGNORE_ADLER32 option.
|
||||||
|
Removed the use of a macro containing the pre-processor 'defined'
|
||||||
|
operator. It is unclear whether this is valid; a macro that
|
||||||
|
"generates" 'defined' is not permitted, but the use of the word
|
||||||
|
"generates" within the C90 standard seems to imply more than simple
|
||||||
|
substitution of an expression itself containing a well-formed defined
|
||||||
|
operation.
|
||||||
|
Added ARM support to CMakeLists.txt (Andreas Franek).
|
||||||
|
|
||||||
|
Version 1.6.27 [December 29, 2016]
|
||||||
|
Fixed a potential null pointer dereference in png_set_text_2() (bug report
|
||||||
|
and patch by Patrick Keshishian, CVE-2016-10087).
|
||||||
|
|
||||||
|
Version 1.6.28rc01 [January 3, 2017]
|
||||||
|
Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna).
|
||||||
|
Added option to Cmake build allowing a custom location of zlib to be
|
||||||
|
specified in a scenario where libpng is being built as a subproject
|
||||||
|
alongside zlib by another project (Sam Serrels).
|
||||||
|
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
|
||||||
|
up to 16 options.
|
||||||
|
|
||||||
|
Version 1.6.28rc02 [January 4, 2017]
|
||||||
|
Added "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
|
||||||
|
Moved SSE2 optimization code into the main libpng source directory.
|
||||||
|
Configure libpng with "configure --enable-intel-sse" or compile
|
||||||
|
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
||||||
|
|
||||||
|
Version 1.6.28rc03 [January 4, 2017]
|
||||||
|
Backed out the SSE optimization and last CMakeLists.txt to allow time for QA.
|
||||||
|
|
||||||
|
Version 1.6.28 [January 5, 2017]
|
||||||
|
No changes.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
|
@@ -1,13 +1,33 @@
|
|||||||
# CMakeLists.txt
|
# CMakeLists.txt
|
||||||
|
|
||||||
# Copyright (C) 2007-2015 Glenn Randers-Pehrson
|
# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson
|
||||||
|
# Written by Christian Ehrlicher, 2007
|
||||||
|
# Revised by Roger Lowman, 2009-2010
|
||||||
|
# Revised by Clifford Yapp, 2011-2012
|
||||||
|
# Revised by Roger Leigh, 2016
|
||||||
|
# Revised by Andreas Franek, 2016
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.4.4)
|
cmake_minimum_required(VERSION 2.8.3)
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
cmake_policy(VERSION 2.8.3)
|
||||||
|
|
||||||
|
# Set MacOSX @rpath usage globally.
|
||||||
|
if (POLICY CMP0020)
|
||||||
|
cmake_policy(SET CMP0020 NEW)
|
||||||
|
endif(POLICY CMP0020)
|
||||||
|
if (POLICY CMP0042)
|
||||||
|
cmake_policy(SET CMP0042 NEW)
|
||||||
|
endif(POLICY CMP0042)
|
||||||
|
# Use new variable expansion policy.
|
||||||
|
if (POLICY CMP0053)
|
||||||
|
cmake_policy(SET CMP0053 NEW)
|
||||||
|
endif(POLICY CMP0053)
|
||||||
|
if (POLICY CMP0054)
|
||||||
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
endif(POLICY CMP0054)
|
||||||
|
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
||||||
|
|
||||||
@@ -16,13 +36,20 @@ enable_testing()
|
|||||||
|
|
||||||
set(PNGLIB_MAJOR 1)
|
set(PNGLIB_MAJOR 1)
|
||||||
set(PNGLIB_MINOR 6)
|
set(PNGLIB_MINOR 6)
|
||||||
set(PNGLIB_RELEASE 21)
|
set(PNGLIB_RELEASE 28)
|
||||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||||
|
|
||||||
# needed packages
|
# needed packages
|
||||||
|
|
||||||
|
#Allow users to specify location of Zlib,
|
||||||
|
# Useful if zlib is being built alongside this as a sub-project
|
||||||
|
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
|
||||||
|
|
||||||
|
IF(NOT PNG_BUILD_ZLIB)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
include_directories(${ZLIB_INCLUDE_DIR})
|
include_directories(${ZLIB_INCLUDE_DIR})
|
||||||
|
ENDIF(NOT PNG_BUILD_ZLIB)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
find_library(M_LIBRARY
|
find_library(M_LIBRARY
|
||||||
@@ -47,32 +74,314 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
|||||||
option(PNG_DEBUG "Build with debug output" OFF)
|
option(PNG_DEBUG "Build with debug output" OFF)
|
||||||
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
||||||
|
|
||||||
|
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
||||||
|
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
||||||
|
|
||||||
|
# set definitions and sources for arm
|
||||||
|
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm" OR
|
||||||
|
${CMAKE_SYSTEM_PROCESSOR} MATCHES "^aarch64")
|
||||||
|
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
|
||||||
|
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
|
||||||
|
check: (default) use internal checking code;
|
||||||
|
off: disable the optimizations;
|
||||||
|
on: turn on unconditionally.")
|
||||||
|
set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS
|
||||||
|
${PNG_ARM_NEON_POSSIBLE_VALUES})
|
||||||
|
list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index)
|
||||||
|
if(index EQUAL -1)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
" PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
|
||||||
|
elseif(NOT ${PNG_ARM_NEON} STREQUAL "no")
|
||||||
|
set(libpng_arm_sources
|
||||||
|
arm/arm_init.c
|
||||||
|
arm/filter_neon.S
|
||||||
|
arm/filter_neon_intrinsics.c)
|
||||||
|
|
||||||
|
if(${PNG_ARM_NEON} STREQUAL "on")
|
||||||
|
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
||||||
|
elseif(${PNG_ARM_NEON} STREQUAL "check")
|
||||||
|
add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# SET LIBNAME
|
# SET LIBNAME
|
||||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
|
|
||||||
# to distinguish between debug and release lib
|
# to distinguish between debug and release lib
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
|
||||||
# Use the prebuilt pnglibconf.h file from the scripts folder
|
include(CheckCSourceCompiles)
|
||||||
# TODO: fix this by building with awk; without this no cmake build can be
|
option(ld-version-script "Enable linker version script" ON)
|
||||||
# configured directly (to do so indirectly use your local awk to build a
|
if(ld-version-script AND NOT APPLE)
|
||||||
# pnglibconf.h in the build directory.)
|
# Check if LD supports linker scripts.
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
|
||||||
|
global: sym;
|
||||||
|
local: *;
|
||||||
|
};
|
||||||
|
|
||||||
|
VERS_2 {
|
||||||
|
global: sym2;
|
||||||
|
main;
|
||||||
|
} VERS_1;
|
||||||
|
")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
|
||||||
|
check_c_source_compiles("void sym(void) {}
|
||||||
|
void sym2(void) {}
|
||||||
|
int main(void) {return 0;}
|
||||||
|
" HAVE_LD_VERSION_SCRIPT)
|
||||||
|
if(NOT HAVE_LD_VERSION_SCRIPT)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
check_c_source_compiles("void sym(void) {}
|
||||||
|
void sym2(void) {}
|
||||||
|
int main(void) {return 0;}
|
||||||
|
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
|
||||||
|
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find symbol prefix. Likely obsolete and unnecessary with recent
|
||||||
|
# toolchains (it's not done in many other projects).
|
||||||
|
function(symbol_prefix)
|
||||||
|
set(SYMBOL_PREFIX)
|
||||||
|
|
||||||
|
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
|
||||||
|
INPUT_FILE /dev/null
|
||||||
|
OUTPUT_VARIABLE OUT
|
||||||
|
RESULT_VARIABLE STATUS)
|
||||||
|
|
||||||
|
if(CPP_FAIL)
|
||||||
|
message(WARNING "Failed to run the C preprocessor")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" OUT "${OUT}")
|
||||||
|
foreach(line ${OUT})
|
||||||
|
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
||||||
|
if(found_match)
|
||||||
|
STRING(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
||||||
|
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
||||||
|
if(found_match)
|
||||||
|
STRING(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
||||||
|
endif()
|
||||||
|
set(SYMBOL_PREFIX "${prefix}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
|
||||||
|
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
symbol_prefix()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(AWK NAMES gawk awk)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
if(NOT AWK)
|
||||||
|
# No awk available to generate sources; use pre-built pnglibconf.h
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
add_custom_target(genfiles) # Dummy
|
||||||
|
else()
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
# Generate .chk from .out with awk
|
||||||
|
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_chk)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs INPUT OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if (NOT _GC_INPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
||||||
|
endif()
|
||||||
|
if (NOT _GC_OUTPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DINPUT=${_GC_INPUT}"
|
||||||
|
"-DOUTPUT=${_GC_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
|
||||||
|
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate .out from .c with awk
|
||||||
|
# generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_out)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs INPUT OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if (NOT _GO_INPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
||||||
|
endif()
|
||||||
|
if (NOT _GO_OUTPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DINPUT=${_GO_INPUT}"
|
||||||
|
"-DOUTPUT=${_GO_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
|
||||||
|
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate specific source file with awk
|
||||||
|
# generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_source)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if (NOT _GSO_OUTPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DOUTPUT=${_GSO_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
||||||
|
DEPENDS ${_GSO_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Copy file
|
||||||
|
function(generate_copy source destination)
|
||||||
|
add_custom_command(OUTPUT "${destination}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E remove "${destination}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${source}"
|
||||||
|
"${destination}"
|
||||||
|
DEPENDS "${source}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate scripts/pnglibconf.h
|
||||||
|
generate_source(OUTPUT "scripts/pnglibconf.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
||||||
|
|
||||||
|
# Generate pnglibconf.c
|
||||||
|
generate_source(OUTPUT "pnglibconf.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
||||||
|
|
||||||
|
if(PNG_PREFIX)
|
||||||
|
set(PNGLIBCONF_H_EXTRA_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst")
|
||||||
|
set(PNGPREFIX_H_EXTRA_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
||||||
|
|
||||||
|
# Generate pnglibconf.h
|
||||||
|
generate_source(OUTPUT "pnglibconf.h"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
||||||
|
${PNGLIBCONF_H_EXTRA_DEPENDS})
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
||||||
|
|
||||||
|
# Generate pngprefix.h
|
||||||
|
generate_source(OUTPUT "pngprefix.h"
|
||||||
|
DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
|
||||||
|
|
||||||
|
add_custom_target(symbol-check DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
|
||||||
|
|
||||||
|
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
||||||
|
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
||||||
|
|
||||||
|
add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
||||||
|
add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
||||||
|
|
||||||
|
add_custom_target("genprebuilt"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DOUTPUT=scripts/pnglibconf.h.prebuilt"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# A single target handles generation of all generated files. If
|
||||||
|
# they are dependend upon separately by multiple targets, this
|
||||||
|
# confuses parallel make (it would require a separate top-level
|
||||||
|
# target for each file to track the dependencies properly).
|
||||||
|
add_custom_target(genfiles DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
|
||||||
|
endif(NOT AWK)
|
||||||
|
|
||||||
# OUR SOURCES
|
# OUR SOURCES
|
||||||
set(libpng_public_hdrs
|
set(libpng_public_hdrs
|
||||||
png.h
|
png.h
|
||||||
pngconf.h
|
pngconf.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
||||||
)
|
)
|
||||||
set(libpng_sources
|
set(libpng_private_hdrs
|
||||||
${libpng_public_hdrs}
|
pngpriv.h
|
||||||
pngdebug.h
|
pngdebug.h
|
||||||
pnginfo.h
|
pnginfo.h
|
||||||
pngpriv.h
|
|
||||||
pngstruct.h
|
pngstruct.h
|
||||||
|
)
|
||||||
|
if(AWK)
|
||||||
|
list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
|
||||||
|
endif()
|
||||||
|
set(libpng_sources
|
||||||
|
${libpng_public_hdrs}
|
||||||
|
${libpng_private_hdrs}
|
||||||
png.c
|
png.c
|
||||||
pngerror.c
|
pngerror.c
|
||||||
pngget.c
|
pngget.c
|
||||||
@@ -88,6 +397,7 @@ set(libpng_sources
|
|||||||
pngwrite.c
|
pngwrite.c
|
||||||
pngwtran.c
|
pngwtran.c
|
||||||
pngwutil.c
|
pngwutil.c
|
||||||
|
${libpng_arm_sources}
|
||||||
)
|
)
|
||||||
set(pngtest_sources
|
set(pngtest_sources
|
||||||
pngtest.c
|
pngtest.c
|
||||||
@@ -98,7 +408,18 @@ set(pngvalid_sources
|
|||||||
set(pngstest_sources
|
set(pngstest_sources
|
||||||
contrib/libtests/pngstest.c
|
contrib/libtests/pngstest.c
|
||||||
)
|
)
|
||||||
# SOME NEEDED DEFINITIONS
|
set(pngunknown_sources
|
||||||
|
contrib/libtests/pngunknown.c
|
||||||
|
)
|
||||||
|
set(pngimage_sources
|
||||||
|
contrib/libtests/pngimage.c
|
||||||
|
)
|
||||||
|
set(pngfix_sources
|
||||||
|
contrib/tools/pngfix.c
|
||||||
|
)
|
||||||
|
set(png_fix_itxt_sources
|
||||||
|
contrib/tools/png-fix-itxt.c
|
||||||
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
@@ -114,33 +435,59 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
|||||||
unset(PNG_LIB_TARGETS)
|
unset(PNG_LIB_TARGETS)
|
||||||
|
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
|
add_library(png SHARED ${libpng_sources})
|
||||||
set(PNG_LIB_TARGETS ${PNG_LIB_NAME})
|
set(PNG_LIB_TARGETS png)
|
||||||
|
set_target_properties(png PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
|
||||||
|
add_dependencies(png genfiles)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
set_target_properties(png PROPERTIES PREFIX "lib")
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
set_target_properties(png PROPERTIES IMPORT_PREFIX "lib")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(png ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
|
|
||||||
|
if(UNIX AND AWK)
|
||||||
|
if(HAVE_LD_VERSION_SCRIPT)
|
||||||
|
set_target_properties(png PROPERTIES LINK_FLAGS
|
||||||
|
"-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
|
||||||
|
elseif(HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
||||||
|
set_target_properties(png PROPERTIES LINK_FLAGS
|
||||||
|
"-Wl,-M -Wl,'${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
# does not work without changing name
|
# does not work without changing name
|
||||||
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
|
set(PNG_LIB_NAME_STATIC png_static)
|
||||||
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
|
add_library(png_static STATIC ${libpng_sources})
|
||||||
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_STATIC})
|
add_dependencies(png_static genfiles)
|
||||||
|
# MSVC doesn't use a different file extension for shared vs. static
|
||||||
|
# libs. We are able to change OUTPUT_NAME to remove the _static
|
||||||
|
# for all other platforms.
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(png_static PROPERTIES
|
||||||
|
OUTPUT_NAME "${PNG_LIB_NAME}"
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
else()
|
||||||
|
set_target_properties(png_static PROPERTIES
|
||||||
|
OUTPUT_NAME "${PNG_LIB_NAME}_static"
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
endif()
|
||||||
|
list(APPEND PNG_LIB_TARGETS png_static)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
set_target_properties(png_static PROPERTIES PREFIX "lib")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
target_link_libraries(png_static ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PNG_FRAMEWORK)
|
if(PNG_FRAMEWORK)
|
||||||
set(PNG_LIB_NAME_FRAMEWORK ${PNG_LIB_NAME}_framework)
|
set(PNG_LIB_NAME_FRAMEWORK png_framework)
|
||||||
add_library(${PNG_LIB_NAME_FRAMEWORK} SHARED ${libpng_sources})
|
add_library(png_framework SHARED ${libpng_sources})
|
||||||
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_FRAMEWORK})
|
add_dependencies(png_framework genfiles)
|
||||||
set_target_properties(${PNG_LIB_NAME_FRAMEWORK} PROPERTIES
|
list(APPEND PNG_LIB_TARGETS png_framework)
|
||||||
|
set_target_properties(png_framework PROPERTIES
|
||||||
FRAMEWORK TRUE
|
FRAMEWORK TRUE
|
||||||
FRAMEWORK_VERSION ${PNGLIB_VERSION}
|
FRAMEWORK_VERSION ${PNGLIB_VERSION}
|
||||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
|
||||||
@@ -149,7 +496,7 @@ if(PNG_FRAMEWORK)
|
|||||||
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
|
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
|
||||||
PUBLIC_HEADER "${libpng_public_hdrs}"
|
PUBLIC_HEADER "${libpng_public_hdrs}"
|
||||||
OUTPUT_NAME png)
|
OUTPUT_NAME png)
|
||||||
target_link_libraries(${PNG_LIB_NAME_FRAMEWORK} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
target_link_libraries(png_framework ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT PNG_LIB_TARGETS)
|
if(NOT PNG_LIB_TARGETS)
|
||||||
@@ -160,52 +507,170 @@ if(NOT PNG_LIB_TARGETS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PNG_SHARED AND WIN32)
|
if(PNG_SHARED AND WIN32)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
set_target_properties(png PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
function(png_add_test)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs NAME COMMAND)
|
||||||
|
set(multiValueArgs OPTIONS FILES)
|
||||||
|
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if (NOT _PAT_NAME)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
|
||||||
|
endif()
|
||||||
|
if (NOT _PAT_COMMAND)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TEST_OPTIONS "${_PAT_OPTIONS}")
|
||||||
|
set(TEST_FILES "${_PAT_FILES}")
|
||||||
|
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
|
||||||
|
if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
|
||||||
|
add_test(NAME "${_PAT_NAME}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DLIBPNG=$<TARGET_FILE:png>"
|
||||||
|
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||||
|
else() # old 2.x add_test; limited and won't work well on Windows
|
||||||
|
# Note LIBPNG is a dummy value as there are no generator expressions
|
||||||
|
add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
|
||||||
|
"-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
|
||||||
|
"-DTEST_COMMAND=./${_PAT_COMMAND}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
if(PNG_TESTS AND PNG_SHARED)
|
if(PNG_TESTS AND PNG_SHARED)
|
||||||
# does not work with msvc due to png_lib_ver issue
|
# Find test PNG files by globbing, but sort lists to ensure
|
||||||
|
# consistency between different filesystems.
|
||||||
|
file(GLOB PNGSUITE_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/*.png")
|
||||||
|
list(SORT PNGSUITE_PNGS)
|
||||||
|
file(GLOB TEST_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/*.png")
|
||||||
|
list(SORT TEST_PNGS)
|
||||||
|
|
||||||
|
set(PNGTEST_PNG "${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png")
|
||||||
|
|
||||||
add_executable(pngtest ${pngtest_sources})
|
add_executable(pngtest ${pngtest_sources})
|
||||||
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
target_link_libraries(pngtest png)
|
||||||
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
|
||||||
#
|
png_add_test(NAME pngtest COMMAND pngtest FILES "${PNGTEST_PNG}")
|
||||||
|
|
||||||
add_executable(pngvalid ${pngvalid_sources})
|
add_executable(pngvalid ${pngvalid_sources})
|
||||||
target_link_libraries(pngvalid ${PNG_LIB_NAME})
|
target_link_libraries(pngvalid png)
|
||||||
add_test(pngvalid ./pngvalid)
|
|
||||||
|
png_add_test(NAME pngvalid-gamma-16-to-8
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-16-to-8)
|
||||||
|
png_add_test(NAME pngvalid-gamma-alpha-mode
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-alpha-mode)
|
||||||
|
png_add_test(NAME pngvalid-gamma-background
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-background)
|
||||||
|
png_add_test(NAME pngvalid-gamma-expand16-alpha-mode
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-alpha-mode --expand16)
|
||||||
|
png_add_test(NAME pngvalid-gamma-expand16-background
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-background --expand16)
|
||||||
|
png_add_test(NAME pngvalid-gamma-expand16-transform
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-transform --expand16)
|
||||||
|
png_add_test(NAME pngvalid-gamma-sbit
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-sbit)
|
||||||
|
png_add_test(NAME pngvalid-gamma-threshold
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-threshold)
|
||||||
|
png_add_test(NAME pngvalid-gamma-transform
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-transform)
|
||||||
|
png_add_test(NAME pngvalid-progressive-interlace-standard
|
||||||
|
COMMAND pngvalid OPTIONS --standard --progressive-read --interlace)
|
||||||
|
png_add_test(NAME pngvalid-progressive-size
|
||||||
|
COMMAND pngvalid OPTIONS --size --progressive-read)
|
||||||
|
png_add_test(NAME pngvalid-progressive-standard
|
||||||
|
COMMAND pngvalid OPTIONS --standard --progressive-read)
|
||||||
|
png_add_test(NAME pngvalid-standard
|
||||||
|
COMMAND pngvalid OPTIONS --standard)
|
||||||
|
png_add_test(NAME pngvalid-transform
|
||||||
|
COMMAND pngvalid OPTIONS --transform)
|
||||||
|
|
||||||
add_executable(pngstest ${pngstest_sources})
|
add_executable(pngstest ${pngstest_sources})
|
||||||
target_link_libraries(pngstest ${PNG_LIB_NAME})
|
target_link_libraries(pngstest png)
|
||||||
add_test(pngstest ./pngstest
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g01.png
|
foreach(gamma_type 1.8 linear none sRGB)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g02.png
|
foreach(alpha_type none alpha)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g04.png
|
set(PNGSTEST_FILES)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g08.png
|
foreach(test_png ${TEST_PNGS})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g16.png
|
string(REGEX MATCH ".*-linear[-.].*" TEST_PNG_LINEAR "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c08.png
|
string(REGEX MATCH ".*-sRGB[-.].*" TEST_PNG_SRGB "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c16.png
|
string(REGEX MATCH ".*-1.8[-.].*" TEST_PNG_G18 "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p01.png
|
string(REGEX MATCH ".*-alpha-.*" TEST_PNG_ALPHA "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p02.png
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p04.png
|
set(TEST_PNG_VALID TRUE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p08.png
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a08.png
|
if(TEST_PNG_ALPHA)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
|
if (NOT "${alpha_type}" STREQUAL "alpha")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g01.png
|
else()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g02.png
|
if ("${alpha_type}" STREQUAL "alpha")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g04.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
|
if(TEST_PNG_LINEAR)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
|
if(NOT "${gamma_type}" STREQUAL "linear")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn0g16.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
|
elseif(TEST_PNG_SRGB)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n0g08.png
|
if(NOT "${gamma_type}" STREQUAL "sRGB")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
|
elseif(TEST_PNG_G18)
|
||||||
)
|
if(NOT "${gamma_type}" STREQUAL "1.8")
|
||||||
|
set(TEST_PNG_VALID FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(NOT "${gamma_type}" STREQUAL "none")
|
||||||
|
set(TEST_PNG_VALID FALSE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TEST_PNG_VALID)
|
||||||
|
list(APPEND PNGSTEST_FILES "${test_png}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
# Should already be sorted, but sort anyway to be certain.
|
||||||
|
list(SORT PNGSTEST_FILES)
|
||||||
|
png_add_test(NAME pngstest-${gamma_type}-${alpha_type}
|
||||||
|
COMMAND pngstest
|
||||||
|
OPTIONS --tmpfile "${gamma_type}-${alpha_type}-" --log
|
||||||
|
FILES ${PNGSTEST_FILES})
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_executable(pngunknown ${pngunknown_sources})
|
||||||
|
target_link_libraries(pngunknown png)
|
||||||
|
|
||||||
|
png_add_test(NAME pngunknown-discard COMMAND pngunknown OPTIONS --strict default=discard FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-IDAT COMMAND pngunknown OPTIONS --strict default=discard IDAT=save FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-if-safe COMMAND pngunknown OPTIONS --strict default=if-safe FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-sAPI COMMAND pngunknown OPTIONS --strict bKGD=save cHRM=save gAMA=save all=discard iCCP=save sBIT=save sRGB=save FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-save COMMAND pngunknown OPTIONS --strict default=save FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-sTER COMMAND pngunknown OPTIONS --strict sTER=if-safe FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-vpAg COMMAND pngunknown OPTIONS --strict vpAg=if-safe FILES "${PNGTEST_PNG}")
|
||||||
|
|
||||||
|
add_executable(pngimage ${pngimage_sources})
|
||||||
|
target_link_libraries(pngimage png)
|
||||||
|
|
||||||
|
png_add_test(NAME pngimage-quick COMMAND pngimage OPTIONS --list-combos --log FILES ${PNGSUITE_PNGS})
|
||||||
|
png_add_test(NAME pngimage-full COMMAND pngimage OPTIONS --exhaustive --list-combos --log FILES ${PNGSUITE_PNGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_SHARED)
|
||||||
|
add_executable(pngfix ${pngfix_sources})
|
||||||
|
target_link_libraries(pngfix png)
|
||||||
|
set(PNG_BIN_TARGETS pngfix)
|
||||||
|
|
||||||
|
add_executable(png-fix-itxt ${png_fix_itxt_sources})
|
||||||
|
target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
|
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
||||||
@@ -234,6 +699,15 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
|||||||
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Create source generation scripts.
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
||||||
|
|
||||||
|
|
||||||
# libpng is a library so default to 'lib'
|
# libpng is a library so default to 'lib'
|
||||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
set(CMAKE_INSTALL_LIBDIR lib)
|
||||||
@@ -260,22 +734,12 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
|||||||
|
|
||||||
# SET UP LINKS
|
# SET UP LINKS
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
set_target_properties(png PROPERTIES
|
||||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.21
|
# VERSION 16.${PNGLIB_RELEASE}.1.6.28
|
||||||
VERSION 16.${PNGLIB_RELEASE}.0
|
VERSION 16.${PNGLIB_RELEASE}.0
|
||||||
SOVERSION 16
|
SOVERSION 16
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
endif()
|
endif()
|
||||||
if(PNG_STATIC)
|
|
||||||
# MSVC doesn't use a different file extension for shared vs. static
|
|
||||||
# libs. We are able to change OUTPUT_NAME to remove the _static
|
|
||||||
# for all other platforms.
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
|
||||||
OUTPUT_NAME ${PNG_LIB_NAME}
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If CMake > 2.4.x, we set a variable used below to export
|
# If CMake > 2.4.x, we set a variable used below to export
|
||||||
# targets to an export file.
|
# targets to an export file.
|
||||||
@@ -298,14 +762,14 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||||
if(CYGWIN OR MINGW)
|
if(CYGWIN OR MINGW)
|
||||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif(CYGWIN OR MINGW)
|
endif(CYGWIN OR MINGW)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
@@ -314,7 +778,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
|
get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
@@ -334,6 +798,11 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
|||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL )
|
||||||
|
install(TARGETS ${PNG_BIN_TARGETS}
|
||||||
|
RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||||
# Install man pages
|
# Install man pages
|
||||||
if(NOT PNG_MAN_DIR)
|
if(NOT PNG_MAN_DIR)
|
||||||
|
@@ -18,7 +18,8 @@ VIII. Configuring libpng for 16-bit platforms
|
|||||||
XIII. Removing unwanted object code
|
XIII. Removing unwanted object code
|
||||||
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||||
XV. Setjmp/longjmp issues
|
XV. Setjmp/longjmp issues
|
||||||
XVI. Other sources of information about libpng
|
XVI. Common linking failures
|
||||||
|
XVII. Other sources of information about libpng
|
||||||
|
|
||||||
I. Simple installation
|
I. Simple installation
|
||||||
|
|
||||||
@@ -47,7 +48,9 @@ If configure does not work on your system, or if you have a need to
|
|||||||
change configure.ac or Makefile.am, and you have a reasonably
|
change configure.ac or Makefile.am, and you have a reasonably
|
||||||
up-to-date set of tools, running ./autogen.sh in a git clone before
|
up-to-date set of tools, running ./autogen.sh in a git clone before
|
||||||
running ./configure may fix the problem. To be really sure that you
|
running ./configure may fix the problem. To be really sure that you
|
||||||
aren't using any of the included pre-built scripts, you can do this:
|
aren't using any of the included pre-built scripts, especially if you
|
||||||
|
are building from a tar distribution instead of a git distribution,
|
||||||
|
do this:
|
||||||
|
|
||||||
./configure --enable-maintainer-mode
|
./configure --enable-maintainer-mode
|
||||||
make maintainer-clean
|
make maintainer-clean
|
||||||
@@ -76,7 +79,7 @@ Or you can use one of the "projects" in the "projects" directory.
|
|||||||
Before installing libpng, you must first install zlib, if it
|
Before installing libpng, you must first install zlib, if it
|
||||||
is not already on your system. zlib can usually be found
|
is not already on your system. zlib can usually be found
|
||||||
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
||||||
zlib in in the same directory as libpng or in another directory.
|
zlib in the same directory as libpng or in another directory.
|
||||||
|
|
||||||
If your system already has a preinstalled zlib you will still need
|
If your system already has a preinstalled zlib you will still need
|
||||||
to have access to the zlib.h and zconf.h include files that
|
to have access to the zlib.h and zconf.h include files that
|
||||||
@@ -94,7 +97,9 @@ LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
|||||||
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
||||||
|
|
||||||
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
||||||
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
|
in your environment and type
|
||||||
|
|
||||||
|
make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test
|
||||||
|
|
||||||
IV. Using cmake
|
IV. Using cmake
|
||||||
|
|
||||||
@@ -160,9 +165,14 @@ VII. Building with makefiles
|
|||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
MSDOS example: copy scripts\makefile.msc makefile
|
MSDOS example:
|
||||||
|
|
||||||
|
copy scripts\makefile.msc makefile
|
||||||
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||||
UNIX example: cp scripts/makefile.std makefile
|
|
||||||
|
UNIX example:
|
||||||
|
|
||||||
|
cp scripts/makefile.std makefile
|
||||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||||
|
|
||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
@@ -239,7 +249,7 @@ libpng are compiled. All the defines end in _SUPPORTED. If you are
|
|||||||
never going to use a capability, you can change the #define to #undef
|
never going to use a capability, you can change the #define to #undef
|
||||||
before recompiling libpng and save yourself code and data space, or
|
before recompiling libpng and save yourself code and data space, or
|
||||||
you can turn off individual capabilities with defines that begin with
|
you can turn off individual capabilities with defines that begin with
|
||||||
PNG_NO_.
|
"PNG_NO_".
|
||||||
|
|
||||||
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
||||||
|
|
||||||
@@ -307,7 +317,7 @@ only png_longjmp_ptr, which must match the C longjmp function.) The new
|
|||||||
approach is documented in pngconf.h
|
approach is documented in pngconf.h
|
||||||
|
|
||||||
Despite these changes, libpng 1.5.0 only supports the native C function
|
Despite these changes, libpng 1.5.0 only supports the native C function
|
||||||
calling standard on those platforms tested so far (__cdecl on Microsoft
|
calling standard on those platforms tested so far ("__cdecl" on Microsoft
|
||||||
Windows). This is because the support requirements for alternative
|
Windows). This is because the support requirements for alternative
|
||||||
calling conventions seem to no longer exist. Developers who find it
|
calling conventions seem to no longer exist. Developers who find it
|
||||||
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
||||||
@@ -380,28 +390,25 @@ This requires setjmp/longjmp, so you must either build the library
|
|||||||
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
||||||
|
|
||||||
XVI. Other sources of information about libpng:
|
XVI. Common linking failures
|
||||||
|
|
||||||
|
If your application fails to find libpng or zlib entries while linking:
|
||||||
|
|
||||||
|
Be sure "-lz" appears after "-lpng" on your linking command.
|
||||||
|
|
||||||
|
Be sure you have built libpng, zlib, and your application for the
|
||||||
|
same platform (e.g., 32-bit or 64-bit).
|
||||||
|
|
||||||
|
If you are using the vstudio project, observe the WARNING in
|
||||||
|
project/vstudio/README.txt.
|
||||||
|
|
||||||
|
XVII. Other sources of information about libpng:
|
||||||
|
|
||||||
Further information can be found in the README and libpng-manual.txt
|
Further information can be found in the README and libpng-manual.txt
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
libpng.3 and png.5.
|
libpng.3 and png.5.
|
||||||
|
|
||||||
Using the ./configure script -- 16 December 2002.
|
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
|
||||||
=================================================
|
This document is released under the libpng license.
|
||||||
|
For conditions of distribution and use, see the disclaimer
|
||||||
The ./configure script should work compatibly with what scripts/makefile.*
|
and license in png.h.
|
||||||
did, however there are some options you might need to add to configure
|
|
||||||
explicitly, which previously was done semi-automatically (if you didn't edit
|
|
||||||
scripts/makefile.* yourself, that is)
|
|
||||||
|
|
||||||
CFLAGS="-Wall -O -funroll-loops \
|
|
||||||
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
|
||||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
|
||||||
|
|
||||||
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
|
||||||
/usr/include/libpng16, or whatever.
|
|
||||||
|
|
||||||
If you find that the configure script is out-of-date or is not supporting
|
|
||||||
your platform properly, try running autogen.sh to regenerate "configure",
|
|
||||||
"Makefile.in", and the other configuration files. Then try configure again.
|
|
||||||
|
|
||||||
|
@@ -10,8 +10,8 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
|
libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
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
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
added to the list of Contributing Authors:
|
added to the list of Contributing Authors:
|
||||||
@@ -22,6 +22,7 @@ added to the list of Contributing Authors:
|
|||||||
Cosmin Truta
|
Cosmin Truta
|
||||||
Gilles Vollant
|
Gilles Vollant
|
||||||
James Yu
|
James Yu
|
||||||
|
Mandar Sahastrabuddhe
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
@@ -32,6 +33,10 @@ and with the following additions to the disclaimer:
|
|||||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
the user.
|
the user.
|
||||||
|
|
||||||
|
Some files in the "contrib" directory and some configure-generated
|
||||||
|
files that are distributed with libpng have other copyright owners and
|
||||||
|
are released under other open source licenses.
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
libpng-0.96, and are distributed according to the same disclaimer and
|
libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
@@ -55,6 +60,9 @@ Contributing Authors:
|
|||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
Tom Tanner
|
Tom Tanner
|
||||||
|
|
||||||
|
Some files in the "scripts" directory have other copyright owners
|
||||||
|
but are released under this license.
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
@@ -95,18 +103,29 @@ appreciated.
|
|||||||
|
|
||||||
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
|
||||||
A "png_get_copyright" function is available, for convenient use in "about"
|
TRADEMARK:
|
||||||
boxes and the like:
|
|
||||||
|
|
||||||
printf("%s", png_get_copyright(NULL));
|
The name "libpng" has not been registered by the Copyright owner
|
||||||
|
as a trademark in any jurisdiction. However, because libpng has
|
||||||
|
been distributed and maintained world-wide, continually since 1995,
|
||||||
|
the Copyright owner claims "common-law trademark protection" in any
|
||||||
|
jurisdiction where common-law trademark is recognized.
|
||||||
|
|
||||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
OSI CERTIFICATION:
|
||||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
|
||||||
|
|
||||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||||
a certification mark of the Open Source Initiative. OSI has not addressed
|
a certification mark of the Open Source Initiative. OSI has not addressed
|
||||||
the additional disclaimers inserted at version 1.0.7.
|
the additional disclaimers inserted at version 1.0.7.
|
||||||
|
|
||||||
|
EXPORT CONTROL:
|
||||||
|
|
||||||
|
The Copyright owner believes that the Export Control Classification
|
||||||
|
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
controls or International Traffic in Arms Regulations (ITAR) because
|
||||||
|
it is open source, publicly available software, that does not contain
|
||||||
|
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||||
|
734.7(b).
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
January 15, 2016
|
January 5, 2017
|
||||||
|
@@ -1,13 +1,21 @@
|
|||||||
# Makefile.am:
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
# Source file for Makefile.in (and hence Makefile)
|
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.25 [September 1, 2016]
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I scripts
|
ACLOCAL_AMFLAGS = -I scripts
|
||||||
|
|
||||||
# test programs - run on make check, make distcheck
|
# test programs - run on make check, make distcheck
|
||||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage
|
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
||||||
|
if HAVE_CLOCK_GETTIME
|
||||||
|
check_PROGRAMS += timepng
|
||||||
|
endif
|
||||||
|
|
||||||
# Utilities - installed
|
# Utilities - installed
|
||||||
bin_PROGRAMS= pngfix png-fix-itxt
|
bin_PROGRAMS= pngfix png-fix-itxt
|
||||||
@@ -37,11 +45,17 @@ pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
|||||||
pngimage_SOURCES = contrib/libtests/pngimage.c
|
pngimage_SOURCES = contrib/libtests/pngimage.c
|
||||||
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
|
timepng_SOURCES = contrib/libtests/timepng.c
|
||||||
|
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
pngfix_SOURCES = contrib/tools/pngfix.c
|
pngfix_SOURCES = contrib/tools/pngfix.c
|
||||||
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||||
|
|
||||||
|
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||||
|
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
# Generally these are single line shell scripts to run a test with a particular
|
# Generally these are single line shell scripts to run a test with a particular
|
||||||
# set of parameters:
|
# set of parameters:
|
||||||
TESTS =\
|
TESTS =\
|
||||||
@@ -83,6 +97,11 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
|||||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if PNG_MIPS_MSA
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
|
||||||
|
mips/filter_msa_intrinsics.c
|
||||||
|
endif
|
||||||
|
|
||||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||||
@@ -219,6 +238,7 @@ contrib/libtests/timepng.o: pnglibconf.h
|
|||||||
|
|
||||||
contrib/tools/makesRGB.o: pnglibconf.h
|
contrib/tools/makesRGB.o: pnglibconf.h
|
||||||
contrib/tools/pngfix.o: pnglibconf.h
|
contrib/tools/pngfix.o: pnglibconf.h
|
||||||
|
contrib/tools/pngcp.o: pnglibconf.h
|
||||||
|
|
||||||
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
||||||
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
||||||
|
@@ -14,9 +14,14 @@
|
|||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
# Makefile.am:
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
# Source file for Makefile.in (and hence Makefile)
|
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.25 [September 1, 2016]
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -96,18 +101,23 @@ POST_UNINSTALL = :
|
|||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
check_PROGRAMS = pngtest$(EXEEXT) pngunknown$(EXEEXT) \
|
check_PROGRAMS = pngtest$(EXEEXT) pngunknown$(EXEEXT) \
|
||||||
pngstest$(EXEEXT) pngvalid$(EXEEXT) pngimage$(EXEEXT)
|
pngstest$(EXEEXT) pngvalid$(EXEEXT) pngimage$(EXEEXT) \
|
||||||
|
pngcp$(EXEEXT) $(am__EXEEXT_1)
|
||||||
|
@HAVE_CLOCK_GETTIME_TRUE@am__append_1 = timepng
|
||||||
bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT)
|
bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT)
|
||||||
@PNG_ARM_NEON_TRUE@am__append_1 = arm/arm_init.c\
|
@PNG_ARM_NEON_TRUE@am__append_2 = arm/arm_init.c\
|
||||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c
|
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||||
|
|
||||||
|
@PNG_MIPS_MSA_TRUE@am__append_3 = mips/mips_init.c\
|
||||||
|
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.c
|
||||||
|
|
||||||
|
|
||||||
# Versioned symbols and restricted exports
|
# Versioned symbols and restricted exports
|
||||||
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_TRUE@am__append_2 = -Wl,-M -Wl,libpng.vers
|
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_TRUE@am__append_4 = -Wl,-M -Wl,libpng.vers
|
||||||
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@am__append_3 = -Wl,--version-script=libpng.vers
|
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@am__append_5 = -Wl,--version-script=libpng.vers
|
||||||
# Only restricted exports when possible
|
# Only restricted exports when possible
|
||||||
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_4 = -export-symbols libpng.sym
|
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_6 = -export-symbols libpng.sym
|
||||||
@DO_PNG_PREFIX_TRUE@am__append_5 = -DPNG_PREFIX='@PNG_PREFIX@'
|
@DO_PNG_PREFIX_TRUE@am__append_7 = -DPNG_PREFIX='@PNG_PREFIX@'
|
||||||
subdir = .
|
subdir = .
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/scripts/libtool.m4 \
|
am__aclocal_m4_deps = $(top_srcdir)/scripts/libtool.m4 \
|
||||||
@@ -164,14 +174,18 @@ am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
|
|||||||
pngrtran.c pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c \
|
pngrtran.c pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c \
|
||||||
pngwtran.c pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h \
|
pngwtran.c pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h \
|
||||||
pngpriv.h pngstruct.h pngusr.dfa arm/arm_init.c \
|
pngpriv.h pngstruct.h pngusr.dfa arm/arm_init.c \
|
||||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||||
|
mips/mips_init.c mips/filter_msa_intrinsics.c
|
||||||
am__dirstamp = $(am__leading_dot)dirstamp
|
am__dirstamp = $(am__leading_dot)dirstamp
|
||||||
@PNG_ARM_NEON_TRUE@am__objects_1 = arm/arm_init.lo arm/filter_neon.lo \
|
@PNG_ARM_NEON_TRUE@am__objects_1 = arm/arm_init.lo arm/filter_neon.lo \
|
||||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo
|
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo
|
||||||
|
@PNG_MIPS_MSA_TRUE@am__objects_2 = mips/mips_init.lo \
|
||||||
|
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.lo
|
||||||
am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = png.lo pngerror.lo \
|
am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = png.lo pngerror.lo \
|
||||||
pngget.lo pngmem.lo pngpread.lo pngread.lo pngrio.lo \
|
pngget.lo pngmem.lo pngpread.lo pngread.lo pngrio.lo \
|
||||||
pngrtran.lo pngrutil.lo pngset.lo pngtrans.lo pngwio.lo \
|
pngrtran.lo pngrutil.lo pngset.lo pngtrans.lo pngwio.lo \
|
||||||
pngwrite.lo pngwtran.lo pngwutil.lo $(am__objects_1)
|
pngwrite.lo pngwtran.lo pngwutil.lo $(am__objects_1) \
|
||||||
|
$(am__objects_2)
|
||||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS =
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS =
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
|
||||||
$(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) \
|
$(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) \
|
||||||
@@ -185,10 +199,14 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) $(AM_V_lt) \
|
|||||||
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
|
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
|
||||||
$@
|
$@
|
||||||
|
@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = timepng$(EXEEXT)
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
am_png_fix_itxt_OBJECTS = contrib/tools/png-fix-itxt.$(OBJEXT)
|
am_png_fix_itxt_OBJECTS = contrib/tools/png-fix-itxt.$(OBJEXT)
|
||||||
png_fix_itxt_OBJECTS = $(am_png_fix_itxt_OBJECTS)
|
png_fix_itxt_OBJECTS = $(am_png_fix_itxt_OBJECTS)
|
||||||
png_fix_itxt_LDADD = $(LDADD)
|
png_fix_itxt_LDADD = $(LDADD)
|
||||||
|
am_pngcp_OBJECTS = contrib/tools/pngcp.$(OBJEXT)
|
||||||
|
pngcp_OBJECTS = $(am_pngcp_OBJECTS)
|
||||||
|
pngcp_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
am_pngfix_OBJECTS = contrib/tools/pngfix.$(OBJEXT)
|
am_pngfix_OBJECTS = contrib/tools/pngfix.$(OBJEXT)
|
||||||
pngfix_OBJECTS = $(am_pngfix_OBJECTS)
|
pngfix_OBJECTS = $(am_pngfix_OBJECTS)
|
||||||
pngfix_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngfix_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
@@ -207,6 +225,9 @@ pngunknown_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
|||||||
am_pngvalid_OBJECTS = contrib/libtests/pngvalid.$(OBJEXT)
|
am_pngvalid_OBJECTS = contrib/libtests/pngvalid.$(OBJEXT)
|
||||||
pngvalid_OBJECTS = $(am_pngvalid_OBJECTS)
|
pngvalid_OBJECTS = $(am_pngvalid_OBJECTS)
|
||||||
pngvalid_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngvalid_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
am_timepng_OBJECTS = contrib/libtests/timepng.$(OBJEXT)
|
||||||
|
timepng_OBJECTS = $(am_timepng_OBJECTS)
|
||||||
|
timepng_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
SCRIPTS = $(bin_SCRIPTS)
|
SCRIPTS = $(bin_SCRIPTS)
|
||||||
AM_V_P = $(am__v_P_@AM_V@)
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
@@ -254,14 +275,14 @@ am__v_CCLD_0 = @echo " CCLD " $@;
|
|||||||
am__v_CCLD_1 =
|
am__v_CCLD_1 =
|
||||||
SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
|
SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
|
||||||
$(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
|
$(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
|
||||||
$(png_fix_itxt_SOURCES) $(pngfix_SOURCES) $(pngimage_SOURCES) \
|
$(png_fix_itxt_SOURCES) $(pngcp_SOURCES) $(pngfix_SOURCES) \
|
||||||
$(pngstest_SOURCES) $(pngtest_SOURCES) $(pngunknown_SOURCES) \
|
$(pngimage_SOURCES) $(pngstest_SOURCES) $(pngtest_SOURCES) \
|
||||||
$(pngvalid_SOURCES)
|
$(pngunknown_SOURCES) $(pngvalid_SOURCES) $(timepng_SOURCES)
|
||||||
DIST_SOURCES = \
|
DIST_SOURCES = \
|
||||||
$(am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST) \
|
$(am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST) \
|
||||||
$(png_fix_itxt_SOURCES) $(pngfix_SOURCES) $(pngimage_SOURCES) \
|
$(png_fix_itxt_SOURCES) $(pngcp_SOURCES) $(pngfix_SOURCES) \
|
||||||
$(pngstest_SOURCES) $(pngtest_SOURCES) $(pngunknown_SOURCES) \
|
$(pngimage_SOURCES) $(pngstest_SOURCES) $(pngtest_SOURCES) \
|
||||||
$(pngvalid_SOURCES)
|
$(pngunknown_SOURCES) $(pngvalid_SOURCES) $(timepng_SOURCES)
|
||||||
am__can_run_installinfo = \
|
am__can_run_installinfo = \
|
||||||
case $$AM_UPDATE_INFO_DIR in \
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
n|no|NO) false;; \
|
n|no|NO) false;; \
|
||||||
@@ -664,9 +685,13 @@ pngunknown_SOURCES = contrib/libtests/pngunknown.c
|
|||||||
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
pngimage_SOURCES = contrib/libtests/pngimage.c
|
pngimage_SOURCES = contrib/libtests/pngimage.c
|
||||||
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
timepng_SOURCES = contrib/libtests/timepng.c
|
||||||
|
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
pngfix_SOURCES = contrib/tools/pngfix.c
|
pngfix_SOURCES = contrib/tools/pngfix.c
|
||||||
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||||
|
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||||
|
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
# Generally these are single line shell scripts to run a test with a particular
|
# Generally these are single line shell scripts to run a test with a particular
|
||||||
# set of parameters:
|
# set of parameters:
|
||||||
@@ -701,12 +726,12 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c \
|
|||||||
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c \
|
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c \
|
||||||
pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c \
|
pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c \
|
||||||
pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h \
|
pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h \
|
||||||
pngstruct.h pngusr.dfa $(am__append_1)
|
pngstruct.h pngusr.dfa $(am__append_2) $(am__append_3)
|
||||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
|
||||||
-export-dynamic -version-number \
|
-export-dynamic -version-number \
|
||||||
@PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0 \
|
@PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0 \
|
||||||
$(am__append_2) $(am__append_3) $(am__append_4)
|
$(am__append_4) $(am__append_5) $(am__append_6)
|
||||||
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||||
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
||||||
pkginclude_HEADERS = png.h pngconf.h
|
pkginclude_HEADERS = png.h pngconf.h
|
||||||
@@ -742,7 +767,7 @@ SUFFIXES = .chk .out
|
|||||||
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0' \
|
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0' \
|
||||||
-DPNGLIB_VERSION='@PNGLIB_VERSION@' \
|
-DPNGLIB_VERSION='@PNGLIB_VERSION@' \
|
||||||
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)' -DPNG_NO_USE_READ_MACROS \
|
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)' -DPNG_NO_USE_READ_MACROS \
|
||||||
-DPNG_BUILDING_SYMBOL_TABLE $(am__append_5)
|
-DPNG_BUILDING_SYMBOL_TABLE $(am__append_7)
|
||||||
|
|
||||||
# EXT_LIST is a list of the possibly library directory extensions, this exists
|
# EXT_LIST is a list of the possibly library directory extensions, this exists
|
||||||
# because we can't find a good way of discovering the file extensions that are
|
# because we can't find a good way of discovering the file extensions that are
|
||||||
@@ -851,6 +876,15 @@ arm/arm_init.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
|||||||
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
||||||
arm/$(DEPDIR)/$(am__dirstamp)
|
arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
mips/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) mips
|
||||||
|
@: > mips/$(am__dirstamp)
|
||||||
|
mips/$(DEPDIR)/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) mips/$(DEPDIR)
|
||||||
|
@: > mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
mips/mips_init.lo: mips/$(am__dirstamp) mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
mips/filter_msa_intrinsics.lo: mips/$(am__dirstamp) \
|
||||||
|
mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
|
||||||
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
|
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
|
||||||
@@ -924,6 +958,12 @@ contrib/tools/png-fix-itxt.$(OBJEXT): contrib/tools/$(am__dirstamp) \
|
|||||||
png-fix-itxt$(EXEEXT): $(png_fix_itxt_OBJECTS) $(png_fix_itxt_DEPENDENCIES) $(EXTRA_png_fix_itxt_DEPENDENCIES)
|
png-fix-itxt$(EXEEXT): $(png_fix_itxt_OBJECTS) $(png_fix_itxt_DEPENDENCIES) $(EXTRA_png_fix_itxt_DEPENDENCIES)
|
||||||
@rm -f png-fix-itxt$(EXEEXT)
|
@rm -f png-fix-itxt$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(png_fix_itxt_OBJECTS) $(png_fix_itxt_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(png_fix_itxt_OBJECTS) $(png_fix_itxt_LDADD) $(LIBS)
|
||||||
|
contrib/tools/pngcp.$(OBJEXT): contrib/tools/$(am__dirstamp) \
|
||||||
|
contrib/tools/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
|
||||||
|
pngcp$(EXEEXT): $(pngcp_OBJECTS) $(pngcp_DEPENDENCIES) $(EXTRA_pngcp_DEPENDENCIES)
|
||||||
|
@rm -f pngcp$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(pngcp_OBJECTS) $(pngcp_LDADD) $(LIBS)
|
||||||
contrib/tools/pngfix.$(OBJEXT): contrib/tools/$(am__dirstamp) \
|
contrib/tools/pngfix.$(OBJEXT): contrib/tools/$(am__dirstamp) \
|
||||||
contrib/tools/$(DEPDIR)/$(am__dirstamp)
|
contrib/tools/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
|
||||||
@@ -965,6 +1005,12 @@ contrib/libtests/pngvalid.$(OBJEXT): contrib/libtests/$(am__dirstamp) \
|
|||||||
pngvalid$(EXEEXT): $(pngvalid_OBJECTS) $(pngvalid_DEPENDENCIES) $(EXTRA_pngvalid_DEPENDENCIES)
|
pngvalid$(EXEEXT): $(pngvalid_OBJECTS) $(pngvalid_DEPENDENCIES) $(EXTRA_pngvalid_DEPENDENCIES)
|
||||||
@rm -f pngvalid$(EXEEXT)
|
@rm -f pngvalid$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(pngvalid_OBJECTS) $(pngvalid_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(pngvalid_OBJECTS) $(pngvalid_LDADD) $(LIBS)
|
||||||
|
contrib/libtests/timepng.$(OBJEXT): contrib/libtests/$(am__dirstamp) \
|
||||||
|
contrib/libtests/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
|
||||||
|
timepng$(EXEEXT): $(timepng_OBJECTS) $(timepng_DEPENDENCIES) $(EXTRA_timepng_DEPENDENCIES)
|
||||||
|
@rm -f timepng$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(timepng_OBJECTS) $(timepng_LDADD) $(LIBS)
|
||||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
|
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
|
||||||
@@ -1007,6 +1053,8 @@ mostlyclean-compile:
|
|||||||
-rm -f arm/*.lo
|
-rm -f arm/*.lo
|
||||||
-rm -f contrib/libtests/*.$(OBJEXT)
|
-rm -f contrib/libtests/*.$(OBJEXT)
|
||||||
-rm -f contrib/tools/*.$(OBJEXT)
|
-rm -f contrib/tools/*.$(OBJEXT)
|
||||||
|
-rm -f mips/*.$(OBJEXT)
|
||||||
|
-rm -f mips/*.lo
|
||||||
|
|
||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
@@ -1034,8 +1082,12 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngvalid.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngvalid.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/timepng.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/png-fix-itxt.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/png-fix-itxt.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngcp.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_msa_intrinsics.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/mips_init.Plo@am__quote@
|
||||||
|
|
||||||
.S.o:
|
.S.o:
|
||||||
@am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
@am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||||
@@ -1091,6 +1143,7 @@ mostlyclean-libtool:
|
|||||||
clean-libtool:
|
clean-libtool:
|
||||||
-rm -rf .libs _libs
|
-rm -rf .libs _libs
|
||||||
-rm -rf arm/.libs arm/_libs
|
-rm -rf arm/.libs arm/_libs
|
||||||
|
-rm -rf mips/.libs mips/_libs
|
||||||
|
|
||||||
distclean-libtool:
|
distclean-libtool:
|
||||||
-rm -f libtool config.lt
|
-rm -f libtool config.lt
|
||||||
@@ -1898,6 +1951,8 @@ distclean-generic:
|
|||||||
-rm -f contrib/libtests/$(am__dirstamp)
|
-rm -f contrib/libtests/$(am__dirstamp)
|
||||||
-rm -f contrib/tools/$(DEPDIR)/$(am__dirstamp)
|
-rm -f contrib/tools/$(DEPDIR)/$(am__dirstamp)
|
||||||
-rm -f contrib/tools/$(am__dirstamp)
|
-rm -f contrib/tools/$(am__dirstamp)
|
||||||
|
-rm -f mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
-rm -f mips/$(am__dirstamp)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@@ -1914,7 +1969,7 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
|
|||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR)
|
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR) mips/$(DEPDIR)
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
distclean-am: clean-am distclean-compile distclean-generic \
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
distclean-hdr distclean-libtool distclean-tags
|
distclean-hdr distclean-libtool distclean-tags
|
||||||
@@ -1966,7 +2021,7 @@ installcheck-am:
|
|||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-am
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
-rm -rf $(top_srcdir)/autom4te.cache
|
-rm -rf $(top_srcdir)/autom4te.cache
|
||||||
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR)
|
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR) mips/$(DEPDIR)
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
@@ -2090,6 +2145,7 @@ contrib/libtests/timepng.o: pnglibconf.h
|
|||||||
|
|
||||||
contrib/tools/makesRGB.o: pnglibconf.h
|
contrib/tools/makesRGB.o: pnglibconf.h
|
||||||
contrib/tools/pngfix.o: pnglibconf.h
|
contrib/tools/pngfix.o: pnglibconf.h
|
||||||
|
contrib/tools/pngcp.o: pnglibconf.h
|
||||||
|
|
||||||
.c.out:
|
.c.out:
|
||||||
rm -f $@ $*.tf[12]
|
rm -f $@ $*.tf[12]
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
README for libpng version 1.6.21 - January 15, 2016 (shared library 16.0)
|
README for libpng version 1.6.28 - January 5, 2017 (shared library 16.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
@@ -180,15 +180,18 @@ Files in this distribution:
|
|||||||
pngwutil.c => Write utility functions
|
pngwutil.c => Write utility functions
|
||||||
arm => Contains optimized code for the ARM platform
|
arm => Contains optimized code for the ARM platform
|
||||||
contrib => Contributions
|
contrib => Contributions
|
||||||
|
arm-neon => Optimized code for ARM-NEON platform
|
||||||
examples => Example programs
|
examples => Example programs
|
||||||
gregbook => source code for PNG reading and writing, from
|
gregbook => source code for PNG reading and writing, from
|
||||||
Greg Roelofs' "PNG: The Definitive Guide",
|
Greg Roelofs' "PNG: The Definitive Guide",
|
||||||
O'Reilly, 1999
|
O'Reilly, 1999
|
||||||
|
intel => Optimized code for INTEL-SSE2 platform
|
||||||
libtests => Test programs
|
libtests => Test programs
|
||||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||||
programs demonstrating use of pngusr.dfa
|
programs demonstrating use of pngusr.dfa
|
||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
|
testpngs
|
||||||
tools => Various tools
|
tools => Various tools
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for
|
projects => Contains project files and workspaces for
|
||||||
|
@@ -5,13 +5,14 @@ Final bug fixes.
|
|||||||
Better C++ wrapper/full C++ implementation?
|
Better C++ wrapper/full C++ implementation?
|
||||||
Fix problem with C++ and EXTERN "C".
|
Fix problem with C++ and EXTERN "C".
|
||||||
cHRM transformation.
|
cHRM transformation.
|
||||||
Remove setjmp/longjmp usage in favor of returning error codes.
|
Remove setjmp/longjmp usage in favor of returning error codes. As a start on
|
||||||
|
this, minimize the use of png_error(), replacing them with
|
||||||
|
png_warning(); return(0); or similar.
|
||||||
Palette creation.
|
Palette creation.
|
||||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
Improved dithering.
|
Improved dithering.
|
||||||
Multi-lingual error and warning message support.
|
Multi-lingual error and warning message support.
|
||||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||||
Make profile checking optional via a png_set_something() call.
|
|
||||||
Man pages for function calls.
|
Man pages for function calls.
|
||||||
Better documentation.
|
Better documentation.
|
||||||
Better filter selection
|
Better filter selection
|
||||||
@@ -23,7 +24,6 @@ Use greater precision when changing to linear gamma for compositing against
|
|||||||
background and doing rgb-to-gray transformation.
|
background and doing rgb-to-gray transformation.
|
||||||
Investigate pre-incremented loop counters and other loop constructions.
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
Add interpolated method of handling interlacing.
|
Add interpolated method of handling interlacing.
|
||||||
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
|
||||||
Extend pngvalid.c to validate more of the libpng transformations.
|
Extend pngvalid.c to validate more of the libpng transformations.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@@ -78,6 +78,15 @@
|
|||||||
/* Enable ARM Neon optimizations */
|
/* Enable ARM Neon optimizations */
|
||||||
#undef PNG_ARM_NEON_OPT
|
#undef PNG_ARM_NEON_OPT
|
||||||
|
|
||||||
|
/* Turn on MIPS MSA optimizations at run-time */
|
||||||
|
#undef PNG_MIPS_MSA_API_SUPPORTED
|
||||||
|
|
||||||
|
/* Check for MIPS MSA support at run-time */
|
||||||
|
#undef PNG_MIPS_MSA_CHECK_SUPPORTED
|
||||||
|
|
||||||
|
/* Enable MIPS MSA optimizations */
|
||||||
|
#undef PNG_MIPS_MSA_OPT
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#undef STDC_HEADERS
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
|
156
src/png/configure
vendored
156
src/png/configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for libpng 1.6.21.
|
# Generated by GNU Autoconf 2.69 for libpng 1.6.28.
|
||||||
#
|
#
|
||||||
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
||||||
#
|
#
|
||||||
@@ -590,8 +590,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='libpng'
|
PACKAGE_NAME='libpng'
|
||||||
PACKAGE_TARNAME='libpng'
|
PACKAGE_TARNAME='libpng'
|
||||||
PACKAGE_VERSION='1.6.21'
|
PACKAGE_VERSION='1.6.28'
|
||||||
PACKAGE_STRING='libpng 1.6.21'
|
PACKAGE_STRING='libpng 1.6.28'
|
||||||
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
@@ -635,6 +635,8 @@ ac_includes_default="\
|
|||||||
ac_subst_vars='am__EXEEXT_FALSE
|
ac_subst_vars='am__EXEEXT_FALSE
|
||||||
am__EXEEXT_TRUE
|
am__EXEEXT_TRUE
|
||||||
LTLIBOBJS
|
LTLIBOBJS
|
||||||
|
PNG_MIPS_MSA_FALSE
|
||||||
|
PNG_MIPS_MSA_TRUE
|
||||||
PNG_ARM_NEON_FALSE
|
PNG_ARM_NEON_FALSE
|
||||||
PNG_ARM_NEON_TRUE
|
PNG_ARM_NEON_TRUE
|
||||||
DO_INSTALL_LIBPNG_CONFIG_FALSE
|
DO_INSTALL_LIBPNG_CONFIG_FALSE
|
||||||
@@ -657,6 +659,8 @@ HAVE_LD_VERSION_SCRIPT_FALSE
|
|||||||
HAVE_LD_VERSION_SCRIPT_TRUE
|
HAVE_LD_VERSION_SCRIPT_TRUE
|
||||||
HAVE_SOLARIS_LD_FALSE
|
HAVE_SOLARIS_LD_FALSE
|
||||||
HAVE_SOLARIS_LD_TRUE
|
HAVE_SOLARIS_LD_TRUE
|
||||||
|
HAVE_CLOCK_GETTIME_FALSE
|
||||||
|
HAVE_CLOCK_GETTIME_TRUE
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
POW_LIB
|
POW_LIB
|
||||||
PNG_COPTS
|
PNG_COPTS
|
||||||
@@ -806,6 +810,7 @@ enable_unversioned_links
|
|||||||
enable_unversioned_libpng_pc
|
enable_unversioned_libpng_pc
|
||||||
enable_unversioned_libpng_config
|
enable_unversioned_libpng_config
|
||||||
enable_arm_neon
|
enable_arm_neon
|
||||||
|
enable_mips_msa
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
host_alias
|
host_alias
|
||||||
@@ -1360,7 +1365,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures libpng 1.6.21 to adapt to many kinds of systems.
|
\`configure' configures libpng 1.6.28 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1430,7 +1435,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of libpng 1.6.21:";;
|
short | recursive ) echo "Configuration of libpng 1.6.28:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1489,6 +1494,13 @@ Optional Features:
|
|||||||
call to png_set_option; yes/on: turn on
|
call to png_set_option; yes/on: turn on
|
||||||
unconditionally. If not specified: determined by the
|
unconditionally. If not specified: determined by the
|
||||||
compiler.
|
compiler.
|
||||||
|
--enable-mips-msa Enable MIPS MSA optimizations: =no/off, check, api,
|
||||||
|
yes/on: no/off: disable the optimizations; check:
|
||||||
|
use internal checking code (deprecated and poorly
|
||||||
|
supported); api: disable by default, enable by a
|
||||||
|
call to png_set_option; yes/on: turn on
|
||||||
|
unconditionally. If not specified: determined by the
|
||||||
|
compiler.
|
||||||
|
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||||
@@ -1591,7 +1603,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
libpng configure 1.6.21
|
libpng configure 1.6.28
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
@@ -1923,7 +1935,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by libpng $as_me 1.6.21, which was
|
It was created by libpng $as_me 1.6.28, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -2794,7 +2806,7 @@ fi
|
|||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='libpng'
|
PACKAGE='libpng'
|
||||||
VERSION='1.6.21'
|
VERSION='1.6.28'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
@@ -2888,7 +2900,7 @@ END
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# The following line causes --disable-maintainer-mode to be the default to
|
# The following line causes --disable-maintainer-mode to be the default to
|
||||||
# configure, this is necessary because libpng distributions cannot rely on the
|
# configure. This is necessary because libpng distributions cannot rely on the
|
||||||
# time stamps of the autotools generated files being correct
|
# time stamps of the autotools generated files being correct
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
|
||||||
@@ -2915,10 +2927,10 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PNGLIB_VERSION=1.6.21
|
PNGLIB_VERSION=1.6.28
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=6
|
PNGLIB_MINOR=6
|
||||||
PNGLIB_RELEASE=21
|
PNGLIB_RELEASE=28
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -12597,6 +12609,41 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
|
||||||
|
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
|
||||||
|
# This is incompatible with the new default mode, so we test for that and force the
|
||||||
|
# "-std=c89" compiler option:
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need to force back C standard to C89" >&5
|
||||||
|
$as_echo_n "checking if we need to force back C standard to C89... " >&6; }
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#define _POSIX_SOURCE 1
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
else
|
||||||
|
|
||||||
|
if test "x$GCC" != "xyes"; then
|
||||||
|
as_fn_error $? "Forcing back to C89 is required but the flags are only known for GCC" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
CFLAGS="$CFLAGS -std=c89"
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
|
||||||
$as_echo_n "checking for ANSI C header files... " >&6; }
|
$as_echo_n "checking for ANSI C header files... " >&6; }
|
||||||
@@ -13073,6 +13120,26 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Some later POSIX 1003.1 functions are required for test programs, failure here
|
||||||
|
# is soft (the corresponding test program is not built).
|
||||||
|
ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
|
||||||
|
if test "x$ac_cv_func_clock_gettime" = xyes; then :
|
||||||
|
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: not building timepng" >&5
|
||||||
|
$as_echo "$as_me: WARNING: not building timepng" >&2;}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$ac_cv_func_clock_gettime" = "yes"; then
|
||||||
|
HAVE_CLOCK_GETTIME_TRUE=
|
||||||
|
HAVE_CLOCK_GETTIME_FALSE='#'
|
||||||
|
else
|
||||||
|
HAVE_CLOCK_GETTIME_TRUE='#'
|
||||||
|
HAVE_CLOCK_GETTIME_FALSE=
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --with-zlib-prefix was given.
|
# Check whether --with-zlib-prefix was given.
|
||||||
if test "${with_zlib_prefix+set}" = set; then :
|
if test "${with_zlib_prefix+set}" = set; then :
|
||||||
withval=$with_zlib_prefix; ZPREFIX=${withval}
|
withval=$with_zlib_prefix; ZPREFIX=${withval}
|
||||||
@@ -13476,6 +13543,61 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# MIPS
|
||||||
|
# ===
|
||||||
|
#
|
||||||
|
# MIPS MSA (SIMD) support.
|
||||||
|
|
||||||
|
# Check whether --enable-mips-msa was given.
|
||||||
|
if test "${enable_mips_msa+set}" = set; then :
|
||||||
|
enableval=$enable_mips_msa; case "$enableval" in
|
||||||
|
no|off)
|
||||||
|
# disable the default enabling on __mips_msa systems:
|
||||||
|
|
||||||
|
$as_echo "#define PNG_MIPS_MSA_OPT 0" >>confdefs.h
|
||||||
|
|
||||||
|
# Prevent inclusion of the assembler files below:
|
||||||
|
enable_mips_msa=no;;
|
||||||
|
check)
|
||||||
|
|
||||||
|
$as_echo "#define PNG_MIPS_MSA_CHECK_SUPPORTED /**/" >>confdefs.h
|
||||||
|
;;
|
||||||
|
api)
|
||||||
|
|
||||||
|
$as_echo "#define PNG_MIPS_MSA_API_SUPPORTED /**/" >>confdefs.h
|
||||||
|
;;
|
||||||
|
yes|on)
|
||||||
|
|
||||||
|
$as_echo "#define PNG_MIPS_MSA_OPT 2" >>confdefs.h
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-mips-msa: please specify 'check' or 'api', if
|
||||||
|
you want the optimizations unconditionally pass '-mmsa -mfp64'
|
||||||
|
to the compiler." >&5
|
||||||
|
$as_echo "$as_me: WARNING: --enable-mips-msa: please specify 'check' or 'api', if
|
||||||
|
you want the optimizations unconditionally pass '-mmsa -mfp64'
|
||||||
|
to the compiler." >&2;};;
|
||||||
|
*)
|
||||||
|
as_fn_error $? "--enable-mips-msa=${enable_mips_msa}: invalid value" "$LINENO" 5
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
|
||||||
|
# where MIPS optimizations were explicitly requested (this allows a fallback if a
|
||||||
|
# future host CPU does not match 'mips*')
|
||||||
|
|
||||||
|
if test "$enable_mips_msa" != 'no' &&
|
||||||
|
case "$host_cpu" in
|
||||||
|
mipsel*|mips64el*) :;;
|
||||||
|
esac; then
|
||||||
|
PNG_MIPS_MSA_TRUE=
|
||||||
|
PNG_MIPS_MSA_FALSE='#'
|
||||||
|
else
|
||||||
|
PNG_MIPS_MSA_TRUE='#'
|
||||||
|
PNG_MIPS_MSA_FALSE=
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Extra options for compiler: $PNG_COPTS" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: Extra options for compiler: $PNG_COPTS" >&5
|
||||||
$as_echo "$as_me: Extra options for compiler: $PNG_COPTS" >&6;}
|
$as_echo "$as_me: Extra options for compiler: $PNG_COPTS" >&6;}
|
||||||
|
|
||||||
@@ -13626,6 +13748,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
|
|||||||
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
|
as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
if test -z "${HAVE_CLOCK_GETTIME_TRUE}" && test -z "${HAVE_CLOCK_GETTIME_FALSE}"; then
|
||||||
|
as_fn_error $? "conditional \"HAVE_CLOCK_GETTIME\" was never defined.
|
||||||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
fi
|
||||||
if test -z "${HAVE_SOLARIS_LD_TRUE}" && test -z "${HAVE_SOLARIS_LD_FALSE}"; then
|
if test -z "${HAVE_SOLARIS_LD_TRUE}" && test -z "${HAVE_SOLARIS_LD_FALSE}"; then
|
||||||
as_fn_error $? "conditional \"HAVE_SOLARIS_LD\" was never defined.
|
as_fn_error $? "conditional \"HAVE_SOLARIS_LD\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
@@ -13654,6 +13780,10 @@ if test -z "${PNG_ARM_NEON_TRUE}" && test -z "${PNG_ARM_NEON_FALSE}"; then
|
|||||||
as_fn_error $? "conditional \"PNG_ARM_NEON\" was never defined.
|
as_fn_error $? "conditional \"PNG_ARM_NEON\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
if test -z "${PNG_MIPS_MSA_TRUE}" && test -z "${PNG_MIPS_MSA_FALSE}"; then
|
||||||
|
as_fn_error $? "conditional \"PNG_MIPS_MSA\" was never defined.
|
||||||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
: "${CONFIG_STATUS=./config.status}"
|
: "${CONFIG_STATUS=./config.status}"
|
||||||
ac_write_fail=0
|
ac_write_fail=0
|
||||||
@@ -14051,7 +14181,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by libpng $as_me 1.6.21, which was
|
This file was extended by libpng $as_me 1.6.28, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -14117,7 +14247,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
libpng config.status 1.6.21
|
libpng config.status 1.6.28
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
# configure.ac
|
# configure.ac
|
||||||
|
|
||||||
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
|
# Last changed in libpng 1.6.25 [September 1, 2016]
|
||||||
|
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl
|
dnl
|
||||||
dnl Minor upgrades (compatible ABI): increment the package version
|
dnl Minor upgrades (compatible ABI): increment the package version
|
||||||
@@ -18,7 +25,7 @@ AC_PREREQ([2.68])
|
|||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
AC_INIT([libpng],[1.6.21],[png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng],[1.6.28],[png-mng-implement@lists.sourceforge.net])
|
||||||
AC_CONFIG_MACRO_DIR([scripts])
|
AC_CONFIG_MACRO_DIR([scripts])
|
||||||
|
|
||||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||||
@@ -29,7 +36,7 @@ AC_CONFIG_MACRO_DIR([scripts])
|
|||||||
# 1.13 is required for parallel tests
|
# 1.13 is required for parallel tests
|
||||||
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
|
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
|
||||||
# The following line causes --disable-maintainer-mode to be the default to
|
# The following line causes --disable-maintainer-mode to be the default to
|
||||||
# configure, this is necessary because libpng distributions cannot rely on the
|
# configure. This is necessary because libpng distributions cannot rely on the
|
||||||
# time stamps of the autotools generated files being correct
|
# time stamps of the autotools generated files being correct
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
@@ -39,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
|||||||
dnl AM_PREREQ([1.11.2])
|
dnl AM_PREREQ([1.11.2])
|
||||||
dnl stop configure from automagically running automake
|
dnl stop configure from automagically running automake
|
||||||
|
|
||||||
PNGLIB_VERSION=1.6.21
|
PNGLIB_VERSION=1.6.28
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=6
|
PNGLIB_MINOR=6
|
||||||
PNGLIB_RELEASE=21
|
PNGLIB_RELEASE=28
|
||||||
|
|
||||||
dnl End of version number stuff
|
dnl End of version number stuff
|
||||||
|
|
||||||
@@ -60,7 +67,7 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
|
dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
|
||||||
dnl compatible later version may be used
|
dnl compatible later version may be used
|
||||||
LT_INIT([win32-dll])
|
LT_INIT([win32-dll])
|
||||||
LT_PREREQ([2.4.2])
|
LT_PREREQ([2.4.2])
|
||||||
@@ -107,6 +114,25 @@ AC_ARG_ENABLE(werror,
|
|||||||
CFLAGS="$sav_CFLAGS"
|
CFLAGS="$sav_CFLAGS"
|
||||||
fi],)
|
fi],)
|
||||||
|
|
||||||
|
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
|
||||||
|
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
|
||||||
|
# This is incompatible with the new default mode, so we test for that and force the
|
||||||
|
# "-std=c89" compiler option:
|
||||||
|
AC_MSG_CHECKING([if we need to force back C standard to C89])
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([
|
||||||
|
[#define _POSIX_SOURCE 1]
|
||||||
|
[#include <stdio.h>]
|
||||||
|
])],
|
||||||
|
AC_MSG_RESULT(no),[
|
||||||
|
if test "x$GCC" != "xyes"; then
|
||||||
|
AC_MSG_ERROR(
|
||||||
|
[Forcing back to C89 is required but the flags are only known for GCC])
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
CFLAGS="$CFLAGS -std=c89"
|
||||||
|
])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
@@ -120,6 +146,12 @@ AC_C_RESTRICT
|
|||||||
AC_FUNC_STRTOD
|
AC_FUNC_STRTOD
|
||||||
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
||||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
||||||
|
|
||||||
|
# Some later POSIX 1003.1 functions are required for test programs, failure here
|
||||||
|
# is soft (the corresponding test program is not built).
|
||||||
|
AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
|
||||||
|
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
||||||
|
|
||||||
AC_ARG_WITH(zlib-prefix,
|
AC_ARG_WITH(zlib-prefix,
|
||||||
AS_HELP_STRING([[[--with-zlib-prefix]]],
|
AS_HELP_STRING([[[--with-zlib-prefix]]],
|
||||||
[prefix that may have been used in installed zlib]),
|
[prefix that may have been used in installed zlib]),
|
||||||
@@ -314,6 +346,51 @@ AM_CONDITIONAL([PNG_ARM_NEON],
|
|||||||
*) test "$enable_arm_neon" != '';;
|
*) test "$enable_arm_neon" != '';;
|
||||||
esac])
|
esac])
|
||||||
|
|
||||||
|
# MIPS
|
||||||
|
# ===
|
||||||
|
#
|
||||||
|
# MIPS MSA (SIMD) support.
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([mips-msa],
|
||||||
|
AS_HELP_STRING([[[--enable-mips-msa]]],
|
||||||
|
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
|
||||||
|
[no/off: disable the optimizations; check: use internal checking code]
|
||||||
|
[(deprecated and poorly supported); api: disable by default, enable by]
|
||||||
|
[a call to png_set_option; yes/on: turn on unconditionally.]
|
||||||
|
[If not specified: determined by the compiler.]),
|
||||||
|
[case "$enableval" in
|
||||||
|
no|off)
|
||||||
|
# disable the default enabling on __mips_msa systems:
|
||||||
|
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||||
|
[Disable MIPS MSA optimizations])
|
||||||
|
# Prevent inclusion of the assembler files below:
|
||||||
|
enable_mips_msa=no;;
|
||||||
|
check)
|
||||||
|
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
||||||
|
[Check for MIPS MSA support at run-time]);;
|
||||||
|
api)
|
||||||
|
AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
|
||||||
|
[Turn on MIPS MSA optimizations at run-time]);;
|
||||||
|
yes|on)
|
||||||
|
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
||||||
|
[Enable MIPS MSA optimizations])
|
||||||
|
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
|
||||||
|
[you want the optimizations unconditionally pass '-mmsa -mfp64']
|
||||||
|
[to the compiler.]);;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
||||||
|
esac])
|
||||||
|
|
||||||
|
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
|
||||||
|
# where MIPS optimizations were explicitly requested (this allows a fallback if a
|
||||||
|
# future host CPU does not match 'mips*')
|
||||||
|
|
||||||
|
AM_CONDITIONAL([PNG_MIPS_MSA],
|
||||||
|
[test "$enable_mips_msa" != 'no' &&
|
||||||
|
case "$host_cpu" in
|
||||||
|
mipsel*|mips64el*) :;;
|
||||||
|
esac])
|
||||||
|
|
||||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||||
|
|
||||||
# Config files, substituting as above
|
# Config files, substituting as above
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
#if 0 /* in case someone actually tries to compile this */
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng
|
/* example.c - an example of using libpng
|
||||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||||
* Maintained 1998-2014 Glenn Randers-Pehrson
|
* Maintained 1998-2016 Glenn Randers-Pehrson
|
||||||
* Maintained 1996, 1997 Andreas Dilger)
|
* Maintained 1996, 1997 Andreas Dilger)
|
||||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* To the extent possible under law, the authors have waived
|
* To the extent possible under law, the authors have waived
|
||||||
@@ -530,7 +530,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
|||||||
* see the png_read_row() method below:
|
* see the png_read_row() method below:
|
||||||
*/
|
*/
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
#else
|
#else /* !READ_INTERLACING */
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
#endif /* READ_INTERLACING */
|
#endif /* READ_INTERLACING */
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.6.21 - January 15, 2016
|
libpng version 1.6.28 - January 5, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||||
@@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.6.21 - January 15, 2016
|
libpng versions 0.97, January 1998, through 1.6.28 - January 5, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@@ -467,8 +467,9 @@ the default, use
|
|||||||
|
|
||||||
The values for png_set_crc_action() say how libpng is to handle CRC errors in
|
The values for png_set_crc_action() say how libpng is to handle CRC errors in
|
||||||
ancillary and critical chunks, and whether to use the data contained
|
ancillary and critical chunks, and whether to use the data contained
|
||||||
therein. Note that it is impossible to "discard" data in a critical
|
therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error
|
||||||
chunk.
|
is handled while reading the IDAT chunk. Note that it is impossible to
|
||||||
|
"discard" data in a critical chunk.
|
||||||
|
|
||||||
Choices for (int) crit_action are
|
Choices for (int) crit_action are
|
||||||
PNG_CRC_DEFAULT 0 error/quit
|
PNG_CRC_DEFAULT 0 error/quit
|
||||||
@@ -485,6 +486,9 @@ Choices for (int) ancil_action are
|
|||||||
PNG_CRC_QUIET_USE 4 quiet/use data
|
PNG_CRC_QUIET_USE 4 quiet/use data
|
||||||
PNG_CRC_NO_CHANGE 5 use the current value
|
PNG_CRC_NO_CHANGE 5 use the current value
|
||||||
|
|
||||||
|
When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32
|
||||||
|
checksums are not only ignored, but they are not evaluated.
|
||||||
|
|
||||||
Setting up callback code
|
Setting up callback code
|
||||||
|
|
||||||
You can set up a callback function to handle any unknown chunks in the
|
You can set up a callback function to handle any unknown chunks in the
|
||||||
@@ -559,7 +563,7 @@ non-interlaced case the row that was just handled is simply one less than the
|
|||||||
passed in row number, and pass will always be 0. For the interlaced case the
|
passed in row number, and pass will always be 0. For the interlaced case the
|
||||||
same applies unless the row value is 0, in which case the row just handled was
|
same applies unless the row value is 0, in which case the row just handled was
|
||||||
the last one from one of the preceding passes. Because interlacing may skip a
|
the last one from one of the preceding passes. Because interlacing may skip a
|
||||||
pass you cannot be sure that the preceding pass is just 'pass-1', if you really
|
pass you cannot be sure that the preceding pass is just 'pass-1'; if you really
|
||||||
need to know what the last pass is record (row,pass) from the callback and use
|
need to know what the last pass is record (row,pass) from the callback and use
|
||||||
the last recorded value each time.
|
the last recorded value each time.
|
||||||
|
|
||||||
@@ -2230,7 +2234,8 @@ is exactly the same. If you are planning on displaying the image
|
|||||||
after each pass, the "rectangle" effect is generally considered the
|
after each pass, the "rectangle" effect is generally considered the
|
||||||
better looking one.
|
better looking one.
|
||||||
|
|
||||||
If you only want the "sparkle" effect, just call png_read_rows() as
|
If you only want the "sparkle" effect, just call png_read_row() or
|
||||||
|
png_read_rows() as
|
||||||
normal, with the third parameter NULL. Make sure you make pass over
|
normal, with the third parameter NULL. Make sure you make pass over
|
||||||
the image number_of_passes times, and you don't change the data in the
|
the image number_of_passes times, and you don't change the data in the
|
||||||
rows between calls. You can change the locations of the data, just
|
rows between calls. You can change the locations of the data, just
|
||||||
@@ -2239,6 +2244,8 @@ pass, and assumes the data from previous passes is still valid.
|
|||||||
|
|
||||||
png_read_rows(png_ptr, row_pointers, NULL,
|
png_read_rows(png_ptr, row_pointers, NULL,
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
|
or
|
||||||
|
png_read_row(png_ptr, row_pointers, NULL);
|
||||||
|
|
||||||
If you only want the first effect (the rectangles), do the same as
|
If you only want the first effect (the rectangles), do the same as
|
||||||
before except pass the row buffer in the third parameter, and leave
|
before except pass the row buffer in the third parameter, and leave
|
||||||
@@ -2246,6 +2253,8 @@ the second parameter NULL.
|
|||||||
|
|
||||||
png_read_rows(png_ptr, NULL, row_pointers,
|
png_read_rows(png_ptr, NULL, row_pointers,
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
|
or
|
||||||
|
png_read_row(png_ptr, NULL, row_pointers);
|
||||||
|
|
||||||
If you don't want libpng to handle the interlacing details, just call
|
If you don't want libpng to handle the interlacing details, just call
|
||||||
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
|
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
|
||||||
@@ -2842,7 +2851,7 @@ filter types.
|
|||||||
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
|
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
|
||||||
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
|
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
|
||||||
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
|
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
|
||||||
PNG_ALL_FILTERS);
|
PNG_ALL_FILTERS | PNG_FAST_FILTERS);
|
||||||
|
|
||||||
If an application wants to start and stop using particular filters during
|
If an application wants to start and stop using particular filters during
|
||||||
compression, it should start out with all of the filters (to ensure that
|
compression, it should start out with all of the filters (to ensure that
|
||||||
@@ -4103,6 +4112,13 @@ be written:
|
|||||||
|
|
||||||
Write the image to the named file.
|
Write the image to the named file.
|
||||||
|
|
||||||
|
int png_image_write_to_memory (png_imagep image, void *memory,
|
||||||
|
png_alloc_size_t * PNG_RESTRICT memory_bytes,
|
||||||
|
int convert_to_8_bit, const void *buffer, ptrdiff_t row_stride,
|
||||||
|
const void *colormap));
|
||||||
|
|
||||||
|
Write the image to memory.
|
||||||
|
|
||||||
int png_image_write_to_stdio(png_imagep image, FILE *file,
|
int png_image_write_to_stdio(png_imagep image, FILE *file,
|
||||||
int convert_to_8_bit, const void *buffer,
|
int convert_to_8_bit, const void *buffer,
|
||||||
png_int_32 row_stride, const void *colormap)
|
png_int_32 row_stride, const void *colormap)
|
||||||
@@ -4380,8 +4396,9 @@ for any images with bit depths less than 8 bits/pixel.
|
|||||||
The 'method' parameter sets the main filtering method, which is
|
The 'method' parameter sets the main filtering method, which is
|
||||||
currently only '0' in the PNG 1.2 specification. The 'filters'
|
currently only '0' in the PNG 1.2 specification. The 'filters'
|
||||||
parameter sets which filter(s), if any, should be used for each
|
parameter sets which filter(s), if any, should be used for each
|
||||||
scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS
|
scanline. Possible values are PNG_ALL_FILTERS, PNG_NO_FILTERS,
|
||||||
to turn filtering on and off, respectively.
|
or PNG_FAST_FILTERS to turn filtering on and off, or to turn on
|
||||||
|
just the fast-decoding subset of filters, respectively.
|
||||||
|
|
||||||
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
||||||
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
||||||
@@ -4395,12 +4412,19 @@ means the first row must always be adaptively filtered, because libpng
|
|||||||
currently does not allocate the filter buffers until png_write_row()
|
currently does not allocate the filter buffers until png_write_row()
|
||||||
is called for the first time.)
|
is called for the first time.)
|
||||||
|
|
||||||
filters = PNG_FILTER_NONE | PNG_FILTER_SUB
|
filters = PNG_NO_FILTERS;
|
||||||
|
filters = PNG_ALL_FILTERS;
|
||||||
|
filters = PNG_FAST_FILTERS;
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
filters = PNG_FILTER_NONE | PNG_FILTER_SUB |
|
||||||
PNG_FILTER_UP | PNG_FILTER_AVG |
|
PNG_FILTER_UP | PNG_FILTER_AVG |
|
||||||
PNG_FILTER_PAETH | PNG_ALL_FILTERS;
|
PNG_FILTER_PAETH;
|
||||||
|
|
||||||
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
||||||
filters);
|
filters);
|
||||||
|
|
||||||
The second parameter can also be
|
The second parameter can also be
|
||||||
PNG_INTRAPIXEL_DIFFERENCING if you are
|
PNG_INTRAPIXEL_DIFFERENCING if you are
|
||||||
writing a PNG to be embedded in a MNG
|
writing a PNG to be embedded in a MNG
|
||||||
@@ -4775,7 +4799,8 @@ There are no substantial API changes between the non-deprecated parts of
|
|||||||
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
|
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
|
||||||
members of the main libpng control structures, png_struct and png_info,
|
members of the main libpng control structures, png_struct and png_info,
|
||||||
deprecated in earlier versions of libpng, has been completely removed from
|
deprecated in earlier versions of libpng, has been completely removed from
|
||||||
libpng 1.5.
|
libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
|
||||||
|
header files were created.
|
||||||
|
|
||||||
We no longer include zlib.h in png.h. The include statement has been moved
|
We no longer include zlib.h in png.h. The include statement has been moved
|
||||||
to pngstruct.h, where it is not accessible by applications. Applications that
|
to pngstruct.h, where it is not accessible by applications. Applications that
|
||||||
@@ -5015,6 +5040,7 @@ includes the following:
|
|||||||
png_image_free()
|
png_image_free()
|
||||||
write functions
|
write functions
|
||||||
png_image_write_to_file()
|
png_image_write_to_file()
|
||||||
|
png_image_write_to_memory()
|
||||||
png_image_write_to_stdio()
|
png_image_write_to_stdio()
|
||||||
|
|
||||||
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
|
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
|
||||||
@@ -5313,8 +5339,9 @@ with an even number of lower-case hex digits, and to make them unsigned
|
|||||||
We prefer to use underscores rather than camelCase in names, except
|
We prefer to use underscores rather than camelCase in names, except
|
||||||
for a few type names that we inherit from zlib.h.
|
for a few type names that we inherit from zlib.h.
|
||||||
|
|
||||||
We prefer "if (something != 0)" and "if (something == 0)"
|
We prefer "if (something != 0)" and "if (something == 0)" over
|
||||||
over "if (something)" and if "(!something)", respectively.
|
"if (something)" and if "(!something)", respectively, and for pointers
|
||||||
|
we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
|
||||||
|
|
||||||
We do not use the TAB character for indentation in the C sources.
|
We do not use the TAB character for indentation in the C sources.
|
||||||
|
|
||||||
@@ -5328,7 +5355,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
|||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.6.21 are Y2K compliant. It is my belief that earlier
|
upward through 1.6.28 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
|
112
src/png/libpng.3
112
src/png/libpng.3
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNG 3 "January 15, 2016"
|
.TH LIBPNG 3 "January 5, 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.28
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB
|
\fB
|
||||||
#include <png.h>\fP
|
#include <png.h>\fP
|
||||||
@@ -229,6 +229,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
|
|||||||
|
|
||||||
\fBint png_image_write_to_file (png_imagep \fP\fIimage\fP\fB, const char \fP\fI*file\fP\fB, int \fP\fIconvert_to_8bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap\fP\fB);\fP
|
\fBint png_image_write_to_file (png_imagep \fP\fIimage\fP\fB, const char \fP\fI*file\fP\fB, int \fP\fIconvert_to_8bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBint png_image_write_to_memory (png_imagep \fP\fIimage\fP\fB, void \fP\fI*memory\fP\fB, png_alloc_size_t * PNG_RESTRICT \fP\fImemory_bytes\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, const void \fI*colormap)\fP\fB);\fP
|
||||||
|
|
||||||
\fBint png_image_write_to_stdio (png_imagep \fP\fIimage\fP\fB, FILE \fP\fI*file\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap)\fP\fB);\fP
|
\fBint png_image_write_to_stdio (png_imagep \fP\fIimage\fP\fB, FILE \fP\fI*file\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap)\fP\fB);\fP
|
||||||
|
|
||||||
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
|
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
|
||||||
@@ -508,7 +510,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng-manual.txt - A description on how to use and modify libpng
|
libpng-manual.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.6.21 - January 15, 2016
|
libpng version 1.6.28 - January 5, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||||
@@ -519,7 +521,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.6.21 - January 15, 2016
|
libpng versions 0.97, January 1998, through 1.6.28 - January 5, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@@ -975,8 +977,9 @@ the default, use
|
|||||||
|
|
||||||
The values for png_set_crc_action() say how libpng is to handle CRC errors in
|
The values for png_set_crc_action() say how libpng is to handle CRC errors in
|
||||||
ancillary and critical chunks, and whether to use the data contained
|
ancillary and critical chunks, and whether to use the data contained
|
||||||
therein. Note that it is impossible to "discard" data in a critical
|
therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error
|
||||||
chunk.
|
is handled while reading the IDAT chunk. Note that it is impossible to
|
||||||
|
"discard" data in a critical chunk.
|
||||||
|
|
||||||
Choices for (int) crit_action are
|
Choices for (int) crit_action are
|
||||||
PNG_CRC_DEFAULT 0 error/quit
|
PNG_CRC_DEFAULT 0 error/quit
|
||||||
@@ -993,6 +996,9 @@ Choices for (int) ancil_action are
|
|||||||
PNG_CRC_QUIET_USE 4 quiet/use data
|
PNG_CRC_QUIET_USE 4 quiet/use data
|
||||||
PNG_CRC_NO_CHANGE 5 use the current value
|
PNG_CRC_NO_CHANGE 5 use the current value
|
||||||
|
|
||||||
|
When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32
|
||||||
|
checksums are not only ignored, but they are not evaluated.
|
||||||
|
|
||||||
.SS Setting up callback code
|
.SS Setting up callback code
|
||||||
|
|
||||||
You can set up a callback function to handle any unknown chunks in the
|
You can set up a callback function to handle any unknown chunks in the
|
||||||
@@ -1067,7 +1073,7 @@ non-interlaced case the row that was just handled is simply one less than the
|
|||||||
passed in row number, and pass will always be 0. For the interlaced case the
|
passed in row number, and pass will always be 0. For the interlaced case the
|
||||||
same applies unless the row value is 0, in which case the row just handled was
|
same applies unless the row value is 0, in which case the row just handled was
|
||||||
the last one from one of the preceding passes. Because interlacing may skip a
|
the last one from one of the preceding passes. Because interlacing may skip a
|
||||||
pass you cannot be sure that the preceding pass is just 'pass\-1', if you really
|
pass you cannot be sure that the preceding pass is just 'pass\-1'; if you really
|
||||||
need to know what the last pass is record (row,pass) from the callback and use
|
need to know what the last pass is record (row,pass) from the callback and use
|
||||||
the last recorded value each time.
|
the last recorded value each time.
|
||||||
|
|
||||||
@@ -2738,7 +2744,8 @@ is exactly the same. If you are planning on displaying the image
|
|||||||
after each pass, the "rectangle" effect is generally considered the
|
after each pass, the "rectangle" effect is generally considered the
|
||||||
better looking one.
|
better looking one.
|
||||||
|
|
||||||
If you only want the "sparkle" effect, just call png_read_rows() as
|
If you only want the "sparkle" effect, just call png_read_row() or
|
||||||
|
png_read_rows() as
|
||||||
normal, with the third parameter NULL. Make sure you make pass over
|
normal, with the third parameter NULL. Make sure you make pass over
|
||||||
the image number_of_passes times, and you don't change the data in the
|
the image number_of_passes times, and you don't change the data in the
|
||||||
rows between calls. You can change the locations of the data, just
|
rows between calls. You can change the locations of the data, just
|
||||||
@@ -2747,6 +2754,8 @@ pass, and assumes the data from previous passes is still valid.
|
|||||||
|
|
||||||
png_read_rows(png_ptr, row_pointers, NULL,
|
png_read_rows(png_ptr, row_pointers, NULL,
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
|
or
|
||||||
|
png_read_row(png_ptr, row_pointers, NULL);
|
||||||
|
|
||||||
If you only want the first effect (the rectangles), do the same as
|
If you only want the first effect (the rectangles), do the same as
|
||||||
before except pass the row buffer in the third parameter, and leave
|
before except pass the row buffer in the third parameter, and leave
|
||||||
@@ -2754,6 +2763,8 @@ the second parameter NULL.
|
|||||||
|
|
||||||
png_read_rows(png_ptr, NULL, row_pointers,
|
png_read_rows(png_ptr, NULL, row_pointers,
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
|
or
|
||||||
|
png_read_row(png_ptr, NULL, row_pointers);
|
||||||
|
|
||||||
If you don't want libpng to handle the interlacing details, just call
|
If you don't want libpng to handle the interlacing details, just call
|
||||||
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
|
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
|
||||||
@@ -3350,7 +3361,7 @@ filter types.
|
|||||||
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
|
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
|
||||||
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
|
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
|
||||||
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
|
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
|
||||||
PNG_ALL_FILTERS);
|
PNG_ALL_FILTERS | PNG_FAST_FILTERS);
|
||||||
|
|
||||||
If an application wants to start and stop using particular filters during
|
If an application wants to start and stop using particular filters during
|
||||||
compression, it should start out with all of the filters (to ensure that
|
compression, it should start out with all of the filters (to ensure that
|
||||||
@@ -4611,6 +4622,13 @@ be written:
|
|||||||
|
|
||||||
Write the image to the named file.
|
Write the image to the named file.
|
||||||
|
|
||||||
|
int png_image_write_to_memory (png_imagep image, void *memory,
|
||||||
|
png_alloc_size_t * PNG_RESTRICT memory_bytes,
|
||||||
|
int convert_to_8_bit, const void *buffer, ptrdiff_t row_stride,
|
||||||
|
const void *colormap));
|
||||||
|
|
||||||
|
Write the image to memory.
|
||||||
|
|
||||||
int png_image_write_to_stdio(png_imagep image, FILE *file,
|
int png_image_write_to_stdio(png_imagep image, FILE *file,
|
||||||
int convert_to_8_bit, const void *buffer,
|
int convert_to_8_bit, const void *buffer,
|
||||||
png_int_32 row_stride, const void *colormap)
|
png_int_32 row_stride, const void *colormap)
|
||||||
@@ -4888,8 +4906,9 @@ for any images with bit depths less than 8 bits/pixel.
|
|||||||
The 'method' parameter sets the main filtering method, which is
|
The 'method' parameter sets the main filtering method, which is
|
||||||
currently only '0' in the PNG 1.2 specification. The 'filters'
|
currently only '0' in the PNG 1.2 specification. The 'filters'
|
||||||
parameter sets which filter(s), if any, should be used for each
|
parameter sets which filter(s), if any, should be used for each
|
||||||
scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS
|
scanline. Possible values are PNG_ALL_FILTERS, PNG_NO_FILTERS,
|
||||||
to turn filtering on and off, respectively.
|
or PNG_FAST_FILTERS to turn filtering on and off, or to turn on
|
||||||
|
just the fast-decoding subset of filters, respectively.
|
||||||
|
|
||||||
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
||||||
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
||||||
@@ -4903,12 +4922,19 @@ means the first row must always be adaptively filtered, because libpng
|
|||||||
currently does not allocate the filter buffers until png_write_row()
|
currently does not allocate the filter buffers until png_write_row()
|
||||||
is called for the first time.)
|
is called for the first time.)
|
||||||
|
|
||||||
filters = PNG_FILTER_NONE | PNG_FILTER_SUB
|
filters = PNG_NO_FILTERS;
|
||||||
|
filters = PNG_ALL_FILTERS;
|
||||||
|
filters = PNG_FAST_FILTERS;
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
filters = PNG_FILTER_NONE | PNG_FILTER_SUB |
|
||||||
PNG_FILTER_UP | PNG_FILTER_AVG |
|
PNG_FILTER_UP | PNG_FILTER_AVG |
|
||||||
PNG_FILTER_PAETH | PNG_ALL_FILTERS;
|
PNG_FILTER_PAETH;
|
||||||
|
|
||||||
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
||||||
filters);
|
filters);
|
||||||
|
|
||||||
The second parameter can also be
|
The second parameter can also be
|
||||||
PNG_INTRAPIXEL_DIFFERENCING if you are
|
PNG_INTRAPIXEL_DIFFERENCING if you are
|
||||||
writing a PNG to be embedded in a MNG
|
writing a PNG to be embedded in a MNG
|
||||||
@@ -5283,7 +5309,8 @@ There are no substantial API changes between the non-deprecated parts of
|
|||||||
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
|
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
|
||||||
members of the main libpng control structures, png_struct and png_info,
|
members of the main libpng control structures, png_struct and png_info,
|
||||||
deprecated in earlier versions of libpng, has been completely removed from
|
deprecated in earlier versions of libpng, has been completely removed from
|
||||||
libpng 1.5.
|
libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
|
||||||
|
header files were created.
|
||||||
|
|
||||||
We no longer include zlib.h in png.h. The include statement has been moved
|
We no longer include zlib.h in png.h. The include statement has been moved
|
||||||
to pngstruct.h, where it is not accessible by applications. Applications that
|
to pngstruct.h, where it is not accessible by applications. Applications that
|
||||||
@@ -5523,6 +5550,7 @@ includes the following:
|
|||||||
png_image_free()
|
png_image_free()
|
||||||
write functions
|
write functions
|
||||||
png_image_write_to_file()
|
png_image_write_to_file()
|
||||||
|
png_image_write_to_memory()
|
||||||
png_image_write_to_stdio()
|
png_image_write_to_stdio()
|
||||||
|
|
||||||
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
|
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
|
||||||
@@ -5821,8 +5849,9 @@ with an even number of lower-case hex digits, and to make them unsigned
|
|||||||
We prefer to use underscores rather than camelCase in names, except
|
We prefer to use underscores rather than camelCase in names, except
|
||||||
for a few type names that we inherit from zlib.h.
|
for a few type names that we inherit from zlib.h.
|
||||||
|
|
||||||
We prefer "if (something != 0)" and "if (something == 0)"
|
We prefer "if (something != 0)" and "if (something == 0)" over
|
||||||
over "if (something)" and if "(!something)", respectively.
|
"if (something)" and if "(!something)", respectively, and for pointers
|
||||||
|
we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
|
||||||
|
|
||||||
We do not use the TAB character for indentation in the C sources.
|
We do not use the TAB character for indentation in the C sources.
|
||||||
|
|
||||||
@@ -5836,7 +5865,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
|||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.6.21 are Y2K compliant. It is my belief that earlier
|
upward through 1.6.28 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
@@ -5934,11 +5963,11 @@ the first widely used release:
|
|||||||
...
|
...
|
||||||
1.0.19 10 10019 10.so.0.19[.0]
|
1.0.19 10 10019 10.so.0.19[.0]
|
||||||
...
|
...
|
||||||
1.2.53 13 10253 12.so.0.53[.0]
|
1.2.57 13 10257 12.so.0.56[.0]
|
||||||
...
|
...
|
||||||
1.5.23 15 10523 15.so.15.23[.0]
|
1.5.28 15 10528 15.so.15.28[.0]
|
||||||
...
|
...
|
||||||
1.6.21 16 10621 16.so.16.21[.0]
|
1.6.28 16 10628 16.so.16.28[.0]
|
||||||
|
|
||||||
Henceforth the source version will match the shared-library minor
|
Henceforth the source version will match the shared-library minor
|
||||||
and patch numbers; the shared-library major version number will be
|
and patch numbers; the shared-library major version number will be
|
||||||
@@ -5994,7 +6023,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.6.21 - January 15, 2016:
|
Libpng version 1.6.28 - January 5, 2017:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||||
|
|
||||||
@@ -6019,8 +6048,8 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
|
libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
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
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
added to the list of Contributing Authors:
|
added to the list of Contributing Authors:
|
||||||
@@ -6031,6 +6060,7 @@ added to the list of Contributing Authors:
|
|||||||
Cosmin Truta
|
Cosmin Truta
|
||||||
Gilles Vollant
|
Gilles Vollant
|
||||||
James Yu
|
James Yu
|
||||||
|
Mandar Sahastrabuddhe
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
@@ -6041,6 +6071,10 @@ and with the following additions to the disclaimer:
|
|||||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
the user.
|
the user.
|
||||||
|
|
||||||
|
Some files in the "contrib" directory and some configure-generated
|
||||||
|
files that are distributed with libpng have other copyright owners and
|
||||||
|
are released under other open source licenses.
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
libpng-0.96, and are distributed according to the same disclaimer and
|
libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
@@ -6064,6 +6098,9 @@ Contributing Authors:
|
|||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
Tom Tanner
|
Tom Tanner
|
||||||
|
|
||||||
|
Some files in the "scripts" directory have other copyright owners
|
||||||
|
but are released under this license.
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
@@ -6104,6 +6141,29 @@ appreciated.
|
|||||||
|
|
||||||
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
|
||||||
|
TRADEMARK:
|
||||||
|
|
||||||
|
The name "libpng" has not been registered by the Copyright owner
|
||||||
|
as a trademark in any jurisdiction. However, because libpng has
|
||||||
|
been distributed and maintained world-wide, continually since 1995,
|
||||||
|
the Copyright owner claims "common-law trademark protection" in any
|
||||||
|
jurisdiction where common-law trademark is recognized.
|
||||||
|
|
||||||
|
OSI CERTIFICATION:
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
EXPORT CONTROL:
|
||||||
|
|
||||||
|
The Copyright owner believes that the Export Control Classification
|
||||||
|
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
controls or International Traffic in Arms Regulations (ITAR) because
|
||||||
|
it is open source, publicly available software, that does not contain
|
||||||
|
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||||
|
734.7(b).
|
||||||
|
|
||||||
A "png_get_copyright" function is available, for convenient use in "about"
|
A "png_get_copyright" function is available, for convenient use in "about"
|
||||||
boxes and the like:
|
boxes and the like:
|
||||||
|
|
||||||
@@ -6112,13 +6172,9 @@ boxes and the like:
|
|||||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
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.
|
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
January 15, 2016
|
January 5, 2017
|
||||||
|
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNGPF 3 "January 15, 2016"
|
.TH LIBPNGPF 3 "January 5, 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.28
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include \fI"pngpriv.h"
|
\fB#include \fI"pngpriv.h"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "January 15, 2016"
|
.TH PNG 5 "January 5, 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
|
|||||||
RFC 2083
|
RFC 2083
|
||||||
.IP
|
.IP
|
||||||
.br
|
.br
|
||||||
ftp://ds.internic.net/rfc/rfc2083.txt
|
http://www.ietf.org/rfc/rfc2083.txt
|
||||||
.br
|
.br
|
||||||
or (as a W3C Recommendation) at
|
or (as a W3C Recommendation) at
|
||||||
.br
|
.br
|
||||||
|
111
src/png/png.c
111
src/png/png.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
* Last changed in libpng 1.6.28 [January 5, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_21 Your_png_h_is_not_version_1_6_21;
|
typedef png_libpng_version_1_6_28 Your_png_h_is_not_version_1_6_28;
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* 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
|
* of the PNG file signature. If the PNG data is embedded into another
|
||||||
@@ -458,7 +458,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
|||||||
|
|
||||||
#ifdef PNG_TEXT_SUPPORTED
|
#ifdef PNG_TEXT_SUPPORTED
|
||||||
/* Free text item num or (if num == -1) all text items */
|
/* Free text item num or (if num == -1) all text items */
|
||||||
if (info_ptr->text != 0 &&
|
if (info_ptr->text != NULL &&
|
||||||
((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0)
|
((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0)
|
||||||
{
|
{
|
||||||
if (num != -1)
|
if (num != -1)
|
||||||
@@ -477,6 +477,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
|||||||
png_free(png_ptr, info_ptr->text);
|
png_free(png_ptr, info_ptr->text);
|
||||||
info_ptr->text = NULL;
|
info_ptr->text = NULL;
|
||||||
info_ptr->num_text = 0;
|
info_ptr->num_text = 0;
|
||||||
|
info_ptr->max_text = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -541,7 +542,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
|||||||
|
|
||||||
#ifdef PNG_sPLT_SUPPORTED
|
#ifdef PNG_sPLT_SUPPORTED
|
||||||
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
|
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
|
||||||
if (info_ptr->splt_palettes != 0 &&
|
if (info_ptr->splt_palettes != NULL &&
|
||||||
((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0)
|
((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0)
|
||||||
{
|
{
|
||||||
if (num != -1)
|
if (num != -1)
|
||||||
@@ -571,7 +572,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
if (info_ptr->unknown_chunks != 0 &&
|
if (info_ptr->unknown_chunks != NULL &&
|
||||||
((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0)
|
((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0)
|
||||||
{
|
{
|
||||||
if (num != -1)
|
if (num != -1)
|
||||||
@@ -617,7 +618,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
|||||||
/* Free any image bits attached to the info structure */
|
/* Free any image bits attached to the info structure */
|
||||||
if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
|
if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
|
||||||
{
|
{
|
||||||
if (info_ptr->row_pointers != 0)
|
if (info_ptr->row_pointers != NULL)
|
||||||
{
|
{
|
||||||
png_uint_32 row;
|
png_uint_32 row;
|
||||||
for (row = 0; row < info_ptr->height; row++)
|
for (row = 0; row < info_ptr->height; row++)
|
||||||
@@ -684,7 +685,7 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||||
{
|
{
|
||||||
png_save_uint_32(buf, i);
|
png_save_uint_32(buf, (png_uint_32)i);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -775,15 +776,15 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.21 - January 15, 2016" PNG_STRING_NEWLINE \
|
"libpng version 1.6.28 - January 5, 2017" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \
|
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
||||||
PNG_STRING_NEWLINE \
|
PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.6.21 - January 15, 2016\
|
return "libpng version 1.6.28 - January 5, 2017\
|
||||||
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
# endif
|
# endif
|
||||||
@@ -1931,8 +1932,8 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
static const png_byte D50_nCIEXYZ[12] =
|
static const png_byte D50_nCIEXYZ[12] =
|
||||||
{ 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d };
|
{ 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d };
|
||||||
|
|
||||||
int /* PRIVATE */
|
static int /* bool */
|
||||||
png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||||
png_const_charp name, png_uint_32 profile_length)
|
png_const_charp name, png_uint_32 profile_length)
|
||||||
{
|
{
|
||||||
if (profile_length < 132)
|
if (profile_length < 132)
|
||||||
@@ -1942,6 +1943,40 @@ png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||||
|
int /* PRIVATE */
|
||||||
|
png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||||
|
png_const_charp name, png_uint_32 profile_length)
|
||||||
|
{
|
||||||
|
if (!icc_check_length(png_ptr, colorspace, name, profile_length))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* This needs to be here because the 'normal' check is in
|
||||||
|
* png_decompress_chunk, yet this happens after the attempt to
|
||||||
|
* png_malloc_base the required data. We only need this on read; on write
|
||||||
|
* the caller supplies the profile buffer so libpng doesn't allocate it. See
|
||||||
|
* the call to icc_check_length below (the write case).
|
||||||
|
*/
|
||||||
|
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
|
else if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||||
|
png_ptr->user_chunk_malloc_max < profile_length)
|
||||||
|
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
||||||
|
"exceeds application limits");
|
||||||
|
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||||
|
else if (PNG_USER_CHUNK_MALLOC_MAX < profile_length)
|
||||||
|
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
||||||
|
"exceeds libpng limits");
|
||||||
|
# else /* !SET_USER_LIMITS */
|
||||||
|
/* This will get compiled out on all 32-bit and better systems. */
|
||||||
|
else if (PNG_SIZE_MAX < profile_length)
|
||||||
|
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
||||||
|
"exceeds system limits");
|
||||||
|
# endif /* !SET_USER_LIMITS */
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif /* READ_iCCP */
|
||||||
|
|
||||||
int /* PRIVATE */
|
int /* PRIVATE */
|
||||||
png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||||
png_const_charp name, png_uint_32 profile_length,
|
png_const_charp name, png_uint_32 profile_length,
|
||||||
@@ -2354,7 +2389,6 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
|
|||||||
|
|
||||||
return 0; /* no match */
|
return 0; /* no match */
|
||||||
}
|
}
|
||||||
#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
|
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_icc_set_sRGB(png_const_structrp png_ptr,
|
png_icc_set_sRGB(png_const_structrp png_ptr,
|
||||||
@@ -2363,12 +2397,11 @@ png_icc_set_sRGB(png_const_structrp png_ptr,
|
|||||||
/* Is this profile one of the known ICC sRGB profiles? If it is, just set
|
/* Is this profile one of the known ICC sRGB profiles? If it is, just set
|
||||||
* the sRGB information.
|
* the sRGB information.
|
||||||
*/
|
*/
|
||||||
#if PNG_sRGB_PROFILE_CHECKS >= 0
|
|
||||||
if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler) != 0)
|
if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler) != 0)
|
||||||
#endif
|
|
||||||
(void)png_colorspace_set_sRGB(png_ptr, colorspace,
|
(void)png_colorspace_set_sRGB(png_ptr, colorspace,
|
||||||
(int)/*already checked*/png_get_uint_32(profile+64));
|
(int)/*already checked*/png_get_uint_32(profile+64));
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
|
||||||
#endif /* sRGB */
|
#endif /* sRGB */
|
||||||
|
|
||||||
int /* PRIVATE */
|
int /* PRIVATE */
|
||||||
@@ -2379,13 +2412,13 @@ png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||||||
if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
|
if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (png_icc_check_length(png_ptr, colorspace, name, profile_length) != 0 &&
|
if (icc_check_length(png_ptr, colorspace, name, profile_length) != 0 &&
|
||||||
png_icc_check_header(png_ptr, colorspace, name, profile_length, profile,
|
png_icc_check_header(png_ptr, colorspace, name, profile_length, profile,
|
||||||
color_type) != 0 &&
|
color_type) != 0 &&
|
||||||
png_icc_check_tag_table(png_ptr, colorspace, name, profile_length,
|
png_icc_check_tag_table(png_ptr, colorspace, name, profile_length,
|
||||||
profile) != 0)
|
profile) != 0)
|
||||||
{
|
{
|
||||||
# ifdef PNG_sRGB_SUPPORTED
|
# if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
|
||||||
/* If no sRGB support, don't try storing sRGB information */
|
/* If no sRGB support, don't try storing sRGB information */
|
||||||
png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
|
png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
|
||||||
# endif
|
# endif
|
||||||
@@ -2497,7 +2530,7 @@ png_check_IHDR(png_const_structrp png_ptr,
|
|||||||
error = 1;
|
error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_gt(((width + 7) & (~7)),
|
if (png_gt(((width + 7) & (~7U)),
|
||||||
((PNG_SIZE_MAX
|
((PNG_SIZE_MAX
|
||||||
- 48 /* big_row_buf hack */
|
- 48 /* big_row_buf hack */
|
||||||
- 1) /* filter byte */
|
- 1) /* filter byte */
|
||||||
@@ -2908,7 +2941,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||||||
*/
|
*/
|
||||||
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
|
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
|
||||||
{
|
{
|
||||||
czero = -exp_b10; /* PLUS 2 digits: TOTAL 3 */
|
czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
|
||||||
exp_b10 = 0; /* Dot added below before first output. */
|
exp_b10 = 0; /* Dot added below before first output. */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3086,11 +3119,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||||||
if (exp_b10 < 0)
|
if (exp_b10 < 0)
|
||||||
{
|
{
|
||||||
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
|
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||||
uexp_b10 = -exp_b10;
|
uexp_b10 = (unsigned int)(-exp_b10);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
uexp_b10 = exp_b10;
|
uexp_b10 = (unsigned int)exp_b10;
|
||||||
|
|
||||||
cdigits = 0;
|
cdigits = 0;
|
||||||
|
|
||||||
@@ -3152,9 +3185,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
|||||||
|
|
||||||
/* Avoid overflow here on the minimum integer. */
|
/* Avoid overflow here on the minimum integer. */
|
||||||
if (fp < 0)
|
if (fp < 0)
|
||||||
*ascii++ = 45, num = -fp;
|
*ascii++ = 45, num = (png_uint_32)(-fp);
|
||||||
else
|
else
|
||||||
num = fp;
|
num = (png_uint_32)fp;
|
||||||
|
|
||||||
if (num <= 0x80000000) /* else overflowed */
|
if (num <= 0x80000000) /* else overflowed */
|
||||||
{
|
{
|
||||||
@@ -4092,9 +4125,9 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
|||||||
|
|
||||||
/* Remove any existing table; this copes with multiple calls to
|
/* Remove any existing table; this copes with multiple calls to
|
||||||
* png_read_update_info. The warning is because building the gamma tables
|
* png_read_update_info. The warning is because building the gamma tables
|
||||||
* multiple times is a performance hit - it's harmless but the ability to call
|
* multiple times is a performance hit - it's harmless but the ability to
|
||||||
* png_read_update_info() multiple times is new in 1.5.6 so it seems sensible
|
* call png_read_update_info() multiple times is new in 1.5.6 so it seems
|
||||||
* to warn if the app introduces such a hit.
|
* sensible to warn if the app introduces such a hit.
|
||||||
*/
|
*/
|
||||||
if (png_ptr->gamma_table != NULL || png_ptr->gamma_16_table != NULL)
|
if (png_ptr->gamma_table != NULL || png_ptr->gamma_16_table != NULL)
|
||||||
{
|
{
|
||||||
@@ -4105,7 +4138,8 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
|||||||
if (bit_depth <= 8)
|
if (bit_depth <= 8)
|
||||||
{
|
{
|
||||||
png_build_8bit_table(png_ptr, &png_ptr->gamma_table,
|
png_build_8bit_table(png_ptr, &png_ptr->gamma_table,
|
||||||
png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
|
png_ptr->screen_gamma > 0 ?
|
||||||
|
png_reciprocal2(png_ptr->colorspace.gamma,
|
||||||
png_ptr->screen_gamma) : PNG_FP_1);
|
png_ptr->screen_gamma) : PNG_FP_1);
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||||
@@ -4117,7 +4151,8 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
|||||||
png_reciprocal(png_ptr->colorspace.gamma));
|
png_reciprocal(png_ptr->colorspace.gamma));
|
||||||
|
|
||||||
png_build_8bit_table(png_ptr, &png_ptr->gamma_from_1,
|
png_build_8bit_table(png_ptr, &png_ptr->gamma_from_1,
|
||||||
png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
|
png_ptr->screen_gamma > 0 ?
|
||||||
|
png_reciprocal(png_ptr->screen_gamma) :
|
||||||
png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
|
png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
|
||||||
}
|
}
|
||||||
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
|
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
|
||||||
@@ -4148,8 +4183,8 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
|||||||
* pow(iv, gamma).
|
* pow(iv, gamma).
|
||||||
*
|
*
|
||||||
* Thus the gamma table consists of up to 256 256-entry tables. The table
|
* Thus the gamma table consists of up to 256 256-entry tables. The table
|
||||||
* is selected by the (8-gamma_shift) most significant of the low 8 bits of
|
* is selected by the (8-gamma_shift) most significant of the low 8 bits
|
||||||
* the color value then indexed by the upper 8 bits:
|
* of the color value then indexed by the upper 8 bits:
|
||||||
*
|
*
|
||||||
* table[low bits][high 8 bits]
|
* table[low bits][high 8 bits]
|
||||||
*
|
*
|
||||||
@@ -4182,8 +4217,8 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
|||||||
|
|
||||||
/* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
|
/* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
|
||||||
* PNG_COMPOSE). This effectively smashed the background calculation for
|
* PNG_COMPOSE). This effectively smashed the background calculation for
|
||||||
* 16-bit output because the 8-bit table assumes the result will be reduced
|
* 16-bit output because the 8-bit table assumes the result will be
|
||||||
* to 8 bits.
|
* reduced to 8 bits.
|
||||||
*/
|
*/
|
||||||
if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
|
if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
|
||||||
png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
|
png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
|
||||||
@@ -4225,11 +4260,11 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
|
|||||||
if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
|
if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
|
||||||
(option & 1) == 0)
|
(option & 1) == 0)
|
||||||
{
|
{
|
||||||
int mask = 3 << option;
|
png_uint_32 mask = 3 << option;
|
||||||
int setting = (2 + (onoff != 0)) << option;
|
png_uint_32 setting = (2 + (onoff != 0)) << option;
|
||||||
int current = png_ptr->options;
|
png_uint_32 current = png_ptr->options;
|
||||||
|
|
||||||
png_ptr->options = (png_byte)(((current & ~mask) | setting) & 0xff);
|
png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff);
|
||||||
|
|
||||||
return (current & mask) >> option;
|
return (current & mask) >> option;
|
||||||
}
|
}
|
||||||
|
270
src/png/png.h
270
src/png/png.h
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.21, January 15, 2016
|
* libpng version 1.6.28, January 5, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.21, January 15, 2016:
|
* libpng versions 0.97, January 1998, through 1.6.28, January 5, 2017:
|
||||||
* Glenn Randers-Pehrson.
|
* Glenn Randers-Pehrson.
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*/
|
*/
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
|
* libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
* derived from libpng-1.0.6, and are distributed according to the same
|
* 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
|
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
* added to the list of Contributing Authors:
|
* added to the list of Contributing Authors:
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
* Cosmin Truta
|
* Cosmin Truta
|
||||||
* Gilles Vollant
|
* Gilles Vollant
|
||||||
* James Yu
|
* James Yu
|
||||||
|
* Mandar Sahastrabuddhe
|
||||||
*
|
*
|
||||||
* and with the following additions to the disclaimer:
|
* and with the following additions to the disclaimer:
|
||||||
*
|
*
|
||||||
@@ -47,6 +48,10 @@
|
|||||||
* risk of satisfactory quality, performance, accuracy, and effort is with
|
* risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
* the user.
|
* the user.
|
||||||
*
|
*
|
||||||
|
* Some files in the "contrib" directory and some configure-generated
|
||||||
|
* files that are distributed with libpng have other copyright owners and
|
||||||
|
* are released under other open source licenses.
|
||||||
|
*
|
||||||
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
* libpng-0.96, and are distributed according to the same disclaimer and
|
* libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
@@ -70,6 +75,9 @@
|
|||||||
* Greg Roelofs
|
* Greg Roelofs
|
||||||
* Tom Tanner
|
* Tom Tanner
|
||||||
*
|
*
|
||||||
|
* Some files in the "scripts" directory have other copyright owners
|
||||||
|
* but are released under this license.
|
||||||
|
*
|
||||||
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
*
|
*
|
||||||
@@ -109,6 +117,29 @@
|
|||||||
* appreciated.
|
* appreciated.
|
||||||
*
|
*
|
||||||
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
*
|
||||||
|
* TRADEMARK:
|
||||||
|
*
|
||||||
|
* The name "libpng" has not been registered by the Copyright owner
|
||||||
|
* as a trademark in any jurisdiction. However, because libpng has
|
||||||
|
* been distributed and maintained world-wide, continually since 1995,
|
||||||
|
* the Copyright owner claims "common-law trademark protection" in any
|
||||||
|
* jurisdiction where common-law trademark is recognized.
|
||||||
|
*
|
||||||
|
* OSI CERTIFICATION:
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* EXPORT CONTROL:
|
||||||
|
*
|
||||||
|
* The Copyright owner believes that the Export Control Classification
|
||||||
|
* Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
* controls or International Traffic in Arms Regulations (ITAR) because
|
||||||
|
* it is open source, publicly available software, that does not contain
|
||||||
|
* any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||||
|
* 734.7(b).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -121,12 +152,6 @@
|
|||||||
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
* 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
|
* The contributing authors would like to thank all those who helped
|
||||||
* with testing, bug fixes, and patience. This wouldn't have been
|
* with testing, bug fixes, and patience. This wouldn't have been
|
||||||
@@ -182,11 +207,11 @@
|
|||||||
* ...
|
* ...
|
||||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.2.53 13 10253 12.so.0.53[.0]
|
* 1.2.57 13 10257 12.so.0.57[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.5.23 15 10523 15.so.15.23[.0]
|
* 1.5.28 15 10527 15.so.15.28[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.6.21 16 10621 16.so.16.21[.0]
|
* 1.6.28 16 10628 16.so.16.28[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
@@ -214,13 +239,13 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* January 15, 2016
|
* January 5, 2017
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.6.21 are Y2K compliant. It is my belief that
|
* upward through 1.6.28 are Y2K compliant. It is my belief that
|
||||||
* earlier versions were also Y2K compliant.
|
* earlier versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
@@ -282,9 +307,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.21"
|
#define PNG_LIBPNG_VER_STRING "1.6.28"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.28 - January 5, 2017\n"
|
||||||
" libpng version 1.6.21 - January 15, 2016\n"
|
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
@@ -292,7 +316,7 @@
|
|||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 21
|
#define PNG_LIBPNG_VER_RELEASE 28
|
||||||
|
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
@@ -323,7 +347,7 @@
|
|||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* 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
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10621 /* 1.6.21 */
|
#define PNG_LIBPNG_VER 10628 /* 1.6.28 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
@@ -433,7 +457,7 @@ extern "C" {
|
|||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_21;
|
typedef char* png_libpng_version_1_6_28;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
@@ -734,24 +758,22 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
|||||||
* data in the info_struct to be written into the output file. The values
|
* data in the info_struct to be written into the output file. The values
|
||||||
* of the PNG_INFO_<chunk> defines should NOT be changed.
|
* of the PNG_INFO_<chunk> defines should NOT be changed.
|
||||||
*/
|
*/
|
||||||
#define PNG_INFO_gAMA 0x0001
|
#define PNG_INFO_gAMA 0x0001U
|
||||||
#define PNG_INFO_sBIT 0x0002
|
#define PNG_INFO_sBIT 0x0002U
|
||||||
#define PNG_INFO_cHRM 0x0004
|
#define PNG_INFO_cHRM 0x0004U
|
||||||
#define PNG_INFO_PLTE 0x0008
|
#define PNG_INFO_PLTE 0x0008U
|
||||||
#define PNG_INFO_tRNS 0x0010
|
#define PNG_INFO_tRNS 0x0010U
|
||||||
#define PNG_INFO_bKGD 0x0020
|
#define PNG_INFO_bKGD 0x0020U
|
||||||
#define PNG_INFO_hIST 0x0040
|
#define PNG_INFO_hIST 0x0040U
|
||||||
#define PNG_INFO_pHYs 0x0080
|
#define PNG_INFO_pHYs 0x0080U
|
||||||
#define PNG_INFO_oFFs 0x0100
|
#define PNG_INFO_oFFs 0x0100U
|
||||||
#define PNG_INFO_tIME 0x0200
|
#define PNG_INFO_tIME 0x0200U
|
||||||
#define PNG_INFO_pCAL 0x0400
|
#define PNG_INFO_pCAL 0x0400U
|
||||||
#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
|
#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */
|
||||||
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
|
#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */
|
||||||
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
|
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
|
||||||
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
|
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
|
||||||
#if INT_MAX >= 0x8000 /* else this might break */
|
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
|
||||||
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This is used for the transformation routines, as some of them
|
/* This is used for the transformation routines, as some of them
|
||||||
* change these values for the row. It also should enable using
|
* change these values for the row. It also should enable using
|
||||||
@@ -1322,7 +1344,7 @@ PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||||
#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
|
#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
|
||||||
/* Strip the second byte of information from a 16-bit depth file. */
|
/* Strip the second byte of information from a 16-bit depth file. */
|
||||||
PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
|
PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
|
||||||
#endif
|
#endif
|
||||||
@@ -1473,8 +1495,8 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
|||||||
#define PNG_FILTER_UP 0x20
|
#define PNG_FILTER_UP 0x20
|
||||||
#define PNG_FILTER_AVG 0x40
|
#define PNG_FILTER_AVG 0x40
|
||||||
#define PNG_FILTER_PAETH 0x80
|
#define PNG_FILTER_PAETH 0x80
|
||||||
#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
|
#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
|
||||||
PNG_FILTER_AVG | PNG_FILTER_PAETH)
|
#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
|
||||||
|
|
||||||
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
|
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
|
||||||
* These defines should NOT be changed.
|
* These defines should NOT be changed.
|
||||||
@@ -1751,21 +1773,21 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
|||||||
#define PNG_SET_WILL_FREE_DATA 1
|
#define PNG_SET_WILL_FREE_DATA 1
|
||||||
#define PNG_USER_WILL_FREE_DATA 2
|
#define PNG_USER_WILL_FREE_DATA 2
|
||||||
/* Flags for png_ptr->free_me and info_ptr->free_me */
|
/* Flags for png_ptr->free_me and info_ptr->free_me */
|
||||||
#define PNG_FREE_HIST 0x0008
|
#define PNG_FREE_HIST 0x0008U
|
||||||
#define PNG_FREE_ICCP 0x0010
|
#define PNG_FREE_ICCP 0x0010U
|
||||||
#define PNG_FREE_SPLT 0x0020
|
#define PNG_FREE_SPLT 0x0020U
|
||||||
#define PNG_FREE_ROWS 0x0040
|
#define PNG_FREE_ROWS 0x0040U
|
||||||
#define PNG_FREE_PCAL 0x0080
|
#define PNG_FREE_PCAL 0x0080U
|
||||||
#define PNG_FREE_SCAL 0x0100
|
#define PNG_FREE_SCAL 0x0100U
|
||||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
# define PNG_FREE_UNKN 0x0200
|
# define PNG_FREE_UNKN 0x0200U
|
||||||
#endif
|
#endif
|
||||||
/* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */
|
/* PNG_FREE_LIST 0x0400U removed in 1.6.0 because it is ignored */
|
||||||
#define PNG_FREE_PLTE 0x1000
|
#define PNG_FREE_PLTE 0x1000U
|
||||||
#define PNG_FREE_TRNS 0x2000
|
#define PNG_FREE_TRNS 0x2000U
|
||||||
#define PNG_FREE_TEXT 0x4000
|
#define PNG_FREE_TEXT 0x4000U
|
||||||
#define PNG_FREE_ALL 0x7fff
|
#define PNG_FREE_ALL 0x7fffU
|
||||||
#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
|
#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
|
PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
|
||||||
@@ -2271,8 +2293,10 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
|
|||||||
* except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to
|
* except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to
|
||||||
* be processed by libpng.
|
* be processed by libpng.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
|
PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
|
||||||
int keep, png_const_bytep chunk_list, int num_chunks));
|
int keep, png_const_bytep chunk_list, int num_chunks));
|
||||||
|
#endif /* HANDLE_AS_UNKNOWN */
|
||||||
|
|
||||||
/* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned;
|
/* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned;
|
||||||
* the result is therefore true (non-zero) if special handling is required,
|
* the result is therefore true (non-zero) if special handling is required,
|
||||||
@@ -2280,7 +2304,7 @@ PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
|
|||||||
*/
|
*/
|
||||||
PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr,
|
PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr,
|
||||||
png_const_bytep chunk_name));
|
png_const_bytep chunk_name));
|
||||||
#endif
|
#endif /* SET_UNKNOWN_CHUNKS */
|
||||||
|
|
||||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr,
|
PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr,
|
||||||
@@ -2502,18 +2526,22 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
|||||||
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
|
||||||
|
|
||||||
# define png_composite(composite, fg, alpha, bg) \
|
# define png_composite(composite, fg, alpha, bg) \
|
||||||
{ png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
|
{ \
|
||||||
|
png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
|
||||||
* (png_uint_16)(alpha) \
|
* (png_uint_16)(alpha) \
|
||||||
+ (png_uint_16)(bg)*(png_uint_16)(255 \
|
+ (png_uint_16)(bg)*(png_uint_16)(255 \
|
||||||
- (png_uint_16)(alpha)) + 128); \
|
- (png_uint_16)(alpha)) + 128); \
|
||||||
(composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); }
|
(composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
|
||||||
|
}
|
||||||
|
|
||||||
# define png_composite_16(composite, fg, alpha, bg) \
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
|
{ \
|
||||||
|
png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
|
||||||
* (png_uint_32)(alpha) \
|
* (png_uint_32)(alpha) \
|
||||||
+ (png_uint_32)(bg)*(65535 \
|
+ (png_uint_32)(bg)*(65535 \
|
||||||
- (png_uint_32)(alpha)) + 32768); \
|
- (png_uint_32)(alpha)) + 32768); \
|
||||||
(composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); }
|
(composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); \
|
||||||
|
}
|
||||||
|
|
||||||
#else /* Standard method using integer division */
|
#else /* Standard method using integer division */
|
||||||
|
|
||||||
@@ -2889,12 +2917,19 @@ typedef struct
|
|||||||
* is the minimum 'row stride', the minimum count of components between each
|
* is the minimum 'row stride', the minimum count of components between each
|
||||||
* row. For a color-mapped image this is the minimum number of bytes in a
|
* row. For a color-mapped image this is the minimum number of bytes in a
|
||||||
* row.
|
* row.
|
||||||
|
*
|
||||||
|
* WARNING: this macro overflows for some images with more than one component
|
||||||
|
* and very large image widths. libpng will refuse to process an image where
|
||||||
|
* this macro would overflow.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
|
#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
|
||||||
(PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
|
(PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
|
||||||
/* Return the size, in bytes, of an image buffer given a png_image and a row
|
/* Return the size, in bytes, of an image buffer given a png_image and a row
|
||||||
* stride - the number of components to leave space for in each row.
|
* stride - the number of components to leave space for in each row.
|
||||||
|
*
|
||||||
|
* WARNING: this macro overflows a 32-bit integer for some large PNG images,
|
||||||
|
* libpng will refuse to process an image where such an overflow would occur.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_IMAGE_SIZE(image)\
|
#define PNG_IMAGE_SIZE(image)\
|
||||||
@@ -3015,7 +3050,6 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
|
|||||||
#endif /* SIMPLIFIED_READ */
|
#endif /* SIMPLIFIED_READ */
|
||||||
|
|
||||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
|
||||||
/* WRITE APIS
|
/* WRITE APIS
|
||||||
* ----------
|
* ----------
|
||||||
* For write you must initialize a png_image structure to describe the image to
|
* For write you must initialize a png_image structure to describe the image to
|
||||||
@@ -3032,6 +3066,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
|
|||||||
* values do not correspond to the colors in sRGB.
|
* values do not correspond to the colors in sRGB.
|
||||||
* colormap_entries: set to the number of entries in the color-map (0 to 256)
|
* colormap_entries: set to the number of entries in the color-map (0 to 256)
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||||
PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
|
PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
|
||||||
const char *file, int convert_to_8bit, const void *buffer,
|
const char *file, int convert_to_8bit, const void *buffer,
|
||||||
png_int_32 row_stride, const void *colormap));
|
png_int_32 row_stride, const void *colormap));
|
||||||
@@ -3041,8 +3076,9 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
|||||||
int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
|
int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
|
||||||
const void *colormap));
|
const void *colormap));
|
||||||
/* Write the image to the given (FILE*). */
|
/* Write the image to the given (FILE*). */
|
||||||
|
#endif /* SIMPLIFIED_WRITE_STDIO */
|
||||||
|
|
||||||
/* With both write APIs if image is in one of the linear formats with 16-bit
|
/* With all write APIs if image is in one of the linear formats with 16-bit
|
||||||
* data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
|
* data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
|
||||||
* gamma encoded according to the sRGB specification, otherwise a 16-bit linear
|
* gamma encoded according to the sRGB specification, otherwise a 16-bit linear
|
||||||
* encoded PNG file is written.
|
* encoded PNG file is written.
|
||||||
@@ -3054,13 +3090,103 @@ 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
|
* 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
|
* 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. If row_stride is zero,
|
* negative indicates a bottom-up row layout in the buffer. If row_stride is
|
||||||
* libpng will calculate it for you from the image width and number of channels.
|
* zero, libpng will calculate it for you from the image width and number of
|
||||||
|
* channels.
|
||||||
*
|
*
|
||||||
* Note that the write API does not support interlacing, sub-8-bit pixels, indexed
|
* Note that the write API does not support interlacing, sub-8-bit pixels or
|
||||||
* PNG (color_type 3) or most ancillary chunks.
|
* most ancillary chunks. If you need to write text chunks (e.g. for copyright
|
||||||
|
* notices) you need to use one of the other APIs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
|
||||||
|
png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit,
|
||||||
|
const void *buffer, png_int_32 row_stride, const void *colormap));
|
||||||
|
/* Write the image to the given memory buffer. The function both writes the
|
||||||
|
* whole PNG data stream to *memory and updates *memory_bytes with the count
|
||||||
|
* of bytes written.
|
||||||
|
*
|
||||||
|
* 'memory' may be NULL. In this case *memory_bytes is not read however on
|
||||||
|
* success the number of bytes which would have been written will still be
|
||||||
|
* stored in *memory_bytes. On failure *memory_bytes will contain 0.
|
||||||
|
*
|
||||||
|
* If 'memory' is not NULL it must point to memory[*memory_bytes] of
|
||||||
|
* writeable memory.
|
||||||
|
*
|
||||||
|
* If the function returns success memory[*memory_bytes] (if 'memory' is not
|
||||||
|
* NULL) contains the written PNG data. *memory_bytes will always be less
|
||||||
|
* than or equal to the original value.
|
||||||
|
*
|
||||||
|
* If the function returns false and *memory_bytes was not changed an error
|
||||||
|
* occured during write. If *memory_bytes was changed, or is not 0 if
|
||||||
|
* 'memory' was NULL, the write would have succeeded but for the memory
|
||||||
|
* buffer being too small. *memory_bytes contains the required number of
|
||||||
|
* bytes and will be bigger that the original value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
|
||||||
|
row_stride, colormap)\
|
||||||
|
png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
|
||||||
|
row_stride, colormap)
|
||||||
|
/* Return the amount of memory in 'size' required to compress this image.
|
||||||
|
* The png_image structure 'image' must be filled in as in the above
|
||||||
|
* function and must not be changed before the actual write call, the buffer
|
||||||
|
* and all other parameters must also be identical to that in the final
|
||||||
|
* write call. The 'size' variable need not be initialized.
|
||||||
|
*
|
||||||
|
* NOTE: the macro returns true/false, if false is returned 'size' will be
|
||||||
|
* set to zero and the write failed and probably will fail if tried again.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* You can pre-allocate the buffer by making sure it is of sufficient size
|
||||||
|
* regardless of the amount of compression achieved. The buffer size will
|
||||||
|
* always be bigger than the original image and it will never be filled. The
|
||||||
|
* following macros are provided to assist in allocating the buffer.
|
||||||
|
*/
|
||||||
|
#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
|
||||||
|
/* The number of uncompressed bytes in the PNG byte encoding of the image;
|
||||||
|
* uncompressing the PNG IDAT data will give this number of bytes.
|
||||||
|
*
|
||||||
|
* NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this
|
||||||
|
* macro can because of the extra bytes used in the PNG byte encoding. You
|
||||||
|
* need to avoid this macro if your image size approaches 2^30 in width or
|
||||||
|
* height. The same goes for the remainder of these macros; they all produce
|
||||||
|
* bigger numbers than the actual in-memory image size.
|
||||||
|
*/
|
||||||
|
#ifndef PNG_ZLIB_MAX_SIZE
|
||||||
|
# define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
|
||||||
|
/* An upper bound on the number of compressed bytes given 'b' uncompressed
|
||||||
|
* bytes. This is based on deflateBounds() in zlib; different
|
||||||
|
* implementations of zlib compression may conceivably produce more data so
|
||||||
|
* if your zlib implementation is not zlib itself redefine this macro
|
||||||
|
* appropriately.
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
|
||||||
|
PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
|
||||||
|
/* An upper bound on the size of the data in the PNG IDAT chunks. */
|
||||||
|
|
||||||
|
#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
|
||||||
|
((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
|
||||||
|
(((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
|
||||||
|
12U+3U*(image).colormap_entries/*PLTE data*/+\
|
||||||
|
(((image).format&PNG_FORMAT_FLAG_ALPHA)?\
|
||||||
|
12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
|
||||||
|
12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
|
||||||
|
/* A helper for the following macro; if your compiler cannot handle the
|
||||||
|
* following macro use this one with the result of
|
||||||
|
* PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
|
||||||
|
* compilers should handle this just fine.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PNG_IMAGE_PNG_SIZE_MAX(image)\
|
||||||
|
PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
|
||||||
|
/* An upper bound on the total length of the PNG data stream for 'image'.
|
||||||
|
* The result is of type png_alloc_size_t, on 32-bit systems this may
|
||||||
|
* overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
|
||||||
|
* run out of buffer space but return a corrected size which should work.
|
||||||
*/
|
*/
|
||||||
#endif /* STDIO */
|
|
||||||
#endif /* SIMPLIFIED_WRITE */
|
#endif /* SIMPLIFIED_WRITE */
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* END OF SIMPLIFIED API
|
* END OF SIMPLIFIED API
|
||||||
@@ -3094,7 +3220,11 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
|||||||
#endif
|
#endif
|
||||||
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
||||||
#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
|
#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
|
||||||
#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
|
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
||||||
|
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
||||||
|
#endif
|
||||||
|
#define PNG_IGNORE_ADLER32 8
|
||||||
|
#define PNG_OPTION_NEXT 10 /* Next option - numbers must be even */
|
||||||
|
|
||||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||||
@@ -3118,7 +3248,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
|||||||
* one to use is one more than this.)
|
* one to use is one more than this.)
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||||
PNG_EXPORT_LAST_ORDINAL(244);
|
PNG_EXPORT_LAST_ORDINAL(245);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.21, January 15, 2016
|
* libpng version 1.6.28, January 5, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -507,9 +507,9 @@
|
|||||||
# error "libpng requires a signed 32-bit (or more) type"
|
# error "libpng requires a signed 32-bit (or more) type"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UINT_MAX > 4294967294
|
#if UINT_MAX > 4294967294U
|
||||||
typedef unsigned int png_uint_32;
|
typedef unsigned int png_uint_32;
|
||||||
#elif ULONG_MAX > 4294967294
|
#elif ULONG_MAX > 4294967294U
|
||||||
typedef unsigned long int png_uint_32;
|
typedef unsigned long int png_uint_32;
|
||||||
#else
|
#else
|
||||||
# error "libpng requires an unsigned 32-bit (or more) type"
|
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -44,7 +44,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
if ((png_ptr->flags &
|
if ((png_ptr->flags &
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
|
||||||
{
|
{
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
@@ -573,7 +573,7 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
|
|||||||
{
|
{
|
||||||
# define fixed_message "fixed point overflow in "
|
# define fixed_message "fixed point overflow in "
|
||||||
# define fixed_message_ln ((sizeof fixed_message)-1)
|
# define fixed_message_ln ((sizeof fixed_message)-1)
|
||||||
int iin;
|
unsigned int iin;
|
||||||
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
||||||
memcpy(msg, fixed_message, fixed_message_ln);
|
memcpy(msg, fixed_message, fixed_message_ln);
|
||||||
iin = 0;
|
iin = 0;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -338,7 +338,7 @@ ppi_from_ppm(png_uint_32 ppm)
|
|||||||
png_fixed_point result;
|
png_fixed_point result;
|
||||||
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
|
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
|
||||||
5000) != 0)
|
5000) != 0)
|
||||||
return result;
|
return (png_uint_32)result;
|
||||||
|
|
||||||
/* Overflow. */
|
/* Overflow. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* libpng version 1.6.21, January 15, 2016 */
|
/* libpng version 1.6.28, January 5, 2017 */
|
||||||
|
|
||||||
/* Copyright (c) 1998-2016 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2016 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
@@ -107,6 +107,7 @@
|
|||||||
#define PNG_SIMPLIFIED_READ_SUPPORTED
|
#define PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||||
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||||
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
|
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
#define PNG_STDIO_SUPPORTED
|
#define PNG_STDIO_SUPPORTED
|
||||||
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
@@ -319,6 +320,7 @@
|
|||||||
#define png_image_finish_read wx_png_image_finish_read
|
#define png_image_finish_read wx_png_image_finish_read
|
||||||
#define png_image_free wx_png_image_free
|
#define png_image_free wx_png_image_free
|
||||||
#define png_image_write_to_file wx_png_image_write_to_file
|
#define png_image_write_to_file wx_png_image_write_to_file
|
||||||
|
#define png_image_write_to_memory wx_png_image_write_to_memory
|
||||||
#define png_image_write_to_stdio wx_png_image_write_to_stdio
|
#define png_image_write_to_stdio wx_png_image_write_to_stdio
|
||||||
#define png_info_init_3 wx_png_info_init_3
|
#define png_info_init_3 wx_png_info_init_3
|
||||||
#define png_init_io wx_png_init_io
|
#define png_init_io wx_png_init_io
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -109,7 +109,7 @@ static png_voidp
|
|||||||
png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
|
png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
|
||||||
size_t element_size)
|
size_t element_size)
|
||||||
{
|
{
|
||||||
png_alloc_size_t req = nelements; /* known to be > 0 */
|
png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */
|
||||||
|
|
||||||
if (req <= PNG_SIZE_MAX/element_size)
|
if (req <= PNG_SIZE_MAX/element_size)
|
||||||
return png_malloc_base(png_ptr, req * element_size);
|
return png_malloc_base(png_ptr, req * element_size);
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -210,13 +210,15 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
(png_ptr->mode & PNG_HAVE_PLTE) == 0)
|
(png_ptr->mode & PNG_HAVE_PLTE) == 0)
|
||||||
png_error(png_ptr, "Missing PLTE before IDAT");
|
png_error(png_ptr, "Missing PLTE before IDAT");
|
||||||
|
|
||||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
|
||||||
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
||||||
|
|
||||||
|
if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
||||||
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
|
||||||
if (png_ptr->push_length == 0)
|
if (png_ptr->push_length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||||
|
|
||||||
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
||||||
png_benign_error(png_ptr, "Too many IDATs found");
|
png_benign_error(png_ptr, "Too many IDATs found");
|
||||||
}
|
}
|
||||||
@@ -499,7 +501,10 @@ png_push_save_buffer(png_structrp png_ptr)
|
|||||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (old_buffer)
|
||||||
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||||
|
else if (png_ptr->save_buffer_size)
|
||||||
|
png_error(png_ptr, "save_buffer error");
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
png_ptr->save_buffer_max = new_max;
|
png_ptr->save_buffer_max = new_max;
|
||||||
}
|
}
|
||||||
@@ -678,8 +683,13 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
|
|||||||
png_ptr->pass > 6)
|
png_ptr->pass > 6)
|
||||||
png_warning(png_ptr, "Truncated compressed data in IDAT");
|
png_warning(png_ptr, "Truncated compressed data in IDAT");
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ret == Z_DATA_ERROR)
|
||||||
|
png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch");
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Decompression error in IDAT");
|
png_error(png_ptr, "Decompression error in IDAT");
|
||||||
|
}
|
||||||
|
|
||||||
/* Skip the check on unprocessed input */
|
/* Skip the check on unprocessed input */
|
||||||
return;
|
return;
|
||||||
|
@@ -55,18 +55,12 @@
|
|||||||
#define png_do_read_interlace wx_png_do_read_interlace
|
#define png_do_read_interlace wx_png_do_read_interlace
|
||||||
#define png_do_write_interlace wx_png_do_write_interlace
|
#define png_do_write_interlace wx_png_do_write_interlace
|
||||||
#define png_read_filter_row wx_png_read_filter_row
|
#define png_read_filter_row wx_png_read_filter_row
|
||||||
#define png_read_filter_row_up_neon wx_png_read_filter_row_up_neon
|
|
||||||
#define png_read_filter_row_sub3_neon wx_png_read_filter_row_sub3_neon
|
|
||||||
#define png_read_filter_row_sub4_neon wx_png_read_filter_row_sub4_neon
|
|
||||||
#define png_read_filter_row_avg3_neon wx_png_read_filter_row_avg3_neon
|
|
||||||
#define png_read_filter_row_avg4_neon wx_png_read_filter_row_avg4_neon
|
|
||||||
#define png_read_filter_row_paeth3_neon wx_png_read_filter_row_paeth3_neon
|
|
||||||
#define png_read_filter_row_paeth4_neon wx_png_read_filter_row_paeth4_neon
|
|
||||||
#define png_write_find_filter wx_png_write_find_filter
|
#define png_write_find_filter wx_png_write_find_filter
|
||||||
#define png_read_IDAT_data wx_png_read_IDAT_data
|
#define png_read_IDAT_data wx_png_read_IDAT_data
|
||||||
#define png_read_finish_IDAT wx_png_read_finish_IDAT
|
#define png_read_finish_IDAT wx_png_read_finish_IDAT
|
||||||
#define png_read_finish_row wx_png_read_finish_row
|
#define png_read_finish_row wx_png_read_finish_row
|
||||||
#define png_read_start_row wx_png_read_start_row
|
#define png_read_start_row wx_png_read_start_row
|
||||||
|
#define png_zlib_inflate wx_png_zlib_inflate
|
||||||
#define png_read_transform_info wx_png_read_transform_info
|
#define png_read_transform_info wx_png_read_transform_info
|
||||||
#define png_do_strip_channel wx_png_do_strip_channel
|
#define png_do_strip_channel wx_png_do_strip_channel
|
||||||
#define png_do_swap wx_png_do_swap
|
#define png_do_swap wx_png_do_swap
|
||||||
@@ -162,5 +156,4 @@
|
|||||||
#define png_safe_warning wx_png_safe_warning
|
#define png_safe_warning wx_png_safe_warning
|
||||||
#define png_safe_execute wx_png_safe_execute
|
#define png_safe_execute wx_png_safe_execute
|
||||||
#define png_image_error wx_png_image_error
|
#define png_image_error wx_png_image_error
|
||||||
#define png_init_filter_functions_neon wx_png_init_filter_functions_neon
|
|
||||||
#define png_check_keyword wx_png_check_keyword
|
#define png_check_keyword wx_png_check_keyword
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngpriv.h - private declarations for use inside libpng
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -182,6 +182,35 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
|
|
||||||
|
#ifndef PNG_MIPS_MSA_OPT
|
||||||
|
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||||
|
# define PNG_MIPS_MSA_OPT 2
|
||||||
|
# else
|
||||||
|
# define PNG_MIPS_MSA_OPT 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PNG_MIPS_MSA_OPT > 0
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
|
||||||
|
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||||
|
# if defined(__mips_msa)
|
||||||
|
# if defined(__clang__)
|
||||||
|
# elif defined(__GNUC__)
|
||||||
|
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
|
||||||
|
# define PNG_MIPS_MSA_IMPLEMENTATION 2
|
||||||
|
# endif /* no GNUC support */
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
# else /* !defined __mips_msa */
|
||||||
|
# define PNG_MIPS_MSA_IMPLEMENTATION 2
|
||||||
|
# endif /* __mips_msa */
|
||||||
|
# endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
|
||||||
|
|
||||||
|
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
||||||
|
# define PNG_MIPS_MSA_IMPLEMENTATION 1
|
||||||
|
# endif
|
||||||
|
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
||||||
|
|
||||||
|
|
||||||
/* Is this a build of a DLL where compilation of the object modules requires
|
/* Is this a build of a DLL where compilation of the object modules requires
|
||||||
* different preprocessor settings to those required for a simple library? If
|
* different preprocessor settings to those required for a simple library? If
|
||||||
* so PNG_BUILD_DLL must be set.
|
* so PNG_BUILD_DLL must be set.
|
||||||
@@ -504,7 +533,8 @@
|
|||||||
/* This implicitly assumes alignment is always to a power of 2. */
|
/* This implicitly assumes alignment is always to a power of 2. */
|
||||||
#ifdef png_alignof
|
#ifdef png_alignof
|
||||||
# define png_isaligned(ptr, type)\
|
# define png_isaligned(ptr, type)\
|
||||||
((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0)
|
(((type)((const char*)ptr-(const char*)0) & \
|
||||||
|
(type)(png_alignof(type)-1)) == 0)
|
||||||
#else
|
#else
|
||||||
# define png_isaligned(ptr, type) 0
|
# define png_isaligned(ptr, type) 0
|
||||||
#endif
|
#endif
|
||||||
@@ -521,92 +551,92 @@
|
|||||||
* are defined in png.h because they need to be visible to applications
|
* are defined in png.h because they need to be visible to applications
|
||||||
* that call png_set_unknown_chunk().
|
* that call png_set_unknown_chunk().
|
||||||
*/
|
*/
|
||||||
/* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */
|
/* #define PNG_HAVE_IHDR 0x01U (defined in png.h) */
|
||||||
/* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */
|
/* #define PNG_HAVE_PLTE 0x02U (defined in png.h) */
|
||||||
#define PNG_HAVE_IDAT 0x04
|
#define PNG_HAVE_IDAT 0x04U
|
||||||
/* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */
|
/* #define PNG_AFTER_IDAT 0x08U (defined in png.h) */
|
||||||
#define PNG_HAVE_IEND 0x10
|
#define PNG_HAVE_IEND 0x10U
|
||||||
/* 0x20 (unused) */
|
/* 0x20U (unused) */
|
||||||
/* 0x40 (unused) */
|
/* 0x40U (unused) */
|
||||||
/* 0x80 (unused) */
|
/* 0x80U (unused) */
|
||||||
#define PNG_HAVE_CHUNK_HEADER 0x100
|
#define PNG_HAVE_CHUNK_HEADER 0x100U
|
||||||
#define PNG_WROTE_tIME 0x200
|
#define PNG_WROTE_tIME 0x200U
|
||||||
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
|
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400U
|
||||||
#define PNG_BACKGROUND_IS_GRAY 0x800
|
#define PNG_BACKGROUND_IS_GRAY 0x800U
|
||||||
#define PNG_HAVE_PNG_SIGNATURE 0x1000
|
#define PNG_HAVE_PNG_SIGNATURE 0x1000U
|
||||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
|
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
|
||||||
/* 0x4000 (unused) */
|
/* 0x4000U (unused) */
|
||||||
#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
|
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
|
||||||
|
|
||||||
/* Flags for the transformations the PNG library does on the image data */
|
/* Flags for the transformations the PNG library does on the image data */
|
||||||
#define PNG_BGR 0x0001
|
#define PNG_BGR 0x0001U
|
||||||
#define PNG_INTERLACE 0x0002
|
#define PNG_INTERLACE 0x0002U
|
||||||
#define PNG_PACK 0x0004
|
#define PNG_PACK 0x0004U
|
||||||
#define PNG_SHIFT 0x0008
|
#define PNG_SHIFT 0x0008U
|
||||||
#define PNG_SWAP_BYTES 0x0010
|
#define PNG_SWAP_BYTES 0x0010U
|
||||||
#define PNG_INVERT_MONO 0x0020
|
#define PNG_INVERT_MONO 0x0020U
|
||||||
#define PNG_QUANTIZE 0x0040
|
#define PNG_QUANTIZE 0x0040U
|
||||||
#define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */
|
#define PNG_COMPOSE 0x0080U /* Was PNG_BACKGROUND */
|
||||||
#define PNG_BACKGROUND_EXPAND 0x0100
|
#define PNG_BACKGROUND_EXPAND 0x0100U
|
||||||
#define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */
|
#define PNG_EXPAND_16 0x0200U /* Added to libpng 1.5.2 */
|
||||||
#define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */
|
#define PNG_16_TO_8 0x0400U /* Becomes 'chop' in 1.5.4 */
|
||||||
#define PNG_RGBA 0x0800
|
#define PNG_RGBA 0x0800U
|
||||||
#define PNG_EXPAND 0x1000
|
#define PNG_EXPAND 0x1000U
|
||||||
#define PNG_GAMMA 0x2000
|
#define PNG_GAMMA 0x2000U
|
||||||
#define PNG_GRAY_TO_RGB 0x4000
|
#define PNG_GRAY_TO_RGB 0x4000U
|
||||||
#define PNG_FILLER 0x8000
|
#define PNG_FILLER 0x8000U
|
||||||
#define PNG_PACKSWAP 0x10000
|
#define PNG_PACKSWAP 0x10000U
|
||||||
#define PNG_SWAP_ALPHA 0x20000
|
#define PNG_SWAP_ALPHA 0x20000U
|
||||||
#define PNG_STRIP_ALPHA 0x40000
|
#define PNG_STRIP_ALPHA 0x40000U
|
||||||
#define PNG_INVERT_ALPHA 0x80000
|
#define PNG_INVERT_ALPHA 0x80000U
|
||||||
#define PNG_USER_TRANSFORM 0x100000
|
#define PNG_USER_TRANSFORM 0x100000U
|
||||||
#define PNG_RGB_TO_GRAY_ERR 0x200000
|
#define PNG_RGB_TO_GRAY_ERR 0x200000U
|
||||||
#define PNG_RGB_TO_GRAY_WARN 0x400000
|
#define PNG_RGB_TO_GRAY_WARN 0x400000U
|
||||||
#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
|
#define PNG_RGB_TO_GRAY 0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
|
||||||
#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */
|
#define PNG_ENCODE_ALPHA 0x800000U /* Added to libpng-1.5.4 */
|
||||||
#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
|
#define PNG_ADD_ALPHA 0x1000000U /* Added to libpng-1.2.7 */
|
||||||
#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
|
#define PNG_EXPAND_tRNS 0x2000000U /* Added to libpng-1.2.9 */
|
||||||
#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
|
#define PNG_SCALE_16_TO_8 0x4000000U /* Added to libpng-1.5.4 */
|
||||||
/* 0x8000000 unused */
|
/* 0x8000000U unused */
|
||||||
/* 0x10000000 unused */
|
/* 0x10000000U unused */
|
||||||
/* 0x20000000 unused */
|
/* 0x20000000U unused */
|
||||||
/* 0x40000000 unused */
|
/* 0x40000000U unused */
|
||||||
/* Flags for png_create_struct */
|
/* Flags for png_create_struct */
|
||||||
#define PNG_STRUCT_PNG 0x0001
|
#define PNG_STRUCT_PNG 0x0001U
|
||||||
#define PNG_STRUCT_INFO 0x0002
|
#define PNG_STRUCT_INFO 0x0002U
|
||||||
|
|
||||||
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
|
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
|
||||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
|
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U
|
||||||
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
|
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U /* Added to libpng-1.6.0 */
|
||||||
/* 0x0004 unused */
|
/* 0x0004U unused */
|
||||||
#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */
|
#define PNG_FLAG_ZSTREAM_ENDED 0x0008U /* Added to libpng-1.6.0 */
|
||||||
/* 0x0010 unused */
|
/* 0x0010U unused */
|
||||||
/* 0x0020 unused */
|
/* 0x0020U unused */
|
||||||
#define PNG_FLAG_ROW_INIT 0x0040
|
#define PNG_FLAG_ROW_INIT 0x0040U
|
||||||
#define PNG_FLAG_FILLER_AFTER 0x0080
|
#define PNG_FLAG_FILLER_AFTER 0x0080U
|
||||||
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
|
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U
|
||||||
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
|
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U
|
||||||
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
|
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400U
|
||||||
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
|
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U
|
||||||
#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
|
#define PNG_FLAG_ASSUME_sRGB 0x1000U /* Added to libpng-1.5.4 */
|
||||||
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
|
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U /* Added to libpng-1.5.4 */
|
||||||
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
|
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U /* Added to libpng-1.5.4 */
|
||||||
/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 */
|
/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */
|
||||||
/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 */
|
/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */
|
||||||
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000
|
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U
|
||||||
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000
|
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U
|
||||||
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000
|
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U
|
||||||
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000 /* Added to libpng-1.4.0 */
|
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */
|
||||||
#define PNG_FLAG_APP_WARNINGS_WARN 0x200000 /* Added to libpng-1.6.0 */
|
#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */
|
||||||
#define PNG_FLAG_APP_ERRORS_WARN 0x400000 /* Added to libpng-1.6.0 */
|
#define PNG_FLAG_APP_ERRORS_WARN 0x400000U /* Added to libpng-1.6.0 */
|
||||||
/* 0x800000 unused */
|
/* 0x800000U unused */
|
||||||
/* 0x1000000 unused */
|
/* 0x1000000U unused */
|
||||||
/* 0x2000000 unused */
|
/* 0x2000000U unused */
|
||||||
/* 0x4000000 unused */
|
/* 0x4000000U unused */
|
||||||
/* 0x8000000 unused */
|
/* 0x8000000U unused */
|
||||||
/* 0x10000000 unused */
|
/* 0x10000000U unused */
|
||||||
/* 0x20000000 unused */
|
/* 0x20000000U unused */
|
||||||
/* 0x40000000 unused */
|
/* 0x40000000U unused */
|
||||||
|
|
||||||
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
|
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
|
||||||
PNG_FLAG_CRC_ANCILLARY_NOWARN)
|
PNG_FLAG_CRC_ANCILLARY_NOWARN)
|
||||||
@@ -640,6 +670,24 @@
|
|||||||
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
|
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
|
||||||
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
|
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
|
||||||
|
|
||||||
|
/* This returns the number of trailing bits in the last byte of a row, 0 if the
|
||||||
|
* last byte is completely full of pixels. It is, in principle, (pixel_bits x
|
||||||
|
* width) % 8, but that would overflow for large 'width'. The second macro is
|
||||||
|
* the same except that it returns the number of unused bits in the last byte;
|
||||||
|
* (8-TRAILBITS), but 0 when TRAILBITS is 0.
|
||||||
|
*
|
||||||
|
* NOTE: these macros are intended to be self-evidently correct and never
|
||||||
|
* overflow on the assumption that pixel_bits is in the range 0..255. The
|
||||||
|
* arguments are evaluated only once and they can be signed (e.g. as a result of
|
||||||
|
* the integral promotions). The result of the expression always has type
|
||||||
|
* (png_uint_32), however the compiler always knows it is in the range 0..7.
|
||||||
|
*/
|
||||||
|
#define PNG_TRAILBITS(pixel_bits, width) \
|
||||||
|
(((pixel_bits) * ((width) % (png_uint_32)8)) % 8)
|
||||||
|
|
||||||
|
#define PNG_PADBITS(pixel_bits, width) \
|
||||||
|
((8 - PNG_TRAILBITS(pixel_bits, width)) % 8)
|
||||||
|
|
||||||
/* PNG_OUT_OF_RANGE returns true if value is outside the range
|
/* PNG_OUT_OF_RANGE returns true if value is outside the range
|
||||||
* ideal-delta..ideal+delta. Each argument is evaluated twice.
|
* ideal-delta..ideal+delta. Each argument is evaluated twice.
|
||||||
* "ideal" and "delta" should be constants, normally simple
|
* "ideal" and "delta" should be constants, normally simple
|
||||||
@@ -1174,6 +1222,7 @@ PNG_INTERNAL_FUNCTION(void,png_do_write_interlace,(png_row_infop row_info,
|
|||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop
|
||||||
row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY);
|
row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY);
|
||||||
|
|
||||||
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info,
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info,
|
||||||
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop
|
||||||
@@ -1188,6 +1237,24 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
|
|||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PNG_MIPS_MSA_OPT > 0
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
|
||||||
|
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
|
||||||
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Choose the best filter to use and filter the row data */
|
/* Choose the best filter to use and filter the row data */
|
||||||
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
||||||
@@ -1215,7 +1282,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
|||||||
/* Initialize the row buffers, etc. */
|
/* Initialize the row buffers, etc. */
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
||||||
|
|
||||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
#if ZLIB_VERNUM >= 0x1240
|
||||||
PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
|
PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
|
||||||
PNG_EMPTY);
|
PNG_EMPTY);
|
||||||
# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
|
# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
|
||||||
@@ -1492,9 +1559,11 @@ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_ICC,(png_const_structrp png_ptr,
|
|||||||
/* The 'name' is used for information only */
|
/* The 'name' is used for information only */
|
||||||
|
|
||||||
/* Routines for checking parts of an ICC profile. */
|
/* Routines for checking parts of an ICC profile. */
|
||||||
|
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
|
||||||
png_colorspacerp colorspace, png_const_charp name,
|
png_colorspacerp colorspace, png_const_charp name,
|
||||||
png_uint_32 profile_length), PNG_EMPTY);
|
png_uint_32 profile_length), PNG_EMPTY);
|
||||||
|
#endif /* READ_iCCP */
|
||||||
PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
|
||||||
png_colorspacerp colorspace, png_const_charp name,
|
png_colorspacerp colorspace, png_const_charp name,
|
||||||
png_uint_32 profile_length,
|
png_uint_32 profile_length,
|
||||||
@@ -1913,10 +1982,17 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
|||||||
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
|
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
|
||||||
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
|
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
|
||||||
*/
|
*/
|
||||||
|
# if PNG_ARM_NEON_OPT > 0
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PNG_MIPS_MSA_OPT > 0
|
||||||
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
|
||||||
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
||||||
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -127,7 +127,10 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
||||||
|
{
|
||||||
|
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||||
|
}
|
||||||
|
|
||||||
/* This should be a binary subdivision search or a hash for
|
/* This should be a binary subdivision search or a hash for
|
||||||
* matching the chunk name rather than a linear search.
|
* matching the chunk name rather than a linear search.
|
||||||
@@ -356,9 +359,9 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
{
|
{
|
||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
|
||||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
|
||||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
|
||||||
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
|
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
|
||||||
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
|
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
|
||||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||||
@@ -785,6 +788,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
png_uint_32 length = png_read_chunk_header(png_ptr);
|
png_uint_32 length = png_read_chunk_header(png_ptr);
|
||||||
png_uint_32 chunk_name = png_ptr->chunk_name;
|
png_uint_32 chunk_name = png_ptr->chunk_name;
|
||||||
|
|
||||||
|
if (chunk_name != png_IDAT)
|
||||||
|
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||||
|
|
||||||
if (chunk_name == png_IEND)
|
if (chunk_name == png_IEND)
|
||||||
png_handle_IEND(png_ptr, info_ptr, length);
|
png_handle_IEND(png_ptr, info_ptr, length);
|
||||||
|
|
||||||
@@ -799,9 +805,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
{
|
{
|
||||||
if (chunk_name == png_IDAT)
|
if (chunk_name == png_IDAT)
|
||||||
{
|
{
|
||||||
if ((length > 0) ||
|
if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
|
||||||
(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
|
|| (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
|
||||||
png_benign_error(png_ptr, "Too many IDATs found");
|
png_benign_error(png_ptr, ".Too many IDATs found");
|
||||||
}
|
}
|
||||||
png_handle_unknown(png_ptr, info_ptr, length, keep);
|
png_handle_unknown(png_ptr, info_ptr, length, keep);
|
||||||
if (chunk_name == png_PLTE)
|
if (chunk_name == png_PLTE)
|
||||||
@@ -812,10 +818,14 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||||||
else if (chunk_name == png_IDAT)
|
else if (chunk_name == png_IDAT)
|
||||||
{
|
{
|
||||||
/* Zero length IDATs are legal after the last IDAT has been
|
/* Zero length IDATs are legal after the last IDAT has been
|
||||||
* read, but not after other chunks have been read.
|
* read, but not after other chunks have been read. 1.6 does not
|
||||||
|
* always read all the deflate data; specifically it cannot be relied
|
||||||
|
* upon to read the Adler32 at the end. If it doesn't ignore IDAT
|
||||||
|
* chunks which are longer than zero as well:
|
||||||
*/
|
*/
|
||||||
if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
|
if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
|
||||||
png_benign_error(png_ptr, "Too many IDATs found");
|
|| (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
|
||||||
|
png_benign_error(png_ptr, "..Too many IDATs found");
|
||||||
|
|
||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
}
|
}
|
||||||
@@ -1020,8 +1030,7 @@ png_set_read_status_fn(png_structrp png_ptr, png_read_status_ptr read_row_fn)
|
|||||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms,
|
int transforms, voidp params)
|
||||||
voidp params)
|
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -1384,7 +1393,9 @@ png_image_read_header(png_voidp argument)
|
|||||||
png_structrp png_ptr = image->opaque->png_ptr;
|
png_structrp png_ptr = image->opaque->png_ptr;
|
||||||
png_inforp info_ptr = image->opaque->info_ptr;
|
png_inforp info_ptr = image->opaque->info_ptr;
|
||||||
|
|
||||||
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
png_set_benign_errors(png_ptr, 1/*warn*/);
|
png_set_benign_errors(png_ptr, 1/*warn*/);
|
||||||
|
#endif
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
/* Do this the fast way; just read directly out of png_struct. */
|
/* Do this the fast way; just read directly out of png_struct. */
|
||||||
@@ -1422,7 +1433,7 @@ png_image_read_header(png_voidp argument)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PNG_COLOR_TYPE_PALETTE:
|
case PNG_COLOR_TYPE_PALETTE:
|
||||||
cmap_entries = png_ptr->num_palette;
|
cmap_entries = (png_uint_32)png_ptr->num_palette;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1957,7 +1968,7 @@ make_gray_file_colormap(png_image_read_control *display)
|
|||||||
for (i=0; i<256; ++i)
|
for (i=0; i<256; ++i)
|
||||||
png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
|
png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
|
||||||
|
|
||||||
return i;
|
return (int)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1968,7 +1979,7 @@ make_gray_colormap(png_image_read_control *display)
|
|||||||
for (i=0; i<256; ++i)
|
for (i=0; i<256; ++i)
|
||||||
png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
|
png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
|
||||||
|
|
||||||
return i;
|
return (int)i;
|
||||||
}
|
}
|
||||||
#define PNG_GRAY_COLORMAP_ENTRIES 256
|
#define PNG_GRAY_COLORMAP_ENTRIES 256
|
||||||
|
|
||||||
@@ -2022,7 +2033,7 @@ make_ga_colormap(png_image_read_control *display)
|
|||||||
P_sRGB);
|
P_sRGB);
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return (int)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PNG_GA_COLORMAP_ENTRIES 256
|
#define PNG_GA_COLORMAP_ENTRIES 256
|
||||||
@@ -2047,7 +2058,7 @@ make_rgb_colormap(png_image_read_control *display)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return (int)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PNG_RGB_COLORMAP_ENTRIES 216
|
#define PNG_RGB_COLORMAP_ENTRIES 216
|
||||||
@@ -2095,7 +2106,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
|
|
||||||
else if (display->background == NULL /* no way to remove it */)
|
else if (display->background == NULL /* no way to remove it */)
|
||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"a background color must be supplied to remove alpha/transparency");
|
"background color must be supplied to remove alpha/transparency");
|
||||||
|
|
||||||
/* Get a copy of the background color (this avoids repeating the checks
|
/* Get a copy of the background color (this avoids repeating the checks
|
||||||
* below.) The encoding is 8-bit sRGB or 16-bit linear, depending on the
|
* below.) The encoding is 8-bit sRGB or 16-bit linear, depending on the
|
||||||
@@ -2240,7 +2251,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
||||||
png_error(png_ptr, "gray[16] color-map: too few entries");
|
png_error(png_ptr, "gray[16] color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_gray_colormap(display);
|
cmap_entries = (unsigned int)make_gray_colormap(display);
|
||||||
|
|
||||||
if (png_ptr->num_trans > 0)
|
if (png_ptr->num_trans > 0)
|
||||||
{
|
{
|
||||||
@@ -2338,7 +2349,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
|
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
|
||||||
png_error(png_ptr, "gray+alpha color-map: too few entries");
|
png_error(png_ptr, "gray+alpha color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_ga_colormap(display);
|
cmap_entries = (unsigned int)make_ga_colormap(display);
|
||||||
|
|
||||||
background_index = PNG_CMAP_GA_BACKGROUND;
|
background_index = PNG_CMAP_GA_BACKGROUND;
|
||||||
output_processing = PNG_CMAP_GA;
|
output_processing = PNG_CMAP_GA;
|
||||||
@@ -2372,7 +2383,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
||||||
png_error(png_ptr, "gray-alpha color-map: too few entries");
|
png_error(png_ptr, "gray-alpha color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_gray_colormap(display);
|
cmap_entries = (unsigned int)make_gray_colormap(display);
|
||||||
|
|
||||||
if (output_encoding == P_LINEAR)
|
if (output_encoding == P_LINEAR)
|
||||||
{
|
{
|
||||||
@@ -2420,8 +2431,8 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
background_index = i;
|
background_index = i;
|
||||||
png_create_colormap_entry(display, i++, back_r, back_g, back_b,
|
png_create_colormap_entry(display, i++, back_r, back_g, back_b,
|
||||||
#ifdef __COVERITY__
|
#ifdef __COVERITY__
|
||||||
/* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
|
/* Coverity claims that output_encoding
|
||||||
* here.
|
* cannot be 2 (P_LINEAR) here.
|
||||||
*/ 255U,
|
*/ 255U,
|
||||||
#else
|
#else
|
||||||
output_encoding == P_LINEAR ? 65535U : 255U,
|
output_encoding == P_LINEAR ? 65535U : 255U,
|
||||||
@@ -2511,7 +2522,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
|
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
|
||||||
png_error(png_ptr, "rgb[ga] color-map: too few entries");
|
png_error(png_ptr, "rgb[ga] color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_ga_colormap(display);
|
cmap_entries = (unsigned int)make_ga_colormap(display);
|
||||||
background_index = PNG_CMAP_GA_BACKGROUND;
|
background_index = PNG_CMAP_GA_BACKGROUND;
|
||||||
output_processing = PNG_CMAP_GA;
|
output_processing = PNG_CMAP_GA;
|
||||||
}
|
}
|
||||||
@@ -2537,12 +2548,12 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
png_ptr->num_trans > 0) &&
|
png_ptr->num_trans > 0) &&
|
||||||
png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
|
png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
|
||||||
{
|
{
|
||||||
cmap_entries = make_gray_file_colormap(display);
|
cmap_entries = (unsigned int)make_gray_file_colormap(display);
|
||||||
data_encoding = P_FILE;
|
data_encoding = P_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
cmap_entries = make_gray_colormap(display);
|
cmap_entries = (unsigned int)make_gray_colormap(display);
|
||||||
|
|
||||||
/* But if the input has alpha or transparency it must be removed
|
/* But if the input has alpha or transparency it must be removed
|
||||||
*/
|
*/
|
||||||
@@ -2630,7 +2641,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
|
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
|
||||||
png_error(png_ptr, "rgb+alpha color-map: too few entries");
|
png_error(png_ptr, "rgb+alpha color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_rgb_colormap(display);
|
cmap_entries = (unsigned int)make_rgb_colormap(display);
|
||||||
|
|
||||||
/* Add a transparent entry. */
|
/* Add a transparent entry. */
|
||||||
png_create_colormap_entry(display, cmap_entries, 255, 255,
|
png_create_colormap_entry(display, cmap_entries, 255, 255,
|
||||||
@@ -2679,7 +2690,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
|
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
|
||||||
png_error(png_ptr, "rgb-alpha color-map: too few entries");
|
png_error(png_ptr, "rgb-alpha color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_rgb_colormap(display);
|
cmap_entries = (unsigned int)make_rgb_colormap(display);
|
||||||
|
|
||||||
png_create_colormap_entry(display, cmap_entries, back_r,
|
png_create_colormap_entry(display, cmap_entries, back_r,
|
||||||
back_g, back_b, 0/*unused*/, output_encoding);
|
back_g, back_b, 0/*unused*/, output_encoding);
|
||||||
@@ -2764,7 +2775,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries)
|
if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries)
|
||||||
png_error(png_ptr, "rgb color-map: too few entries");
|
png_error(png_ptr, "rgb color-map: too few entries");
|
||||||
|
|
||||||
cmap_entries = make_rgb_colormap(display);
|
cmap_entries = (unsigned int)make_rgb_colormap(display);
|
||||||
output_processing = PNG_CMAP_RGB;
|
output_processing = PNG_CMAP_RGB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2788,11 +2799,11 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
|
|
||||||
output_processing = PNG_CMAP_NONE;
|
output_processing = PNG_CMAP_NONE;
|
||||||
data_encoding = P_FILE; /* Don't change from color-map indices */
|
data_encoding = P_FILE; /* Don't change from color-map indices */
|
||||||
cmap_entries = png_ptr->num_palette;
|
cmap_entries = (unsigned int)png_ptr->num_palette;
|
||||||
if (cmap_entries > 256)
|
if (cmap_entries > 256)
|
||||||
cmap_entries = 256;
|
cmap_entries = 256;
|
||||||
|
|
||||||
if (cmap_entries > image->colormap_entries)
|
if (cmap_entries > (unsigned int)image->colormap_entries)
|
||||||
png_error(png_ptr, "palette color-map: too few entries");
|
png_error(png_ptr, "palette color-map: too few entries");
|
||||||
|
|
||||||
for (i=0; i < cmap_entries; ++i)
|
for (i=0; i < cmap_entries; ++i)
|
||||||
@@ -2809,12 +2820,12 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
* on the sRGB color in 'back'.
|
* on the sRGB color in 'back'.
|
||||||
*/
|
*/
|
||||||
png_create_colormap_entry(display, i,
|
png_create_colormap_entry(display, i,
|
||||||
png_colormap_compose(display, colormap[i].red, P_FILE,
|
png_colormap_compose(display, colormap[i].red,
|
||||||
trans[i], back_r, output_encoding),
|
P_FILE, trans[i], back_r, output_encoding),
|
||||||
png_colormap_compose(display, colormap[i].green, P_FILE,
|
png_colormap_compose(display, colormap[i].green,
|
||||||
trans[i], back_g, output_encoding),
|
P_FILE, trans[i], back_g, output_encoding),
|
||||||
png_colormap_compose(display, colormap[i].blue, P_FILE,
|
png_colormap_compose(display, colormap[i].blue,
|
||||||
trans[i], back_b, output_encoding),
|
P_FILE, trans[i], back_b, output_encoding),
|
||||||
output_encoding == P_LINEAR ? trans[i] * 257U :
|
output_encoding == P_LINEAR ? trans[i] * 257U :
|
||||||
trans[i],
|
trans[i],
|
||||||
output_encoding);
|
output_encoding);
|
||||||
@@ -2904,7 +2915,7 @@ png_image_read_colormap(png_voidp argument)
|
|||||||
png_error(png_ptr, "bad background index (internal error)");
|
png_error(png_ptr, "bad background index (internal error)");
|
||||||
}
|
}
|
||||||
|
|
||||||
display->colormap_processing = output_processing;
|
display->colormap_processing = (int)output_processing;
|
||||||
|
|
||||||
return 1/*ok*/;
|
return 1/*ok*/;
|
||||||
}
|
}
|
||||||
@@ -3213,14 +3224,14 @@ png_image_read_colormapped(png_voidp argument)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_alloc_size_t row_bytes = display->row_bytes;
|
png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
|
||||||
|
|
||||||
while (--passes >= 0)
|
while (--passes >= 0)
|
||||||
{
|
{
|
||||||
png_uint_32 y = image->height;
|
png_uint_32 y = image->height;
|
||||||
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
||||||
|
|
||||||
while (y-- > 0)
|
for (; y > 0; --y)
|
||||||
{
|
{
|
||||||
png_read_row(png_ptr, row, NULL);
|
png_read_row(png_ptr, row, NULL);
|
||||||
row += row_bytes;
|
row += row_bytes;
|
||||||
@@ -3423,8 +3434,7 @@ png_image_read_background(png_voidp argument)
|
|||||||
|
|
||||||
for (pass = 0; pass < passes; ++pass)
|
for (pass = 0; pass < passes; ++pass)
|
||||||
{
|
{
|
||||||
png_bytep row = png_voidcast(png_bytep,
|
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
||||||
display->first_row);
|
|
||||||
unsigned int startx, stepx, stepy;
|
unsigned int startx, stepx, stepy;
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
|
|
||||||
@@ -3549,8 +3559,9 @@ png_image_read_background(png_voidp argument)
|
|||||||
* stride which was multiplied by 2 (below) to get row_bytes.
|
* stride which was multiplied by 2 (below) to get row_bytes.
|
||||||
*/
|
*/
|
||||||
ptrdiff_t step_row = display->row_bytes / 2;
|
ptrdiff_t step_row = display->row_bytes / 2;
|
||||||
int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
|
unsigned int preserve_alpha = (image->format &
|
||||||
unsigned int outchannels = 1+preserve_alpha;
|
PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||||
|
unsigned int outchannels = 1U+preserve_alpha;
|
||||||
int swap_alpha = 0;
|
int swap_alpha = 0;
|
||||||
|
|
||||||
# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||||
@@ -4047,14 +4058,14 @@ png_image_read_direct(png_voidp argument)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_alloc_size_t row_bytes = display->row_bytes;
|
png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
|
||||||
|
|
||||||
while (--passes >= 0)
|
while (--passes >= 0)
|
||||||
{
|
{
|
||||||
png_uint_32 y = image->height;
|
png_uint_32 y = image->height;
|
||||||
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
||||||
|
|
||||||
while (y-- > 0)
|
for (; y > 0; --y)
|
||||||
{
|
{
|
||||||
png_read_row(png_ptr, row, NULL);
|
png_read_row(png_ptr, row, NULL);
|
||||||
row += row_bytes;
|
row += row_bytes;
|
||||||
@@ -4070,20 +4081,57 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
|||||||
void *buffer, png_int_32 row_stride, void *colormap)
|
void *buffer, png_int_32 row_stride, void *colormap)
|
||||||
{
|
{
|
||||||
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
||||||
|
{
|
||||||
|
/* Check for row_stride overflow. This check is not performed on the
|
||||||
|
* original PNG format because it may not occur in the output PNG format
|
||||||
|
* and libpng deals with the issues of reading the original.
|
||||||
|
*/
|
||||||
|
const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
|
||||||
|
|
||||||
|
/* The following checks just the 'row_stride' calculation to ensure it
|
||||||
|
* fits in a signed 32-bit value. Because channels/components can be
|
||||||
|
* either 1 or 2 bytes in size the length of a row can still overflow 32
|
||||||
|
* bits; this is just to verify that the 'row_stride' argument can be
|
||||||
|
* represented.
|
||||||
|
*/
|
||||||
|
if (image->width <= 0x7fffffffU/channels) /* no overflow */
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
|
const png_uint_32 png_row_stride = image->width * channels;
|
||||||
|
|
||||||
if (row_stride == 0)
|
if (row_stride == 0)
|
||||||
row_stride = PNG_IMAGE_ROW_STRIDE(*image);
|
row_stride = (png_int_32)/*SAFE*/png_row_stride;
|
||||||
|
|
||||||
if (row_stride < 0)
|
if (row_stride < 0)
|
||||||
check = -row_stride;
|
check = (png_uint_32)(-row_stride);
|
||||||
|
|
||||||
else
|
else
|
||||||
check = row_stride;
|
check = (png_uint_32)row_stride;
|
||||||
|
|
||||||
if (image->opaque != NULL && buffer != NULL &&
|
/* This verifies 'check', the absolute value of the actual stride
|
||||||
check >= PNG_IMAGE_ROW_STRIDE(*image))
|
* passed in and detects overflow in the application calculation (i.e.
|
||||||
|
* if the app did actually pass in a non-zero 'row_stride'.
|
||||||
|
*/
|
||||||
|
if (image->opaque != NULL && buffer != NULL && check >= png_row_stride)
|
||||||
|
{
|
||||||
|
/* Now check for overflow of the image buffer calculation; this
|
||||||
|
* limits the whole image size to 32 bits for API compatibility with
|
||||||
|
* the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
|
||||||
|
*
|
||||||
|
* The PNG_IMAGE_BUFFER_SIZE macro is:
|
||||||
|
*
|
||||||
|
* (PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)*height*(row_stride))
|
||||||
|
*
|
||||||
|
* And the component size is always 1 or 2, so make sure that the
|
||||||
|
* number of *bytes* that the application is saying are available
|
||||||
|
* does actually fit into a 32-bit number.
|
||||||
|
*
|
||||||
|
* NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE
|
||||||
|
* will be changed to use png_alloc_size_t; bigger images can be
|
||||||
|
* accomodated on 64-bit systems.
|
||||||
|
*/
|
||||||
|
if (image->height <=
|
||||||
|
0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check)
|
||||||
{
|
{
|
||||||
if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
|
if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
|
||||||
(image->colormap_entries > 0 && colormap != NULL))
|
(image->colormap_entries > 0 && colormap != NULL))
|
||||||
@@ -4099,17 +4147,20 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
|||||||
display.background = background;
|
display.background = background;
|
||||||
display.local_row = NULL;
|
display.local_row = NULL;
|
||||||
|
|
||||||
/* Choose the correct 'end' routine; for the color-map case all the
|
/* Choose the correct 'end' routine; for the color-map case
|
||||||
* setup has already been done.
|
* all the setup has already been done.
|
||||||
*/
|
*/
|
||||||
if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
|
if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
|
||||||
result =
|
result =
|
||||||
png_safe_execute(image, png_image_read_colormap, &display) &&
|
png_safe_execute(image,
|
||||||
png_safe_execute(image, png_image_read_colormapped, &display);
|
png_image_read_colormap, &display) &&
|
||||||
|
png_safe_execute(image,
|
||||||
|
png_image_read_colormapped, &display);
|
||||||
|
|
||||||
else
|
else
|
||||||
result =
|
result =
|
||||||
png_safe_execute(image, png_image_read_direct, &display);
|
png_safe_execute(image,
|
||||||
|
png_image_read_direct, &display);
|
||||||
|
|
||||||
png_image_free(image);
|
png_image_free(image);
|
||||||
return result;
|
return result;
|
||||||
@@ -4120,11 +4171,21 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
|||||||
"png_image_finish_read[color-map]: no color-map");
|
"png_image_finish_read[color-map]: no color-map");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return png_image_error(image,
|
||||||
|
"png_image_finish_read: image too large");
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return png_image_error(image,
|
return png_image_error(image,
|
||||||
"png_image_finish_read: invalid argument");
|
"png_image_finish_read: invalid argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return png_image_error(image,
|
||||||
|
"png_image_finish_read: row_stride too large");
|
||||||
|
}
|
||||||
|
|
||||||
else if (image != NULL)
|
else if (image != NULL)
|
||||||
return png_image_error(image,
|
return png_image_error(image,
|
||||||
"png_image_finish_read: damaged PNG_IMAGE_VERSION");
|
"png_image_finish_read: damaged PNG_IMAGE_VERSION");
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -289,9 +289,12 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
|
|||||||
* is expected to be 1 or greater, but this range test allows for some
|
* is expected to be 1 or greater, but this range test allows for some
|
||||||
* viewing correction values. The intent is to weed out users of this API
|
* viewing correction values. The intent is to weed out users of this API
|
||||||
* who use the inverse of the gamma value accidentally! Since some of these
|
* who use the inverse of the gamma value accidentally! Since some of these
|
||||||
* values are reasonable this may have to be changed.
|
* values are reasonable this may have to be changed:
|
||||||
|
*
|
||||||
|
* 1.6.x: changed from 0.07..3 to 0.01..100 (to accomodate the optimal 16-bit
|
||||||
|
* gamma of 36, and its reciprocal.)
|
||||||
*/
|
*/
|
||||||
if (output_gamma < 70000 || output_gamma > 300000)
|
if (output_gamma < 1000 || output_gamma > 10000000)
|
||||||
png_error(png_ptr, "output gamma out of expected range");
|
png_error(png_ptr, "output gamma out of expected range");
|
||||||
|
|
||||||
/* The default file gamma is the inverse of the output gamma; the output
|
/* The default file gamma is the inverse of the output gamma; the output
|
||||||
@@ -426,7 +429,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
png_ptr->quantize_index[i] = (png_byte)i;
|
png_ptr->quantize_index[i] = (png_byte)i;
|
||||||
}
|
}
|
||||||
@@ -443,7 +446,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
/* Initialize an array to sort colors */
|
/* Initialize an array to sort colors */
|
||||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||||
|
|
||||||
/* Initialize the quantize_sort array */
|
/* Initialize the quantize_sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@@ -577,9 +580,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
/* Initialize palette index arrays */
|
/* Initialize palette index arrays */
|
||||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||||
|
|
||||||
/* Initialize the sort array */
|
/* Initialize the sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@@ -2147,7 +2150,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 3);
|
png_bytep sp = row + (png_size_t)((row_width - 1) >> 3);
|
||||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||||
png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07);
|
png_uint_32 shift = 7U - ((row_width + 7U) & 0x07);
|
||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*dp = (png_byte)((*sp >> shift) & 0x01);
|
*dp = (png_byte)((*sp >> shift) & 0x01);
|
||||||
@@ -2171,7 +2174,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 2);
|
png_bytep sp = row + (png_size_t)((row_width - 1) >> 2);
|
||||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||||
png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
|
png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1);
|
||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*dp = (png_byte)((*sp >> shift) & 0x03);
|
*dp = (png_byte)((*sp >> shift) & 0x03);
|
||||||
@@ -2194,7 +2197,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 1);
|
png_bytep sp = row + (png_size_t)((row_width - 1) >> 1);
|
||||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||||
png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
|
png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2);
|
||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
*dp = (png_byte)((*sp >> shift) & 0x0f);
|
*dp = (png_byte)((*sp >> shift) & 0x0f);
|
||||||
@@ -3220,7 +3223,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
== png_ptr->trans_color.gray)
|
== png_ptr->trans_color.gray)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
|
unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
|
||||||
tmp |= png_ptr->background.gray << shift;
|
tmp |=
|
||||||
|
(unsigned int)(png_ptr->background.gray << shift);
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3249,7 +3253,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
== png_ptr->trans_color.gray)
|
== png_ptr->trans_color.gray)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
||||||
tmp |= png_ptr->background.gray << shift;
|
tmp |=
|
||||||
|
(unsigned int)png_ptr->background.gray << shift;
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3259,7 +3264,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
unsigned int g = (gamma_table [p | (p << 2) |
|
unsigned int g = (gamma_table [p | (p << 2) |
|
||||||
(p << 4) | (p << 6)] >> 6) & 0x03;
|
(p << 4) | (p << 6)] >> 6) & 0x03;
|
||||||
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
||||||
tmp |= g << shift;
|
tmp |= (unsigned int)(g << shift);
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3285,7 +3290,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
== png_ptr->trans_color.gray)
|
== png_ptr->trans_color.gray)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
||||||
tmp |= png_ptr->background.gray << shift;
|
tmp |=
|
||||||
|
(unsigned int)png_ptr->background.gray << shift;
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3315,7 +3321,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
== png_ptr->trans_color.gray)
|
== png_ptr->trans_color.gray)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||||
tmp |= png_ptr->background.gray << shift;
|
tmp |=
|
||||||
|
(unsigned int)(png_ptr->background.gray << shift);
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3325,7 +3332,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
|
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
|
||||||
0x0f;
|
0x0f;
|
||||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||||
tmp |= g << shift;
|
tmp |= (unsigned int)(g << shift);
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3351,7 +3358,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||||||
== png_ptr->trans_color.gray)
|
== png_ptr->trans_color.gray)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||||
tmp |= png_ptr->background.gray << shift;
|
tmp |=
|
||||||
|
(unsigned int)(png_ptr->background.gray << shift);
|
||||||
*sp = (png_byte)(tmp & 0xff);
|
*sp = (png_byte)(tmp & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.20 [December 3, 2014]
|
* Last changed in libpng 1.6.27 [January 5, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -86,7 +86,7 @@ png_get_int_32)(png_const_bytep buf)
|
|||||||
{
|
{
|
||||||
png_uint_32 uval = png_get_uint_32(buf);
|
png_uint_32 uval = png_get_uint_32(buf);
|
||||||
if ((uval & 0x80000000) == 0) /* non-negative */
|
if ((uval & 0x80000000) == 0) /* non-negative */
|
||||||
return uval;
|
return (png_int_32)uval;
|
||||||
|
|
||||||
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
|
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
|
||||||
if ((uval & 0x80000000) == 0) /* no overflow */
|
if ((uval & 0x80000000) == 0) /* no overflow */
|
||||||
@@ -370,11 +370,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ret; /* zlib return code */
|
int ret; /* zlib return code */
|
||||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
#if ZLIB_VERNUM >= 0x1240
|
||||||
|
int window_bits = 0;
|
||||||
|
|
||||||
# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
|
# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
|
||||||
int window_bits;
|
|
||||||
|
|
||||||
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
||||||
PNG_OPTION_ON)
|
PNG_OPTION_ON)
|
||||||
{
|
{
|
||||||
@@ -384,14 +383,12 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
window_bits = 0;
|
|
||||||
png_ptr->zstream_start = 1;
|
png_ptr->zstream_start = 1;
|
||||||
}
|
}
|
||||||
# else
|
|
||||||
# define window_bits 0
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#endif /* ZLIB_VERNUM >= 0x1240 */
|
||||||
|
|
||||||
/* Set this for safety, just in case the previous owner left pointers to
|
/* Set this for safety, just in case the previous owner left pointers to
|
||||||
* memory allocations.
|
* memory allocations.
|
||||||
*/
|
*/
|
||||||
@@ -402,25 +399,32 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
|||||||
|
|
||||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
||||||
{
|
{
|
||||||
#if PNG_ZLIB_VERNUM < 0x1240
|
#if ZLIB_VERNUM >= 0x1240
|
||||||
ret = inflateReset(&png_ptr->zstream);
|
|
||||||
#else
|
|
||||||
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
||||||
|
#else
|
||||||
|
ret = inflateReset(&png_ptr->zstream);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if PNG_ZLIB_VERNUM < 0x1240
|
#if ZLIB_VERNUM >= 0x1240
|
||||||
ret = inflateInit(&png_ptr->zstream);
|
|
||||||
#else
|
|
||||||
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
||||||
|
#else
|
||||||
|
ret = inflateInit(&png_ptr->zstream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret == Z_OK)
|
if (ret == Z_OK)
|
||||||
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ZLIB_VERNUM >= 0x1281 && \
|
||||||
|
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
|
||||||
|
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
|
||||||
|
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
|
||||||
|
ret = inflateValidate(&png_ptr->zstream, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret == Z_OK)
|
if (ret == Z_OK)
|
||||||
png_ptr->zowner = owner;
|
png_ptr->zowner = owner;
|
||||||
|
|
||||||
@@ -435,7 +439,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
#if ZLIB_VERNUM >= 0x1240
|
||||||
/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
|
/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
|
||||||
* in this case some zlib versions skip validation of the CINFO field and, in
|
* in this case some zlib versions skip validation of the CINFO field and, in
|
||||||
* certain circumstances, libpng may end up displaying an invalid image, in
|
* certain circumstances, libpng may end up displaying an invalid image, in
|
||||||
@@ -461,6 +465,7 @@ png_zlib_inflate(png_structrp png_ptr, int flush)
|
|||||||
#endif /* Zlib >= 1.2.4 */
|
#endif /* Zlib >= 1.2.4 */
|
||||||
|
|
||||||
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||||
|
#if defined(PNG_READ_zTXt_SUPPORTED) || defined (PNG_READ_iTXt_SUPPORTED)
|
||||||
/* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
|
/* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
|
||||||
* allow the caller to do multiple calls if required. If the 'finish' flag is
|
* allow the caller to do multiple calls if required. If the 'finish' flag is
|
||||||
* set Z_FINISH will be passed to the final inflate() call and Z_STREAM_END must
|
* set Z_FINISH will be passed to the final inflate() call and Z_STREAM_END must
|
||||||
@@ -754,6 +759,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||||||
return Z_MEM_ERROR;
|
return Z_MEM_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* READ_zTXt || READ_iTXt */
|
||||||
#endif /* READ_COMPRESSED_TEXT */
|
#endif /* READ_COMPRESSED_TEXT */
|
||||||
|
|
||||||
#ifdef PNG_READ_iCCP_SUPPORTED
|
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||||
@@ -802,8 +808,8 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
|
|||||||
* the available output is produced; this allows reading of truncated
|
* the available output is produced; this allows reading of truncated
|
||||||
* streams.
|
* streams.
|
||||||
*/
|
*/
|
||||||
ret = PNG_INFLATE(png_ptr,
|
ret = PNG_INFLATE(png_ptr, *chunk_bytes > 0 ?
|
||||||
*chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
|
Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
|
||||||
}
|
}
|
||||||
while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
|
while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
|
||||||
|
|
||||||
@@ -821,7 +827,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
|
|||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* READ_iCCP */
|
||||||
|
|
||||||
/* Read and check the IDHR chunk */
|
/* Read and check the IDHR chunk */
|
||||||
|
|
||||||
@@ -1009,7 +1015,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)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_crc_finish(png_ptr, (int) length - num * 3);
|
png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
||||||
@@ -1512,7 +1518,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
finished = 1;
|
finished = 1;
|
||||||
|
|
||||||
# ifdef PNG_sRGB_SUPPORTED
|
# if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
|
||||||
/* Check for a match against sRGB */
|
/* Check for a match against sRGB */
|
||||||
png_icc_set_sRGB(png_ptr,
|
png_icc_set_sRGB(png_ptr,
|
||||||
&png_ptr->colorspace, profile,
|
&png_ptr->colorspace, profile,
|
||||||
@@ -1715,13 +1721,13 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
data_length = length - (png_uint_32)(entry_start - buffer);
|
data_length = length - (png_uint_32)(entry_start - buffer);
|
||||||
|
|
||||||
/* Integrity-check the data length */
|
/* Integrity-check the data length */
|
||||||
if ((data_length % entry_size) != 0)
|
if ((data_length % (unsigned int)entry_size) != 0)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "sPLT chunk has bad length");
|
png_warning(png_ptr, "sPLT chunk has bad length");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl = (png_int_32)(data_length / entry_size);
|
dl = (png_uint_32)(data_length / (unsigned int)entry_size);
|
||||||
max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry));
|
max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry));
|
||||||
|
|
||||||
if (dl > max_dl)
|
if (dl > max_dl)
|
||||||
@@ -1730,10 +1736,10 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_palette.nentries = (png_int_32)(data_length / entry_size);
|
new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size);
|
||||||
|
|
||||||
new_palette.entries = (png_sPLT_entryp)png_malloc_warn(
|
new_palette.entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
|
||||||
png_ptr, new_palette.nentries * (sizeof (png_sPLT_entry)));
|
(png_alloc_size_t) new_palette.nentries * (sizeof (png_sPLT_entry)));
|
||||||
|
|
||||||
if (new_palette.entries == NULL)
|
if (new_palette.entries == NULL)
|
||||||
{
|
{
|
||||||
@@ -3097,7 +3103,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||||||
# ifdef PNG_READ_PACKSWAP_SUPPORTED
|
# ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||||
/* little-endian byte */
|
/* little-endian byte */
|
||||||
end_mask = 0xff << end_mask;
|
end_mask = (unsigned int)(0xff << end_mask);
|
||||||
|
|
||||||
else /* big-endian byte */
|
else /* big-endian byte */
|
||||||
# endif
|
# endif
|
||||||
@@ -3418,8 +3424,8 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||||||
/* Everything is aligned for png_uint_16 copies, but try for
|
/* Everything is aligned for png_uint_16 copies, but try for
|
||||||
* png_uint_32 first.
|
* png_uint_32 first.
|
||||||
*/
|
*/
|
||||||
if (png_isaligned(dp, png_uint_32) != 0 &&
|
if (png_isaligned(dp, png_uint_32) &&
|
||||||
png_isaligned(sp, png_uint_32) != 0 &&
|
png_isaligned(sp, png_uint_32) &&
|
||||||
bytes_to_copy % (sizeof (png_uint_32)) == 0 &&
|
bytes_to_copy % (sizeof (png_uint_32)) == 0 &&
|
||||||
bytes_to_jump % (sizeof (png_uint_32)) == 0)
|
bytes_to_jump % (sizeof (png_uint_32)) == 0)
|
||||||
{
|
{
|
||||||
@@ -3543,7 +3549,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
{
|
{
|
||||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||||
/* Offset to next interlace block */
|
/* Offset to next interlace block */
|
||||||
static PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
|
|
||||||
png_debug(1, "in png_do_read_interlace");
|
png_debug(1, "in png_do_read_interlace");
|
||||||
if (row != NULL && row_info != NULL)
|
if (row != NULL && row_info != NULL)
|
||||||
@@ -3558,9 +3564,10 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
{
|
{
|
||||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
||||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
|
png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
|
||||||
int sshift, dshift;
|
unsigned int sshift, dshift;
|
||||||
int s_start, s_end, s_inc;
|
unsigned int s_start, s_end;
|
||||||
int jstop = png_pass_inc[pass];
|
int s_inc;
|
||||||
|
int jstop = (int)png_pass_inc[pass];
|
||||||
png_byte v;
|
png_byte v;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int j;
|
int j;
|
||||||
@@ -3568,8 +3575,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||||
if ((transformations & PNG_PACKSWAP) != 0)
|
if ((transformations & PNG_PACKSWAP) != 0)
|
||||||
{
|
{
|
||||||
sshift = (int)((row_info->width + 7) & 0x07);
|
sshift = ((row_info->width + 7) & 0x07);
|
||||||
dshift = (int)((final_width + 7) & 0x07);
|
dshift = ((final_width + 7) & 0x07);
|
||||||
s_start = 7;
|
s_start = 7;
|
||||||
s_end = 0;
|
s_end = 0;
|
||||||
s_inc = -1;
|
s_inc = -1;
|
||||||
@@ -3578,8 +3585,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
sshift = 7 - (int)((row_info->width + 7) & 0x07);
|
sshift = 7 - ((row_info->width + 7) & 0x07);
|
||||||
dshift = 7 - (int)((final_width + 7) & 0x07);
|
dshift = 7 - ((final_width + 7) & 0x07);
|
||||||
s_start = 0;
|
s_start = 0;
|
||||||
s_end = 7;
|
s_end = 7;
|
||||||
s_inc = 1;
|
s_inc = 1;
|
||||||
@@ -3591,7 +3598,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
for (j = 0; j < jstop; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
|
unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
|
||||||
tmp |= v << dshift;
|
tmp |= (unsigned int)(v << dshift);
|
||||||
*dp = (png_byte)(tmp & 0xff);
|
*dp = (png_byte)(tmp & 0xff);
|
||||||
|
|
||||||
if (dshift == s_end)
|
if (dshift == s_end)
|
||||||
@@ -3601,7 +3608,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
dshift += s_inc;
|
dshift = (unsigned int)((int)dshift + s_inc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sshift == s_end)
|
if (sshift == s_end)
|
||||||
@@ -3611,7 +3618,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
sshift += s_inc;
|
sshift = (unsigned int)((int)sshift + s_inc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3620,16 +3627,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
{
|
{
|
||||||
png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2);
|
png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2);
|
||||||
png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2);
|
png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2);
|
||||||
int sshift, dshift;
|
unsigned int sshift, dshift;
|
||||||
int s_start, s_end, s_inc;
|
unsigned int s_start, s_end;
|
||||||
int jstop = png_pass_inc[pass];
|
int s_inc;
|
||||||
|
int jstop = (int)png_pass_inc[pass];
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||||
if ((transformations & PNG_PACKSWAP) != 0)
|
if ((transformations & PNG_PACKSWAP) != 0)
|
||||||
{
|
{
|
||||||
sshift = (int)(((row_info->width + 3) & 0x03) << 1);
|
sshift = (((row_info->width + 3) & 0x03) << 1);
|
||||||
dshift = (int)(((final_width + 3) & 0x03) << 1);
|
dshift = (((final_width + 3) & 0x03) << 1);
|
||||||
s_start = 6;
|
s_start = 6;
|
||||||
s_end = 0;
|
s_end = 0;
|
||||||
s_inc = -2;
|
s_inc = -2;
|
||||||
@@ -3638,8 +3646,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1);
|
sshift = ((3 - ((row_info->width + 3) & 0x03)) << 1);
|
||||||
dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1);
|
dshift = ((3 - ((final_width + 3) & 0x03)) << 1);
|
||||||
s_start = 0;
|
s_start = 0;
|
||||||
s_end = 6;
|
s_end = 6;
|
||||||
s_inc = 2;
|
s_inc = 2;
|
||||||
@@ -3654,7 +3662,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
for (j = 0; j < jstop; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
|
unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
|
||||||
tmp |= v << dshift;
|
tmp |= (unsigned int)(v << dshift);
|
||||||
*dp = (png_byte)(tmp & 0xff);
|
*dp = (png_byte)(tmp & 0xff);
|
||||||
|
|
||||||
if (dshift == s_end)
|
if (dshift == s_end)
|
||||||
@@ -3664,7 +3672,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
dshift += s_inc;
|
dshift = (unsigned int)((int)dshift + s_inc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sshift == s_end)
|
if (sshift == s_end)
|
||||||
@@ -3674,7 +3682,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
sshift += s_inc;
|
sshift = (unsigned int)((int)sshift + s_inc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3683,16 +3691,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
{
|
{
|
||||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
||||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
|
png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
|
||||||
int sshift, dshift;
|
unsigned int sshift, dshift;
|
||||||
int s_start, s_end, s_inc;
|
unsigned int s_start, s_end;
|
||||||
|
int s_inc;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int jstop = png_pass_inc[pass];
|
int jstop = (int)png_pass_inc[pass];
|
||||||
|
|
||||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||||
if ((transformations & PNG_PACKSWAP) != 0)
|
if ((transformations & PNG_PACKSWAP) != 0)
|
||||||
{
|
{
|
||||||
sshift = (int)(((row_info->width + 1) & 0x01) << 2);
|
sshift = (((row_info->width + 1) & 0x01) << 2);
|
||||||
dshift = (int)(((final_width + 1) & 0x01) << 2);
|
dshift = (((final_width + 1) & 0x01) << 2);
|
||||||
s_start = 4;
|
s_start = 4;
|
||||||
s_end = 0;
|
s_end = 0;
|
||||||
s_inc = -4;
|
s_inc = -4;
|
||||||
@@ -3701,8 +3710,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2);
|
sshift = ((1 - ((row_info->width + 1) & 0x01)) << 2);
|
||||||
dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2);
|
dshift = ((1 - ((final_width + 1) & 0x01)) << 2);
|
||||||
s_start = 0;
|
s_start = 0;
|
||||||
s_end = 4;
|
s_end = 4;
|
||||||
s_inc = 4;
|
s_inc = 4;
|
||||||
@@ -3716,7 +3725,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
for (j = 0; j < jstop; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
|
unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
|
||||||
tmp |= v << dshift;
|
tmp |= (unsigned int)(v << dshift);
|
||||||
*dp = (png_byte)(tmp & 0xff);
|
*dp = (png_byte)(tmp & 0xff);
|
||||||
|
|
||||||
if (dshift == s_end)
|
if (dshift == s_end)
|
||||||
@@ -3726,7 +3735,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
dshift += s_inc;
|
dshift = (unsigned int)((int)dshift + s_inc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sshift == s_end)
|
if (sshift == s_end)
|
||||||
@@ -3736,7 +3745,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
sshift += s_inc;
|
sshift = (unsigned int)((int)sshift + s_inc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3750,7 +3759,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
|
|
||||||
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
||||||
|
|
||||||
int jstop = png_pass_inc[pass];
|
int jstop = (int)png_pass_inc[pass];
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0; i < row_info->width; i++)
|
for (i = 0; i < row_info->width; i++)
|
||||||
@@ -3894,7 +3903,7 @@ static void
|
|||||||
png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||||
png_const_bytep prev_row)
|
png_const_bytep prev_row)
|
||||||
{
|
{
|
||||||
int bpp = (row_info->pixel_depth + 7) >> 3;
|
unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||||
png_bytep rp_end = row + bpp;
|
png_bytep rp_end = row + bpp;
|
||||||
|
|
||||||
/* Process the first pixel in the row completely (this is the same as 'up'
|
/* Process the first pixel in the row completely (this is the same as 'up'
|
||||||
@@ -3907,7 +3916,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remainder */
|
/* Remainder */
|
||||||
rp_end += row_info->rowbytes - bpp;
|
rp_end = rp_end + (row_info->rowbytes - bpp);
|
||||||
|
|
||||||
while (row < rp_end)
|
while (row < rp_end)
|
||||||
{
|
{
|
||||||
@@ -4252,7 +4261,7 @@ png_read_start_row(png_structrp png_ptr)
|
|||||||
/* Offset to next interlace block in the y direction */
|
/* Offset to next interlace block in the y direction */
|
||||||
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||||
|
|
||||||
int max_pixel_depth;
|
unsigned int max_pixel_depth;
|
||||||
png_size_t row_bytes;
|
png_size_t row_bytes;
|
||||||
|
|
||||||
png_debug(1, "in png_read_start_row");
|
png_debug(1, "in png_read_start_row");
|
||||||
@@ -4281,7 +4290,7 @@ png_read_start_row(png_structrp png_ptr)
|
|||||||
png_ptr->iwidth = png_ptr->width;
|
png_ptr->iwidth = png_ptr->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_pixel_depth = png_ptr->pixel_depth;
|
max_pixel_depth = (unsigned int)png_ptr->pixel_depth;
|
||||||
|
|
||||||
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
|
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
|
||||||
* calculations to calculate the final pixel depth, then
|
* calculations to calculate the final pixel depth, then
|
||||||
@@ -4416,7 +4425,7 @@ png_read_start_row(png_structrp png_ptr)
|
|||||||
defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||||
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||||
{
|
{
|
||||||
int user_pixel_depth = png_ptr->user_transform_depth *
|
unsigned int user_pixel_depth = png_ptr->user_transform_depth *
|
||||||
png_ptr->user_transform_channels;
|
png_ptr->user_transform_channels;
|
||||||
|
|
||||||
if (user_pixel_depth > max_pixel_depth)
|
if (user_pixel_depth > max_pixel_depth)
|
||||||
@@ -4438,7 +4447,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||||||
* for safety's sake
|
* for safety's sake
|
||||||
*/
|
*/
|
||||||
row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) +
|
row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) +
|
||||||
1 + ((max_pixel_depth + 7) >> 3);
|
1 + ((max_pixel_depth + 7) >> 3U);
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (row_bytes > (png_uint_32)65536L)
|
if (row_bytes > (png_uint_32)65536L)
|
||||||
@@ -4507,7 +4516,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||||||
* does not, so free the read buffer now regardless; the sequential reader
|
* does not, so free the read buffer now regardless; the sequential reader
|
||||||
* reallocates it on demand.
|
* reallocates it on demand.
|
||||||
*/
|
*/
|
||||||
if (png_ptr->read_buffer != 0)
|
if (png_ptr->read_buffer != NULL)
|
||||||
{
|
{
|
||||||
png_bytep buffer = png_ptr->read_buffer;
|
png_bytep buffer = png_ptr->read_buffer;
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -283,17 +283,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
/* Check that the type matches the specification. */
|
/* Check that the type matches the specification. */
|
||||||
if (type < 0 || type > 3)
|
if (type < 0 || type > 3)
|
||||||
png_error(png_ptr, "Invalid pCAL equation type");
|
{
|
||||||
|
png_chunk_report(png_ptr, "Invalid pCAL equation type",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (nparams < 0 || nparams > 255)
|
if (nparams < 0 || nparams > 255)
|
||||||
png_error(png_ptr, "Invalid pCAL parameter count");
|
{
|
||||||
|
png_chunk_report(png_ptr, "Invalid pCAL parameter count",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate params[nparams] */
|
/* Validate params[nparams] */
|
||||||
for (i=0; i<nparams; ++i)
|
for (i=0; i<nparams; ++i)
|
||||||
{
|
{
|
||||||
if (params[i] == NULL ||
|
if (params[i] == NULL ||
|
||||||
!png_check_fp_string(params[i], strlen(params[i])))
|
!png_check_fp_string(params[i], strlen(params[i])))
|
||||||
png_error(png_ptr, "Invalid format for pCAL parameter");
|
{
|
||||||
|
png_chunk_report(png_ptr, "Invalid format for pCAL parameter",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
||||||
@@ -301,8 +313,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
if (info_ptr->pcal_purpose == NULL)
|
if (info_ptr->pcal_purpose == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
|
png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +343,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
memcpy(info_ptr->pcal_units, units, length);
|
memcpy(info_ptr->pcal_units, units, length);
|
||||||
|
|
||||||
info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
|
info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
|
||||||
(png_size_t)((nparams + 1) * (sizeof (png_charp)))));
|
(png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
|
||||||
|
|
||||||
if (info_ptr->pcal_params == NULL)
|
if (info_ptr->pcal_params == NULL)
|
||||||
{
|
{
|
||||||
@@ -340,7 +352,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp)));
|
memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) *
|
||||||
|
(sizeof (png_charp)));
|
||||||
|
|
||||||
for (i = 0; i < nparams; i++)
|
for (i = 0; i < nparams; i++)
|
||||||
{
|
{
|
||||||
@@ -563,7 +576,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
|||||||
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
|
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
|
||||||
|
|
||||||
if (num_palette > 0)
|
if (num_palette > 0)
|
||||||
memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
|
memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
|
||||||
|
(sizeof (png_color)));
|
||||||
info_ptr->palette = png_ptr->palette;
|
info_ptr->palette = png_ptr->palette;
|
||||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||||
|
|
||||||
@@ -952,13 +966,15 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
|
||||||
|
|
||||||
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
|
|
||||||
png_ptr->trans_alpha = info_ptr->trans_alpha = png_voidcast(png_bytep,
|
|
||||||
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
|
||||||
|
|
||||||
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
|
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
|
||||||
|
{
|
||||||
|
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
|
||||||
|
info_ptr->trans_alpha = png_voidcast(png_bytep,
|
||||||
|
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
||||||
memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
|
memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
|
||||||
}
|
}
|
||||||
|
png_ptr->trans_alpha = info_ptr->trans_alpha;
|
||||||
|
}
|
||||||
|
|
||||||
if (trans_color != NULL)
|
if (trans_color != NULL)
|
||||||
{
|
{
|
||||||
@@ -1078,7 +1094,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
|||||||
* checked it when doing the allocation.
|
* checked it when doing the allocation.
|
||||||
*/
|
*/
|
||||||
memcpy(np->entries, entries->entries,
|
memcpy(np->entries, entries->entries,
|
||||||
entries->nentries * sizeof (png_sPLT_entry));
|
(unsigned int)entries->nentries * sizeof (png_sPLT_entry));
|
||||||
|
|
||||||
/* Note that 'continue' skips the advance of the out pointer and out
|
/* Note that 'continue' skips the advance of the out pointer and out
|
||||||
* count, so an invalid entry is not added.
|
* count, so an invalid entry is not added.
|
||||||
@@ -1247,7 +1263,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
{
|
{
|
||||||
png_app_error(png_ptr, "invalid unknown chunk location");
|
png_app_error(png_ptr, "invalid unknown chunk location");
|
||||||
/* Fake out the pre 1.6.0 behavior: */
|
/* Fake out the pre 1.6.0 behavior: */
|
||||||
if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
|
if (((unsigned int)location & PNG_HAVE_IDAT) != 0) /* undocumented! */
|
||||||
location = PNG_AFTER_IDAT;
|
location = PNG_AFTER_IDAT;
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -1371,7 +1387,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_chunks = num_chunks_in;
|
num_chunks = (unsigned int)num_chunks_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
old_num_chunks = png_ptr->num_chunk_list;
|
old_num_chunks = png_ptr->num_chunk_list;
|
||||||
@@ -1561,7 +1577,7 @@ void PNGAPI
|
|||||||
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
|
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
info_ptr->valid &= ~mask;
|
info_ptr->valid &= (unsigned int)(~mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1660,7 +1676,9 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
|
|||||||
png_uint_32 /* PRIVATE */
|
png_uint_32 /* PRIVATE */
|
||||||
png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
png_const_charp orig_key = key;
|
png_const_charp orig_key = key;
|
||||||
|
#endif
|
||||||
png_uint_32 key_len = 0;
|
png_uint_32 key_len = 0;
|
||||||
int bad_character = 0;
|
int bad_character = 0;
|
||||||
int space = 1;
|
int space = 1;
|
||||||
@@ -1723,7 +1741,9 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||||||
|
|
||||||
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
||||||
}
|
}
|
||||||
#endif /* WARNINGS */
|
#else /* !WARNINGS */
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
#endif /* !WARNINGS */
|
||||||
|
|
||||||
return key_len;
|
return key_len;
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngstruct.h - header file for PNG reference library
|
/* pngstruct.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
* Last changed in libpng 1.6.28 [January 5, 2017]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -249,7 +249,7 @@ struct png_struct_def
|
|||||||
png_byte filter; /* file filter type (always 0) */
|
png_byte filter; /* file filter type (always 0) */
|
||||||
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||||
png_byte pass; /* current interlace pass (0 - 6) */
|
png_byte pass; /* current interlace pass (0 - 6) */
|
||||||
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
|
png_byte do_filter; /* row filter flags (see PNG_FILTER_ in png.h ) */
|
||||||
png_byte color_type; /* color type of file */
|
png_byte color_type; /* color type of file */
|
||||||
png_byte bit_depth; /* bit depth of file */
|
png_byte bit_depth; /* bit depth of file */
|
||||||
png_byte usr_bit_depth; /* bit depth of users row: write only */
|
png_byte usr_bit_depth; /* bit depth of users row: write only */
|
||||||
@@ -263,7 +263,7 @@ struct png_struct_def
|
|||||||
/* pixel depth used for the row buffers */
|
/* pixel depth used for the row buffers */
|
||||||
png_byte transformed_pixel_depth;
|
png_byte transformed_pixel_depth;
|
||||||
/* pixel depth after read/write transforms */
|
/* pixel depth after read/write transforms */
|
||||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
#if ZLIB_VERNUM >= 0x1240
|
||||||
png_byte zstream_start; /* at start of an input zlib stream */
|
png_byte zstream_start; /* at start of an input zlib stream */
|
||||||
#endif /* Zlib >= 1.2.4 */
|
#endif /* Zlib >= 1.2.4 */
|
||||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
@@ -353,7 +353,7 @@ struct png_struct_def
|
|||||||
|
|
||||||
/* Options */
|
/* Options */
|
||||||
#ifdef PNG_SET_OPTION_SUPPORTED
|
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||||
png_byte options; /* On/off state (up to 4 options) */
|
png_uint_32 options; /* On/off state (up to 16 options) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PNG_LIBPNG_VER < 10700
|
#if PNG_LIBPNG_VER < 10700
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.25 [December 3, 2015]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -964,6 +964,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
if (strict != 0)
|
if (strict != 0)
|
||||||
{
|
{
|
||||||
/* Treat png_benign_error() as errors on read */
|
/* Treat png_benign_error() as errors on read */
|
||||||
@@ -985,10 +986,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
/* Allow application (pngtest) errors and warnings to pass */
|
/* Allow application (pngtest) errors and warnings to pass */
|
||||||
png_set_benign_errors(read_ptr, 1);
|
png_set_benign_errors(read_ptr, 1);
|
||||||
|
|
||||||
|
/* Turn off CRC checking while reading */
|
||||||
|
png_set_crc_action(read_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
|
||||||
|
|
||||||
|
#ifdef PNG_IGNORE_ADLER32
|
||||||
|
/* Turn off ADLER32 checking while reading */
|
||||||
|
png_set_option(read_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON);
|
||||||
|
#endif
|
||||||
|
|
||||||
# ifdef PNG_WRITE_SUPPORTED
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
png_set_benign_errors(write_ptr, 1);
|
png_set_benign_errors(write_ptr, 1);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif /* BENIGN_ERRORS */
|
||||||
|
|
||||||
pngtest_debug("Initializing input and output streams");
|
pngtest_debug("Initializing input and output streams");
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
@@ -1386,6 +1397,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_write_info(write_ptr, write_info_ptr);
|
png_write_info(write_ptr, write_info_ptr);
|
||||||
|
|
||||||
write_chunks(write_ptr, before_IDAT); /* after PLTE */
|
write_chunks(write_ptr, before_IDAT); /* after PLTE */
|
||||||
|
|
||||||
|
#ifdef PNG_COMPRESSION_COMPAT
|
||||||
|
/* Test the 'compatibility' setting here, if it is available. */
|
||||||
|
png_set_compression(write_ptr, PNG_COMPRESSION_COMPAT);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SINGLE_ROWBUF_ALLOC
|
#ifdef SINGLE_ROWBUF_ALLOC
|
||||||
@@ -1681,7 +1697,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
if (wrote_question == 0 && unsupported_chunks == 0)
|
if (wrote_question == 0 && unsupported_chunks == 0)
|
||||||
{
|
{
|
||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
" Was %s written with the same maximum IDAT chunk size (%d bytes),",
|
" Was %s written with the same maximum IDAT"
|
||||||
|
" chunk size (%d bytes),",
|
||||||
inname, PNG_ZBUF_SIZE);
|
inname, PNG_ZBUF_SIZE);
|
||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
"\n filtering heuristic (libpng default), compression");
|
"\n filtering heuristic (libpng default), compression");
|
||||||
@@ -1712,7 +1729,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
if (wrote_question == 0 && unsupported_chunks == 0)
|
if (wrote_question == 0 && unsupported_chunks == 0)
|
||||||
{
|
{
|
||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
" Was %s written with the same maximum IDAT chunk size (%d bytes),",
|
" Was %s written with the same maximum"
|
||||||
|
" IDAT chunk size (%d bytes),",
|
||||||
inname, PNG_ZBUF_SIZE);
|
inname, PNG_ZBUF_SIZE);
|
||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
"\n filtering heuristic (libpng default), compression");
|
"\n filtering heuristic (libpng default), compression");
|
||||||
@@ -2070,4 +2088,4 @@ main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_21 Your_png_h_is_not_version_1_6_21;
|
typedef png_libpng_version_1_6_28 Your_png_h_is_not_version_1_6_28;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -172,7 +172,8 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
* size!
|
* size!
|
||||||
*/
|
*/
|
||||||
png_app_error(png_ptr,
|
png_app_error(png_ptr,
|
||||||
"png_set_filler is invalid for low bit depth gray output");
|
"png_set_filler is invalid for"
|
||||||
|
" low bit depth gray output");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +595,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
return; /* The filler channel has gone already */
|
return; /* The filler channel has gone already */
|
||||||
|
|
||||||
/* Fix the rowbytes value. */
|
/* Fix the rowbytes value. */
|
||||||
row_info->rowbytes = dp-row;
|
row_info->rowbytes = (unsigned int)(dp-row);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -692,7 +693,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
* and this calculation is used because it avoids warnings that other
|
* and this calculation is used because it avoids warnings that other
|
||||||
* forms produced on either GCC or MSVC.
|
* forms produced on either GCC or MSVC.
|
||||||
*/
|
*/
|
||||||
int padding = (-row_info->pixel_depth * row_info->width) & 7;
|
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
||||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||||
|
|
||||||
switch (row_info->bit_depth)
|
switch (row_info->bit_depth)
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
|
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
#endif
|
#endif /* SIMPLIFIED_WRITE_STDIO */
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
@@ -666,9 +666,9 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
{
|
{
|
||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
|
||||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
|
||||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
|
||||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||||
*(rp ) = (png_byte)(red >> 8);
|
*(rp ) = (png_byte)(red >> 8);
|
||||||
@@ -901,7 +901,7 @@ png_set_flush(png_structrp png_ptr, int nrows)
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
|
png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the current output buffers now */
|
/* Flush the current output buffers now */
|
||||||
@@ -1452,7 +1452,6 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
|
|
||||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
|
|
||||||
/* Initialize the write structure - general purpose utility. */
|
/* Initialize the write structure - general purpose utility. */
|
||||||
static int
|
static int
|
||||||
png_image_write_init(png_imagep image)
|
png_image_write_init(png_imagep image)
|
||||||
@@ -1504,6 +1503,10 @@ typedef struct
|
|||||||
png_const_voidp first_row;
|
png_const_voidp first_row;
|
||||||
ptrdiff_t row_bytes;
|
ptrdiff_t row_bytes;
|
||||||
png_voidp local_row;
|
png_voidp local_row;
|
||||||
|
/* Byte count for memory writing */
|
||||||
|
png_bytep memory;
|
||||||
|
png_alloc_size_t memory_bytes; /* not used for STDIO */
|
||||||
|
png_alloc_size_t output_bytes; /* running total */
|
||||||
} png_image_write_control;
|
} png_image_write_control;
|
||||||
|
|
||||||
/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
|
/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
|
||||||
@@ -1522,7 +1525,8 @@ png_write_image_16bit(png_voidp argument)
|
|||||||
display->first_row);
|
display->first_row);
|
||||||
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
|
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
|
||||||
png_uint_16p row_end;
|
png_uint_16p row_end;
|
||||||
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
|
const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
|
||||||
|
3 : 1;
|
||||||
int aindex = 0;
|
int aindex = 0;
|
||||||
png_uint_32 y = image->height;
|
png_uint_32 y = image->height;
|
||||||
|
|
||||||
@@ -1536,9 +1540,9 @@ png_write_image_16bit(png_voidp argument)
|
|||||||
++output_row;
|
++output_row;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aindex = channels;
|
aindex = (int)channels;
|
||||||
# else
|
# else
|
||||||
aindex = channels;
|
aindex = (int)channels;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1551,7 +1555,7 @@ png_write_image_16bit(png_voidp argument)
|
|||||||
*/
|
*/
|
||||||
row_end = output_row + image->width * (channels+1);
|
row_end = output_row + image->width * (channels+1);
|
||||||
|
|
||||||
while (y-- > 0)
|
for (; y > 0; --y)
|
||||||
{
|
{
|
||||||
png_const_uint_16p in_ptr = input_row;
|
png_const_uint_16p in_ptr = input_row;
|
||||||
png_uint_16p out_ptr = output_row;
|
png_uint_16p out_ptr = output_row;
|
||||||
@@ -1572,7 +1576,7 @@ png_write_image_16bit(png_voidp argument)
|
|||||||
if (alpha > 0 && alpha < 65535)
|
if (alpha > 0 && alpha < 65535)
|
||||||
reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
|
reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
|
||||||
|
|
||||||
c = channels;
|
c = (int)channels;
|
||||||
do /* always at least one channel */
|
do /* always at least one channel */
|
||||||
{
|
{
|
||||||
png_uint_16 component = *in_ptr++;
|
png_uint_16 component = *in_ptr++;
|
||||||
@@ -1607,7 +1611,7 @@ png_write_image_16bit(png_voidp argument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
|
png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
|
||||||
input_row += display->row_bytes/(sizeof (png_uint_16));
|
input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1680,7 +1684,8 @@ png_write_image_8bit(png_voidp argument)
|
|||||||
display->first_row);
|
display->first_row);
|
||||||
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
|
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
|
||||||
png_uint_32 y = image->height;
|
png_uint_32 y = image->height;
|
||||||
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
|
const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
|
||||||
|
3 : 1;
|
||||||
|
|
||||||
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
|
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
|
||||||
{
|
{
|
||||||
@@ -1697,12 +1702,12 @@ png_write_image_8bit(png_voidp argument)
|
|||||||
|
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
aindex = channels;
|
aindex = (int)channels;
|
||||||
|
|
||||||
/* Use row_end in place of a loop counter: */
|
/* Use row_end in place of a loop counter: */
|
||||||
row_end = output_row + image->width * (channels+1);
|
row_end = output_row + image->width * (channels+1);
|
||||||
|
|
||||||
while (y-- > 0)
|
for (; y > 0; --y)
|
||||||
{
|
{
|
||||||
png_const_uint_16p in_ptr = input_row;
|
png_const_uint_16p in_ptr = input_row;
|
||||||
png_bytep out_ptr = output_row;
|
png_bytep out_ptr = output_row;
|
||||||
@@ -1720,7 +1725,7 @@ png_write_image_8bit(png_voidp argument)
|
|||||||
if (alphabyte > 0 && alphabyte < 255)
|
if (alphabyte > 0 && alphabyte < 255)
|
||||||
reciprocal = UNP_RECIPROCAL(alpha);
|
reciprocal = UNP_RECIPROCAL(alpha);
|
||||||
|
|
||||||
c = channels;
|
c = (int)channels;
|
||||||
do /* always at least one channel */
|
do /* always at least one channel */
|
||||||
*out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
|
*out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
|
||||||
while (--c > 0);
|
while (--c > 0);
|
||||||
@@ -1732,7 +1737,7 @@ png_write_image_8bit(png_voidp argument)
|
|||||||
|
|
||||||
png_write_row(png_ptr, png_voidcast(png_const_bytep,
|
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));
|
input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
|
||||||
} /* while y */
|
} /* while y */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1743,7 +1748,7 @@ png_write_image_8bit(png_voidp argument)
|
|||||||
*/
|
*/
|
||||||
png_bytep row_end = output_row + image->width * channels;
|
png_bytep row_end = output_row + image->width * channels;
|
||||||
|
|
||||||
while (y-- > 0)
|
for (; y > 0; --y)
|
||||||
{
|
{
|
||||||
png_const_uint_16p in_ptr = input_row;
|
png_const_uint_16p in_ptr = input_row;
|
||||||
png_bytep out_ptr = output_row;
|
png_bytep out_ptr = output_row;
|
||||||
@@ -1757,7 +1762,7 @@ png_write_image_8bit(png_voidp argument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_write_row(png_ptr, output_row);
|
png_write_row(png_ptr, output_row);
|
||||||
input_row += display->row_bytes/(sizeof (png_uint_16));
|
input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1774,7 +1779,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||||||
|
|
||||||
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
|
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
|
||||||
const png_uint_32 format = image->format;
|
const png_uint_32 format = image->format;
|
||||||
const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
|
const unsigned 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)
|
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
|
||||||
@@ -1806,7 +1811,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||||||
{
|
{
|
||||||
png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
|
png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
|
||||||
|
|
||||||
entry += i * channels;
|
entry += (unsigned int)i * channels;
|
||||||
|
|
||||||
if ((channels & 1) != 0) /* no alpha */
|
if ((channels & 1) != 0) /* no alpha */
|
||||||
{
|
{
|
||||||
@@ -1862,7 +1867,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||||||
{
|
{
|
||||||
png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
|
png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
|
||||||
|
|
||||||
entry += i * channels;
|
entry += (unsigned int)i * channels;
|
||||||
|
|
||||||
switch (channels)
|
switch (channels)
|
||||||
{
|
{
|
||||||
@@ -1907,7 +1912,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||||||
png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
|
png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
|
||||||
num_trans, NULL);
|
num_trans, NULL);
|
||||||
|
|
||||||
image->colormap_entries = entries;
|
image->colormap_entries = (png_uint_32)entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1931,9 +1936,43 @@ png_image_write_main(png_voidp argument)
|
|||||||
png_set_benign_errors(png_ptr, 0/*error*/);
|
png_set_benign_errors(png_ptr, 0/*error*/);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Default the 'row_stride' parameter if required. */
|
/* Default the 'row_stride' parameter if required, also check the row stride
|
||||||
|
* and total image size to ensure that they are within the system limits.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
|
||||||
|
|
||||||
|
if (image->width <= 0x7fffffffU/channels) /* no overflow */
|
||||||
|
{
|
||||||
|
png_uint_32 check;
|
||||||
|
const png_uint_32 png_row_stride = image->width * channels;
|
||||||
|
|
||||||
if (display->row_stride == 0)
|
if (display->row_stride == 0)
|
||||||
display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
|
display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
|
||||||
|
|
||||||
|
if (display->row_stride < 0)
|
||||||
|
check = (png_uint_32)(-display->row_stride);
|
||||||
|
|
||||||
|
else
|
||||||
|
check = (png_uint_32)display->row_stride;
|
||||||
|
|
||||||
|
if (check >= png_row_stride)
|
||||||
|
{
|
||||||
|
/* Now check for overflow of the image buffer calculation; this
|
||||||
|
* limits the whole image size to 32 bits for API compatibility with
|
||||||
|
* the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
|
||||||
|
*/
|
||||||
|
if (image->height > 0xffffffffU/png_row_stride)
|
||||||
|
png_error(image->opaque->png_ptr, "memory image too large");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
png_error(image->opaque->png_ptr, "supplied row stride too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
png_error(image->opaque->png_ptr, "image row stride too large");
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the required transforms then write the rows in the correct order. */
|
/* Set the required transforms then write the rows in the correct order. */
|
||||||
if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
|
if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
|
||||||
@@ -2099,7 +2138,7 @@ png_image_write_main(png_voidp argument)
|
|||||||
ptrdiff_t row_bytes = display->row_bytes;
|
ptrdiff_t row_bytes = display->row_bytes;
|
||||||
png_uint_32 y = image->height;
|
png_uint_32 y = image->height;
|
||||||
|
|
||||||
while (y-- > 0)
|
for (; y > 0; --y)
|
||||||
{
|
{
|
||||||
png_write_row(png_ptr, row);
|
png_write_row(png_ptr, row);
|
||||||
row += row_bytes;
|
row += row_bytes;
|
||||||
@@ -2110,6 +2149,122 @@ png_image_write_main(png_voidp argument)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void (PNGCBAPI
|
||||||
|
image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
|
||||||
|
png_size_t size)
|
||||||
|
{
|
||||||
|
png_image_write_control *display = png_voidcast(png_image_write_control*,
|
||||||
|
png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
|
||||||
|
const png_alloc_size_t ob = display->output_bytes;
|
||||||
|
|
||||||
|
/* Check for overflow; this should never happen: */
|
||||||
|
if (size <= ((png_alloc_size_t)-1) - ob)
|
||||||
|
{
|
||||||
|
/* I don't think libpng ever does this, but just in case: */
|
||||||
|
if (size > 0)
|
||||||
|
{
|
||||||
|
if (display->memory_bytes >= ob+size) /* writing */
|
||||||
|
memcpy(display->memory+ob, data, size);
|
||||||
|
|
||||||
|
/* Always update the size: */
|
||||||
|
display->output_bytes = ob+size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
png_error(png_ptr, "png_image_write_to_memory: PNG too big");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (PNGCBAPI
|
||||||
|
image_memory_flush)(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
png_image_write_memory(png_voidp argument)
|
||||||
|
{
|
||||||
|
png_image_write_control *display = png_voidcast(png_image_write_control*,
|
||||||
|
argument);
|
||||||
|
|
||||||
|
/* The rest of the memory-specific init and write_main in an error protected
|
||||||
|
* environment. This case needs to use callbacks for the write operations
|
||||||
|
* since libpng has no built in support for writing to memory.
|
||||||
|
*/
|
||||||
|
png_set_write_fn(display->image->opaque->png_ptr, display/*io_ptr*/,
|
||||||
|
image_memory_write, image_memory_flush);
|
||||||
|
|
||||||
|
return png_image_write_main(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PNGAPI
|
||||||
|
png_image_write_to_memory(png_imagep image, void *memory,
|
||||||
|
png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
|
||||||
|
const void *buffer, png_int_32 row_stride, const void *colormap)
|
||||||
|
{
|
||||||
|
/* Write the image to the given buffer, or count the bytes if it is NULL */
|
||||||
|
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
||||||
|
{
|
||||||
|
if (memory_bytes != NULL && buffer != NULL)
|
||||||
|
{
|
||||||
|
/* This is to give the caller an easier error detection in the NULL
|
||||||
|
* case and guard against uninitialized variable problems:
|
||||||
|
*/
|
||||||
|
if (memory == NULL)
|
||||||
|
*memory_bytes = 0;
|
||||||
|
|
||||||
|
if (png_image_write_init(image) != 0)
|
||||||
|
{
|
||||||
|
png_image_write_control display;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
memset(&display, 0, (sizeof display));
|
||||||
|
display.image = image;
|
||||||
|
display.buffer = buffer;
|
||||||
|
display.row_stride = row_stride;
|
||||||
|
display.colormap = colormap;
|
||||||
|
display.convert_to_8bit = convert_to_8bit;
|
||||||
|
display.memory = png_voidcast(png_bytep, memory);
|
||||||
|
display.memory_bytes = *memory_bytes;
|
||||||
|
display.output_bytes = 0;
|
||||||
|
|
||||||
|
result = png_safe_execute(image, png_image_write_memory, &display);
|
||||||
|
png_image_free(image);
|
||||||
|
|
||||||
|
/* write_memory returns true even if we ran out of buffer. */
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
/* On out-of-buffer this function returns '0' but still updates
|
||||||
|
* memory_bytes:
|
||||||
|
*/
|
||||||
|
if (memory != NULL && display.output_bytes > *memory_bytes)
|
||||||
|
result = 0;
|
||||||
|
|
||||||
|
*memory_bytes = display.output_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return png_image_error(image,
|
||||||
|
"png_image_write_to_memory: invalid argument");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (image != NULL)
|
||||||
|
return png_image_error(image,
|
||||||
|
"png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
|
||||||
|
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||||
int PNGAPI
|
int PNGAPI
|
||||||
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
|
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
|
||||||
const void *buffer, png_int_32 row_stride, const void *colormap)
|
const void *buffer, png_int_32 row_stride, const void *colormap)
|
||||||
@@ -2117,7 +2272,7 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
|
|||||||
/* Write the image to the given (FILE*). */
|
/* Write the image to the given (FILE*). */
|
||||||
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
||||||
{
|
{
|
||||||
if (file != NULL)
|
if (file != NULL && buffer != NULL)
|
||||||
{
|
{
|
||||||
if (png_image_write_init(image) != 0)
|
if (png_image_write_init(image) != 0)
|
||||||
{
|
{
|
||||||
@@ -2167,7 +2322,7 @@ png_image_write_to_file(png_imagep image, const char *file_name,
|
|||||||
/* Write the image to the named file. */
|
/* Write the image to the named file. */
|
||||||
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
||||||
{
|
{
|
||||||
if (file_name != NULL)
|
if (file_name != NULL && buffer != NULL)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen(file_name, "wb");
|
FILE *fp = fopen(file_name, "wb");
|
||||||
|
|
||||||
@@ -2225,6 +2380,6 @@ png_image_write_to_file(png_imagep image, const char *file_name,
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
# endif /* STDIO */
|
#endif /* SIMPLIFIED_WRITE_STDIO */
|
||||||
#endif /* SIMPLIFIED_WRITE */
|
#endif /* SIMPLIFIED_WRITE */
|
||||||
#endif /* WRITE */
|
#endif /* WRITE */
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -177,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
int shift_start[4], shift_dec[4];
|
int shift_start[4], shift_dec[4];
|
||||||
int channels = 0;
|
unsigned int channels = 0;
|
||||||
|
|
||||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -23,10 +23,10 @@
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_save_uint_32(png_bytep buf, png_uint_32 i)
|
png_save_uint_32(png_bytep buf, png_uint_32 i)
|
||||||
{
|
{
|
||||||
buf[0] = (png_byte)(i >> 24);
|
buf[0] = (png_byte)((i >> 24) & 0xffU);
|
||||||
buf[1] = (png_byte)(i >> 16);
|
buf[1] = (png_byte)((i >> 16) & 0xffU);
|
||||||
buf[2] = (png_byte)(i >> 8);
|
buf[2] = (png_byte)((i >> 8) & 0xffU);
|
||||||
buf[3] = (png_byte)(i );
|
buf[3] = (png_byte)( i & 0xffU);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place a 16-bit number into a buffer in PNG byte order.
|
/* Place a 16-bit number into a buffer in PNG byte order.
|
||||||
@@ -36,8 +36,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_save_uint_16(png_bytep buf, unsigned int i)
|
png_save_uint_16(png_bytep buf, unsigned int i)
|
||||||
{
|
{
|
||||||
buf[0] = (png_byte)(i >> 8);
|
buf[0] = (png_byte)((i >> 8) & 0xffU);
|
||||||
buf[1] = (png_byte)(i );
|
buf[1] = (png_byte)( i & 0xffU);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||||||
png_ptr->zstream.avail_out = 0;
|
png_ptr->zstream.avail_out = 0;
|
||||||
|
|
||||||
/* Now initialize if required, setting the new parameters, otherwise just
|
/* Now initialize if required, setting the new parameters, otherwise just
|
||||||
* to a simple reset to the previous parameters.
|
* do a simple reset to the previous parameters.
|
||||||
*/
|
*/
|
||||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
||||||
ret = deflateReset(&png_ptr->zstream);
|
ret = deflateReset(&png_ptr->zstream);
|
||||||
@@ -1176,7 +1176,7 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
|
|||||||
png_byte new_name[80];
|
png_byte new_name[80];
|
||||||
png_byte entrybuf[10];
|
png_byte entrybuf[10];
|
||||||
png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
|
png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
|
||||||
png_size_t palette_size = entry_size * spalette->nentries;
|
png_size_t palette_size = entry_size * (png_size_t)spalette->nentries;
|
||||||
png_sPLT_entryp ep;
|
png_sPLT_entryp ep;
|
||||||
#ifndef PNG_POINTER_INDEXING_SUPPORTED
|
#ifndef PNG_POINTER_INDEXING_SUPPORTED
|
||||||
int i;
|
int i;
|
||||||
@@ -1441,7 +1441,8 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8");
|
"Ignoring attempt to write 16-bit bKGD chunk "
|
||||||
|
"when bit_depth is 8");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1742,7 +1743,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
|
|||||||
total_len = purpose_len + units_len + 10;
|
total_len = purpose_len + units_len + 10;
|
||||||
|
|
||||||
params_len = (png_size_tp)png_malloc(png_ptr,
|
params_len = (png_size_tp)png_malloc(png_ptr,
|
||||||
(png_alloc_size_t)(nparams * (sizeof (png_size_t))));
|
(png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t))));
|
||||||
|
|
||||||
/* Find the length of each parameter, making sure we don't count the
|
/* Find the length of each parameter, making sure we don't count the
|
||||||
* null terminator for the last parameter.
|
* null terminator for the last parameter.
|
||||||
@@ -2254,7 +2255,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
png_bytep rp, dp, lp;
|
png_bytep rp, dp, lp;
|
||||||
png_size_t i;
|
png_size_t i;
|
||||||
png_size_t sum = 0;
|
png_size_t sum = 0;
|
||||||
int v;
|
unsigned int v;
|
||||||
|
|
||||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
|
||||||
|
|
||||||
@@ -2262,14 +2263,22 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
i++, rp++, dp++)
|
i++, rp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = *rp;
|
v = *dp = *rp;
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lp = png_ptr->row_buf + 1; i < row_bytes;
|
for (lp = png_ptr->row_buf + 1; i < row_bytes;
|
||||||
i++, rp++, lp++, dp++)
|
i++, rp++, lp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sum > lmins) /* We are already worse, don't continue. */
|
if (sum > lmins) /* We are already worse, don't continue. */
|
||||||
break;
|
break;
|
||||||
@@ -2278,6 +2287,28 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
return (sum);
|
return (sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void /* PRIVATE */
|
||||||
|
png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||||
|
const png_size_t row_bytes)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, lp;
|
||||||
|
png_size_t i;
|
||||||
|
|
||||||
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
|
||||||
|
|
||||||
|
for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
|
||||||
|
i++, rp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = *rp;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (lp = png_ptr->row_buf + 1; i < row_bytes;
|
||||||
|
i++, rp++, lp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static png_size_t /* PRIVATE */
|
static png_size_t /* PRIVATE */
|
||||||
png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
||||||
const png_size_t lmins)
|
const png_size_t lmins)
|
||||||
@@ -2285,7 +2316,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
|||||||
png_bytep rp, dp, pp;
|
png_bytep rp, dp, pp;
|
||||||
png_size_t i;
|
png_size_t i;
|
||||||
png_size_t sum = 0;
|
png_size_t sum = 0;
|
||||||
int v;
|
unsigned int v;
|
||||||
|
|
||||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
|
||||||
|
|
||||||
@@ -2294,7 +2325,11 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
|||||||
i++, rp++, pp++, dp++)
|
i++, rp++, pp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sum > lmins) /* We are already worse, don't continue. */
|
if (sum > lmins) /* We are already worse, don't continue. */
|
||||||
break;
|
break;
|
||||||
@@ -2302,6 +2337,21 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
|||||||
|
|
||||||
return (sum);
|
return (sum);
|
||||||
}
|
}
|
||||||
|
static void /* PRIVATE */
|
||||||
|
png_setup_up_row_only(png_structrp png_ptr, const png_size_t row_bytes)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, pp;
|
||||||
|
png_size_t i;
|
||||||
|
|
||||||
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
|
||||||
|
|
||||||
|
for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
|
||||||
|
pp = png_ptr->prev_row + 1; i < row_bytes;
|
||||||
|
i++, rp++, pp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static png_size_t /* PRIVATE */
|
static png_size_t /* PRIVATE */
|
||||||
png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||||
@@ -2310,7 +2360,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
png_bytep rp, dp, pp, lp;
|
png_bytep rp, dp, pp, lp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_size_t sum = 0;
|
png_size_t sum = 0;
|
||||||
int v;
|
unsigned int v;
|
||||||
|
|
||||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
|
||||||
|
|
||||||
@@ -2319,7 +2369,11 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
{
|
{
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
||||||
|
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
|
for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
|
||||||
@@ -2327,7 +2381,11 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
v = *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
|
v = *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
|
||||||
& 0xff);
|
& 0xff);
|
||||||
|
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sum > lmins) /* We are already worse, don't continue. */
|
if (sum > lmins) /* We are already worse, don't continue. */
|
||||||
break;
|
break;
|
||||||
@@ -2335,6 +2393,27 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
|
|
||||||
return (sum);
|
return (sum);
|
||||||
}
|
}
|
||||||
|
static void /* PRIVATE */
|
||||||
|
png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||||
|
const png_size_t row_bytes)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, pp, lp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
|
||||||
|
|
||||||
|
for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
|
||||||
|
pp = png_ptr->prev_row + 1; i < bpp; i++)
|
||||||
|
{
|
||||||
|
*dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
|
||||||
|
{
|
||||||
|
*dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
|
||||||
|
& 0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static png_size_t /* PRIVATE */
|
static png_size_t /* PRIVATE */
|
||||||
png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||||
@@ -2343,7 +2422,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
png_bytep rp, dp, pp, cp, lp;
|
png_bytep rp, dp, pp, cp, lp;
|
||||||
png_size_t i;
|
png_size_t i;
|
||||||
png_size_t sum = 0;
|
png_size_t sum = 0;
|
||||||
int v;
|
unsigned int v;
|
||||||
|
|
||||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||||
|
|
||||||
@@ -2352,7 +2431,11 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
{
|
{
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
||||||
|
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
|
for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
|
||||||
@@ -2381,7 +2464,11 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
|
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
||||||
|
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sum > lmins) /* We are already worse, don't continue. */
|
if (sum > lmins) /* We are already worse, don't continue. */
|
||||||
break;
|
break;
|
||||||
@@ -2389,6 +2476,48 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
|||||||
|
|
||||||
return (sum);
|
return (sum);
|
||||||
}
|
}
|
||||||
|
static void /* PRIVATE */
|
||||||
|
png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||||
|
const png_size_t row_bytes)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, pp, cp, lp;
|
||||||
|
png_size_t i;
|
||||||
|
|
||||||
|
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||||
|
|
||||||
|
for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
|
||||||
|
pp = png_ptr->prev_row + 1; i < bpp; i++)
|
||||||
|
{
|
||||||
|
*dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
|
||||||
|
i++)
|
||||||
|
{
|
||||||
|
int a, b, c, pa, pb, pc, p;
|
||||||
|
|
||||||
|
b = *pp++;
|
||||||
|
c = *cp++;
|
||||||
|
a = *lp++;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||||
|
|
||||||
|
*dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /* WRITE_FILTER */
|
#endif /* WRITE_FILTER */
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
@@ -2397,7 +2526,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
#ifndef PNG_WRITE_FILTER_SUPPORTED
|
#ifndef PNG_WRITE_FILTER_SUPPORTED
|
||||||
png_write_filtered_row(png_ptr, png_ptr->row_buf, row_info->rowbytes+1);
|
png_write_filtered_row(png_ptr, png_ptr->row_buf, row_info->rowbytes+1);
|
||||||
#else
|
#else
|
||||||
png_byte filter_to_do = png_ptr->do_filter;
|
unsigned int filter_to_do = png_ptr->do_filter;
|
||||||
png_bytep row_buf;
|
png_bytep row_buf;
|
||||||
png_bytep best_row;
|
png_bytep best_row;
|
||||||
png_uint_32 bpp;
|
png_uint_32 bpp;
|
||||||
@@ -2443,32 +2572,33 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
*/
|
*/
|
||||||
best_row = png_ptr->row_buf;
|
best_row = png_ptr->row_buf;
|
||||||
|
|
||||||
|
if (PNG_SIZE_MAX/128 <= row_bytes)
|
||||||
if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
|
|
||||||
{
|
{
|
||||||
|
/* Overflow can occur in the calculation, just select the lowest set
|
||||||
|
* filter.
|
||||||
|
*/
|
||||||
|
filter_to_do &= 0U-filter_to_do;
|
||||||
|
}
|
||||||
|
else if ((filter_to_do & PNG_FILTER_NONE) != 0 &&
|
||||||
|
filter_to_do != PNG_FILTER_NONE)
|
||||||
|
{
|
||||||
|
/* Overflow not possible and multiple filters in the list, including the
|
||||||
|
* 'none' filter.
|
||||||
|
*/
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_size_t sum = 0;
|
png_size_t sum = 0;
|
||||||
png_size_t i;
|
png_size_t i;
|
||||||
int v;
|
unsigned int v;
|
||||||
|
|
||||||
if (PNG_SIZE_MAX/128 <= row_bytes)
|
|
||||||
{
|
|
||||||
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
|
|
||||||
{
|
|
||||||
/* Check for overflow */
|
|
||||||
if (sum > PNG_SIZE_MAX/128 - 256)
|
|
||||||
break;
|
|
||||||
|
|
||||||
v = *rp;
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else /* Overflow is not possible */
|
|
||||||
{
|
{
|
||||||
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
|
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
|
||||||
{
|
{
|
||||||
v = *rp;
|
v = *rp;
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
sum += 128 - abs((int)v - 128);
|
||||||
|
#else
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2479,7 +2609,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
if (filter_to_do == PNG_FILTER_SUB)
|
if (filter_to_do == PNG_FILTER_SUB)
|
||||||
/* It's the only filter so no testing is needed */
|
/* It's the only filter so no testing is needed */
|
||||||
{
|
{
|
||||||
(void) png_setup_sub_row(png_ptr, bpp, row_bytes, mins);
|
png_setup_sub_row_only(png_ptr, bpp, row_bytes);
|
||||||
best_row = png_ptr->try_row;
|
best_row = png_ptr->try_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2505,7 +2635,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
/* Up filter */
|
/* Up filter */
|
||||||
if (filter_to_do == PNG_FILTER_UP)
|
if (filter_to_do == PNG_FILTER_UP)
|
||||||
{
|
{
|
||||||
(void) png_setup_up_row(png_ptr, row_bytes, mins);
|
png_setup_up_row_only(png_ptr, row_bytes);
|
||||||
best_row = png_ptr->try_row;
|
best_row = png_ptr->try_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2531,7 +2661,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
/* Avg filter */
|
/* Avg filter */
|
||||||
if (filter_to_do == PNG_FILTER_AVG)
|
if (filter_to_do == PNG_FILTER_AVG)
|
||||||
{
|
{
|
||||||
(void) png_setup_avg_row(png_ptr, bpp, row_bytes, mins);
|
png_setup_avg_row_only(png_ptr, bpp, row_bytes);
|
||||||
best_row = png_ptr->try_row;
|
best_row = png_ptr->try_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2555,9 +2685,9 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Paeth filter */
|
/* Paeth filter */
|
||||||
if ((filter_to_do == PNG_FILTER_PAETH) != 0)
|
if (filter_to_do == PNG_FILTER_PAETH)
|
||||||
{
|
{
|
||||||
(void) png_setup_paeth_row(png_ptr, bpp, row_bytes, mins);
|
png_setup_paeth_row_only(png_ptr, bpp, row_bytes);
|
||||||
best_row = png_ptr->try_row;
|
best_row = png_ptr->try_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Makefiles for libpng version 1.6.21 - January 15, 2016
|
Makefiles for libpng version 1.6.28 - January 5, 2017
|
||||||
|
|
||||||
pnglibconf.h.prebuilt => Stores configuration settings
|
pnglibconf.h.prebuilt => Stores configuration settings
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng16.so.16.1.6.21)
|
(gcc, creates libpng16.so.16.1.6.28)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
@@ -33,12 +33,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
|||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.sggcc => Silicon Graphics (gcc,
|
makefile.sggcc => Silicon Graphics (gcc,
|
||||||
creates libpng16.so.16.1.6.21)
|
creates libpng16.so.16.1.6.28)
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||||
creates libpng16.so.16.1.6.21)
|
creates libpng16.so.16.1.6.28)
|
||||||
makefile.so9 => Solaris 9 makefile (gcc,
|
makefile.so9 => Solaris 9 makefile (gcc,
|
||||||
creates libpng16.so.16.1.6.21)
|
creates libpng16.so.16.1.6.28)
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
@@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
|
|||||||
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
||||||
PNG_DFN ""
|
PNG_DFN ""
|
||||||
PNG_DFN "EXPORTS"
|
PNG_DFN "EXPORTS"
|
||||||
PNG_DFN ";Version 1.6.21"
|
PNG_DFN ";Version 1.6.28"
|
||||||
|
|
||||||
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||||
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
# Modeled after libxml-config.
|
# Modeled after libxml-config.
|
||||||
|
|
||||||
version=1.6.21
|
version=1.6.28
|
||||||
prefix=""
|
prefix=""
|
||||||
libdir=""
|
libdir=""
|
||||||
libs=""
|
libs=""
|
||||||
|
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
|
|||||||
|
|
||||||
Name: libpng
|
Name: libpng
|
||||||
Description: Loads and saves PNG files
|
Description: Loads and saves PNG files
|
||||||
Version: 1.6.21
|
Version: 1.6.28
|
||||||
Libs: -L${libdir} -lpng16
|
Libs: -L${libdir} -lpng16
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
VERMAJ = 1
|
VERMAJ = 1
|
||||||
VERMIN = 6
|
VERMIN = 6
|
||||||
VERMIC = 21
|
VERMIC = 28
|
||||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||||
NAME = libpng
|
NAME = libpng
|
||||||
PACKAGE = $(NAME)-$(VER)
|
PACKAGE = $(NAME)-$(VER)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
# Library name:
|
# Library name:
|
||||||
LIBNAME = libpng16
|
LIBNAME = libpng16
|
||||||
PNGMAJ = 16
|
PNGMAJ = 16
|
||||||
RELEASE = 21
|
RELEASE = 28
|
||||||
|
|
||||||
# Shared library names:
|
# Shared library names:
|
||||||
LIBSO=$(LIBNAME).so
|
LIBSO=$(LIBNAME).so
|
||||||
|
@@ -18,7 +18,7 @@ exec_prefix=$(prefix)
|
|||||||
# Library name:
|
# Library name:
|
||||||
LIBNAME = libpng16
|
LIBNAME = libpng16
|
||||||
PNGMAJ = 16
|
PNGMAJ = 16
|
||||||
RELEASE = 21
|
RELEASE = 28
|
||||||
|
|
||||||
# Shared library names:
|
# Shared library names:
|
||||||
LIBSO=$(LIBNAME).dll
|
LIBSO=$(LIBNAME).dll
|
||||||
|
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
|
|||||||
|
|
||||||
LIB= png16
|
LIB= png16
|
||||||
SHLIB_MAJOR= 0
|
SHLIB_MAJOR= 0
|
||||||
SHLIB_MINOR= 1.6.21
|
SHLIB_MINOR= 1.6.28
|
||||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||||
|
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
|||||||
|
|
||||||
LIB= png
|
LIB= png
|
||||||
SHLIB_MAJOR= 16
|
SHLIB_MAJOR= 16
|
||||||
SHLIB_MINOR= 1.6.21
|
SHLIB_MINOR= 1.6.28
|
||||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||||
|
@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
|||||||
MANDIR= ${PREFIX}/man/cat
|
MANDIR= ${PREFIX}/man/cat
|
||||||
|
|
||||||
SHLIB_MAJOR= 16
|
SHLIB_MAJOR= 16
|
||||||
SHLIB_MINOR= 1.6.21
|
SHLIB_MINOR= 1.6.28
|
||||||
|
|
||||||
LIB= png
|
LIB= png
|
||||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
|
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
|
# Contributed by Mike Hopkirk (hops at sco.com) modified from Makefile.lnx
|
||||||
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
|
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
|
||||||
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1998 Greg Roelofs
|
# Copyright (C) 1998 Greg Roelofs
|
||||||
|
@@ -552,6 +552,7 @@ option WRITE_ANCILLARY_CHUNKS requires WRITE
|
|||||||
|
|
||||||
# These options disable *all* the text chunks if turned off
|
# These options disable *all* the text chunks if turned off
|
||||||
|
|
||||||
|
option TEXT disabled
|
||||||
option READ_TEXT requires READ_ANCILLARY_CHUNKS enables TEXT
|
option READ_TEXT requires READ_ANCILLARY_CHUNKS enables TEXT
|
||||||
option WRITE_TEXT requires WRITE_ANCILLARY_CHUNKS enables TEXT
|
option WRITE_TEXT requires WRITE_ANCILLARY_CHUNKS enables TEXT
|
||||||
|
|
||||||
@@ -873,9 +874,12 @@ option SIMPLIFIED_READ_BGR enables FORMAT_BGR,
|
|||||||
|
|
||||||
# Write:
|
# Write:
|
||||||
option SIMPLIFIED_WRITE,
|
option SIMPLIFIED_WRITE,
|
||||||
requires WRITE STDIO, SETJMP, WRITE_SWAP, WRITE_PACK,
|
requires WRITE, SETJMP, WRITE_SWAP, WRITE_PACK,
|
||||||
WRITE_tRNS, WRITE_gAMA, WRITE_sRGB, WRITE_cHRM
|
WRITE_tRNS, WRITE_gAMA, WRITE_sRGB, WRITE_cHRM
|
||||||
|
|
||||||
|
# 1.6.22: allow simplified write without stdio support:
|
||||||
|
option SIMPLIFIED_WRITE_STDIO requires SIMPLIFIED_WRITE STDIO
|
||||||
|
|
||||||
option SIMPLIFIED_WRITE_AFIRST enables FORMAT_AFIRST,
|
option SIMPLIFIED_WRITE_AFIRST enables FORMAT_AFIRST,
|
||||||
requires SIMPLIFIED_WRITE WRITE_SWAP_ALPHA
|
requires SIMPLIFIED_WRITE WRITE_SWAP_ALPHA
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/* libpng 1.6.21 STANDARD API DEFINITION */
|
/* libpng 1.6.28 STANDARD API DEFINITION */
|
||||||
|
|
||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* Libpng version 1.6.21 - January 15, 2016 */
|
/* Libpng version 1.6.28 - January 5, 2017 */
|
||||||
|
|
||||||
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
@@ -109,6 +109,7 @@
|
|||||||
#define PNG_SIMPLIFIED_READ_SUPPORTED
|
#define PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||||
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||||
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
|
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
#define PNG_STDIO_SUPPORTED
|
#define PNG_STDIO_SUPPORTED
|
||||||
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
;Version 1.6.21
|
;Version 1.6.28
|
||||||
;--------------------------------------------------------------
|
;--------------------------------------------------------------
|
||||||
; LIBPNG symbol list as a Win32 DEF file
|
; LIBPNG symbol list as a Win32 DEF file
|
||||||
; Contains all the symbols that can be exported from libpng
|
; Contains all the symbols that can be exported from libpng
|
||||||
@@ -249,3 +249,4 @@ EXPORTS
|
|||||||
png_set_check_for_invalid_index @242
|
png_set_check_for_invalid_index @242
|
||||||
png_get_palette_max @243
|
png_get_palette_max @243
|
||||||
png_set_option @244
|
png_set_option @244
|
||||||
|
png_image_write_to_memory @245
|
||||||
|
Reference in New Issue
Block a user