mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
218 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e753eb8b2 | ||
|
|
759c903686 | ||
|
|
8c12078e95 | ||
|
|
b91528db20 | ||
|
|
2f1dede991 | ||
|
|
5af0307f11 | ||
|
|
efaaad7447 | ||
|
|
bda94b1005 | ||
|
|
4250328102 | ||
|
|
bb6e0a2db3 | ||
|
|
41633d33c4 | ||
|
|
88cf760b07 | ||
|
|
4ea97d8bc7 | ||
|
|
bef206b0a8 | ||
|
|
b94db2eb34 | ||
|
|
3f7a169c2d | ||
|
|
bc79c250e9 | ||
|
|
3cc9e8ff96 | ||
|
|
95a197397f | ||
|
|
d0479d24a0 | ||
|
|
1fc0171278 | ||
|
|
a8472470a4 | ||
|
|
88ecac68be | ||
|
|
e51ba2eff4 | ||
|
|
a80e864faa | ||
|
|
1d3c990425 | ||
|
|
79f0ba499f | ||
|
|
74e84d0f7d | ||
|
|
4568762d28 | ||
|
|
0740c62700 | ||
|
|
38f49403bd | ||
|
|
8f1150eb75 | ||
|
|
c10930a4fc | ||
|
|
bff81bdddc | ||
|
|
be3977de2c | ||
|
|
67f101e6c9 | ||
|
|
b6f0a641cb | ||
|
|
81dfd007b2 | ||
|
|
1f23775d10 | ||
|
|
84092bbf29 | ||
|
|
1658e602c6 | ||
|
|
83b132f14d | ||
|
|
1f63da349b | ||
|
|
44db02364e | ||
|
|
3f8a2ed600 | ||
|
|
30145f29c5 | ||
|
|
d56af331e1 | ||
|
|
1c6e5f8caa | ||
|
|
27ae9362d8 | ||
|
|
88507b4ef9 | ||
|
|
0f6303301f | ||
|
|
aaf1bb1ae1 | ||
|
|
b5596712fc | ||
|
|
503a49458b | ||
|
|
c912050a7b | ||
|
|
113213416c | ||
|
|
bd757acf26 | ||
|
|
a7f0bcb3a6 | ||
|
|
7976b3c3e3 | ||
|
|
012d36f643 | ||
|
|
68dfa9e526 | ||
|
|
416bb9320f | ||
|
|
f2b8961f58 | ||
|
|
6a3805c25b | ||
|
|
cf247ebffe | ||
|
|
0ea69cdfa9 | ||
|
|
8bf54399a3 | ||
|
|
4da9d314bc | ||
|
|
08b0620202 | ||
|
|
dee5a914fc | ||
|
|
d2d09e5bf9 | ||
|
|
03eafe24ed | ||
|
|
e9a8fb8d07 | ||
|
|
fd8bba4b80 | ||
|
|
bb9adfdad9 | ||
|
|
393d3c8285 | ||
|
|
9450ffb26d | ||
|
|
ed049010b1 | ||
|
|
db9d96840d | ||
|
|
9e9977e153 | ||
|
|
681b731151 | ||
|
|
83a841ab7c | ||
|
|
85c2ec9a69 | ||
|
|
cf644fa901 | ||
|
|
17ad121e93 | ||
|
|
19e4edaf3f | ||
|
|
e1540e3b4c | ||
|
|
063eb1b497 | ||
|
|
fecdd46639 | ||
|
|
0e036921aa | ||
|
|
e827fa24a0 | ||
|
|
34ac3691cb | ||
|
|
236e105170 | ||
|
|
5b1df53a82 | ||
|
|
940b37b197 | ||
|
|
0441ff62e7 | ||
|
|
de723276e5 | ||
|
|
2464dbfe4c | ||
|
|
b3721757a0 | ||
|
|
cc93d89e43 | ||
|
|
8f381901e3 | ||
|
|
15a80443de | ||
|
|
6f8f004fe1 | ||
|
|
873f16fe2f | ||
|
|
7ae451f527 | ||
|
|
391459424e | ||
|
|
53ae7dc514 | ||
|
|
cd6a3ef31f | ||
|
|
209d3eb5c6 | ||
|
|
d42dc54df5 | ||
|
|
877afaf17e | ||
|
|
8c49ddcf56 | ||
|
|
5680f5d6f2 | ||
|
|
324402044f | ||
|
|
685d79e27a | ||
|
|
52083f9152 | ||
|
|
7191f6e9e6 | ||
|
|
4dcbf24d82 | ||
|
|
492e67163e | ||
|
|
5881b11629 | ||
|
|
847e9efb66 | ||
|
|
db56fa18c2 | ||
|
|
bc8e40d611 | ||
|
|
2b87a54d07 | ||
|
|
b23afad4a1 | ||
|
|
f5d7f438e5 | ||
|
|
b4ec1f8451 | ||
|
|
f5f1206778 | ||
|
|
497e7319f4 | ||
|
|
d5dd93f5d1 | ||
|
|
7f9a49aa65 | ||
|
|
573c9d434f | ||
|
|
56a1a66656 | ||
|
|
d992e05da8 | ||
|
|
870beb5279 | ||
|
|
b0d97356ce | ||
|
|
04d4e38ac2 | ||
|
|
67a46d17d8 | ||
|
|
bbc29a858d | ||
|
|
3948b94700 | ||
|
|
746bc7d883 | ||
|
|
f260f6d156 | ||
|
|
18dd07e3e6 | ||
|
|
0486b17fbd | ||
|
|
aa22442a9c | ||
|
|
4a43182924 | ||
|
|
810b6e51e4 | ||
|
|
88610994da | ||
|
|
1b9b970598 | ||
|
|
43f0311b57 | ||
|
|
421f95deb5 | ||
|
|
f96251291d | ||
|
|
cafa0eebb9 | ||
|
|
afd6cecb76 | ||
|
|
61dbc4c608 | ||
|
|
bea86bba24 | ||
|
|
7fc85a3f46 | ||
|
|
bb8d4f76f4 | ||
|
|
b79c98e57c | ||
|
|
4cf2465c71 | ||
|
|
4ea93e69bc | ||
|
|
ff141eb21e | ||
|
|
122bec17f2 | ||
|
|
9afb90f885 | ||
|
|
34b7d62488 | ||
|
|
3f2b5a6670 | ||
|
|
294d0b8408 | ||
|
|
62c6fbbd29 | ||
|
|
0c7ac064d3 | ||
|
|
db67cba8d4 | ||
|
|
2aa6c96e5d | ||
|
|
2fd3434fa4 | ||
|
|
2c0833e265 | ||
|
|
127b08a265 | ||
|
|
0f42908c0a | ||
|
|
f18a28cc13 | ||
|
|
56d6bc2e88 | ||
|
|
61946e0f56 | ||
|
|
49f9c24910 | ||
|
|
c62fda06a3 | ||
|
|
cd62215d61 | ||
|
|
ac09cd0fec | ||
|
|
529045cf26 | ||
|
|
7b1da52549 | ||
|
|
34d20f482f | ||
|
|
399430dac2 | ||
|
|
3f677d1c65 | ||
|
|
809355b4aa | ||
|
|
7fd71746d0 | ||
|
|
0ee3465fba | ||
|
|
a793120405 | ||
|
|
9bdba4e630 | ||
|
|
a74b70871c | ||
|
|
0d50d6562c | ||
|
|
453fbf942c | ||
|
|
6e1c74b39b | ||
|
|
fdc2d5f38f | ||
|
|
67a289ffa9 | ||
|
|
bf15ac7e86 | ||
|
|
7ef0c46488 | ||
|
|
8d9e494dfb | ||
|
|
0794df4062 | ||
|
|
7a69beda7b | ||
|
|
e4413a735b | ||
|
|
7fdb594e73 | ||
|
|
f1736a636b | ||
|
|
3b4c60f26b | ||
|
|
5c55ccdf4f | ||
|
|
5ec05b3d7c | ||
|
|
70eb0720a0 | ||
|
|
9bb775fc8c | ||
|
|
a8715cabd1 | ||
|
|
364acf40aa | ||
|
|
b44cd59ad9 | ||
|
|
e2d8e11407 | ||
|
|
43c07e1b48 | ||
|
|
2e0c5f0dff | ||
|
|
3a83aa328d |
119
ANNOUNCE
119
ANNOUNCE
@@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.6.1 - March 28, 2013
|
||||
Libpng 1.6.9 - February 6, 2014
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
@@ -8,89 +8,56 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
libpng-1.6.1.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.1.tar.gz
|
||||
libpng-1.6.9.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.9.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lpng161.7z (LZMA-compressed, recommended)
|
||||
lpng161.zip
|
||||
lpng169.7z (LZMA-compressed, recommended)
|
||||
lpng169.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.1-README.txt
|
||||
libpng-1.6.1-LICENSE.txt
|
||||
libpng-1.6.9-README.txt
|
||||
libpng-1.6.9-LICENSE.txt
|
||||
Gnupg/*.asc (PGP armored detached signatures)
|
||||
|
||||
Changes since the last public release (1.6.0):
|
||||
|
||||
Made symbol prefixing work with the ARM neon optimizations. Also allow
|
||||
pngpriv.h to be included for preprocessor definitions only, so it can
|
||||
be used in non-C/C++ files. Back ported from libpng 1.7.
|
||||
Made sRGB check numbers consistent.
|
||||
Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.
|
||||
Removed cc -E workround, corrected png_get_palette_max API Tested on
|
||||
SUN OS cc 5.9, which demonstrates the tokenization problem previously
|
||||
avoided by using /lib/cpp. Since all .dfn output is now protected in
|
||||
double quotes unless it is to be macro substituted the fix should
|
||||
work everywhere.
|
||||
Enabled parallel tests - back ported from libpng-1.7.
|
||||
scripts/pnglibconf.dfa formatting improvements back ported from libpng17.
|
||||
Fixed a race condition in the creation of the build 'scripts' directory
|
||||
while building with a parallel make.
|
||||
Use approved/supported Android method to check for NEON, use Linux/POSIX
|
||||
1003.1 API to check /proc/self/auxv avoiding buffer allocation and other
|
||||
library calls (ported from libpng15).
|
||||
Use parentheses more consistently in "#if defined(MACRO)" tests.
|
||||
Folded long lines.
|
||||
Reenabled code to allow zero length PLTE chunks for MNG.
|
||||
Fixed ALIGNED_MEMORY support.
|
||||
Allow run-time ARM NEON checking to be disabled. A new configure option:
|
||||
--enable-arm-neon=always will stop the run-time checks. New checks
|
||||
within arm/arm_init.c will cause the code not to be compiled unless
|
||||
__ARM_NEON__ is set. This should make it fail safe (if someone asks
|
||||
for it on then the build will fail if it can't be done.)
|
||||
Updated the INSTALL document.
|
||||
Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
|
||||
Revised scripts/makefile.freebsd to respect ZLIBLIB and ZLIBINC.
|
||||
Revised scripts/dfn.awk to work with the buggy MSYS awk that has trouble
|
||||
with CRLF line endings.
|
||||
Avoid a possible memory leak in contrib/gregbook/readpng.c
|
||||
Better documentation of unknown handling API interactions.
|
||||
Corrected Android builds and corrected libpng.vers with symbol
|
||||
prefixing This adds an API to set optimization options externally,
|
||||
providing an alternative and general solution for the non-portable
|
||||
run-time tests used by the ARM Neon code. It also makes those tests
|
||||
compile and link on Android.
|
||||
The order of settings vs options in pnglibconf.h is reversed to allow
|
||||
settings to depend on options and options can now set (or override) the
|
||||
defaults for settings.
|
||||
Corrected simplified API default gamma for color-mapped output, added
|
||||
a flag to change default. In 1.6.0 when the simplified API was used
|
||||
to produce color-mapped output from an input image with no gamma
|
||||
information the gamma assumed for the input could be different from
|
||||
that assumed for non-color-mapped output. In particular 16-bit depth
|
||||
input files were assumed to be sRGB encoded, whereas in the 'direct'
|
||||
case they were assumed to have linear data. This was an error. The
|
||||
fix makes the simplified API treat all input files the same way and
|
||||
adds a new flag to the png_image::flags member to allow the
|
||||
application/user to specify that 16-bit files contain sRGB data
|
||||
rather than the default linear.
|
||||
Fixed bugs in the pngpixel and makepng test programs.
|
||||
Fixed CMakelists.txt to allow building a single variant of the library
|
||||
(Claudio Bley):
|
||||
Introduced a PNG_LIB_TARGETS variable that lists all activated library
|
||||
targets. It is an error if this variable ends up empty, ie. you have
|
||||
to build at least one library variant.
|
||||
Made the *_COPY targets only depend on library targets actually being build.
|
||||
Use PNG_LIB_TARGETS to unify a code path.
|
||||
Changed the CREATE_SYMLINK macro to expect the full path to a file as the
|
||||
first argument. When symlinking the filename component of that path is
|
||||
determined and used as the link target.
|
||||
Use copy_if_different in the CREATE_SYMLINK macro.
|
||||
Eliminated two warnings from the Intel C compiler. The warnings are
|
||||
technically valid, although a reasonable treatment of division would
|
||||
show it to be incorrect.
|
||||
Changes since the last public release (1.6.8):
|
||||
Bookkeeping: Moved functions around (no changes). Moved transform
|
||||
function definitions before the place where they are called so that
|
||||
they can be masde static. Move the intrapixel functions and the
|
||||
grayscale palette builder out of the png?tran.c files. The latter
|
||||
isn't a transform function and is no longer used internally, and the
|
||||
former MNG specific functions are better placed in pngread/pngwrite.c
|
||||
Made transform implementation functions static. This makes the internal
|
||||
functions called by png_do_{read|write}_transformations static. On an
|
||||
x86-64 DLL build (Gentoo Linux) this reduces the size of the text
|
||||
segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
|
||||
maintenance by removing the declarations from pngpriv.h and allowing
|
||||
easier changes to the internal interfaces.
|
||||
Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
|
||||
in the tar distributions.
|
||||
Added checks for libpng 1.5 to pngvalid.c. This supports the use of
|
||||
this version of pngvalid in libpng 1.5
|
||||
Merged with pngvalid.c from libpng-1.7 changes to create a single
|
||||
pngvalid.c
|
||||
Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
|
||||
Merged pngrio.c, pngtrans.c, pngwio.c, and pngerror.c with libpng-1.7.0
|
||||
Merged libpng-1.7.0 changes to make no-interlace configurations work
|
||||
with test programs.
|
||||
Revised pngvalid.c to support libpng 1.5, which does not support the
|
||||
PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when appropriate in
|
||||
pngvalid.c
|
||||
Allow unversioned links created on install to be disabled in configure.
|
||||
In configure builds 'make install' changes/adds links like png.h
|
||||
and libpng.a to point to the newly installed, versioned, files (e.g.
|
||||
libpng17/png.h and libpng17.a). Three new configure options and some
|
||||
rearrangement of Makefile.am allow creation of these links to be disabled.
|
||||
Removed potentially misleading warning from png_check_IHDR().
|
||||
Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
|
||||
Added clang attribute support (Cosmin).
|
||||
Quiet an uninitialized memory warning from VC2013 in png_get_png().
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
||||
329
CHANGES
329
CHANGES
@@ -4047,7 +4047,9 @@ Version 1.6.0beta17 [March 10, 2012]
|
||||
Deflate/inflate was reworked to move common zlib calls into single
|
||||
functions [rw]util.c. A new shared keyword check routine was also added
|
||||
and the 'zbuf' is no longer allocated on progressive read. It is now
|
||||
possible to call png_inflate() incrementally.
|
||||
possible to call png_inflate() incrementally. A warning is no longer
|
||||
issued if the language tag or translated keyword in the iTXt chunk
|
||||
has zero length.
|
||||
If benign errors are disabled use maximum window on ancilliary inflate.
|
||||
This works round a bug introduced in 1.5.4 where compressed ancillary
|
||||
chunks could end up with a too-small windowBits value in the deflate
|
||||
@@ -4473,6 +4475,331 @@ Version 1.6.1rc01 [March 21, 2013]
|
||||
Version 1.6.1 [March 28, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.2beta01 [April 14, 2013]
|
||||
Updated documentation of 1.5.x to 1.6.x changes in iCCP chunk handling.
|
||||
Fixed incorrect warning of excess deflate data. End condition - the
|
||||
warning would be produced if the end of the deflate stream wasn't read
|
||||
in the last row. The warning is harmless.
|
||||
Corrected the test on user transform changes on read. It was in the
|
||||
png_set of the transform function, but that doesn't matter unless the
|
||||
transform function changes the rowbuf size, and that is only valid if
|
||||
transform_info is called.
|
||||
Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
|
||||
(Flavio Medeiros).
|
||||
Corrected length written to uncompressed iTXt chunks (Samuli Suominen).
|
||||
Bug was introduced in libpng-1.6.0.
|
||||
|
||||
Version 1.6.2rc01 [April 18, 2013]
|
||||
Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
|
||||
written by libpng-1.6.0 and 1.6.1.
|
||||
Disallow storing sRGB information when the sRGB is not supported.
|
||||
|
||||
Version 1.6.2rc02 [April 18, 2013]
|
||||
Merge pngtest.c with libpng-1.7.0
|
||||
|
||||
Version 1.6.2rc03 [April 22, 2013]
|
||||
Trivial spelling cleanup.
|
||||
|
||||
Version 1.6.2rc04 and 1.6.2rc05 [omitted]
|
||||
|
||||
Version 1.6.2rc06 [April 24, 2013]
|
||||
Reverted to version 1.6.2rc03. Recent changes to arm/neon support
|
||||
have been ported to libpng-1.7.0beta09 and will reappear in version
|
||||
1.6.3beta01.
|
||||
|
||||
Version 1.6.2 [April 25, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.3beta01 [April 25, 2013]
|
||||
Revised stack marking in arm/filter_neon.S and configure.ac.
|
||||
Ensure that NEON filter stuff is completely disabled when switched 'off'.
|
||||
Previously the ARM NEON specific files were still built if the option
|
||||
was switched 'off' as opposed to being explicitly disabled.
|
||||
|
||||
Version 1.6.3beta02 [April 26, 2013]
|
||||
Test for 'arm*' not just 'arm' in the host_cpu configure variable.
|
||||
Rebuilt the configure scripts.
|
||||
|
||||
Version 1.6.3beta03 [April 30, 2013]
|
||||
Expanded manual paragraph about writing private chunks, particularly
|
||||
the need to call png_set_keep_unknown_chunks() when writing them.
|
||||
Avoid dereferencing NULL pointer possibly returned from
|
||||
png_create_write_struct() (Andrew Church).
|
||||
|
||||
Version 1.6.3beta05 [May 9, 2013]
|
||||
Calculate our own zlib windowBits when decoding rather than trusting the
|
||||
CMF bytes in the PNG datastream.
|
||||
Added an option to force maximum window size for inflating, which was
|
||||
the behavior of libpng15 and earlier.
|
||||
Added png-fix-itxt and png-fix-too-far-back to the built programs and
|
||||
removed warnings from the source code and timepng that are revealed as
|
||||
a result.
|
||||
Detect wrong libpng versions linked to png-fix-too-far-back, which currently
|
||||
only works with libpng versions that can be made to reliably fail when
|
||||
the deflate data contains an out-of-window reference. This means only
|
||||
1.6 and later.
|
||||
Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
|
||||
message which it is easier to work round than ignore.
|
||||
Updated contrib/pngminus/pnm2png.c (Paul Stewart):
|
||||
Check for EOF
|
||||
Ignore "#" delimited comments in input file to pnm2png.c.
|
||||
Fixed whitespace handling
|
||||
Added a call to png_set_packing()
|
||||
Initialize dimension values so if sscanf fails at least we have known
|
||||
invalid values.
|
||||
Attempt to detect configuration issues with png-fix-too-far-back, which
|
||||
requires both the correct libpng and the correct zlib to function
|
||||
correctly.
|
||||
Check ZLIB_VERNUM for mismatches, enclose #error in quotes
|
||||
Added information in the documentation about problems with and fixes for
|
||||
the bad CRC and bad iTXt chunk situations.
|
||||
|
||||
Version 1.6.3beta06 [May 12, 2013]
|
||||
Allow contrib/pngminus/pnm2png.c to compile without WRITE_INVERT and
|
||||
WRITE_PACK supported (writes error message that it can't read P1 or
|
||||
P4 PBM files).
|
||||
Improved png-fix-too-far-back usage message, added --suffix option.
|
||||
Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
|
||||
right zlib header files.
|
||||
Separated CPPFLAGS and CFLAGS in contrib/pngminim/*/makefile
|
||||
|
||||
Version 1.6.3beta07 [June 8, 2013]
|
||||
Removed a redundant test in png_set_IHDR().
|
||||
Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
|
||||
Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
|
||||
Enclose the prototypes for the simplified write API in
|
||||
#ifdef PNG_STDIO_SUPPORTED/#endif
|
||||
Make ARM NEON support work at compile time (not just configure time).
|
||||
This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
|
||||
using a compiler that compiles for multiple architectures at one time.
|
||||
Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
|
||||
pnglibconf.h, allowing more of the decisions to be made internally
|
||||
(pngpriv.h) during the compile. Without this, symbol prefixing is broken
|
||||
under certain circumstances on ARM platforms. Now only the API parts of
|
||||
the optimizations ('check' vs 'api') are exposed in the public header files
|
||||
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||
decision about whether or not to use the optimizations.
|
||||
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
|
||||
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||
prefixing because the definition of the special png_init_filter_functions
|
||||
call was hidden at configure time if the relevant compiler arguments are
|
||||
passed in CFLAGS as opposed to CC. This change attempts to avoid all
|
||||
the confusion that would result by declaring the init function even when
|
||||
it is not used, so that it will always get prefixed.
|
||||
|
||||
Version 1.6.3beta08 [June 18, 2013]
|
||||
Revised libpng.3 so that "doclifter" can process it.
|
||||
|
||||
Version 1.6.3beta09 [June 27, 2013]
|
||||
Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
|
||||
as parameters for png_set_gamma(). These have been available since
|
||||
libpng-1.5.4.
|
||||
Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised it
|
||||
to check all compressed chunks known to libpng.
|
||||
|
||||
Version 1.6.3beta10 [July 5, 2013]
|
||||
Updated documentation to show default behavior of benign errors correctly.
|
||||
Only compile ARM code when PNG_READ_SUPPORTED is defined.
|
||||
Fixed undefined behavior in contrib/tools/pngfix.c and added new strip
|
||||
option. pngfix relied on undefined behavior and even a simple change from
|
||||
gcc to g++ caused it to fail. The new strip option 'unsafe' has been
|
||||
implemented and is the default if --max is given. Option names have
|
||||
been clarified, with --strip=transform now stripping the bKGD chunk,
|
||||
which was stripped previously with --strip=unused.
|
||||
Added all documented chunk types to pngpriv.h
|
||||
Unified pngfix.c source with libpng17.
|
||||
|
||||
Version 1.6.3rc01 [July 11, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.3 [July 18, 2013]
|
||||
Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
|
||||
Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
|
||||
may be erroneously issued by code-checking applications.
|
||||
|
||||
Version 1.6.4beta01 [August 21, 2013]
|
||||
Added information about png_set_options() to the manual.
|
||||
Delay calling png_init_filter_functions() until a row with nonzero filter
|
||||
is found.
|
||||
|
||||
Version 1.6.4beta02 [August 30, 2013]
|
||||
Fixed inconsistent conditional compilation of png_chunk_unknown_handling()
|
||||
prototype, definition, and usage. Made it depend on
|
||||
PNG_HANDLE_AS_UNKNOWN_SUPPORTED everywhere.
|
||||
|
||||
Version 1.6.4rc01 [September 5, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.4 [September 12, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.5 [September 14, 2013]
|
||||
Removed two stray lines of code from arm/arm_init.c.
|
||||
|
||||
Version 1.6.6 [September 16, 2013]
|
||||
Removed two stray lines of code from arm/arm_init.c, again.
|
||||
|
||||
Version 1.6.7beta01 [September 30, 2013]
|
||||
Revised unknown chunk code to correct several bugs in the NO_SAVE_/NO_WRITE
|
||||
combination
|
||||
Allow HANDLE_AS_UNKNOWN to work when other options are configured off. Also
|
||||
fixed the pngminim makefiles to work when $(MAKEFLAGS) contains stuff
|
||||
which terminates the make options (as by default in recent versions of
|
||||
Gentoo).
|
||||
Avoid up-cast warnings in pngvalid.c. On ARM the alignment requirements of
|
||||
png_modifier are greater than that of png_store and as a consequence
|
||||
compilation of pngvalid.c results in a warning about increased alignment
|
||||
requirements because of the bare cast to (png_modifier*). The code is safe,
|
||||
because the pointer is known to point to a stack allocated png_modifier,
|
||||
but this change avoids the warning.
|
||||
Fixed default behavior of ARM_NEON_API. If the ARM NEON API option was
|
||||
compiled without the CHECK option it defaulted to on, not off.
|
||||
Check user callback behavior in pngunknown.c. Previous versions compiled
|
||||
if SAVE_UNKNOWN was not available but did nothing since the callback
|
||||
was never implemented.
|
||||
Merged pngunknown.c with 1.7 version and back ported 1.7 improvements/fixes
|
||||
|
||||
Version 1.6.7beta02 [October 12, 2013]
|
||||
Made changes for compatibility with automake 1.14:
|
||||
1) Added the 'compile' program to the list of programs that must be cleaned
|
||||
in autogen.sh
|
||||
2) Added 'subdir-objects' which causes .c files in sub-directories to be
|
||||
compiled such that the corresponding .o files are also in the
|
||||
sub-directory. This is because automake 1.14 warns that the
|
||||
current behavior of compiling to the top level directory may be removed
|
||||
in the future.
|
||||
3) Updated dependencies on pnglibconf.h to match the new .o locations and
|
||||
added all the files in contrib/libtests and contrib/tools that depend
|
||||
on pnglibconf.h
|
||||
4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
|
||||
way of handling the dependencies of sources that are machine generated;
|
||||
unfortunately it only works if the user does 'make all' or 'make check',
|
||||
so the dependencies (3) are still required.
|
||||
Cleaned up (char*) casts of zlib messages. The latest version of the Intel C
|
||||
compiler complains about casting a string literal as (char*), so copied the
|
||||
treatment of z_const from the library code into pngfix.c
|
||||
Simplified error message code in pngunknown. The simplification has the
|
||||
useful side effect of avoiding a bogus warning generated by the latest
|
||||
version of the Intel C compiler (it objects to
|
||||
condition ? string-literal : string-literal).
|
||||
Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always
|
||||
removing the 1.14 'compile' script but never checking for it.
|
||||
|
||||
Version 1.6.7beta03 [October 19, 2013]
|
||||
Added ARMv8 support (James Yu <james.yu at linaro.org>). Added file
|
||||
arm/filter_neon_intrinsics.c; enable with -mfpu=neon.
|
||||
Revised pngvalid to generate size images with as many filters as it can
|
||||
manage, limited by the number of rows.
|
||||
Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
|
||||
and detect the broken GCC compilers.
|
||||
|
||||
Version 1.6.7beta04 [October 26, 2013]
|
||||
Allow clang derived from older GCC versions to use ARM intrinsics. This
|
||||
causes all clang builds that use -mfpu=neon to use the intrinsics code,
|
||||
not the assembler code. This has only been tested on iOS 7. It may be
|
||||
necessary to exclude some earlier clang versions but this seems unlikely.
|
||||
Changed NEON implementation selection mechanism. This allows assembler
|
||||
or intrinsics to be turned on at compile time during the build by defining
|
||||
PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1). This macro
|
||||
is undefined by default and the build type is selected in pngpriv.h.
|
||||
|
||||
Version 1.6.7rc01 [November 2, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.7rc02 [November 7, 2013]
|
||||
Fixed #include in filter_neon_intrinsics.c and ctype macros. The ctype char
|
||||
checking macros take an unsigned char argument, not a signed char.
|
||||
|
||||
Version 1.6.7 [November 14, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.8beta01 [November 24, 2013]
|
||||
Moved prototype for png_handle_unknown() in pngpriv.h outside of
|
||||
the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
|
||||
Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile
|
||||
Conditionally compile some unused functions reported by -Wall in
|
||||
pngminim.
|
||||
Fixed 'minimal' builds. Various obviously useful minimal configurations
|
||||
don't build because of missing contrib/libtests test programs and
|
||||
overly complex dependencies in scripts/pnglibconf.dfa. This change
|
||||
adds contrib/conftest/*.dfa files that can be used in automatic build
|
||||
scripts to ensure that these configurations continue to build.
|
||||
Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
|
||||
Fixed pngvalid 'fail' function declaration on the Intel C Compiler.
|
||||
This reverts to the previous 'static' implementation and works round
|
||||
the 'unused static function' warning by using PNG_UNUSED().
|
||||
|
||||
Version 1.6.8beta02 [November 30, 2013]
|
||||
Removed or marked PNG_UNUSED some harmless "dead assignments" reported
|
||||
by clang scan-build.
|
||||
Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
|
||||
to '"%s" m' to improve portability among compilers.
|
||||
Changed png_free_default() to free() in pngtest.c
|
||||
|
||||
Version 1.6.8rc01 [December 12, 2013]
|
||||
Tidied up pngfix inits and fixed pngtest no-write builds.
|
||||
|
||||
Version 1.6.8rc02 [December 14, 2013]
|
||||
Handle zero-length PLTE chunk or NULL palette with png_error()
|
||||
instead of png_chunk_report(), which by default issues a warning
|
||||
rather than an error, leading to later reading from a NULL pointer
|
||||
(png_ptr->palette) in png_do_expand_palette(). This is CVE-2013-6954
|
||||
and VU#650142. Libpng-1.6.1 through 1.6.7 are vulnerable.
|
||||
Libpng-1.6.0 and earlier do not have this bug.
|
||||
|
||||
Version 1.6.8 [December 19, 2013]
|
||||
No changes.
|
||||
|
||||
Version 1.6.9beta01 [December 26, 2013]
|
||||
Bookkeeping: Moved functions around (no changes). Moved transform
|
||||
function definitions before the place where they are called so that
|
||||
they can be masde static. Move the intrapixel functions and the
|
||||
grayscale palette builder out of the png?tran.c files. The latter
|
||||
isn't a transform function and is no longer used internally, and the
|
||||
former MNG specific functions are better placed in pngread/pngwrite.c
|
||||
Made transform implementation functions static. This makes the internal
|
||||
functions called by png_do_{read|write}_transformations static. On an
|
||||
x86-64 DLL build (Gentoo Linux) this reduces the size of the text
|
||||
segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
|
||||
maintenance by removing the declarations from pngpriv.h and allowing
|
||||
easier changes to the internal interfaces.
|
||||
Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
|
||||
in the tar distributions.
|
||||
|
||||
Version 1.6.9beta02 [January 1, 2014]
|
||||
Added checks for libpng 1.5 to pngvalid.c. This supports the use of
|
||||
this version of pngvalid in libpng 1.5
|
||||
Merged with pngvalid.c from libpng-1.7 changes to create a single
|
||||
pngvalid.c
|
||||
Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
|
||||
Merged pngrio.c, pngtrans.c, pngwio.c, and pngerror.c with libpng-1.7.0
|
||||
Merged libpng-1.7.0 changes to make no-interlace configurations work
|
||||
with test programs.
|
||||
Revised pngvalid.c to support libpng 1.5, which does not support the
|
||||
PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when appropriate in
|
||||
pngvalid.c
|
||||
Allow unversioned links created on install to be disabled in configure.
|
||||
In configure builds 'make install' changes/adds links like png.h
|
||||
and libpng.a to point to the newly installed, versioned, files (e.g.
|
||||
libpng17/png.h and libpng17.a). Three new configure options and some
|
||||
rearrangement of Makefile.am allow creation of these links to be disabled.
|
||||
|
||||
Version 1.6.9beta03 [January 10, 2014]
|
||||
Removed potentially misleading warning from png_check_IHDR().
|
||||
|
||||
Version 1.6.9beta04 [January 20, 2014]
|
||||
Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
|
||||
Added clang attribute support (Cosmin).
|
||||
|
||||
Version 1.6.9rc01 [January 28, 2014]
|
||||
No changes.
|
||||
|
||||
Version 1.6.9rc02 [January 30, 2014]
|
||||
Quiet an uninitialized memory warning from VC2013 in png_get_png().
|
||||
|
||||
Version 1.6.9 [February 6, 2014]
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
# Copyright (C) 2007-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2007-2013 Glenn Randers-Pehrson
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -9,33 +9,14 @@
|
||||
cmake_minimum_required(VERSION 2.4.4)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
|
||||
# workaround CMake 2.4.x bug
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||
"Choose the type of build, options are:
|
||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
||||
Debug
|
||||
Release
|
||||
RelWithDebInfo
|
||||
MinSizeRel.")
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||
"Choose the type of build, options are:
|
||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
||||
Debug
|
||||
Release
|
||||
RelWithDebInfo
|
||||
MinSizeRel.")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
||||
|
||||
project(libpng C)
|
||||
enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 1)
|
||||
set(PNGLIB_RELEASE 9)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
@@ -271,7 +252,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.1
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.9
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
6
LICENSE
6
LICENSE
@@ -10,8 +10,8 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.1, March 28, 2013, are
|
||||
Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.9, February 6, 2014, are
|
||||
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
|
||||
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
March 28, 2013
|
||||
February 6, 2014
|
||||
|
||||
141
Makefile.am
141
Makefile.am
@@ -9,6 +9,19 @@ ACLOCAL_AMFLAGS = -I scripts
|
||||
# test programs - run on make check, make distcheck
|
||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid
|
||||
|
||||
# Utilities - installed
|
||||
bin_PROGRAMS= pngfix png-fix-itxt
|
||||
|
||||
# This ensures that pnglibconf.h gets built at the start of 'make all' or
|
||||
# 'make check', but it does not add dependencies to the individual programs,
|
||||
# this is done below.
|
||||
#
|
||||
# IMPORTANT: always add the object modules of new programs to the list below
|
||||
# because otherwise the sequence 'configure; make new-program' will *sometimes*
|
||||
# result in the installed (system) pnglibconf.h being used and the result is
|
||||
# always wrong and always very confusing.
|
||||
BUILT_SOURCES = pnglibconf.h
|
||||
|
||||
pngtest_SOURCES = pngtest.c
|
||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
@@ -21,6 +34,11 @@ pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngunknown_SOURCES = contrib/libtests/pngunknown.c
|
||||
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
pngfix_SOURCES = contrib/tools/pngfix.c
|
||||
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
|
||||
# Generally these are single line shell scripts to run a test with a particular
|
||||
# set of parameters:
|
||||
TESTS =\
|
||||
@@ -64,7 +82,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||
|
||||
if PNG_ARM_NEON
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||
arm/filter_neon.S
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||
endif
|
||||
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||
@@ -180,14 +198,27 @@ endif
|
||||
$(srcdir)/scripts/pnglibconf.h.prebuilt:
|
||||
@echo "Attempting to build $@" >&2
|
||||
@echo "This is a machine generated file, but if you want to make" >&2
|
||||
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
|
||||
@echo "a new one simply make 'scripts/pnglibconf.out', copy that" >&2
|
||||
@echo "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)" >&2
|
||||
@exit 1
|
||||
|
||||
# The following is necessary to ensure that the local pnglibconf.h is used, not
|
||||
# an installed one (this can happen immediately after on a clean system if
|
||||
# 'make test' is the first thing the user does.)
|
||||
contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
|
||||
# 'make test' is the first thing the user does.) Only files which include
|
||||
# one of the png source files (typically png.h or pngpriv.h) need to be listed
|
||||
# here:
|
||||
pngtest.o: pnglibconf.h
|
||||
|
||||
contrib/libtests/makepng.o: pnglibconf.h
|
||||
contrib/libtests/pngstest.o: pnglibconf.h
|
||||
contrib/libtests/pngunknown.o: pnglibconf.h
|
||||
contrib/libtests/pngvalid.o: pnglibconf.h
|
||||
contrib/libtests/readpng.o: pnglibconf.h
|
||||
contrib/libtests/tarith.o: pnglibconf.h
|
||||
contrib/libtests/timepng.o: pnglibconf.h
|
||||
|
||||
contrib/tools/makesRGB.o: pnglibconf.h
|
||||
contrib/tools/pngfix.o: pnglibconf.h
|
||||
|
||||
# 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
|
||||
@@ -256,40 +287,76 @@ check: scripts/symbols.chk
|
||||
dist-hook:
|
||||
cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
|
||||
|
||||
# install the .../include headers as links to the new ones
|
||||
install-data-hook:
|
||||
cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h
|
||||
cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
|
||||
cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
|
||||
pngconf.h
|
||||
cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
|
||||
pnglibconf.h
|
||||
cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc
|
||||
cd '$(DESTDIR)$(pkgconfigdir)'; $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
|
||||
# Make links between installed files with release-specific names and the generic
|
||||
# file names. If this install rule is run the generic names will be deleted and
|
||||
# recreated - this has obvious issues for systems with multiple installations.
|
||||
|
||||
# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
|
||||
install-exec-hook:
|
||||
cd '$(DESTDIR)$(bindir)'; rm -f libpng-config
|
||||
cd '$(DESTDIR)$(bindir)';\
|
||||
$(LN_S) $(PNGLIB_BASENAME)-config libpng-config
|
||||
@set -x;\
|
||||
cd '$(DESTDIR)$(libdir)';\
|
||||
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@\
|
||||
sl dylib dll.a; do\
|
||||
rm -f libpng.$$ext;\
|
||||
if test -f $(PNGLIB_BASENAME).$$ext; then\
|
||||
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
|
||||
fi;\
|
||||
install-header-links:
|
||||
@set -ex; cd '$(DESTDIR)$(includedir)'; for f in $(HEADERS); do \
|
||||
rm -f "$$f"; $(LN_S) "$(PNGLIB_BASENAME)/$$f" "$$f"; done
|
||||
|
||||
uninstall-header-links:
|
||||
cd '$(DESTDIR)$(includedir)'; rm -f $(HEADERS)
|
||||
|
||||
install-libpng-pc:
|
||||
@set -ex; cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc; \
|
||||
$(LN_S) '$(PNGLIB_BASENAME).pc' libpng.pc
|
||||
|
||||
uninstall-libpng-pc:
|
||||
rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc'
|
||||
|
||||
# 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
|
||||
# actually installed on a given system, so instead we check for every extension
|
||||
# we have seen.
|
||||
|
||||
EXT_LIST = a dll.a so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ la sl dylib
|
||||
|
||||
install-library-links:
|
||||
@set -x; cd '$(DESTDIR)$(libdir)';\
|
||||
for ext in $(EXT_LIST); do\
|
||||
rm -f "libpng.$$ext";\
|
||||
if test -f "$(PNGLIB_BASENAME).$$ext"; then\
|
||||
$(LN_S) "$(PNGLIB_BASENAME).$$ext" "libpng.$$ext" || exit 1;\
|
||||
fi;\
|
||||
done
|
||||
|
||||
uninstall-hook:
|
||||
cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h
|
||||
rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc'
|
||||
uninstall-library-links:
|
||||
@set -x; cd '$(DESTDIR)$(libdir)'; for ext in $(EXT_LIST); do\
|
||||
rm -f "libpng.$$ext"; done
|
||||
|
||||
install-libpng-config:
|
||||
@set -ex; cd '$(DESTDIR)$(bindir)'; rm -f libpng-config; \
|
||||
$(LN_S) '$(PNGLIB_BASENAME)-config' libpng-config
|
||||
|
||||
uninstall-libpng-config:
|
||||
rm -f '$(DESTDIR)$(bindir)/libpng-config'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.a'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.la'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.so'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.sl'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.dylib'
|
||||
rm -f '$(DESTDIR)$(libdir)/libpng.dll.a'
|
||||
|
||||
if DO_INSTALL_LINKS
|
||||
# If --enable-unversioned-links is specified the header and lib file links
|
||||
# will be automatically made on a 'make install':
|
||||
|
||||
install-data-hook: install-header-links
|
||||
uninstall-hook: uninstall-header-links
|
||||
install-exec-hook: install-library-links
|
||||
uninstall-hook: uninstall-library-links
|
||||
endif
|
||||
|
||||
if DO_INSTALL_LIBPNG_PC
|
||||
# Likewise, --install-pc causes libpng.pc to be constructed:
|
||||
|
||||
install-data-hook: install-libpng-pc
|
||||
uninstall-hook: uninstall-libpng-pc
|
||||
endif
|
||||
|
||||
if DO_INSTALL_LIBPNG_CONFIG
|
||||
# And --install-config:
|
||||
|
||||
install-exec-hook: install-libpng-config
|
||||
uninstall-hook: uninstall-libpng-config
|
||||
endif
|
||||
|
||||
# The following addition ensures that 'make all' always builds the test programs
|
||||
# too. It used to, but some change either in libpng or configure stopped this
|
||||
# working.
|
||||
all-am: $(check_PROGRAMS)
|
||||
|
||||
36
README
36
README
@@ -1,11 +1,11 @@
|
||||
README for libpng version 1.6.1 - March 28, 2013 (shared library 16.0)
|
||||
README for libpng version 1.6.9 - February 6, 2014 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
||||
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
||||
in the text files, or lpng*.zip if you want DOS-style line endings.
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
|
||||
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||
|
||||
Version 0.89 was the first official release of libpng. Don't let the
|
||||
fact that it's the first release fool you. The libpng library has been in
|
||||
@@ -77,17 +77,15 @@ compression library that is useful for more things than just PNG files.
|
||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||
you are so inclined.
|
||||
|
||||
zlib should be available at the same place that libpng is, or at.
|
||||
ftp://ftp.info-zip.org/pub/infozip/zlib
|
||||
zlib should be available at the same place that libpng is, or at zlib.net.
|
||||
|
||||
You may also want a copy of the PNG specification. It is available
|
||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||
these at http://www.libpng.org/pub/png/documents/
|
||||
|
||||
This code is currently being archived at libpng.sf.net in the
|
||||
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||
at GO GRAPHSUP. If you can't find it in any of those places,
|
||||
e-mail me, and I'll help you find it.
|
||||
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
|
||||
in any of those places, e-mail me, and I'll help you find it.
|
||||
|
||||
If you have any code changes, requests, problems, etc., please e-mail
|
||||
them to me. Also, I'd appreciate any make files or project files,
|
||||
@@ -123,7 +121,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for sixteen years now, and it is official and
|
||||
been discussing PNG for nineteen years now, and it is official and
|
||||
finished. If you have suggestions for libpng, however, I'll
|
||||
gladly listen. Even if your suggestion is not used immediately,
|
||||
it may be used later.
|
||||
@@ -167,23 +165,25 @@ Files in this distribution:
|
||||
pngwrite.c => High-level write functions
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
arm => Contains optimized code for the ARM platform
|
||||
contrib => Contributions
|
||||
examples => Example programs
|
||||
gregbook => source code for PNG reading and writing, from
|
||||
Greg Roelofs' "PNG: The Definitive Guide",
|
||||
O'Reilly, 1999
|
||||
msvctest => Builds and runs pngtest using a MSVC workspace
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
libtests => Test programs
|
||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating use of pngusr.dfa
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
tools => Various tools
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
projects => Contains project files and workspaces for
|
||||
building a DLL
|
||||
cbuilder5 => Contains a Borland workspace for building
|
||||
libpng and zlib
|
||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
owatcom => Contains a WATCOM project for building libpng
|
||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
xcode => Contains an Apple xcode
|
||||
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
(see scripts/README.txt for the list of scripts)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.5.15 [March 28, 2013]
|
||||
* Last changed in libpng 1.6.6 [September 16, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_ARM_NEON_SUPPORTED
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
@@ -89,7 +90,7 @@ safe_read(png_structp png_ptr, int fd, void *buffer_in, size_t nbytes)
|
||||
if (errno != EINTR)
|
||||
{
|
||||
png_warning(png_ptr, "/proc read failed");
|
||||
return 0; /* I.e. a permanent failure */
|
||||
return 0; /* I.e., a permanent failure */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +154,16 @@ png_have_neon(png_structp png_ptr)
|
||||
void
|
||||
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
{
|
||||
/* The switch statement is compiled in for ARM_NEON_API, the call to
|
||||
* png_have_neon is compiled in for ARM_NEON_CHECK. If both are defined
|
||||
* the check is only performed if the API has not set the NEON option on
|
||||
* or off explicitly. In this case the check controls what happens.
|
||||
*
|
||||
* If the CHECK is not compiled in and the option is UNSET the behavior prior
|
||||
* to 1.6.7 was to use the NEON code - this was a bug caused by having the
|
||||
* wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF,
|
||||
* as documented in png.h
|
||||
*/
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
switch ((pp->options >> PNG_ARM_NEON) & 3)
|
||||
{
|
||||
@@ -177,13 +188,14 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
break;
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
default: /* OFF or INVALID */
|
||||
return;
|
||||
|
||||
case PNG_OPTION_ON:
|
||||
/* Option turned on */
|
||||
break;
|
||||
|
||||
default: /* OFF or INVALID */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -216,4 +228,5 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
png_read_filter_row_paeth4_neon;
|
||||
}
|
||||
}
|
||||
#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -11,17 +11,26 @@
|
||||
*/
|
||||
|
||||
/* This is required to get the symbol renames, which are #defines, and also
|
||||
* includes the value of PNG_FILTER_OPTIMIZATIONS.
|
||||
* includes the definition (or not) of PNG_ARM_NEON_OPT and
|
||||
* PNG_ARM_NEON_IMPLEMENTATION.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
|
||||
defined(__ARM_NEON__)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
|
||||
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
|
||||
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
|
||||
* for the logic which sets PNG_USE_ARM_NEON_ASM:
|
||||
*/
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
#ifdef __ELF__
|
||||
# define ELF
|
||||
#else
|
||||
@@ -232,4 +241,6 @@ func png_read_filter_row_paeth3_neon, export=1
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||
|
||||
372
arm/filter_neon_intrinsics.c
Normal file
372
arm/filter_neon_intrinsics.c
Normal file
@@ -0,0 +1,372 @@
|
||||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2013 Glenn Randers-Pehrson
|
||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
/* This code requires -mfpu=neon on the command line: */
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
||||
* checks for this (and will not compile unless it is done). This code uses
|
||||
* variants of png_aligncast to avoid compiler warnings.
|
||||
*/
|
||||
#define png_ptr(type,pointer) png_aligncast(type *,pointer)
|
||||
#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
|
||||
|
||||
/* The following relies on a variable 'temp_pointer' being declared with type
|
||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||
* warning; note that the code is safe because there never is an alias between
|
||||
* the input and output pointers.
|
||||
*/
|
||||
#define png_ldr(type,pointer)\
|
||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
void
|
||||
png_read_filter_row_up_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||
{
|
||||
uint8x16_t qrp, qpp;
|
||||
|
||||
qrp = vld1q_u8(rp);
|
||||
qpp = vld1q_u8(pp);
|
||||
qrp = vaddq_u8(qrp, qpp);
|
||||
vst1q_u8(rp, qrp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_sub3_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x16_t vtmp = vld1q_u8(rp);
|
||||
uint8x8x2_t *vrpt = png_ptr(uint8x8x2_t, &vtmp);
|
||||
uint8x8x2_t vrp = *vrpt;
|
||||
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
for (; rp < rp_stop;)
|
||||
{
|
||||
uint8x8_t vtmp1, vtmp2;
|
||||
uint32x2_t *temp_pointer;
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3);
|
||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||
vtmp2 = vext_u8(vrp.val[0], vrp.val[1], 6);
|
||||
vdest.val[1] = vadd_u8(vdest.val[0], vtmp1);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1);
|
||||
vdest.val[2] = vadd_u8(vdest.val[1], vtmp2);
|
||||
vdest.val[3] = vadd_u8(vdest.val[2], vtmp1);
|
||||
|
||||
vtmp = vld1q_u8(rp + 12);
|
||||
vrpt = png_ptr(uint8x8x2_t, &vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0);
|
||||
rp += 3;
|
||||
}
|
||||
|
||||
PNG_UNUSED(prev_row)
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
for (; rp < rp_stop; rp += 16)
|
||||
{
|
||||
uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
uint8x8x4_t vrp = *vrpt;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
|
||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
}
|
||||
|
||||
PNG_UNUSED(prev_row)
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_avg3_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x16_t vtmp;
|
||||
uint8x8x2_t *vrpt;
|
||||
uint8x8x2_t vrp;
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
vtmp = vld1q_u8(rp);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
for (; rp < rp_stop; pp += 12)
|
||||
{
|
||||
uint8x8_t vtmp1, vtmp2, vtmp3;
|
||||
|
||||
uint8x8x2_t *vppt;
|
||||
uint8x8x2_t vpp;
|
||||
|
||||
uint32x2_t *temp_pointer;
|
||||
|
||||
vtmp = vld1q_u8(pp);
|
||||
vppt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3);
|
||||
vdest.val[0] = vhadd_u8(vdest.val[3], vpp.val[0]);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
|
||||
vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 3);
|
||||
vtmp3 = vext_u8(vrp.val[0], vrp.val[1], 6);
|
||||
vdest.val[1] = vhadd_u8(vdest.val[0], vtmp2);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vtmp1);
|
||||
|
||||
vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 6);
|
||||
vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1);
|
||||
|
||||
vtmp = vld1q_u8(rp + 12);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
vdest.val[2] = vhadd_u8(vdest.val[1], vtmp2);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vtmp3);
|
||||
|
||||
vtmp2 = vext_u8(vpp.val[1], vpp.val[1], 1);
|
||||
|
||||
vdest.val[3] = vhadd_u8(vdest.val[2], vtmp2);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vtmp1);
|
||||
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0);
|
||||
rp += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||
{
|
||||
uint32x2x4_t vtmp;
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
vtmp = vld4_u32(png_ptrc(uint32_t,pp));
|
||||
vppt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vdest.val[0] = vhadd_u8(vdest.val[3], vpp.val[0]);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
vdest.val[1] = vhadd_u8(vdest.val[0], vpp.val[1]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]);
|
||||
vdest.val[2] = vhadd_u8(vdest.val[1], vpp.val[2]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]);
|
||||
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8x8_t
|
||||
paeth(uint8x8_t a, uint8x8_t b, uint8x8_t c)
|
||||
{
|
||||
uint8x8_t d, e;
|
||||
uint16x8_t p1, pa, pb, pc;
|
||||
|
||||
p1 = vaddl_u8(a, b); /* a + b */
|
||||
pc = vaddl_u8(c, c); /* c * 2 */
|
||||
pa = vabdl_u8(b, c); /* pa */
|
||||
pb = vabdl_u8(a, c); /* pb */
|
||||
pc = vabdq_u16(p1, pc); /* pc */
|
||||
|
||||
p1 = vcleq_u16(pa, pb); /* pa <= pb */
|
||||
pa = vcleq_u16(pa, pc); /* pa <= pc */
|
||||
pb = vcleq_u16(pb, pc); /* pb <= pc */
|
||||
|
||||
p1 = vandq_u16(p1, pa); /* pa <= pb && pa <= pc */
|
||||
|
||||
d = vmovn_u16(pb);
|
||||
e = vmovn_u16(p1);
|
||||
|
||||
d = vbsl_u8(d, b, c);
|
||||
e = vbsl_u8(e, a, d);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_paeth3_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x16_t vtmp;
|
||||
uint8x8x2_t *vrpt;
|
||||
uint8x8x2_t vrp;
|
||||
uint8x8_t vlast = vdup_n_u8(0);
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
vtmp = vld1q_u8(rp);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
for (; rp < rp_stop; pp += 12)
|
||||
{
|
||||
uint8x8x2_t *vppt;
|
||||
uint8x8x2_t vpp;
|
||||
uint8x8_t vtmp1, vtmp2, vtmp3;
|
||||
uint32x2_t *temp_pointer;
|
||||
|
||||
vtmp = vld1q_u8(pp);
|
||||
vppt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vdest.val[0] = paeth(vdest.val[3], vpp.val[0], vlast);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3);
|
||||
vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 3);
|
||||
vdest.val[1] = paeth(vdest.val[0], vtmp2, vpp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vtmp1);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 6);
|
||||
vtmp3 = vext_u8(vpp.val[0], vpp.val[1], 6);
|
||||
vdest.val[2] = paeth(vdest.val[1], vtmp3, vtmp2);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vtmp1);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1);
|
||||
vtmp2 = vext_u8(vpp.val[1], vpp.val[1], 1);
|
||||
|
||||
vtmp = vld1q_u8(rp + 12);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
vdest.val[3] = paeth(vdest.val[2], vtmp2, vtmp3);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vtmp1);
|
||||
|
||||
vlast = vtmp2;
|
||||
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0);
|
||||
rp += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
uint8x8_t vlast = vdup_n_u8(0);
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||
{
|
||||
uint32x2x4_t vtmp;
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
vtmp = vld4_u32(png_ptrc(uint32_t,pp));
|
||||
vppt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vdest.val[0] = paeth(vdest.val[3], vpp.val[0], vlast);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
vdest.val[1] = paeth(vdest.val[0], vpp.val[1], vpp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]);
|
||||
vdest.val[2] = paeth(vdest.val[1], vpp.val[2], vpp.val[1]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]);
|
||||
vdest.val[3] = paeth(vdest.val[2], vpp.val[3], vpp.val[2]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||
|
||||
vlast = vpp.val[3];
|
||||
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
||||
13
autogen.sh
13
autogen.sh
@@ -9,15 +9,15 @@
|
||||
#
|
||||
# For regular ("tarball") distributions all the files should exist. We do not
|
||||
# want them to be updated *under any circumstances*. It should never be
|
||||
# necessary to rune autogen.sh because ./configure --enable-maintainer-mode says
|
||||
# what to do if Makeile.am or configure.ac are changed.
|
||||
# necessary to run autogen.sh because ./configure --enable-maintainer-mode says
|
||||
# what to do if Makefile.am or configure.ac are changed.
|
||||
#
|
||||
# It is *probably* OK to update the files on a GIT checkout, because they have
|
||||
# come from the local tools, but leave that to the user who is assumed to know
|
||||
# whether it is ok or required.
|
||||
#
|
||||
# This script is intended to work without arguments, there are, however, hidden
|
||||
# arguments for (a) use while testing the script and (b) to fix up systems that
|
||||
# arguments (a) for use while testing the script and (b) to fix up systems that
|
||||
# have been broken. If (b) is required the script prompts for the correct
|
||||
# options. For this reason the options are *NOT* documented in the help; this
|
||||
# is deliberate; UTSL.
|
||||
@@ -76,6 +76,10 @@ done
|
||||
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in\
|
||||
config.sub configure depcomp install-sh ltmain.sh missing test-driver"
|
||||
#
|
||||
# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
|
||||
# versions than those required by configure.ac):
|
||||
libpng_autotools_extra="compile"
|
||||
#
|
||||
# These are separate because 'maintainer-clean' does not remove them.
|
||||
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
|
||||
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
|
||||
@@ -94,6 +98,7 @@ libpng_configure_dirs=".deps"
|
||||
# of Makefile. These functions do the two bits of cleaning.
|
||||
clean_autotools(){
|
||||
rm -rf $libpng_autotools_files $libpng_libtool_files $libpng_autotools_dirs
|
||||
rm -rf $libpng_autotools_extra
|
||||
}
|
||||
|
||||
clean_configure(){
|
||||
@@ -198,7 +203,7 @@ case "$mode" in
|
||||
echo " You can run autoreconf yourself if you don't like maintainer"
|
||||
echo " mode and you can also just run autoreconf -f -i to initialize"
|
||||
echo " everything in the first place; this script is only for"
|
||||
echo " compatiblity with prior releases."
|
||||
echo " compatibility with prior releases."
|
||||
exit 1
|
||||
else
|
||||
exec >&2
|
||||
|
||||
98
configure.ac
98
configure.ac
@@ -18,7 +18,7 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.1],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng],[1.6.9],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
@@ -27,7 +27,7 @@ AC_CONFIG_MACRO_DIR([scripts])
|
||||
# dist-xz requires automake 1.11 or later
|
||||
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
|
||||
# 1.13 is required for parallel tests
|
||||
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules])
|
||||
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
|
||||
# configure, this is necessary because libpng distributions cannot rely on the
|
||||
# time stamps of the autotools generated files being correct
|
||||
@@ -39,10 +39,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.1
|
||||
PNGLIB_VERSION=1.6.9
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=1
|
||||
PNGLIB_RELEASE=9
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
@@ -226,35 +226,93 @@ AC_ARG_WITH(libpng-prefix,
|
||||
fi])
|
||||
AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
|
||||
|
||||
# Because GCC by default assembles code with an executable stack, even though it
|
||||
# compiles C code with a non-executable stack, it is necessary to do a fixup
|
||||
# here (this may by GCC specific)
|
||||
AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
|
||||
# Control over what links are made for installed files. Versioned files are
|
||||
# always installed, when the following options are turned on corresponding
|
||||
# unversioned links are also created (normally as symbolic links):
|
||||
AC_ARG_ENABLE([unversioned-links],
|
||||
AS_HELP_STRING([[[--enable-unversioned-links]]],
|
||||
[Installed libpng header files are placed in a versioned subdirectory]
|
||||
[and installed libpng library (including DLL) files are versioned.]
|
||||
[If this option is enabled unversioned links will be created pointing to]
|
||||
[the corresponding installed files. If you use libpng.pc or]
|
||||
[libpng-config for all builds you do not need these links, but if you]
|
||||
[compile programs directly they will typically #include <png.h> and]
|
||||
[link with -lpng; in that case you need the links.]
|
||||
[The links can be installed manually using 'make install-header-links']
|
||||
[and 'make install-library-links' and can be removed using the]
|
||||
[corresponding uninstall- targets. If you do enable this option every]
|
||||
[libpng 'make install' will recreate the links to point to the just]
|
||||
[installed version of libpng. The default is to create the links;]
|
||||
[use --disable-unversioned-links to change this]))
|
||||
|
||||
# The AM_CONDITIONAL test is written so that the default is enabled;
|
||||
# --disable-unversioned-links must be given to turn the option off.
|
||||
AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"])
|
||||
|
||||
AC_ARG_ENABLE([unversioned-libpng-pc],
|
||||
AS_HELP_STRING([[[--enable-unversioned-libpng-pc]]],
|
||||
[Install the configuration file 'libpng.pc' as a link to the versioned]
|
||||
[version. This is done by default - use --disable-unversioned-libpng-pc]
|
||||
[to change this.]))
|
||||
AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC],
|
||||
[test "$enable_unversioned_libpng_pc" != "no"])
|
||||
|
||||
AC_ARG_ENABLE([unversioned-libpng-config],
|
||||
AS_HELP_STRING([[[--enable-unversioned-libpng-config]]],
|
||||
[Install the configuration file 'libpng-config' as a link to the]
|
||||
[versioned version. This is done by default - use]
|
||||
[--disable-unversioned-libpng-config to change this.]))
|
||||
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||
[test "$enable_unversioned_libpng_config" != "no"])
|
||||
|
||||
# HOST SPECIFIC OPTIONS
|
||||
# =====================
|
||||
#
|
||||
# ARM
|
||||
# ===
|
||||
#
|
||||
# ARM NEON (SIMD) support.
|
||||
|
||||
AC_ARG_ENABLE([arm-neon],
|
||||
AS_HELP_STRING([[[--enable-arm-neon]]],
|
||||
[Enable ARM NEON optimizations: =off, check, api, on:]
|
||||
[off: disable the optimizations; check: use internal checking code]
|
||||
[Enable ARM NEON 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; on: turn on unconditionally. The]
|
||||
[default is 'on' if __ARM_NEON__ is defined, otherwise 'off'.]),
|
||||
[a call to png_set_option; yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
off)
|
||||
AC_DEFINE([PNG_NO_ARM_NEON], [],
|
||||
[Disable ARM Neon optimizations]);;
|
||||
no|off)
|
||||
# disable the default enabling on __ARM_NEON__ systems:
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Disable ARM Neon optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_arm_neon=no;;
|
||||
check)
|
||||
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
||||
[Check for ARM Neon support at run-time]);;
|
||||
api)
|
||||
AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [],
|
||||
[Turn on ARM Neon optimizations at run-time]);;
|
||||
on)
|
||||
AC_DEFINE([PNG_ARM_NEON_SUPPORTED], [],
|
||||
[Enable ARM Neon optimizations]);;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
|
||||
[Enable ARM Neon optimizations])
|
||||
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass -mfpu=neon]
|
||||
[to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([arm-neon: option value required (off/check/api/on)]);;
|
||||
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
|
||||
esac])
|
||||
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" != "no"])
|
||||
|
||||
# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
|
||||
# where ARM optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'arm*')
|
||||
|
||||
AM_CONDITIONAL([PNG_ARM_NEON],
|
||||
[test "$enable_arm_neon" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
arm*) :;;
|
||||
*) test "$enable_arm_neon" != '';;
|
||||
esac])
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
|
||||
49
contrib/conftest/README
Normal file
49
contrib/conftest/README
Normal file
@@ -0,0 +1,49 @@
|
||||
This directory contains test configuration files, currently always '.dfa' files
|
||||
intended to be used in the build by setting the make macro DFA_XTRA to the name
|
||||
of the file.
|
||||
|
||||
These files are used in release validation of the 'configure' builds of libpng
|
||||
by building 'make check', or 'make all-am' for cross-builds, with each .dfa
|
||||
file.
|
||||
|
||||
The files in this directory may change between minor releases, however
|
||||
contributions describing specific builds of libpng are welcomed. There is no
|
||||
guarantee that libpng will continue to build with such configurations; support
|
||||
for given configurations can be, and has been, dropped between successive minor
|
||||
releases. However if a .dfa file describing a configuration is not in this
|
||||
directory it is very unlikely that it will be tested before a minor release!
|
||||
|
||||
You can use these .dfa files as the basis of new configurations. Files in this
|
||||
directory should not have any use restrictions or restrictive licenses.
|
||||
|
||||
This directory is not included in the .zip and .7z distributions, which do
|
||||
not contain 'configure' scripts.
|
||||
|
||||
DOCUMENTATION
|
||||
=============
|
||||
|
||||
Examples:
|
||||
${srcdir}/pngusr.dfa
|
||||
${srcdir}/contrib/pngminim/*/pngusr.dfa
|
||||
|
||||
Documentation of the options:
|
||||
${srcdir}/scripts/pnglibconf.dfa
|
||||
|
||||
Documentation of the file format:
|
||||
${srcdir}/scripts/options.awk
|
||||
|
||||
FILE NAMING
|
||||
===========
|
||||
|
||||
File names in this directory may NOT contain any of the five characters:
|
||||
|
||||
- , + * ?
|
||||
|
||||
Neither may they contain any space character.
|
||||
|
||||
While other characters may be used it is strongly suggested that file names be
|
||||
limited to lower case Latiin alphabetic characters (a-z), digits (0-9) and, if
|
||||
necessary the underscore (_) character. File names should be about 8 characters
|
||||
long (excluding the .dfa extension). Submitted .dfa files should have names
|
||||
between 7 and 16 characters long, shorter names (6 characters or less) are
|
||||
reserved for standard tests.
|
||||
58
contrib/conftest/read.dfa
Normal file
58
contrib/conftest/read.dfa
Normal file
@@ -0,0 +1,58 @@
|
||||
# read.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2013
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with basic read support. This enables the lowest level libpng
|
||||
# read API - the one where the calling code has to use a loop to read each row.
|
||||
# At present this is the API used by most programs.
|
||||
#
|
||||
# Support is enabled only for those chunks and transformations that are
|
||||
# typically required - others can be added easily.
|
||||
#
|
||||
|
||||
everything = off
|
||||
|
||||
# The sequential read code is enabled here; the progressive code can be used
|
||||
# instead but there is no point enabling both.
|
||||
|
||||
option SEQUENTIAL_READ on
|
||||
|
||||
# Likewise it is pointless enabling both fixed and floating point APIs. Choose
|
||||
# one or the other for both the API and the internal math.
|
||||
|
||||
#Fixed point:
|
||||
#option FIXED_POINT on
|
||||
#option FLOATING_ARITHMETIC off
|
||||
|
||||
#Floating point:
|
||||
option FLOATING_POINT on
|
||||
option FLOATING_ARITHMETIC on
|
||||
|
||||
# Basic error handling, IO and user memory support. The latter allows the
|
||||
# application program to provide its own implementations of 'malloc' and 'free'.
|
||||
option SETJMP on
|
||||
option STDIO on
|
||||
option USER_MEM on
|
||||
|
||||
# To read the full set of PNG images correctly interlace, transparency and
|
||||
# 16-bit support is required. The application can implement interlace itself,
|
||||
# but very few do and it's no longer possible to disable it when READ is
|
||||
# enabled.
|
||||
option READ_tRNS on
|
||||
option READ_16BIT on
|
||||
|
||||
# Everything else is application dependent. This file assumes the app handles
|
||||
# all the native PNG bit layouts, so it doesn't need any of layout change
|
||||
# transforms, but needs libpng to perform gamma correction. It doesn't do any
|
||||
# colorspace stuff and ignores the 'significant bit' information.
|
||||
#
|
||||
# If your app always expands the image to a limited set of bit layouts you
|
||||
# probably want to consider using the simplified API instead of the low level
|
||||
# one - see png.h and s_read.dfa.
|
||||
option READ_GAMMA on
|
||||
35
contrib/conftest/s_read.dfa
Normal file
35
contrib/conftest/s_read.dfa
Normal file
@@ -0,0 +1,35 @@
|
||||
# s_read.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2013
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with simplified read support (only). This builds a minimal
|
||||
# libpng able to read all PNG formats and convert them into a small number of
|
||||
# well understood memory formats.
|
||||
#
|
||||
|
||||
everything = off
|
||||
|
||||
option SIMPLIFIED_READ on
|
||||
|
||||
# It isn't necessary to chose fixed or floating point for the APIs because the
|
||||
# simplified API doesn't need fixed or floating point numbers. It is necessary
|
||||
# to chose an internal math implementation. The default (because of 'everything
|
||||
# = off') is fixed point - turn the floating point implementation on if you have
|
||||
# hardware floating point or prefer your software floating point implementation.
|
||||
option FLOATING_ARITHMETIC on
|
||||
|
||||
# This is not strictly necessary, but without it the message strings in the API
|
||||
# will not be filled in
|
||||
option ERROR_TEXT on
|
||||
|
||||
# Switching these options on enables the 'AFIRST' and 'BGR' formats - you don't
|
||||
# need this if you don't use them, they just allow the in-memory layout to be
|
||||
# changed to match common hardware formats.
|
||||
option SIMPLIFIED_READ_AFIRST on
|
||||
option SIMPLIFIED_READ_BGR on
|
||||
33
contrib/conftest/s_write.dfa
Normal file
33
contrib/conftest/s_write.dfa
Normal file
@@ -0,0 +1,33 @@
|
||||
# s_write.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2013
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with (just) simplified write support
|
||||
#
|
||||
|
||||
everything = off
|
||||
|
||||
option SIMPLIFIED_WRITE on
|
||||
|
||||
# It isn't necessary to chose fixed or floating point for the APIs because the
|
||||
# simplified API doesn't need fixed or floating point numbers. It is necessary
|
||||
# to chose an internal math implementation. The default (because of 'everything
|
||||
# = off') is fixed point - turn the floating point implementation on if you have
|
||||
# hardware floating point or prefer your software floating point implementation.
|
||||
option FLOATING_ARITHMETIC on
|
||||
|
||||
# This is not strictly necessary, but without it the message strings in the API
|
||||
# will not be filled in
|
||||
option ERROR_TEXT on
|
||||
|
||||
# Switching these options on enables the 'AFIRST' and 'BGR' formats - you don't
|
||||
# need this if you don't use them, they just allow the in-memory layout to be
|
||||
# changed to match common hardware formats.
|
||||
option SIMPLIFIED_WRITE_AFIRST on
|
||||
option SIMPLIFIED_WRITE_BGR on
|
||||
36
contrib/conftest/simple.dfa
Normal file
36
contrib/conftest/simple.dfa
Normal file
@@ -0,0 +1,36 @@
|
||||
# simple.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2013
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with just the simplified APIs (read and write).
|
||||
#
|
||||
|
||||
everything = off
|
||||
|
||||
option SIMPLIFIED_WRITE on
|
||||
option SIMPLIFIED_READ on
|
||||
|
||||
# It isn't necessary to chose fixed or floating point for the APIs because the
|
||||
# simplified API doesn't need fixed or floating point numbers. It is necessary
|
||||
# to chose an internal math implementation. The default (because of 'everything
|
||||
# = off') is fixed point - turn the floating point implementation on if you have
|
||||
# hardware floating point or prefer your software floating point implementation.
|
||||
option FLOATING_ARITHMETIC on
|
||||
|
||||
# This is not strictly necessary, but without it the message strings in the API
|
||||
# will not be filled in
|
||||
option ERROR_TEXT on
|
||||
|
||||
# Switching these options on enables the 'AFIRST' and 'BGR' formats - you don't
|
||||
# need this if you don't use them, they just allow the in-memory layout to be
|
||||
# changed to match common hardware formats.
|
||||
option SIMPLIFIED_READ_AFIRST on
|
||||
option SIMPLIFIED_READ_BGR on
|
||||
option SIMPLIFIED_WRITE_AFIRST on
|
||||
option SIMPLIFIED_WRITE_BGR on
|
||||
45
contrib/conftest/write.dfa
Normal file
45
contrib/conftest/write.dfa
Normal file
@@ -0,0 +1,45 @@
|
||||
# write.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2013
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with no read support and minimal write support.
|
||||
#
|
||||
|
||||
everything = off
|
||||
|
||||
# Switch on the write code - this makes a minimalist encoder
|
||||
|
||||
option WRITE on
|
||||
|
||||
# Choose fixed or floating point APIs and arithmetic. The choices are
|
||||
# independent but normally they will match. It is typically better to use the
|
||||
# floating point if you have floating point hardware. If you don't know, or
|
||||
# (perhaps) to make libpng smaller used fixed point throughout.
|
||||
|
||||
#Fixed point:
|
||||
#option FIXED_POINT on
|
||||
#option FLOATING_ARITHMETIC off
|
||||
|
||||
#Floating point:
|
||||
option FLOATING_POINT on
|
||||
option FLOATING_ARITHMETIC on
|
||||
|
||||
# Basic error handling, IO and user memory support. The latter allows the
|
||||
# application program to provide its own implementations of 'malloc' and 'free'.
|
||||
option SETJMP on
|
||||
option STDIO on
|
||||
option USER_MEM on
|
||||
|
||||
# Everything else is optional. Unlike the read code in libpng the write code
|
||||
# does not need to deal with arbitrary formats, so only add support for things
|
||||
# you really do write! For example you might only write sRGB images, sometimes
|
||||
# with transparency and never write 16 bit images, so:
|
||||
option WRITE_sRGB on
|
||||
option WRITE_tRNS on
|
||||
#option WRITE_16BIT off (this is the default with 'everything = off')
|
||||
@@ -47,7 +47,8 @@ CC = gcc
|
||||
#CC = i386-mingw32msvc-gcc # e.g., Linux -> Win32 cross-compilation
|
||||
LD = $(CC)
|
||||
RM = rm -f
|
||||
CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS)
|
||||
CPPFLAGS = $(INCS)
|
||||
CFLAGS = -O -Wall $(MINGW_CCFLAGS)
|
||||
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
|
||||
# [-ansi, -pedantic and -W can also be used]
|
||||
LDFLAGS = $(MINGW_LDFLAGS)
|
||||
@@ -85,10 +86,10 @@ EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
%.pic$(O): %.c
|
||||
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
|
||||
|
||||
|
||||
# dependencies --------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +53,8 @@ CC = cc
|
||||
LD = cc
|
||||
RM = rm -f
|
||||
# ABI must be the same as that used to build libpng.
|
||||
ABI=
|
||||
ABI =
|
||||
CPPFLAGS =
|
||||
CFLAGS = $(ABI) -O -fullwarn $(INCS)
|
||||
LDFLAGS = $(ABI)
|
||||
O = .o
|
||||
@@ -73,7 +74,7 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
|
||||
# dependencies --------------------------------------------------------------
|
||||
|
||||
@@ -64,7 +64,8 @@ WLIBSs = $(PNGLIBs) $(ZLIBs)
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
RM = rm -f
|
||||
CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP
|
||||
CPPFLAGS = $(INCS) -DFEATURE_LOOP
|
||||
CFLAGS = -O -Wall
|
||||
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
|
||||
# [-ansi, -pedantic and -W can also be used]
|
||||
LDFLAGS =
|
||||
@@ -92,7 +93,7 @@ EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
|
||||
# dependencies --------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +53,8 @@ WLIBS = $(PNGLIB) $(ZLIB)
|
||||
CC = cl
|
||||
LD = link
|
||||
RM = del
|
||||
CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
|
||||
CPPFLAGS = $(INCS)
|
||||
CFLAGS = -nologo -O -W3 $(cvars)
|
||||
# [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
|
||||
# [see %devstudio%\vc\include\win32.mak for cvars macro definition]
|
||||
O = .obj
|
||||
@@ -76,7 +77,7 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
|
||||
# dependencies --------------------------------------------------------------
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2013 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -517,14 +517,23 @@ static void format_default(format_list *pf, int redundant)
|
||||
|
||||
for (f=0; f<FORMAT_COUNT; ++f)
|
||||
{
|
||||
/* Eliminate redundant settings. */
|
||||
/* BGR is meaningless if no color: */
|
||||
if ((f & PNG_FORMAT_FLAG_COLOR) == 0 && (f & PNG_FORMAT_FLAG_BGR) != 0)
|
||||
/* Eliminate redundant and unsupported settings. */
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
/* BGR is meaningless if no color: */
|
||||
if ((f & PNG_FORMAT_FLAG_COLOR) == 0 &&
|
||||
(f & PNG_FORMAT_FLAG_BGR) != 0)
|
||||
# else
|
||||
if ((f & 0x10U/*HACK: fixed value*/) != 0)
|
||||
# endif
|
||||
continue;
|
||||
|
||||
/* AFIRST is meaningless if no alpha: */
|
||||
if ((f & PNG_FORMAT_FLAG_ALPHA) == 0 &&
|
||||
(f & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if ((f & PNG_FORMAT_FLAG_ALPHA) == 0 &&
|
||||
(f & PNG_FORMAT_FLAG_AFIRST) != 0)
|
||||
# else
|
||||
if ((f & 0x20U/*HACK: fixed value*/) != 0)
|
||||
# endif
|
||||
continue;
|
||||
|
||||
format_set(pf, f);
|
||||
@@ -786,6 +795,7 @@ gp_ga8(Pixel *p, png_const_voidp pb)
|
||||
p->a = pp[1];
|
||||
}
|
||||
|
||||
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
static void
|
||||
gp_ag8(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -794,6 +804,7 @@ gp_ag8(Pixel *p, png_const_voidp pb)
|
||||
p->r = p->g = p->b = pp[1];
|
||||
p->a = pp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gp_rgb8(Pixel *p, png_const_voidp pb)
|
||||
@@ -806,6 +817,7 @@ gp_rgb8(Pixel *p, png_const_voidp pb)
|
||||
p->a = 255;
|
||||
}
|
||||
|
||||
#ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
static void
|
||||
gp_bgr8(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -816,6 +828,7 @@ gp_bgr8(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[0];
|
||||
p->a = 255;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gp_rgba8(Pixel *p, png_const_voidp pb)
|
||||
@@ -828,6 +841,7 @@ gp_rgba8(Pixel *p, png_const_voidp pb)
|
||||
p->a = pp[3];
|
||||
}
|
||||
|
||||
#ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
static void
|
||||
gp_bgra8(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -838,7 +852,9 @@ gp_bgra8(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[0];
|
||||
p->a = pp[3];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
static void
|
||||
gp_argb8(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -849,7 +865,9 @@ gp_argb8(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[3];
|
||||
p->a = pp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_FORMAT_AFIRST_SUPPORTED) && defined(PNG_FORMAT_BGR_SUPPORTED)
|
||||
static void
|
||||
gp_abgr8(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -860,6 +878,7 @@ gp_abgr8(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[1];
|
||||
p->a = pp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gp_g16(Pixel *p, png_const_voidp pb)
|
||||
@@ -879,6 +898,7 @@ gp_ga16(Pixel *p, png_const_voidp pb)
|
||||
p->a = pp[1];
|
||||
}
|
||||
|
||||
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
static void
|
||||
gp_ag16(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -887,6 +907,7 @@ gp_ag16(Pixel *p, png_const_voidp pb)
|
||||
p->r = p->g = p->b = pp[1];
|
||||
p->a = pp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gp_rgb16(Pixel *p, png_const_voidp pb)
|
||||
@@ -899,6 +920,7 @@ gp_rgb16(Pixel *p, png_const_voidp pb)
|
||||
p->a = 65535;
|
||||
}
|
||||
|
||||
#ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
static void
|
||||
gp_bgr16(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -909,6 +931,7 @@ gp_bgr16(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[0];
|
||||
p->a = 65535;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gp_rgba16(Pixel *p, png_const_voidp pb)
|
||||
@@ -921,6 +944,7 @@ gp_rgba16(Pixel *p, png_const_voidp pb)
|
||||
p->a = pp[3];
|
||||
}
|
||||
|
||||
#ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
static void
|
||||
gp_bgra16(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -931,7 +955,9 @@ gp_bgra16(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[0];
|
||||
p->a = pp[3];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
static void
|
||||
gp_argb16(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -942,7 +968,9 @@ gp_argb16(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[3];
|
||||
p->a = pp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_FORMAT_AFIRST_SUPPORTED) && defined(PNG_FORMAT_BGR_SUPPORTED)
|
||||
static void
|
||||
gp_abgr16(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
@@ -953,6 +981,7 @@ gp_abgr16(Pixel *p, png_const_voidp pb)
|
||||
p->b = pp[1];
|
||||
p->a = pp[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Given a format, return the correct one of the above functions. */
|
||||
static void (*
|
||||
@@ -966,29 +995,35 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_COLOR)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_BGR)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_BGR)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_abgr16;
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_abgr16;
|
||||
|
||||
else
|
||||
# endif
|
||||
return gp_bgra16;
|
||||
}
|
||||
|
||||
else
|
||||
return gp_bgra16;
|
||||
return gp_bgr16;
|
||||
}
|
||||
|
||||
else
|
||||
return gp_bgr16;
|
||||
}
|
||||
|
||||
else
|
||||
# endif
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_argb16;
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_argb16;
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
return gp_rgba16;
|
||||
}
|
||||
|
||||
@@ -1001,10 +1036,12 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_ag16;
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_ag16;
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
return gp_ga16;
|
||||
}
|
||||
|
||||
@@ -1017,29 +1054,35 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_COLOR)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_BGR)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_BGR)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_abgr8;
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_abgr8;
|
||||
|
||||
else
|
||||
# endif
|
||||
return gp_bgra8;
|
||||
}
|
||||
|
||||
else
|
||||
return gp_bgra8;
|
||||
return gp_bgr8;
|
||||
}
|
||||
|
||||
else
|
||||
return gp_bgr8;
|
||||
}
|
||||
|
||||
else
|
||||
# endif
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_argb8;
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_argb8;
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
return gp_rgba8;
|
||||
}
|
||||
|
||||
@@ -1052,10 +1095,12 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_ag8;
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
return gp_ag8;
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
return gp_ga8;
|
||||
}
|
||||
|
||||
@@ -2618,13 +2663,15 @@ component_loc(png_byte loc[4], png_uint_32 format)
|
||||
|
||||
loc[2] = 1;
|
||||
|
||||
if (format & PNG_FORMAT_FLAG_BGR)
|
||||
{
|
||||
loc[1] = 2;
|
||||
loc[3] = 0;
|
||||
}
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_BGR)
|
||||
{
|
||||
loc[1] = 2;
|
||||
loc[3] = 0;
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
{
|
||||
loc[1] = 0;
|
||||
loc[3] = 2;
|
||||
@@ -2639,15 +2686,17 @@ component_loc(png_byte loc[4], png_uint_32 format)
|
||||
|
||||
if (format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
{
|
||||
loc[0] = 0;
|
||||
++loc[1];
|
||||
++loc[2];
|
||||
++loc[3];
|
||||
}
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
if (format & PNG_FORMAT_FLAG_AFIRST)
|
||||
{
|
||||
loc[0] = 0;
|
||||
++loc[1];
|
||||
++loc[2];
|
||||
++loc[3];
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
loc[0] = channels;
|
||||
|
||||
++channels;
|
||||
@@ -3017,17 +3066,25 @@ read_file(Image *image, png_uint_32 format, png_const_colorp background)
|
||||
return logerror(image, "memory init: ", image->file_name, "");
|
||||
}
|
||||
|
||||
else if (image->input_file != NULL)
|
||||
{
|
||||
if (!png_image_begin_read_from_stdio(&image->image, image->input_file))
|
||||
return logerror(image, "stdio init: ", image->file_name, "");
|
||||
}
|
||||
# ifdef PNG_STDIO_SUPPORTED
|
||||
else if (image->input_file != NULL)
|
||||
{
|
||||
if (!png_image_begin_read_from_stdio(&image->image, image->input_file))
|
||||
return logerror(image, "stdio init: ", image->file_name, "");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (!png_image_begin_read_from_file(&image->image, image->file_name))
|
||||
return logerror(image, "file init: ", image->file_name, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!png_image_begin_read_from_file(&image->image, image->file_name))
|
||||
return logerror(image, "file init: ", image->file_name, "");
|
||||
}
|
||||
# else
|
||||
else
|
||||
{
|
||||
return logerror(image, "unsupported file/stdio init: ",
|
||||
image->file_name, "");
|
||||
}
|
||||
# endif
|
||||
|
||||
/* This must be set after the begin_read call: */
|
||||
if (image->opts & sRGB_16BIT)
|
||||
@@ -3466,11 +3523,19 @@ main(int argc, char **argv)
|
||||
memset(gpc_error_via_linear, 0, sizeof gpc_error_via_linear);
|
||||
}
|
||||
else if (strcmp(arg, "--file") == 0)
|
||||
opts |= READ_FILE;
|
||||
# ifdef PNG_STDIO_SUPPORTED
|
||||
opts |= READ_FILE;
|
||||
# else
|
||||
return 77; /* skipped: no support */
|
||||
# endif
|
||||
else if (strcmp(arg, "--memory") == 0)
|
||||
opts &= ~READ_FILE;
|
||||
else if (strcmp(arg, "--stdio") == 0)
|
||||
opts |= USE_STDIO;
|
||||
# ifdef PNG_STDIO_SUPPORTED
|
||||
opts |= USE_STDIO;
|
||||
# else
|
||||
return 77; /* skipped: no support */
|
||||
# endif
|
||||
else if (strcmp(arg, "--name") == 0)
|
||||
opts &= ~USE_STDIO;
|
||||
else if (strcmp(arg, "--verbose") == 0)
|
||||
|
||||
@@ -30,7 +30,19 @@
|
||||
# include "../../png.h"
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* Since this program tests the ability to change the unknown chunk handling
|
||||
* these must be defined:
|
||||
*/
|
||||
#if defined(PNG_SET_UNKNOWN_CHUNKS_SUPPORTED) &&\
|
||||
defined(PNG_READ_SUPPORTED)
|
||||
|
||||
/* One of these must be defined to allow us to find out what happened. It is
|
||||
* still useful to set unknown chunk handling without either of these in order
|
||||
* to cause *known* chunks to be discarded. This can be a significant
|
||||
* efficiency gain, but it can't really be tested here.
|
||||
*/
|
||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) ||\
|
||||
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
|
||||
#if PNG_LIBPNG_VER < 10500
|
||||
/* This deliberately lacks the PNG_CONST. */
|
||||
@@ -75,43 +87,74 @@ typedef png_byte *png_const_bytep;
|
||||
# define png_const_structp png_structp
|
||||
#endif
|
||||
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* Copied from libpng 1.7.0 png.h */
|
||||
#define PNG_u2(b1, b2) (((unsigned int)(b1) << 8) + (b2))
|
||||
|
||||
/* Copied from pngpriv.h */
|
||||
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
||||
#define PNG_CHUNK(b1,b2,b3,b4) \
|
||||
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
||||
#define PNG_U16(b1, b2) ((png_uint_16)PNG_u2(b1, b2))
|
||||
#define PNG_U32(b1, b2, b3, b4)\
|
||||
(((png_uint_32)PNG_u2(b1, b2) << 16) + PNG_u2(b3, b4))
|
||||
|
||||
#define png_IHDR PNG_CHUNK( 73, 72, 68, 82)
|
||||
#define png_IDAT PNG_CHUNK( 73, 68, 65, 84)
|
||||
#define png_IEND PNG_CHUNK( 73, 69, 78, 68)
|
||||
#define png_PLTE PNG_CHUNK( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_CHUNK( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_CHUNK( 99, 72, 82, 77)
|
||||
#define png_gAMA PNG_CHUNK(103, 65, 77, 65)
|
||||
#define png_hIST PNG_CHUNK(104, 73, 83, 84)
|
||||
#define png_iCCP PNG_CHUNK(105, 67, 67, 80)
|
||||
#define png_iTXt PNG_CHUNK(105, 84, 88, 116)
|
||||
#define png_oFFs PNG_CHUNK(111, 70, 70, 115)
|
||||
#define png_pCAL PNG_CHUNK(112, 67, 65, 76)
|
||||
#define png_sCAL PNG_CHUNK(115, 67, 65, 76)
|
||||
#define png_pHYs PNG_CHUNK(112, 72, 89, 115)
|
||||
#define png_sBIT PNG_CHUNK(115, 66, 73, 84)
|
||||
#define png_sPLT PNG_CHUNK(115, 80, 76, 84)
|
||||
#define png_sRGB PNG_CHUNK(115, 82, 71, 66)
|
||||
#define png_sTER PNG_CHUNK(115, 84, 69, 82)
|
||||
#define png_tEXt PNG_CHUNK(116, 69, 88, 116)
|
||||
#define png_tIME PNG_CHUNK(116, 73, 77, 69)
|
||||
#define png_tRNS PNG_CHUNK(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_CHUNK(122, 84, 88, 116)
|
||||
#define png_vpAg PNG_CHUNK('v', 'p', 'A', 'g')
|
||||
/* Constants for known chunk types.
|
||||
*/
|
||||
#define png_IDAT PNG_U32( 73, 68, 65, 84)
|
||||
#define png_IEND PNG_U32( 73, 69, 78, 68)
|
||||
#define png_IHDR PNG_U32( 73, 72, 68, 82)
|
||||
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||
#define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
|
||||
#define png_gIFx PNG_U32(103, 73, 70, 120)
|
||||
#define png_hIST PNG_U32(104, 73, 83, 84)
|
||||
#define png_iCCP PNG_U32(105, 67, 67, 80)
|
||||
#define png_iTXt PNG_U32(105, 84, 88, 116)
|
||||
#define png_oFFs PNG_U32(111, 70, 70, 115)
|
||||
#define png_pCAL PNG_U32(112, 67, 65, 76)
|
||||
#define png_pHYs PNG_U32(112, 72, 89, 115)
|
||||
#define png_sBIT PNG_U32(115, 66, 73, 84)
|
||||
#define png_sCAL PNG_U32(115, 67, 65, 76)
|
||||
#define png_sPLT PNG_U32(115, 80, 76, 84)
|
||||
#define png_sRGB PNG_U32(115, 82, 71, 66)
|
||||
#define png_sTER PNG_U32(115, 84, 69, 82)
|
||||
#define png_tEXt PNG_U32(116, 69, 88, 116)
|
||||
#define png_tIME PNG_U32(116, 73, 77, 69)
|
||||
#define png_tRNS PNG_U32(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||
|
||||
/* Test on flag values as defined in the spec (section 5.4): */
|
||||
#define PNG_CHUNK_ANCILLARY(c ) (1 & ((c) >> 29))
|
||||
#define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29))
|
||||
#define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c))
|
||||
#define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21))
|
||||
#define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
|
||||
#define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))
|
||||
|
||||
#endif /* PNG_LIBPNG_VER < 10700 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define this not_the_cpp_this
|
||||
# define new not_the_cpp_new
|
||||
# define voidcast(type, value) static_cast<type>(value)
|
||||
#else
|
||||
# define voidcast(type, value) (value)
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Unused formal parameter errors are removed using the following macro which is
|
||||
* expected to have no bad effects on performance.
|
||||
*/
|
||||
#ifndef UNUSED
|
||||
# if defined(__GNUC__) || defined(_MSC_VER)
|
||||
# define UNUSED(param) (void)param;
|
||||
# else
|
||||
# define UNUSED(param)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Types of chunks not known to libpng */
|
||||
#define png_vpAg PNG_U32(118, 112, 65, 103)
|
||||
|
||||
/* Chunk information */
|
||||
#define PNG_INFO_tEXt 0x10000000U
|
||||
#define PNG_INFO_iTXt 0x20000000U
|
||||
@@ -139,23 +182,128 @@ static struct
|
||||
{ "PLTE", PNG_INFO_PLTE, png_PLTE, 0, 0, ABSENT, 0 },
|
||||
|
||||
/* Non-critical chunks that libpng handles */
|
||||
{ "bKGD", PNG_INFO_bKGD, png_bKGD, 0, 1, START, 0 },
|
||||
{ "cHRM", PNG_INFO_cHRM, png_cHRM, 0, 1, START, 0 },
|
||||
{ "gAMA", PNG_INFO_gAMA, png_gAMA, 0, 1, START, 0 },
|
||||
{ "hIST", PNG_INFO_hIST, png_hIST, 0, 1, ABSENT, 0 },
|
||||
{ "iCCP", PNG_INFO_iCCP, png_iCCP, 0, 1, ABSENT, 0 },
|
||||
{ "iTXt", PNG_INFO_iTXt, png_iTXt, 0, 1, ABSENT, 0 },
|
||||
{ "oFFs", PNG_INFO_oFFs, png_oFFs, 0, 1, START, 0 },
|
||||
{ "pCAL", PNG_INFO_pCAL, png_pCAL, 0, 1, START, 0 },
|
||||
{ "pHYs", PNG_INFO_pHYs, png_pHYs, 0, 1, START, 0 },
|
||||
{ "sBIT", PNG_INFO_sBIT, png_sBIT, 0, 1, START, 0 },
|
||||
{ "sCAL", PNG_INFO_sCAL, png_sCAL, 0, 1, START, 0 },
|
||||
{ "sPLT", PNG_INFO_sPLT, png_sPLT, 0, 1, ABSENT, 0 },
|
||||
{ "sRGB", PNG_INFO_sRGB, png_sRGB, 0, 1, START, 0 },
|
||||
{ "tEXt", PNG_INFO_tEXt, png_tEXt, 0, 1, START, 0 },
|
||||
{ "tIME", PNG_INFO_tIME, png_tIME, 0, 1, START, 0 },
|
||||
{ "tRNS", PNG_INFO_tRNS, png_tRNS, 0, 0, ABSENT, 0 },
|
||||
{ "zTXt", PNG_INFO_zTXt, png_zTXt, 0, 1, END, 0 },
|
||||
/* This is a mess but it seems to be the only way to do it - there is no way
|
||||
* to check for a definition outside a #if.
|
||||
*/
|
||||
{ "bKGD", PNG_INFO_bKGD, png_bKGD,
|
||||
# ifdef PNG_READ_bKGD_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "cHRM", PNG_INFO_cHRM, png_cHRM,
|
||||
# ifdef PNG_READ_cHRM_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "gAMA", PNG_INFO_gAMA, png_gAMA,
|
||||
# ifdef PNG_READ_gAMA_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "hIST", PNG_INFO_hIST, png_hIST,
|
||||
# ifdef PNG_READ_hIST_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, ABSENT, 0 },
|
||||
{ "iCCP", PNG_INFO_iCCP, png_iCCP,
|
||||
# ifdef PNG_READ_iCCP_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, ABSENT, 0 },
|
||||
{ "iTXt", PNG_INFO_iTXt, png_iTXt,
|
||||
# ifdef PNG_READ_iTXt_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, ABSENT, 0 },
|
||||
{ "oFFs", PNG_INFO_oFFs, png_oFFs,
|
||||
# ifdef PNG_READ_oFFs_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "pCAL", PNG_INFO_pCAL, png_pCAL,
|
||||
# ifdef PNG_READ_pCAL_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "pHYs", PNG_INFO_pHYs, png_pHYs,
|
||||
# ifdef PNG_READ_pHYs_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "sBIT", PNG_INFO_sBIT, png_sBIT,
|
||||
# ifdef PNG_READ_sBIT_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "sCAL", PNG_INFO_sCAL, png_sCAL,
|
||||
# ifdef PNG_READ_sCAL_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "sPLT", PNG_INFO_sPLT, png_sPLT,
|
||||
# ifdef PNG_READ_sPLT_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, ABSENT, 0 },
|
||||
{ "sRGB", PNG_INFO_sRGB, png_sRGB,
|
||||
# ifdef PNG_READ_sRGB_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "tEXt", PNG_INFO_tEXt, png_tEXt,
|
||||
# ifdef PNG_READ_tEXt_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "tIME", PNG_INFO_tIME, png_tIME,
|
||||
# ifdef PNG_READ_tIME_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "tRNS", PNG_INFO_tRNS, png_tRNS,
|
||||
# ifdef PNG_READ_tRNS_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
0, ABSENT, 0 },
|
||||
{ "zTXt", PNG_INFO_zTXt, png_zTXt,
|
||||
# ifdef PNG_READ_zTXt_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, END, 0 },
|
||||
|
||||
/* No libpng handling */
|
||||
{ "sTER", PNG_INFO_sTER, png_sTER, 1, 1, START, 0 },
|
||||
@@ -212,14 +360,16 @@ find_by_flag(png_uint_32 flag)
|
||||
static int
|
||||
ancillary(const char *name)
|
||||
{
|
||||
return PNG_CHUNK_ANCILLARY(PNG_CHUNK(name[0], name[1], name[2], name[3]));
|
||||
return PNG_CHUNK_ANCILLARY(PNG_U32(name[0], name[1], name[2], name[3]));
|
||||
}
|
||||
|
||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
static int
|
||||
ancillaryb(const png_byte *name)
|
||||
{
|
||||
return PNG_CHUNK_ANCILLARY(PNG_CHUNK(name[0], name[1], name[2], name[3]));
|
||||
return PNG_CHUNK_ANCILLARY(PNG_U32(name[0], name[1], name[2], name[3]));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Type of an error_ptr */
|
||||
typedef struct
|
||||
@@ -227,8 +377,11 @@ typedef struct
|
||||
jmp_buf error_return;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr, end_ptr;
|
||||
png_uint_32 before_IDAT;
|
||||
png_uint_32 after_IDAT;
|
||||
int error_count;
|
||||
int warning_count;
|
||||
int keep; /* the default value */
|
||||
const char *program;
|
||||
const char *file;
|
||||
const char *test;
|
||||
@@ -261,9 +414,6 @@ clean_display(display *d)
|
||||
d->test);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Invalidate the test */
|
||||
d->test = init;
|
||||
}
|
||||
|
||||
PNG_FUNCTION(void, display_exit, (display *d), static PNG_NORETURN)
|
||||
@@ -339,11 +489,88 @@ get_valid(display *d, png_infop info_ptr)
|
||||
return flags;
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
static int
|
||||
read_callback(png_structp pp, png_unknown_chunkp pc)
|
||||
{
|
||||
/* This function mimics the behavior of png_set_keep_unknown_chunks by
|
||||
* returning '0' to keep the chunk and '1' to discard it.
|
||||
*/
|
||||
display *d = voidcast(display*, png_get_user_chunk_ptr(pp));
|
||||
int chunk = findb(pc->name);
|
||||
int keep, discard;
|
||||
|
||||
if (chunk < 0) /* not one in our list, so not a known chunk */
|
||||
keep = d->keep;
|
||||
|
||||
else
|
||||
{
|
||||
keep = chunk_info[chunk].keep;
|
||||
if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
{
|
||||
/* See the comments in png.h - use the default for unknown chunks,
|
||||
* do not keep known chunks.
|
||||
*/
|
||||
if (chunk_info[chunk].unknown)
|
||||
keep = d->keep;
|
||||
|
||||
else
|
||||
keep = PNG_HANDLE_CHUNK_NEVER;
|
||||
}
|
||||
}
|
||||
|
||||
switch (keep)
|
||||
{
|
||||
default:
|
||||
fprintf(stderr, "%s(%s): %d: unrecognized chunk option\n", d->file,
|
||||
d->test, chunk_info[chunk].keep);
|
||||
display_exit(d);
|
||||
|
||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||
case PNG_HANDLE_CHUNK_NEVER:
|
||||
discard = 1/*handled; discard*/;
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_IF_SAFE:
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
discard = 0/*not handled; keep*/;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Also store information about this chunk in the display, the relevant flag
|
||||
* is set if the chunk is to be kept ('not handled'.)
|
||||
*/
|
||||
if (chunk >= 0) if (!discard) /* stupidity to stop a GCC warning */
|
||||
{
|
||||
png_uint_32 flag = chunk_info[chunk].flag;
|
||||
|
||||
if (pc->location & PNG_AFTER_IDAT)
|
||||
d->after_IDAT |= flag;
|
||||
|
||||
else
|
||||
d->before_IDAT |= flag;
|
||||
}
|
||||
|
||||
/* However if there is no support to store unknown chunks don't ask libpng to
|
||||
* do it; there will be an png_error.
|
||||
*/
|
||||
# ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
return discard;
|
||||
# else
|
||||
return 1; /*handled; discard*/
|
||||
# endif
|
||||
}
|
||||
#endif /* READ_USER_CHUNKS_SUPPORTED */
|
||||
|
||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
static png_uint_32
|
||||
get_unknown(display *d, int def, png_infop info_ptr)
|
||||
get_unknown(display *d, png_infop info_ptr, int after_IDAT)
|
||||
{
|
||||
/* Create corresponding 'unknown' flags */
|
||||
png_uint_32 flags = 0;
|
||||
|
||||
UNUSED(after_IDAT)
|
||||
|
||||
{
|
||||
png_unknown_chunkp unknown;
|
||||
int num_unknown = png_get_unknown_chunks(d->png_ptr, info_ptr, &unknown);
|
||||
@@ -353,16 +580,16 @@ get_unknown(display *d, int def, png_infop info_ptr)
|
||||
int chunk = findb(unknown[num_unknown].name);
|
||||
|
||||
/* Chunks not known to pngunknown must be validated here; since they
|
||||
* must also be unknown to libpng the 'def' behavior should have been
|
||||
* used.
|
||||
* must also be unknown to libpng the 'display->keep' behavior should
|
||||
* have been used.
|
||||
*/
|
||||
if (chunk < 0) switch (def)
|
||||
if (chunk < 0) switch (d->keep)
|
||||
{
|
||||
default: /* impossible */
|
||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||
case PNG_HANDLE_CHUNK_NEVER:
|
||||
fprintf(stderr, "%s(%s): %s: %s: unknown chunk saved\n",
|
||||
d->file, d->test, def ? "discard" : "default",
|
||||
d->file, d->test, d->keep ? "discard" : "default",
|
||||
unknown[num_unknown].name);
|
||||
++(d->error_count);
|
||||
break;
|
||||
@@ -388,14 +615,39 @@ get_unknown(display *d, int def, png_infop info_ptr)
|
||||
|
||||
return flags;
|
||||
}
|
||||
#else
|
||||
static png_uint_32
|
||||
get_unknown(display *d, png_infop info_ptr, int after_IDAT)
|
||||
/* Otherwise this will return the cached values set by any user callback */
|
||||
{
|
||||
UNUSED(info_ptr);
|
||||
|
||||
if (after_IDAT)
|
||||
return d->after_IDAT;
|
||||
|
||||
else
|
||||
return d->before_IDAT;
|
||||
}
|
||||
|
||||
# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
/* The #defines above should mean this is never reached, it's just here as
|
||||
* a check to ensure the logic is correct.
|
||||
*/
|
||||
# error No store support and no user chunk support, this will not work
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int
|
||||
check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
display *d)
|
||||
display *d, int set_callback)
|
||||
{
|
||||
int i, def = PNG_HANDLE_CHUNK_AS_DEFAULT, npasses, ipass;
|
||||
int i, npasses, ipass;
|
||||
png_uint_32 height;
|
||||
|
||||
d->keep = PNG_HANDLE_CHUNK_AS_DEFAULT;
|
||||
d->before_IDAT = 0;
|
||||
d->after_IDAT = 0;
|
||||
|
||||
/* Some of these errors are permanently fatal and cause an exit here, others
|
||||
* are per-test and cause an error return.
|
||||
*/
|
||||
@@ -421,6 +673,16 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
|
||||
png_init_io(d->png_ptr, fp);
|
||||
|
||||
# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
/* This is only done if requested by the caller; it interferes with the
|
||||
* standard store/save mechanism.
|
||||
*/
|
||||
if (set_callback)
|
||||
png_set_read_user_chunk_fn(d->png_ptr, d, read_callback);
|
||||
# else
|
||||
UNUSED(set_callback)
|
||||
# endif
|
||||
|
||||
/* Handle each argument in turn; multiple settings are possible for the same
|
||||
* chunk and multiple calls will occur (the last one should override all
|
||||
* preceding ones).
|
||||
@@ -460,13 +722,11 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
* in this case, so we just check the arguments! This could
|
||||
* be improved in the future by using the read callback.
|
||||
*/
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_byte name[5];
|
||||
png_byte name[5];
|
||||
|
||||
memcpy(name, chunk_info[chunk].name, 5);
|
||||
png_set_keep_unknown_chunks(d->png_ptr, option, name, 1);
|
||||
chunk_info[chunk].keep = option;
|
||||
# endif
|
||||
memcpy(name, chunk_info[chunk].name, 5);
|
||||
png_set_keep_unknown_chunks(d->png_ptr, option, name, 1);
|
||||
chunk_info[chunk].keep = option;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -475,10 +735,8 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
case 7: /* default */
|
||||
if (memcmp(argv[i], "default", 7) == 0)
|
||||
{
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_set_keep_unknown_chunks(d->png_ptr, option, NULL, 0);
|
||||
# endif
|
||||
def = option;
|
||||
png_set_keep_unknown_chunks(d->png_ptr, option, NULL, 0);
|
||||
d->keep = option;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -487,14 +745,12 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
case 3: /* all */
|
||||
if (memcmp(argv[i], "all", 3) == 0)
|
||||
{
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_set_keep_unknown_chunks(d->png_ptr, option, NULL, -1);
|
||||
def = option;
|
||||
png_set_keep_unknown_chunks(d->png_ptr, option, NULL, -1);
|
||||
d->keep = option;
|
||||
|
||||
for (chunk = 0; chunk < NINFO; ++chunk)
|
||||
if (chunk_info[chunk].all)
|
||||
chunk_info[chunk].keep = option;
|
||||
# endif
|
||||
for (chunk = 0; chunk < NINFO; ++chunk)
|
||||
if (chunk_info[chunk].all)
|
||||
chunk_info[chunk].keep = option;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -568,18 +824,18 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
png_read_end(d->png_ptr, d->end_ptr);
|
||||
|
||||
flags[0] = get_valid(d, d->info_ptr);
|
||||
flags[1] = get_unknown(d, def, d->info_ptr);
|
||||
flags[1] = get_unknown(d, d->info_ptr, 0/*before IDAT*/);
|
||||
|
||||
/* Only png_read_png sets PNG_INFO_IDAT! */
|
||||
flags[chunk_info[0/*IDAT*/].keep != PNG_HANDLE_CHUNK_AS_DEFAULT] |=
|
||||
PNG_INFO_IDAT;
|
||||
|
||||
flags[2] = get_valid(d, d->end_ptr);
|
||||
flags[3] = get_unknown(d, def, d->end_ptr);
|
||||
flags[3] = get_unknown(d, d->end_ptr, 1/*after IDAT*/);
|
||||
|
||||
clean_display(d);
|
||||
|
||||
return def;
|
||||
return d->keep;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -600,7 +856,7 @@ check_error(display *d, png_uint_32 flags, const char *message)
|
||||
|
||||
static void
|
||||
check_handling(display *d, int def, png_uint_32 chunks, png_uint_32 known,
|
||||
png_uint_32 unknown, const char *position)
|
||||
png_uint_32 unknown, const char *position, int set_callback)
|
||||
{
|
||||
while (chunks)
|
||||
{
|
||||
@@ -707,8 +963,9 @@ check_handling(display *d, int def, png_uint_32 chunks, png_uint_32 known,
|
||||
if (errorx != NULL)
|
||||
{
|
||||
++(d->error_count);
|
||||
fprintf(stderr, "%s(%s): %s %s %s: %s\n",
|
||||
d->file, d->test, type, chunk_info[i].name, position, errorx);
|
||||
fprintf(stderr, "%s(%s%s): %s %s %s: %s\n", d->file, d->test,
|
||||
set_callback ? ",callback" : "",
|
||||
type, chunk_info[i].name, position, errorx);
|
||||
}
|
||||
|
||||
chunks &= ~flag;
|
||||
@@ -717,7 +974,7 @@ check_handling(display *d, int def, png_uint_32 chunks, png_uint_32 known,
|
||||
|
||||
static void
|
||||
perform_one_test(FILE *fp, int argc, const char **argv,
|
||||
png_uint_32 *default_flags, display *d)
|
||||
png_uint_32 *default_flags, display *d, int set_callback)
|
||||
{
|
||||
int def;
|
||||
png_uint_32 flags[2][4];
|
||||
@@ -726,7 +983,7 @@ perform_one_test(FILE *fp, int argc, const char **argv,
|
||||
clear_keep();
|
||||
memcpy(flags[0], default_flags, sizeof flags[0]);
|
||||
|
||||
def = check(fp, argc, argv, flags[1], d);
|
||||
def = check(fp, argc, argv, flags[1], d, set_callback);
|
||||
|
||||
/* Chunks should either be known or unknown, never both and this should apply
|
||||
* whether the chunk is before or after the IDAT (actually, the app can
|
||||
@@ -761,9 +1018,9 @@ perform_one_test(FILE *fp, int argc, const char **argv,
|
||||
* it or not.
|
||||
*/
|
||||
check_handling(d, def, flags[0][0] | flags[0][1], flags[1][0], flags[1][1],
|
||||
"before IDAT");
|
||||
"before IDAT", set_callback);
|
||||
check_handling(d, def, flags[0][2] | flags[0][3], flags[1][2], flags[1][3],
|
||||
"after IDAT");
|
||||
"after IDAT", set_callback);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -773,7 +1030,12 @@ perform_one_test_safe(FILE *fp, int argc, const char **argv,
|
||||
if (setjmp(d->error_return) == 0)
|
||||
{
|
||||
d->test = test; /* allow use of d->error_return */
|
||||
perform_one_test(fp, argc, argv, default_flags, d);
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
perform_one_test(fp, argc, argv, default_flags, d, 0);
|
||||
# endif
|
||||
# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
perform_one_test(fp, argc, argv, default_flags, d, 1);
|
||||
# endif
|
||||
d->test = init; /* prevent use of d->error_return */
|
||||
}
|
||||
}
|
||||
@@ -797,7 +1059,7 @@ usage(const char *program, const char *reason)
|
||||
fprintf(stderr, "pngunknown: %s: usage:\n %s [--strict] "
|
||||
"--default|{(CHNK|default|all)=(default|discard|if-safe|save)} "
|
||||
"testfile.png\n", reason, program);
|
||||
exit(2);
|
||||
exit(99);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -845,11 +1107,6 @@ main(int argc, const char **argv)
|
||||
else if (default_tests) if (argc != 1)
|
||||
usage(d.program, "extra arguments");
|
||||
|
||||
# ifndef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
fprintf(stderr, "%s: warning: no 'save' support so arguments ignored\n",
|
||||
d.program);
|
||||
# endif
|
||||
|
||||
/* The name of the test file is the last argument; remove it. */
|
||||
d.file = argv[--argc];
|
||||
|
||||
@@ -857,24 +1114,40 @@ main(int argc, const char **argv)
|
||||
if (fp == NULL)
|
||||
{
|
||||
perror(d.file);
|
||||
exit(2);
|
||||
exit(99);
|
||||
}
|
||||
|
||||
/* First find all the chunks, known and unknown, in the test file, a failure
|
||||
* here aborts the whole test.
|
||||
*
|
||||
* If 'save' is supported then the normal saving method should happen,
|
||||
* otherwise if 'read' is supported then the read callback will do the
|
||||
* same thing. If both are supported the 'read' callback won't be
|
||||
* instantiated by default. If 'save' is *not* supported then a user
|
||||
* callback is required even though we can call png_get_unknown_chunks.
|
||||
*/
|
||||
if (check(fp, 1, &count_argv, default_flags, &d) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS)
|
||||
if (check(fp, 1, &count_argv, default_flags, &d,
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
0
|
||||
# else
|
||||
1
|
||||
# endif
|
||||
) != PNG_HANDLE_CHUNK_ALWAYS)
|
||||
{
|
||||
fprintf(stderr, "%s: %s: internal error\n", d.program, d.file);
|
||||
exit(3);
|
||||
exit(99);
|
||||
}
|
||||
|
||||
/* Now find what the various supplied options cause to change: */
|
||||
if (!default_tests)
|
||||
{
|
||||
d.test = cmd; /* acts as a flag to say exit, do not longjmp */
|
||||
perform_one_test(fp, argc, argv, default_flags, &d);
|
||||
# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
perform_one_test(fp, argc, argv, default_flags, &d, 0);
|
||||
# endif
|
||||
# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
perform_one_test(fp, argc, argv, default_flags, &d, 1);
|
||||
# endif
|
||||
d.test = init;
|
||||
}
|
||||
|
||||
@@ -932,14 +1205,14 @@ main(int argc, const char **argv)
|
||||
if (fclose(fsuccess) || err)
|
||||
{
|
||||
fprintf(stderr, "%s: write failed\n", touch_file);
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: open failed\n", touch_file);
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,12 +1222,24 @@ main(int argc, const char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* !(READ_USER_CHUNKS || SAVE_UNKNOWN_CHUNKS) */
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
" test ignored because libpng was not built with unknown chunk support\n");
|
||||
return 0;
|
||||
" test ignored: no support to find out about unknown chunks\n");
|
||||
/* So the test is skipped: */
|
||||
return 77;
|
||||
}
|
||||
#endif
|
||||
#endif /* READ_USER_CHUNKS || SAVE_UNKNOWN_CHUNKS */
|
||||
|
||||
#else /* !(SET_UNKNOWN_CHUNKS && READ) */
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
" test ignored: no support to modify unknown chunk handling\n");
|
||||
/* So the test is skipped: */
|
||||
return 77;
|
||||
}
|
||||
#endif /* SET_UNKNOWN_CHUNKS && READ*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -252,7 +252,7 @@ int main(int argc, char **argv)
|
||||
|
||||
while (fgets(filename, FILENAME_MAX+1, stdin))
|
||||
{
|
||||
int len = strlen(filename);
|
||||
size_t len = strlen(filename);
|
||||
|
||||
if (filename[len-1] == '\n')
|
||||
{
|
||||
|
||||
@@ -14,7 +14,8 @@ LD=$(CC)
|
||||
RM=rm -f
|
||||
COPY=cp
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP -I. -O1
|
||||
CPPFLAGS=-I. -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
|
||||
CFLAGS=-O1 -Wall
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
@@ -81,7 +82,7 @@ OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||
|
||||
# note: dependencies do not work on implicit rule lines
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
# dependencies
|
||||
|
||||
@@ -95,16 +96,16 @@ pngm2pnm$(E): $(OBJS)
|
||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||
# both the build of pnglibconf.h and, subsequently, when
|
||||
# building libpng itself.
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
|
||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||
$(RM) pnglibconf.h pnglibconf.dfn
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
|
||||
DFA_XTRA="pngusr.dfa" $@
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
|
||||
srcdir=$(PNGSRC) clean
|
||||
$(RM) pngm2pnm$(O)
|
||||
$(RM) pngm2pnm$(E)
|
||||
|
||||
@@ -14,7 +14,8 @@ LD=$(CC)
|
||||
RM=rm -f
|
||||
COPY=cp
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DZ_SOLO -DNO_GZIP -I. -O1
|
||||
CPPFLAGS=-I. -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
|
||||
CFLAGS=-O1 -Wall
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
@@ -80,7 +81,7 @@ OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
# dependencies
|
||||
|
||||
@@ -94,16 +95,16 @@ pnm2pngm$(E): $(OBJS)
|
||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||
# both the build of pnglibconf.h and, subsequently, when
|
||||
# building libpng itself.
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
|
||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||
$(RM) pnglibconf.h pnglibconf.dfn
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
|
||||
DFA_XTRA="pngusr.dfa" $@
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
|
||||
srcdir=$(PNGSRC) clean
|
||||
$(RM) pnm2pngm$(O)
|
||||
$(RM) pnm2pngm$(E)
|
||||
|
||||
@@ -14,6 +14,10 @@ everything = off
|
||||
|
||||
option WRITE on
|
||||
|
||||
# These 2 options are required if you need to read PBM (P1 or P4) files.
|
||||
option WRITE_INVERT on
|
||||
option WRITE_PACK on
|
||||
|
||||
# You must choose fixed or floating point arithmetic:
|
||||
# option FLOATING_POINT on
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ XLIB = -L/usr/X11R6/lib -lX11
|
||||
#LIBS = $(XLIB)
|
||||
LIBS = $(XLIB) -lm #platforms that need libm
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP -I. $(XINC) -O1
|
||||
CPPFLAGS=-I. $(XINC) -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
|
||||
CFLAGS=-O1 -Wall
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
@@ -96,7 +97,7 @@ OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||
# implicit make rules -------------------------------------------------------
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
# dependencies
|
||||
|
||||
@@ -110,16 +111,16 @@ rpng2-x$(E): $(OBJS)
|
||||
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||
# both the build of pnglibconf.h and, subsequently, when
|
||||
# building libpng itself.
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
|
||||
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||
$(RM) pnglibconf.h pnglibconf.dfn
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
|
||||
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
|
||||
DFA_XTRA="pngusr.dfa" $@
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
|
||||
srcdir=$(PNGSRC) clean
|
||||
$(RM) rpng2-x$(O)
|
||||
$(RM) rpng2-x$(E)
|
||||
|
||||
@@ -23,7 +23,8 @@ ZINC = -I../../../zlib
|
||||
ZLIB = -L../../../zlib -lz
|
||||
ZLIBS = ../../../zlib/libz.a
|
||||
|
||||
CFLAGS=$(PNGINC) $(ZINC)
|
||||
CPPFLAGS=$(PNGINC) $(ZINC)
|
||||
CFLAGS=
|
||||
LDLIBS=$(PNGLIB) $(ZLIB)
|
||||
LDLIBSS=$(PNGLIBS) $(ZLIBS)
|
||||
C=.c
|
||||
@@ -37,7 +38,7 @@ E=
|
||||
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CFLAGS) png2pnm$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
|
||||
@@ -46,7 +47,7 @@ png2pnm-static$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CFLAGS) pnm2png$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
|
||||
|
||||
@@ -7,7 +7,8 @@ LB=tlib
|
||||
RM=del
|
||||
CP=copy
|
||||
MODEL=l
|
||||
CCFLAGS=-O -m$(MODEL) -I..\libpng -I..\zlib
|
||||
CPPFLAGS=-I..\libpng -I..\zlib
|
||||
CFLAGS=-O -m$(MODEL)
|
||||
LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib
|
||||
C=.c
|
||||
O=.obj
|
||||
@@ -19,13 +20,13 @@ E=.exe
|
||||
all: png2pnm$(E) pnm2png$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CCFLAGS) png2pnm$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) png2pnm$(O) libpng$(L) zlib$(L)
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CCFLAGS) pnm2png$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L)
|
||||
@@ -35,4 +36,3 @@ clean:
|
||||
$(RM) *$(E)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
|
||||
|
||||
@@ -198,9 +198,9 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
char height_token[16];
|
||||
char maxval_token[16];
|
||||
int color_type;
|
||||
unsigned long ul_width, ul_alpha_width;
|
||||
unsigned long ul_height, ul_alpha_height;
|
||||
unsigned long ul_maxval;
|
||||
unsigned long ul_width=0, ul_alpha_width=0;
|
||||
unsigned long ul_height=0, ul_alpha_height=0;
|
||||
unsigned long ul_maxval=0;
|
||||
png_uint_32 width, alpha_width;
|
||||
png_uint_32 height, alpha_height;
|
||||
png_uint_32 maxval;
|
||||
@@ -210,6 +210,9 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
int alpha_present;
|
||||
int row, col;
|
||||
BOOL raw, alpha_raw = FALSE;
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
BOOL packed_bitmap = FALSE;
|
||||
#endif
|
||||
png_uint_32 tmp16;
|
||||
int i;
|
||||
|
||||
@@ -222,9 +225,21 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
}
|
||||
else if ((type_token[1] == '1') || (type_token[1] == '4'))
|
||||
{
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
raw = (type_token[1] == '4');
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
get_token(pnm_file, width_token);
|
||||
sscanf (width_token, "%lu", &ul_width);
|
||||
width = (png_uint_32) ul_width;
|
||||
get_token(pnm_file, height_token);
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
bit_depth = 1;
|
||||
packed_bitmap = TRUE;
|
||||
#else
|
||||
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
|
||||
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
|
||||
#endif
|
||||
}
|
||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
||||
{
|
||||
@@ -343,8 +358,14 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
|
||||
alpha_present = (channels - 1) % 2;
|
||||
|
||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
if (packed_bitmap)
|
||||
/* row data is as many bytes as can fit width x channels x bit_depth */
|
||||
row_bytes = (width * channels * bit_depth + 7) / 8;
|
||||
else
|
||||
#endif
|
||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||
|
||||
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL)
|
||||
return FALSE;
|
||||
@@ -354,40 +375,48 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
|
||||
for (row = 0; row < height; row++)
|
||||
{
|
||||
for (col = 0; col < width; col++)
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
if (packed_bitmap) {
|
||||
for (i = 0; i < row_bytes; i++)
|
||||
/* png supports this format natively so no conversion is needed */
|
||||
*pix_ptr++ = get_data (pnm_file, 8);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
for (i = 0; i < (channels - alpha_present); i++)
|
||||
for (col = 0; col < width; col++)
|
||||
{
|
||||
if (raw)
|
||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||
else
|
||||
if (bit_depth <= 8)
|
||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||
for (i = 0; i < (channels - alpha_present); i++)
|
||||
{
|
||||
if (raw)
|
||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (pnm_file, bit_depth);
|
||||
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
pix_ptr++;
|
||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
||||
pix_ptr++;
|
||||
}
|
||||
}
|
||||
if (bit_depth <= 8)
|
||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (pnm_file, bit_depth);
|
||||
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
pix_ptr++;
|
||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
||||
pix_ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha) /* read alpha-channel from pgm file */
|
||||
{
|
||||
if (alpha_raw)
|
||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||
else
|
||||
if (alpha_depth <= 8)
|
||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||
if (alpha) /* read alpha-channel from pgm file */
|
||||
{
|
||||
if (alpha_raw)
|
||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||
}
|
||||
} /* if alpha */
|
||||
|
||||
if (alpha_depth <= 8)
|
||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||
}
|
||||
} /* if alpha */
|
||||
} /* if packed_bitmap */
|
||||
} /* end for col */
|
||||
} /* end for row */
|
||||
|
||||
@@ -404,6 +433,14 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
if (packed_bitmap == TRUE)
|
||||
{
|
||||
png_set_packing (png_ptr);
|
||||
png_set_invert_mono (png_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
||||
if (setjmp (png_jmpbuf(png_ptr)))
|
||||
{
|
||||
@@ -460,19 +497,32 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
void get_token(FILE *pnm_file, char *token)
|
||||
{
|
||||
int i = 0;
|
||||
int ret;
|
||||
|
||||
/* remove white-space */
|
||||
/* remove white-space and comment lines */
|
||||
do
|
||||
{
|
||||
token[i] = (unsigned char) fgetc (pnm_file);
|
||||
ret = fgetc(pnm_file);
|
||||
if (ret == '#') {
|
||||
/* the rest of this line is a comment */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
}
|
||||
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
||||
}
|
||||
if (ret == EOF) break;
|
||||
token[i] = (unsigned char) ret;
|
||||
}
|
||||
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
|
||||
|
||||
/* read string */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
if (ret == EOF) break;
|
||||
i++;
|
||||
token[i] = (unsigned char) fgetc (pnm_file);
|
||||
token[i] = (unsigned char) ret;
|
||||
}
|
||||
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
||||
|
||||
|
||||
153
contrib/tools/png-fix-itxt.c
Normal file
153
contrib/tools/png-fix-itxt.c
Normal file
@@ -0,0 +1,153 @@
|
||||
|
||||
/* png-fix-itxt version 1.0.0
|
||||
*
|
||||
* Copyright 2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.3 [July 18, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* png-fix-itxt.exe < bad.png > good.png
|
||||
*
|
||||
* Fixes a PNG file written with libpng-1.6.0 or 1.6.1 that has one or more
|
||||
* uncompressed iTXt chunks. Assumes that the actual length is greater
|
||||
* than or equal to the value in the length byte, and that the CRC is
|
||||
* correct for the actual length. This program hunts for the CRC and
|
||||
* adjusts the length byte accordingly. It is not an error to process a
|
||||
* PNG file that has no iTXt chunks or one that has valid iTXt chunks;
|
||||
* such files will simply be copied.
|
||||
*
|
||||
* Requires zlib (for crc32 and Z_NULL); build with
|
||||
*
|
||||
* gcc -O -o png-fix-itxt png-fix-itxt.c -lz
|
||||
*
|
||||
* If you need to handle iTXt chunks larger than 500000 kbytes you must
|
||||
* rebuild png-fix-itxt with a larger values of MAX_LENGTH (or a smaller value
|
||||
* if you know you will never encounter such huge iTXt chunks).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#define MAX_LENGTH 500000
|
||||
|
||||
#define GETBREAK ((unsigned char)(inchar=getchar())); if (inchar == EOF) break
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned char buf[MAX_LENGTH];
|
||||
unsigned long crc;
|
||||
unsigned char c;
|
||||
int inchar;
|
||||
|
||||
/* Skip 8-byte signature */
|
||||
for (i=8; i; i--)
|
||||
{
|
||||
c=GETBREAK;
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
if (inchar != EOF)
|
||||
for (;;)
|
||||
{
|
||||
/* Read the length */
|
||||
unsigned long length; /* must be 32 bits! */
|
||||
c=GETBREAK; buf[0] = c; length = c; length <<= 8;
|
||||
c=GETBREAK; buf[1] = c; length += c; length <<= 8;
|
||||
c=GETBREAK; buf[2] = c; length += c; length <<= 8;
|
||||
c=GETBREAK; buf[3] = c; length += c;
|
||||
|
||||
/* Read the chunkname */
|
||||
c=GETBREAK; buf[4] = c;
|
||||
c=GETBREAK; buf[5] = c;
|
||||
c=GETBREAK; buf[6] = c;
|
||||
c=GETBREAK; buf[7] = c;
|
||||
|
||||
|
||||
/* The iTXt chunk type expressed as integers is (105, 84, 88, 116) */
|
||||
if (buf[4] == 105 && buf[5] == 84 && buf[6] == 88 && buf[7] == 116)
|
||||
{
|
||||
if (length >= MAX_LENGTH-12)
|
||||
break; /* To do: handle this more gracefully */
|
||||
|
||||
/* Initialize the CRC */
|
||||
crc = crc32(0, Z_NULL, 0);
|
||||
|
||||
/* Copy the data bytes */
|
||||
for (i=8; i < length + 12; i++)
|
||||
{
|
||||
c=GETBREAK; buf[i] = c;
|
||||
}
|
||||
|
||||
/* Calculate the CRC */
|
||||
crc = crc32(crc, buf+4, (uInt)length+4);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Check the CRC */
|
||||
if (((crc >> 24) & 0xff) == buf[length+8] &&
|
||||
((crc >> 16) & 0xff) == buf[length+9] &&
|
||||
((crc >> 8) & 0xff) == buf[length+10] &&
|
||||
((crc ) & 0xff) == buf[length+11])
|
||||
break;
|
||||
|
||||
length++;
|
||||
|
||||
if (length >= MAX_LENGTH-12)
|
||||
break;
|
||||
|
||||
c=GETBREAK;
|
||||
buf[length+11]=c;
|
||||
|
||||
/* Update the CRC */
|
||||
crc = crc32(crc, buf+7+length, 1);
|
||||
}
|
||||
|
||||
/* Update length bytes */
|
||||
buf[0] = (unsigned char)((length << 24) & 0xff);
|
||||
buf[1] = (unsigned char)((length << 16) & 0xff);
|
||||
buf[2] = (unsigned char)((length << 8) & 0xff);
|
||||
buf[3] = (unsigned char)((length ) & 0xff);
|
||||
|
||||
/* Write the fixed iTXt chunk (length, name, data, crc) */
|
||||
for (i=0; i<length+12; i++)
|
||||
putchar(buf[i]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Copy bytes that were already read (length and chunk name) */
|
||||
for (i=0; i<8; i++)
|
||||
putchar(buf[i]);
|
||||
|
||||
/* Copy data bytes and CRC */
|
||||
for (i=8; i< length+12; i++)
|
||||
{
|
||||
c=GETBREAK;
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
if (inchar == EOF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* The IEND chunk type expressed as integers is (73, 69, 78, 68) */
|
||||
if (buf[4] == 73 && buf[5] == 69 && buf[6] == 78 && buf[7] == 68)
|
||||
break;
|
||||
}
|
||||
|
||||
if (inchar == EOF)
|
||||
break;
|
||||
|
||||
if (buf[4] == 73 && buf[5] == 69 && buf[6] == 78 && buf[7] == 68)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
4036
contrib/tools/pngfix.c
Normal file
4036
contrib/tools/pngfix.c
Normal file
File diff suppressed because it is too large
Load Diff
10
example.c
10
example.c
@@ -2,7 +2,7 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Last changed in libpng 1.6.3 [July 18, 2013]
|
||||
* Maintained 1998-2013 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger)
|
||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -441,9 +441,9 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||
/* If we don't have another value */
|
||||
else
|
||||
{
|
||||
screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
|
||||
lit room */
|
||||
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
||||
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
|
||||
in a dimly lit room */
|
||||
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */
|
||||
}
|
||||
|
||||
/* Tell libpng to handle the gamma conversion for you. The final call
|
||||
@@ -455,7 +455,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||
int intent;
|
||||
|
||||
if (png_get_sRGB(png_ptr, info_ptr, &intent))
|
||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||
png_set_gamma(png_ptr, screen_gamma, PNG_DEFAULT_sRGB);
|
||||
else
|
||||
{
|
||||
double image_gamma;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.1 - March 28, 2013
|
||||
libpng version 1.6.9 - February 6, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.1 - March 28, 2013
|
||||
libpng versions 0.97, January 1998, through 1.6.9 - February 6, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 version 0.96 May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@@ -50,9 +50,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
I. Introduction
|
||||
|
||||
This file describes how to use and modify the PNG reference library
|
||||
(known as libpng) for your own use. There are five sections to this
|
||||
file: introduction, structures, reading, writing, and modification and
|
||||
configuration notes for various special platforms. In addition to this
|
||||
(known as libpng) for your own use. In addition to this
|
||||
file, example.c is a good starting point for using the library, as
|
||||
it is heavily commented and should include everything most people
|
||||
will need. We assume that libpng is already installed; see the
|
||||
@@ -742,7 +740,7 @@ situations:
|
||||
encoding.
|
||||
|
||||
You would use the linear (unencoded) value if you need to process the pixel
|
||||
values further because this avoids the need to decode and reencode each
|
||||
values further because this avoids the need to decode and re-encode each
|
||||
component value whenever arithmetic is performed. A lot of graphics software
|
||||
uses linear values for this reason, often with higher precision component values
|
||||
to preserve overall accuracy.
|
||||
@@ -2291,7 +2289,7 @@ For a more compact example of reading a PNG image, see the file example.c.
|
||||
|
||||
Reading PNG files progressively
|
||||
|
||||
The progressive reader is slightly different then the non-progressive
|
||||
The progressive reader is slightly different from the non-progressive
|
||||
reader. Instead of calling png_read_info(), png_read_rows(), and
|
||||
png_read_end(), you make one call to png_process_data(), which calls
|
||||
callbacks when it has the info, a row, or the end of the image. You
|
||||
@@ -3093,13 +3091,47 @@ a writeable buffer of at least 29 bytes.
|
||||
|
||||
Writing unknown chunks
|
||||
|
||||
You can use the png_set_unknown_chunks function to queue up chunks
|
||||
for writing. You give it a chunk name, raw data, and a size; that's
|
||||
all there is to it. The chunks will be written by the next following
|
||||
png_write_info_before_PLTE, png_write_info, or png_write_end function.
|
||||
Any chunks previously read into the info structure's unknown-chunk
|
||||
list will also be written out in a sequence that satisfies the PNG
|
||||
specification's ordering rules.
|
||||
You can use the png_set_unknown_chunks function to queue up private chunks
|
||||
for writing. You give it a chunk name, location, raw data, and a size. You
|
||||
also must use png_set_keep_unknown_chunks() to ensure that libpng will
|
||||
handle them. That's all there is to it. The chunks will be written by the
|
||||
next following png_write_info_before_PLTE, png_write_info, or png_write_end
|
||||
function, depending upon the specified location. Any chunks previously
|
||||
read into the info structure's unknown-chunk list will also be written out
|
||||
in a sequence that satisfies the PNG specification's ordering rules.
|
||||
|
||||
Here is an example of writing two private chunks, prVt and miNE:
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Set unknown chunk data */
|
||||
png_unknown_chunk unk_chunk[2];
|
||||
strcpy((char *) unk_chunk[0].name, "prVt";
|
||||
unk_chunk[0].data = (unsigned char *) "PRIVATE DATA";
|
||||
unk_chunk[0].size = strlen(unk_chunk[0].data)+1;
|
||||
unk_chunk[0].location = PNG_HAVE_IHDR;
|
||||
strcpy((char *) unk_chunk[1].name, "miNE";
|
||||
unk_chunk[1].data = (unsigned char *) "MY CHUNK DATA";
|
||||
unk_chunk[1].size = strlen(unk_chunk[0].data)+1;
|
||||
unk_chunk[1].location = PNG_AFTER_IDAT;
|
||||
png_set_unknown_chunks(write_ptr, write_info_ptr,
|
||||
unk_chunk, 2);
|
||||
/* Needed because miNE is not safe-to-copy */
|
||||
png_set_keep_unknown_chunks(png, PNG_HANDLE_CHUNK_ALWAYS,
|
||||
(png_bytep) "miNE", 1);
|
||||
# if PNG_LIBPNG_VER < 10600
|
||||
/* Deal with unknown chunk location bug in 1.5.x and earlier */
|
||||
png_set_unknown_chunk_location(png, info, 0, PNG_HAVE_IHDR);
|
||||
png_set_unknown_chunk_location(png, info, 1, PNG_AFTER_IDAT);
|
||||
# endif
|
||||
# if PNG_LIBPNG_VER < 10500
|
||||
/* PNG_AFTER_IDAT writes two copies of the chunk prior to libpng-1.5.0,
|
||||
* one before IDAT and another after IDAT, so don't use it; only use
|
||||
* PNG_HAVE_IHDR location. This call resets the location previously
|
||||
* set by assignment and png_set_unknown_chunk_location() for chunk 1.
|
||||
*/
|
||||
png_set_unknown_chunk_location(png, info, 1, PNG_HAVE_IHDR);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
The high-level write interface
|
||||
|
||||
@@ -3503,7 +3535,7 @@ The simplified API, which became available in libpng-1.6.0, hides the details
|
||||
of both libpng and the PNG file format itself.
|
||||
It allows PNG files to be read into a very limited number of
|
||||
in-memory bitmap formats or to be written from the same formats. If these
|
||||
formats do not accomodate your needs then you can, and should, use the more
|
||||
formats do not accommodate your needs then you can, and should, use the more
|
||||
sophisticated APIs above - these support a wide variety of in-memory formats
|
||||
and a wide variety of sophisticated transformations to those formats as well
|
||||
as a wide variety of APIs to manipulate ancilliary information.
|
||||
@@ -3994,9 +4026,12 @@ as warnings.
|
||||
|
||||
png_set_benign_errors (png_ptr, int allowed);
|
||||
|
||||
allowed: 0: (default) treat png_benign_error() an error.
|
||||
allowed: 0: treat png_benign_error() as an error.
|
||||
1: treat png_benign_error() as a warning.
|
||||
|
||||
As of libpng-1.6.0, the default condition is to treat benign errors as
|
||||
warnings while reading and as errors while writing.
|
||||
|
||||
Custom chunks
|
||||
|
||||
If you need to read or write custom chunks, you may need to get deeper
|
||||
@@ -4267,7 +4302,7 @@ the message, "message" is the formatted string to be printed,
|
||||
and p1 and p2 are parameters that are to be embedded in the string
|
||||
according to printf-style formatting directives. For example,
|
||||
|
||||
png_debug1(2, "foo=%d\n", foo);
|
||||
png_debug1(2, "foo=%d", foo);
|
||||
|
||||
is expanded to
|
||||
|
||||
@@ -4358,6 +4393,9 @@ png_set_error_fn(), which is essentially the same function, but with a new
|
||||
name to force compilation errors with applications that try to use the old
|
||||
method.
|
||||
|
||||
Support for the sCAL, iCCP, iTXt, and sPLT chunks was added at libpng-1.0.6;
|
||||
however, iTXt support was not enabled by default.
|
||||
|
||||
Starting with version 1.0.7, you can find out which version of the library
|
||||
you are using at run-time:
|
||||
|
||||
@@ -4574,7 +4612,7 @@ it has not been well tested and doesn't actually "dither".
|
||||
The code was not
|
||||
removed, however, and could be enabled by building libpng with
|
||||
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
|
||||
was reenabled, but the function was renamed png_set_quantize() to
|
||||
was re-enabled, but the function was renamed png_set_quantize() to
|
||||
reflect more accurately what it actually does. At the same time,
|
||||
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
|
||||
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS, and PNG_READ_DITHER_SUPPORTED
|
||||
@@ -4586,12 +4624,13 @@ XI. Changes to Libpng from version 1.4.x to 1.5.x
|
||||
|
||||
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
|
||||
function) incorrectly returned a value of type png_uint_32.
|
||||
The incorrect macro was removed from libpng-1.4.5.
|
||||
|
||||
Checking for invalid palette index on read or write was added at libpng
|
||||
1.5.10. When an invalid index is found, libpng issues a benign error.
|
||||
This is enabled by default because this condition is an error according
|
||||
to the PNG specification, Clause 11.3.2, but the error can be ignored in
|
||||
each png_ptr with
|
||||
Checking for invalid palette index on write was added at libpng
|
||||
1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
|
||||
a benign error. This is enabled by default because this condition is an
|
||||
error according to the PNG specification, Clause 11.3.2, but the error can
|
||||
be ignored in each png_ptr with
|
||||
|
||||
png_set_check_for_invalid_index(png_ptr, allowed);
|
||||
|
||||
@@ -4690,7 +4729,10 @@ and the accuracy of PNG fixed point values is insufficient for
|
||||
representation of these values. Consequently a "string" API
|
||||
(png_get_sCAL_s and png_set_sCAL_s) is the only reliable way of reading
|
||||
arbitrary sCAL chunks in the absence of either the floating point API or
|
||||
internal floating point calculations.
|
||||
internal floating point calculations. Starting with libpng-1.5.0, both
|
||||
of these functions are present when PNG_sCAL_SUPPORTED is defined. Prior
|
||||
to libpng-1.5.0, their presence also depended upon PNG_FIXED_POINT_SUPPORTED
|
||||
being defined and PNG_FLOATING_POINT_SUPPORTED not being defined.
|
||||
|
||||
Applications no longer need to include the optional distribution header
|
||||
file pngusr.h or define the corresponding macros during application
|
||||
@@ -4710,15 +4752,10 @@ reset by pngusr.h or by explicit settings on the compiler command line.
|
||||
These settings may produce compiler warnings or errors in 1.5.0 because
|
||||
of macro redefinition.
|
||||
|
||||
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
|
||||
function) incorrectly returned a value of type png_uint_32. libpng 1.5.0
|
||||
is consistent with the implementation in 1.4.5 and 1.2.x (where the macro
|
||||
did not exist.)
|
||||
|
||||
Applications can now choose whether to use these macros or to call the
|
||||
corresponding function by defining PNG_USE_READ_MACROS or
|
||||
PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
|
||||
only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
|
||||
only supported from 1.5.0; defining PNG_NO_USE_READ_MACROS prior to 1.5.0
|
||||
will lead to a link failure.
|
||||
|
||||
Prior to libpng-1.5.4, the zlib compressor used the same set of parameters
|
||||
@@ -4732,7 +4769,10 @@ option was off by default, and slightly inaccurate scaling occurred.
|
||||
This option can no longer be turned off, and the choice of accurate
|
||||
or inaccurate 16-to-8 scaling is by using the new png_set_scale_16_to_8()
|
||||
API for accurate scaling or the old png_set_strip_16_to_8() API for simple
|
||||
chopping.
|
||||
chopping. In libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||
macro became PNG_READ_SCALE_16_TO_8_SUPPORTED, and the PNG_READ_16_TO_8
|
||||
macro became PNG_READ_STRIP_16_TO_8_SUPPORTED, to enable the two
|
||||
png_set_*_16_to_8() functions separately.
|
||||
|
||||
Prior to libpng-1.5.4, the png_set_user_limits() function could only be
|
||||
used to reduce the width and height limits from the value of
|
||||
@@ -4754,6 +4794,9 @@ limits are now
|
||||
png_user_chunk_cache_max 0 (unlimited) 128
|
||||
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
|
||||
|
||||
The png_set_option() function (and the "options" member of the png struct) was
|
||||
added to libpng-1.5.15.
|
||||
|
||||
B. Changes to the build and configuration of libpng
|
||||
|
||||
Details of internal changes to the library code can be found in the CHANGES
|
||||
@@ -4947,9 +4990,9 @@ symbols, using the PNG_PREFIX macro.
|
||||
|
||||
We no longer include string.h in png.h. The include statement has been moved
|
||||
to pngpriv.h, where it is not accessible by applications. Applications that
|
||||
need access to information in string.h must add an '#include "string.h"'
|
||||
need access to information in string.h must add an '#include <string.h>'
|
||||
directive. It does not matter whether this is placed prior to or after
|
||||
the '"#include png.h"' directive.
|
||||
the '#include "png.h"' directive.
|
||||
|
||||
The following API are now DEPRECATED:
|
||||
png_info_init_3()
|
||||
@@ -4977,11 +5020,25 @@ where "rp" indicates a "restricted pointer".
|
||||
|
||||
Error detection in some chunks has improved; in particular the iCCP chunk
|
||||
reader now does pretty complete validation of the basic format. Some bad
|
||||
profiles that were previously accepted are now rejected, in particular the
|
||||
very old broken Microsoft/HP sRGB profile.
|
||||
profiles that were previously accepted are now accepted with a warning or
|
||||
rejected, depending upon the png_set_benign_errors() setting, in particular the
|
||||
very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement
|
||||
that only grayscale profiles may appear in images with color type 0 or 4 and
|
||||
that even if the image only contains gray pixels, only RGB profiles may appear
|
||||
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
|
||||
is allowed to appear in images with any color type.
|
||||
|
||||
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
|
||||
an empty language field or an empty translated keyword. Both of these
|
||||
are allowed by the PNG specification, so these warnings are no longer issued.
|
||||
|
||||
The library now issues an error if the application attempts to set a
|
||||
transform after it calls png_read_update_info().
|
||||
transform after it calls png_read_update_info() or if it attempts to call
|
||||
both png_read_update_info() and png_start_read_image() or to call either
|
||||
of them more than once.
|
||||
|
||||
The default condition for benign_errors is now to treat benign errors as
|
||||
warnings while reading and as errors while writing.
|
||||
|
||||
The library now issues a warning if both background processing and RGB to
|
||||
gray are used when gamma correction happens. As with previous versions of
|
||||
@@ -4999,6 +5056,26 @@ The machine-generated configure files are no longer included in branches
|
||||
libpng16 and later of the GIT repository. They continue to be included
|
||||
in the tarball releases, however.
|
||||
|
||||
Libpng-1.6.0 through 1.6.2 used the CMF bytes at the beginning of the IDAT
|
||||
stream to set the size of the sliding window for reading instead of using the
|
||||
default 32-kbyte sliding window size. It was discovered that there are
|
||||
hundreds of PNG files in the wild that have incorrect CMF bytes that caused
|
||||
libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and
|
||||
later calculate their own safe CMF from the image dimensions, provide a way
|
||||
to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
|
||||
32-kbyte sliding window), by using
|
||||
|
||||
png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
|
||||
PNG_OPTION_ON);
|
||||
|
||||
and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes
|
||||
correctly.
|
||||
|
||||
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
|
||||
length, which resulted in PNG files that cannot be read beyond the bad iTXt
|
||||
chunk. This error was fixed in libpng-1.6.3, and a tool (called
|
||||
contrib/tools/png-fix-itxt) has been added to the libpng distribution.
|
||||
|
||||
XIII. Detecting libpng
|
||||
|
||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||
@@ -5015,11 +5092,11 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
|
||||
going back to version 0.70. You can access the git repository (read only)
|
||||
at
|
||||
|
||||
git://libpng.git.sourceforge.net/gitroot/libpng
|
||||
git://git.code.sf.net/p/libpng/code
|
||||
|
||||
or you can browse it via "gitweb" at
|
||||
or you can browse it with a web browser by selecting the "code" button at
|
||||
|
||||
http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng
|
||||
https://sourceforge.net/projects/libpng
|
||||
|
||||
Patches can be sent to glennrp at users.sourceforge.net or to
|
||||
png-mng-implement at lists.sourceforge.net or you can upload them to
|
||||
@@ -5161,13 +5238,13 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
XVI. Y2K Compliance in libpng
|
||||
|
||||
March 28, 2013
|
||||
February 6, 2014
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.1 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.9 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
||||
226
libpng.3
226
libpng.3
@@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "March 28, 2013"
|
||||
.TH LIBPNG 3 "February 6, 2014"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.1
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.9
|
||||
.SH SYNOPSIS
|
||||
\fB
|
||||
#include <png.h>\fP
|
||||
@@ -504,10 +504,10 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
||||
.SH LIBPNG.TXT
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.1 - March 28, 2013
|
||||
libpng version 1.6.9 - February 6, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@@ -515,9 +515,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.1 - March 28, 2013
|
||||
libpng versions 0.97, January 1998, through 1.6.9 - February 6, 2014
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 version 0.96 May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@@ -554,9 +554,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
.SH I. Introduction
|
||||
|
||||
This file describes how to use and modify the PNG reference library
|
||||
(known as libpng) for your own use. There are five sections to this
|
||||
file: introduction, structures, reading, writing, and modification and
|
||||
configuration notes for various special platforms. In addition to this
|
||||
(known as libpng) for your own use. In addition to this
|
||||
file, example.c is a good starting point for using the library, as
|
||||
it is heavily commented and should include everything most people
|
||||
will need. We assume that libpng is already installed; see the
|
||||
@@ -674,7 +672,7 @@ All APIs that take (double) arguments also have a matching API that
|
||||
takes the corresponding fixed point integer arguments. The fixed point
|
||||
API has the same name as the floating point one with "_fixed" appended.
|
||||
The actual range of values permitted in the APIs is frequently less than
|
||||
the full range of (png_fixed_point) (-21474 to +21474). When APIs require
|
||||
the full range of (png_fixed_point) (\-21474 to +21474). When APIs require
|
||||
a non-negative argument the type is recorded as png_uint_32 above. Consult
|
||||
the header file and the text below for more information.
|
||||
|
||||
@@ -715,7 +713,7 @@ The easiest way to make minor changes to the libpng configuration when
|
||||
auto-configuration is supported is to add definitions to the command line
|
||||
using (typically) CPPFLAGS. For example:
|
||||
|
||||
CPPFLAGS=-DPNG_NO_FLOATING_ARITHMETIC
|
||||
CPPFLAGS=\-DPNG_NO_FLOATING_ARITHMETIC
|
||||
|
||||
will change the internal libpng math implementation for gamma correction and
|
||||
other arithmetic calculations to fixed point, avoiding the need for fast
|
||||
@@ -723,7 +721,7 @@ floating point support. The result can be seen in the generated pnglibconf.h -
|
||||
make sure it contains the changed feature macro setting.
|
||||
|
||||
If you need to make more extensive configuration changes - more than one or two
|
||||
feature macro settings - you can either add -DPNG_USER_CONFIG to the build
|
||||
feature macro settings - you can either add \-DPNG_USER_CONFIG to the build
|
||||
command line and put a list of feature macro settings in pngusr.h or you can set
|
||||
DFA_XTRA (a makefile variable) to a file containing the same information in the
|
||||
form of 'option' settings.
|
||||
@@ -782,7 +780,7 @@ pngusr.dfa in these directories.
|
||||
|
||||
C. Configuration using PNG_USR_CONFIG
|
||||
|
||||
If -DPNG_USR_CONFIG is added to the CFLAGS when pnglibconf.h is built the file
|
||||
If \-DPNG_USR_CONFIG is added to the CFLAGS when pnglibconf.h is built the file
|
||||
pngusr.h will automatically be included before the options in
|
||||
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
|
||||
macro definitions turning features on or off or setting settings.
|
||||
@@ -1012,7 +1010,7 @@ input stream. You must supply the function
|
||||
unknown chunk structure, process it, and return one
|
||||
of the following: */
|
||||
|
||||
return (-n); /* chunk had an error */
|
||||
return (\-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
return (n); /* success */
|
||||
}
|
||||
@@ -1063,7 +1061,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
|
||||
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
|
||||
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
|
||||
the last recorded value each time.
|
||||
|
||||
@@ -1153,7 +1151,7 @@ callback function:
|
||||
.SS User limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
large as 2^(31\-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
Since very few applications really need to process such large images,
|
||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||
Larger images will be rejected immediately with a png_error() call. If
|
||||
@@ -1246,7 +1244,7 @@ situations:
|
||||
encoding.
|
||||
|
||||
You would use the linear (unencoded) value if you need to process the pixel
|
||||
values further because this avoids the need to decode and reencode each
|
||||
values further because this avoids the need to decode and re-encode each
|
||||
component value whenever arithmetic is performed. A lot of graphics software
|
||||
uses linear values for this reason, often with higher precision component values
|
||||
to preserve overall accuracy.
|
||||
@@ -2725,13 +2723,13 @@ point to libpng-allocated storage with the following function:
|
||||
or simply PNG_FREE_ALL
|
||||
|
||||
seq - sequence number of item to be freed
|
||||
(-1 for all items)
|
||||
(\-1 for all items)
|
||||
|
||||
This function may be safely called when the relevant storage has
|
||||
already been freed, or has not yet been allocated, or was allocated
|
||||
by the user and not by libpng, and will in those cases do nothing.
|
||||
The "seq" parameter is ignored if only one item of the selected data
|
||||
type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
|
||||
type, such as PLTE, is allowed. If "seq" is not \-1, and multiple items
|
||||
are allowed for the data type identified in the mask, such as text or
|
||||
sPLT, only the n'th item in the structure is freed, where n is "seq".
|
||||
|
||||
@@ -2795,7 +2793,7 @@ For a more compact example of reading a PNG image, see the file example.c.
|
||||
|
||||
.SS Reading PNG files progressively
|
||||
|
||||
The progressive reader is slightly different then the non-progressive
|
||||
The progressive reader is slightly different from the non-progressive
|
||||
reader. Instead of calling png_read_info(), png_read_rows(), and
|
||||
png_read_end(), you make one call to png_process_data(), which calls
|
||||
callbacks when it has the info, a row, or the end of the image. You
|
||||
@@ -3132,7 +3130,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
|
||||
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
|
||||
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
|
||||
the last recorded value each time.
|
||||
|
||||
@@ -3597,13 +3595,47 @@ a writeable buffer of at least 29 bytes.
|
||||
|
||||
.SS Writing unknown chunks
|
||||
|
||||
You can use the png_set_unknown_chunks function to queue up chunks
|
||||
for writing. You give it a chunk name, raw data, and a size; that's
|
||||
all there is to it. The chunks will be written by the next following
|
||||
png_write_info_before_PLTE, png_write_info, or png_write_end function.
|
||||
Any chunks previously read into the info structure's unknown-chunk
|
||||
list will also be written out in a sequence that satisfies the PNG
|
||||
specification's ordering rules.
|
||||
You can use the png_set_unknown_chunks function to queue up private chunks
|
||||
for writing. You give it a chunk name, location, raw data, and a size. You
|
||||
also must use png_set_keep_unknown_chunks() to ensure that libpng will
|
||||
handle them. That's all there is to it. The chunks will be written by the
|
||||
next following png_write_info_before_PLTE, png_write_info, or png_write_end
|
||||
function, depending upon the specified location. Any chunks previously
|
||||
read into the info structure's unknown-chunk list will also be written out
|
||||
in a sequence that satisfies the PNG specification's ordering rules.
|
||||
|
||||
Here is an example of writing two private chunks, prVt and miNE:
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Set unknown chunk data */
|
||||
png_unknown_chunk unk_chunk[2];
|
||||
strcpy((char *) unk_chunk[0].name, "prVt";
|
||||
unk_chunk[0].data = (unsigned char *) "PRIVATE DATA";
|
||||
unk_chunk[0].size = strlen(unk_chunk[0].data)+1;
|
||||
unk_chunk[0].location = PNG_HAVE_IHDR;
|
||||
strcpy((char *) unk_chunk[1].name, "miNE";
|
||||
unk_chunk[1].data = (unsigned char *) "MY CHUNK DATA";
|
||||
unk_chunk[1].size = strlen(unk_chunk[0].data)+1;
|
||||
unk_chunk[1].location = PNG_AFTER_IDAT;
|
||||
png_set_unknown_chunks(write_ptr, write_info_ptr,
|
||||
unk_chunk, 2);
|
||||
/* Needed because miNE is not safe-to-copy */
|
||||
png_set_keep_unknown_chunks(png, PNG_HANDLE_CHUNK_ALWAYS,
|
||||
(png_bytep) "miNE", 1);
|
||||
# if PNG_LIBPNG_VER < 10600
|
||||
/* Deal with unknown chunk location bug in 1.5.x and earlier */
|
||||
png_set_unknown_chunk_location(png, info, 0, PNG_HAVE_IHDR);
|
||||
png_set_unknown_chunk_location(png, info, 1, PNG_AFTER_IDAT);
|
||||
# endif
|
||||
# if PNG_LIBPNG_VER < 10500
|
||||
/* PNG_AFTER_IDAT writes two copies of the chunk prior to libpng-1.5.0,
|
||||
* one before IDAT and another after IDAT, so don't use it; only use
|
||||
* PNG_HAVE_IHDR location. This call resets the location previously
|
||||
* set by assignment and png_set_unknown_chunk_location() for chunk 1.
|
||||
*/
|
||||
png_set_unknown_chunk_location(png, info, 1, PNG_HAVE_IHDR);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
.SS The high-level write interface
|
||||
|
||||
@@ -3938,13 +3970,13 @@ point to libpng-allocated storage with the following function:
|
||||
or simply PNG_FREE_ALL
|
||||
|
||||
seq - sequence number of item to be freed
|
||||
(-1 for all items)
|
||||
(\-1 for all items)
|
||||
|
||||
This function may be safely called when the relevant storage has
|
||||
already been freed, or has not yet been allocated, or was allocated
|
||||
by the user and not by libpng, and will in those cases do nothing.
|
||||
The "seq" parameter is ignored if only one item of the selected data
|
||||
type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
|
||||
type, such as PLTE, is allowed. If "seq" is not \-1, and multiple items
|
||||
are allowed for the data type identified in the mask, such as text or
|
||||
sPLT, only the n'th item in the structure is freed, where n is "seq".
|
||||
|
||||
@@ -4007,7 +4039,7 @@ The simplified API, which became available in libpng-1.6.0, hides the details
|
||||
of both libpng and the PNG file format itself.
|
||||
It allows PNG files to be read into a very limited number of
|
||||
in-memory bitmap formats or to be written from the same formats. If these
|
||||
formats do not accomodate your needs then you can, and should, use the more
|
||||
formats do not accommodate your needs then you can, and should, use the more
|
||||
sophisticated APIs above - these support a wide variety of in-memory formats
|
||||
and a wide variety of sophisticated transformations to those formats as well
|
||||
as a wide variety of APIs to manipulate ancilliary information.
|
||||
@@ -4498,9 +4530,12 @@ as warnings.
|
||||
|
||||
png_set_benign_errors (png_ptr, int allowed);
|
||||
|
||||
allowed: 0: (default) treat png_benign_error() an error.
|
||||
allowed: 0: treat png_benign_error() as an error.
|
||||
1: treat png_benign_error() as a warning.
|
||||
|
||||
As of libpng-1.6.0, the default condition is to treat benign errors as
|
||||
warnings while reading and as errors while writing.
|
||||
|
||||
.SS Custom chunks
|
||||
|
||||
If you need to read or write custom chunks, you may need to get deeper
|
||||
@@ -4772,12 +4807,12 @@ the message, "message" is the formatted string to be printed,
|
||||
and p1 and p2 are parameters that are to be embedded in the string
|
||||
according to printf-style formatting directives. For example,
|
||||
|
||||
png_debug1(2, "foo=%d\n", foo);
|
||||
png_debug1(2, "foo=%d", foo);
|
||||
|
||||
is expanded to
|
||||
|
||||
if (PNG_DEBUG > 2)
|
||||
fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo);
|
||||
fprintf(PNG_DEBUG_FILE, "foo=%d\en", foo);
|
||||
|
||||
When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
|
||||
can still use PNG_DEBUG to control your own debugging:
|
||||
@@ -4794,7 +4829,7 @@ this version of libpng, but if you insert some they will be printed.
|
||||
|
||||
Starting with libpng-1.6.0, you can configure libpng (when using the
|
||||
"configure" script) to prefix all exported symbols by means of the
|
||||
configuration option "--with-libpng-prefix=FOO_", where FOO_ can be any
|
||||
configuration option "\-\-with\-libpng\-prefix=FOO_", where FOO_ can be any
|
||||
string beginning with a letter and containing only uppercase
|
||||
and lowercase letters, digits, and the underscore (i.e., a C language
|
||||
identifier). This creates a set of macros in pnglibconf.h, so this is
|
||||
@@ -4863,6 +4898,9 @@ png_set_error_fn(), which is essentially the same function, but with a new
|
||||
name to force compilation errors with applications that try to use the old
|
||||
method.
|
||||
|
||||
Support for the sCAL, iCCP, iTXt, and sPLT chunks was added at libpng-1.0.6;
|
||||
however, iTXt support was not enabled by default.
|
||||
|
||||
Starting with version 1.0.7, you can find out which version of the library
|
||||
you are using at run-time:
|
||||
|
||||
@@ -5079,7 +5117,7 @@ it has not been well tested and doesn't actually "dither".
|
||||
The code was not
|
||||
removed, however, and could be enabled by building libpng with
|
||||
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
|
||||
was reenabled, but the function was renamed png_set_quantize() to
|
||||
was re-enabled, but the function was renamed png_set_quantize() to
|
||||
reflect more accurately what it actually does. At the same time,
|
||||
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
|
||||
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS, and PNG_READ_DITHER_SUPPORTED
|
||||
@@ -5091,12 +5129,13 @@ We removed the trailing '.' from the warning and error messages.
|
||||
|
||||
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
|
||||
function) incorrectly returned a value of type png_uint_32.
|
||||
The incorrect macro was removed from libpng-1.4.5.
|
||||
|
||||
Checking for invalid palette index on read or write was added at libpng
|
||||
1.5.10. When an invalid index is found, libpng issues a benign error.
|
||||
This is enabled by default because this condition is an error according
|
||||
to the PNG specification, Clause 11.3.2, but the error can be ignored in
|
||||
each png_ptr with
|
||||
Checking for invalid palette index on write was added at libpng
|
||||
1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
|
||||
a benign error. This is enabled by default because this condition is an
|
||||
error according to the PNG specification, Clause 11.3.2, but the error can
|
||||
be ignored in each png_ptr with
|
||||
|
||||
png_set_check_for_invalid_index(png_ptr, allowed);
|
||||
|
||||
@@ -5117,7 +5156,7 @@ reading, and after png_write_png() or png_write_image() while writing.
|
||||
|
||||
int max_palette = png_get_palette_max(png_ptr, info_ptr);
|
||||
|
||||
This will return the maximum palette index found in the image, or "-1" if
|
||||
This will return the maximum palette index found in the image, or "\-1" if
|
||||
the palette was not checked, or "0" if no palette was found. Note that this
|
||||
does not account for any palette index used by ancillary chunks such as the
|
||||
bKGD chunk; you must check those separately to determine the maximum
|
||||
@@ -5195,7 +5234,10 @@ and the accuracy of PNG fixed point values is insufficient for
|
||||
representation of these values. Consequently a "string" API
|
||||
(png_get_sCAL_s and png_set_sCAL_s) is the only reliable way of reading
|
||||
arbitrary sCAL chunks in the absence of either the floating point API or
|
||||
internal floating point calculations.
|
||||
internal floating point calculations. Starting with libpng-1.5.0, both
|
||||
of these functions are present when PNG_sCAL_SUPPORTED is defined. Prior
|
||||
to libpng-1.5.0, their presence also depended upon PNG_FIXED_POINT_SUPPORTED
|
||||
being defined and PNG_FLOATING_POINT_SUPPORTED not being defined.
|
||||
|
||||
Applications no longer need to include the optional distribution header
|
||||
file pngusr.h or define the corresponding macros during application
|
||||
@@ -5215,15 +5257,10 @@ reset by pngusr.h or by explicit settings on the compiler command line.
|
||||
These settings may produce compiler warnings or errors in 1.5.0 because
|
||||
of macro redefinition.
|
||||
|
||||
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
|
||||
function) incorrectly returned a value of type png_uint_32. libpng 1.5.0
|
||||
is consistent with the implementation in 1.4.5 and 1.2.x (where the macro
|
||||
did not exist.)
|
||||
|
||||
Applications can now choose whether to use these macros or to call the
|
||||
corresponding function by defining PNG_USE_READ_MACROS or
|
||||
PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
|
||||
only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
|
||||
only supported from 1.5.0; defining PNG_NO_USE_READ_MACROS prior to 1.5.0
|
||||
will lead to a link failure.
|
||||
|
||||
Prior to libpng-1.5.4, the zlib compressor used the same set of parameters
|
||||
@@ -5237,7 +5274,10 @@ option was off by default, and slightly inaccurate scaling occurred.
|
||||
This option can no longer be turned off, and the choice of accurate
|
||||
or inaccurate 16-to-8 scaling is by using the new png_set_scale_16_to_8()
|
||||
API for accurate scaling or the old png_set_strip_16_to_8() API for simple
|
||||
chopping.
|
||||
chopping. In libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||
macro became PNG_READ_SCALE_16_TO_8_SUPPORTED, and the PNG_READ_16_TO_8
|
||||
macro became PNG_READ_STRIP_16_TO_8_SUPPORTED, to enable the two
|
||||
png_set_*_16_to_8() functions separately.
|
||||
|
||||
Prior to libpng-1.5.4, the png_set_user_limits() function could only be
|
||||
used to reduce the width and height limits from the value of
|
||||
@@ -5259,6 +5299,9 @@ limits are now
|
||||
png_user_chunk_cache_max 0 (unlimited) 128
|
||||
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
|
||||
|
||||
The png_set_option() function (and the "options" member of the png struct) was
|
||||
added to libpng-1.5.15.
|
||||
|
||||
B. Changes to the build and configuration of libpng
|
||||
|
||||
Details of internal changes to the library code can be found in the CHANGES
|
||||
@@ -5452,9 +5495,9 @@ symbols, using the PNG_PREFIX macro.
|
||||
|
||||
We no longer include string.h in png.h. The include statement has been moved
|
||||
to pngpriv.h, where it is not accessible by applications. Applications that
|
||||
need access to information in string.h must add an '#include "string.h"'
|
||||
need access to information in string.h must add an '#include <string.h>'
|
||||
directive. It does not matter whether this is placed prior to or after
|
||||
the '"#include png.h"' directive.
|
||||
the '#include "png.h"' directive.
|
||||
|
||||
The following API are now DEPRECATED:
|
||||
png_info_init_3()
|
||||
@@ -5482,11 +5525,25 @@ where "rp" indicates a "restricted pointer".
|
||||
|
||||
Error detection in some chunks has improved; in particular the iCCP chunk
|
||||
reader now does pretty complete validation of the basic format. Some bad
|
||||
profiles that were previously accepted are now rejected, in particular the
|
||||
very old broken Microsoft/HP sRGB profile.
|
||||
profiles that were previously accepted are now accepted with a warning or
|
||||
rejected, depending upon the png_set_benign_errors() setting, in particular the
|
||||
very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement
|
||||
that only grayscale profiles may appear in images with color type 0 or 4 and
|
||||
that even if the image only contains gray pixels, only RGB profiles may appear
|
||||
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
|
||||
is allowed to appear in images with any color type.
|
||||
|
||||
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
|
||||
an empty language field or an empty translated keyword. Both of these
|
||||
are allowed by the PNG specification, so these warnings are no longer issued.
|
||||
|
||||
The library now issues an error if the application attempts to set a
|
||||
transform after it calls png_read_update_info().
|
||||
transform after it calls png_read_update_info() or if it attempts to call
|
||||
both png_read_update_info() and png_start_read_image() or to call either
|
||||
of them more than once.
|
||||
|
||||
The default condition for benign_errors is now to treat benign errors as
|
||||
warnings while reading and as errors while writing.
|
||||
|
||||
The library now issues a warning if both background processing and RGB to
|
||||
gray are used when gamma correction happens. As with previous versions of
|
||||
@@ -5504,6 +5561,26 @@ The machine-generated configure files are no longer included in branches
|
||||
libpng16 and later of the GIT repository. They continue to be included
|
||||
in the tarball releases, however.
|
||||
|
||||
Libpng-1.6.0 through 1.6.2 used the CMF bytes at the beginning of the IDAT
|
||||
stream to set the size of the sliding window for reading instead of using the
|
||||
default 32-kbyte sliding window size. It was discovered that there are
|
||||
hundreds of PNG files in the wild that have incorrect CMF bytes that caused
|
||||
libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and
|
||||
later calculate their own safe CMF from the image dimensions, provide a way
|
||||
to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
|
||||
32-kbyte sliding window), by using
|
||||
|
||||
png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
|
||||
PNG_OPTION_ON);
|
||||
|
||||
and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes
|
||||
correctly.
|
||||
|
||||
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
|
||||
length, which resulted in PNG files that cannot be read beyond the bad iTXt
|
||||
chunk. This error was fixed in libpng-1.6.3, and a tool (called
|
||||
contrib/tools/png-fix-itxt) has been added to the libpng distribution.
|
||||
|
||||
.SH XIII. Detecting libpng
|
||||
|
||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||
@@ -5520,11 +5597,11 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
|
||||
going back to version 0.70. You can access the git repository (read only)
|
||||
at
|
||||
|
||||
git://libpng.git.sourceforge.net/gitroot/libpng
|
||||
git://git.code.sf.net/p/libpng/code
|
||||
|
||||
or you can browse it via "gitweb" at
|
||||
or you can browse it with a web browser by selecting the "code" button at
|
||||
|
||||
http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng
|
||||
https://sourceforge.net/projects/libpng
|
||||
|
||||
Patches can be sent to glennrp at users.sourceforge.net or to
|
||||
png-mng-implement at lists.sourceforge.net or you can upload them to
|
||||
@@ -5645,7 +5722,7 @@ C binary operator and after "for" or "while", and before
|
||||
being cast, nor do we put one between a function name and the
|
||||
left parenthesis that follows it:
|
||||
|
||||
for (i = 2; i > 0; --i)
|
||||
for (i = 2; i > 0; \-\-i)
|
||||
y[i] = a(x) + (int)b;
|
||||
|
||||
We prefer #ifdef and #ifndef to #if defined() and #if !defined()
|
||||
@@ -5666,13 +5743,13 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
.SH XVI. Y2K Compliance in libpng
|
||||
|
||||
March 28, 2013
|
||||
February 6, 2014
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.1 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.9 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@@ -5880,8 +5957,29 @@ the first widely used release:
|
||||
1.6.0beta01-40 16 10600 16.so.16.0[.0]
|
||||
1.6.0rc01-08 16 10600 16.so.16.0[.0]
|
||||
1.6.0 16 10600 16.so.16.0[.0]
|
||||
1.6.1beta01-09 16 10601 16.so.16.1[.0]
|
||||
1.6.1rc01 16 10601 16.so.16.1[.0]
|
||||
1.6.1 16 10601 16.so.16.1[.0]
|
||||
1.6.2beta01 16 10602 16.so.16.2[.0]
|
||||
1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
||||
1.6.2 16 10602 16.so.16.2[.0]
|
||||
1.6.3beta01-11 16 10603 16.so.16.3[.0]
|
||||
1.6.3rc01 16 10603 16.so.16.3[.0]
|
||||
1.6.3 16 10603 16.so.16.3[.0]
|
||||
1.6.4beta01-02 16 10604 16.so.16.4[.0]
|
||||
1.6.4rc01 16 10604 16.so.16.4[.0]
|
||||
1.6.4 16 10604 16.so.16.4[.0]
|
||||
1.6.5 16 10605 16.so.16.5[.0]
|
||||
1.6.6 16 10606 16.so.16.6[.0]
|
||||
1.6.7beta01-04 16 10607 16.so.16.7[.0]
|
||||
1.6.7rc01-02 16 10607 16.so.16.7[.0]
|
||||
1.6.7 16 10607 16.so.16.7[.0]
|
||||
1.6.8beta01-02 16 10608 16.so.16.8[.0]
|
||||
1.6.8rc01-02 16 10608 16.so.16.8[.0]
|
||||
1.6.8 16 10608 16.so.16.8[.0]
|
||||
1.6.9beta01-04 16 10609 16.so.16.9[.0]
|
||||
1.6.9rc01-02 16 10609 16.so.16.9[.0]
|
||||
1.6.9 16 10609 16.so.16.9[.0]
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@@ -5938,7 +6036,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.6.1 - March 28, 2013:
|
||||
Libpng version 1.6.9 - February 6, 2014:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
|
||||
@@ -5961,7 +6059,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.1, March 28, 2013, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.9, February 6, 2014, are
|
||||
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
@@ -6060,7 +6158,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
March 28, 2013
|
||||
February 6, 2014
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "March 28, 2013"
|
||||
.TH LIBPNGPF 3 "February 6, 2014"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.1
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.9
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include \fI"pngpriv.h"
|
||||
|
||||
2
png.5
2
png.5
@@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "March 28, 2013"
|
||||
.TH PNG 5 "February 6, 2014"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
||||
134
png.c
134
png.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_1 Your_png_h_is_not_version_1_6_1;
|
||||
typedef png_libpng_version_1_6_9 Your_png_h_is_not_version_1_6_9;
|
||||
|
||||
/* 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
|
||||
@@ -115,7 +115,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
|
||||
{
|
||||
int need_crc = 1;
|
||||
|
||||
if (PNG_CHUNK_ANCILLIARY(png_ptr->chunk_name))
|
||||
if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name))
|
||||
{
|
||||
if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
|
||||
(PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
|
||||
@@ -201,6 +201,7 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
|
||||
pos = png_safecat(m, (sizeof m), pos, user_png_ver);
|
||||
pos = png_safecat(m, (sizeof m), pos, " but running with ");
|
||||
pos = png_safecat(m, (sizeof m), pos, png_libpng_ver);
|
||||
PNG_UNUSED(pos)
|
||||
|
||||
png_warning(png_ptr, m);
|
||||
#endif
|
||||
@@ -259,6 +260,10 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
*/
|
||||
# ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_set_mem_fn(&create_struct, mem_ptr, malloc_fn, free_fn);
|
||||
# else
|
||||
PNG_UNUSED(mem_ptr)
|
||||
PNG_UNUSED(malloc_fn)
|
||||
PNG_UNUSED(free_fn)
|
||||
# endif
|
||||
|
||||
/* (*error_fn) can return control to the caller after the error_ptr is set,
|
||||
@@ -768,14 +773,14 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.1 - March 28, 2013" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.9 - February 6, 2014" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.1 - March 28, 2013\
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
|
||||
return "libpng version 1.6.9 - February 6, 2014\
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
# endif
|
||||
@@ -821,6 +826,63 @@ png_get_header_version(png_const_structrp png_ptr)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
|
||||
/* NOTE: this routine is not used internally! */
|
||||
/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
|
||||
* large of png_color. This lets grayscale images be treated as
|
||||
* paletted. Most useful for gamma correction and simplification
|
||||
* of code. This API is not used internally.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_build_grayscale_palette(int bit_depth, png_colorp palette)
|
||||
{
|
||||
int num_palette;
|
||||
int color_inc;
|
||||
int i;
|
||||
int v;
|
||||
|
||||
png_debug(1, "in png_do_build_grayscale_palette");
|
||||
|
||||
if (palette == NULL)
|
||||
return;
|
||||
|
||||
switch (bit_depth)
|
||||
{
|
||||
case 1:
|
||||
num_palette = 2;
|
||||
color_inc = 0xff;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
num_palette = 4;
|
||||
color_inc = 0x55;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
num_palette = 16;
|
||||
color_inc = 0x11;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
num_palette = 256;
|
||||
color_inc = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
num_palette = 0;
|
||||
color_inc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
|
||||
{
|
||||
palette[i].red = (png_byte)v;
|
||||
palette[i].green = (png_byte)v;
|
||||
palette[i].blue = (png_byte)v;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
int PNGAPI
|
||||
png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
|
||||
@@ -855,7 +917,8 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
|
||||
return PNG_HANDLE_CHUNK_AS_DEFAULT;
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
|
||||
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
||||
int /* PRIVATE */
|
||||
png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name)
|
||||
{
|
||||
@@ -864,7 +927,7 @@ png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name)
|
||||
PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name);
|
||||
return png_handle_as_unknown(png_ptr, chunk_string);
|
||||
}
|
||||
#endif /* READ_UNKNOWN_CHUNKS */
|
||||
#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
|
||||
#endif /* SET_UNKNOWN_CHUNKS */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
@@ -1721,6 +1784,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
# endif
|
||||
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
|
||||
pos = png_safecat(message, (sizeof message), pos, reason);
|
||||
PNG_UNUSED(pos)
|
||||
|
||||
/* This is recoverable, but make it unconditionally an app_error on write to
|
||||
* avoid writing invalid ICC profiles into PNG files. (I.e. we handle them
|
||||
@@ -1866,7 +1930,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
"length does not match profile");
|
||||
|
||||
temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
|
||||
if (temp > 357913930 || /* (2^32-4-132)/12: maxium possible tag count */
|
||||
if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
|
||||
profile_length < 132+12*temp) /* truncated tag table */
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, temp,
|
||||
"tag count too large");
|
||||
@@ -2275,7 +2339,10 @@ png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
png_icc_check_tag_table(png_ptr, colorspace, name, profile_length,
|
||||
profile))
|
||||
{
|
||||
png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
|
||||
# ifdef PNG_sRGB_SUPPORTED
|
||||
/* If no sRGB support, don't try storing sRGB information */
|
||||
png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
|
||||
# endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2406,14 +2473,6 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (width > (PNG_UINT_32_MAX
|
||||
>> 3) /* 8-byte RGBA pixels */
|
||||
- 48 /* bigrowbuf hack */
|
||||
- 1 /* filter byte */
|
||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
||||
- 8) /* extra max_pixel_depth pad */
|
||||
png_warning(png_ptr, "Width is too large for libpng to process pixels");
|
||||
|
||||
/* Check other values */
|
||||
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
|
||||
bit_depth != 8 && bit_depth != 16)
|
||||
@@ -3087,11 +3146,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
|
||||
if (r > 2147483647. || r < -2147483648.)
|
||||
png_fixed_error(png_ptr, text);
|
||||
|
||||
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||
PNG_UNUSED(text)
|
||||
# endif
|
||||
|
||||
return (png_fixed_point)r;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || \
|
||||
#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_COLORSPACE_SUPPORTED) ||\
|
||||
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
|
||||
/* muldiv functions */
|
||||
/* This API takes signed arguments and rounds the result to the nearest
|
||||
@@ -3264,27 +3327,29 @@ png_gamma_significant(png_fixed_point gamma_val)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
# ifdef PNG_16BIT_SUPPORTED
|
||||
/* A local convenience routine. */
|
||||
static png_fixed_point
|
||||
png_product2(png_fixed_point a, png_fixed_point b)
|
||||
{
|
||||
/* The required result is 1/a * 1/b; the following preserves accuracy. */
|
||||
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||
# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||
double r = a * 1E-5;
|
||||
r *= b;
|
||||
r = floor(r+.5);
|
||||
|
||||
if (r <= 2147483647. && r >= -2147483648.)
|
||||
return (png_fixed_point)r;
|
||||
#else
|
||||
# else
|
||||
png_fixed_point res;
|
||||
|
||||
if (png_muldiv(&res, a, b, 100000))
|
||||
return res;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
return 0; /* overflow */
|
||||
}
|
||||
# endif /* 16BIT */
|
||||
|
||||
/* The inverse of the above. */
|
||||
png_fixed_point
|
||||
@@ -3589,6 +3654,7 @@ png_exp8bit(png_fixed_point lg2)
|
||||
return (png_byte)((x + 0x7fffffU) >> 24);
|
||||
}
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
static png_uint_16
|
||||
png_exp16bit(png_fixed_point lg2)
|
||||
{
|
||||
@@ -3599,6 +3665,7 @@ png_exp16bit(png_fixed_point lg2)
|
||||
x -= x >> 16;
|
||||
return (png_uint_16)((x + 32767U) >> 16);
|
||||
}
|
||||
#endif /* 16BIT */
|
||||
#endif /* FLOATING_ARITHMETIC */
|
||||
|
||||
png_byte
|
||||
@@ -3624,6 +3691,7 @@ png_gamma_8bit_correct(unsigned int value, png_fixed_point gamma_val)
|
||||
return (png_byte)value;
|
||||
}
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
png_uint_16
|
||||
png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val)
|
||||
{
|
||||
@@ -3646,6 +3714,7 @@ png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val)
|
||||
|
||||
return (png_uint_16)value;
|
||||
}
|
||||
#endif /* 16BIT */
|
||||
|
||||
/* This does the right thing based on the bit_depth field of the
|
||||
* png_struct, interpreting values as 8-bit or 16-bit. While the result
|
||||
@@ -3659,10 +3728,16 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value,
|
||||
if (png_ptr->bit_depth == 8)
|
||||
return png_gamma_8bit_correct(value, gamma_val);
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
else
|
||||
return png_gamma_16bit_correct(value, gamma_val);
|
||||
#else
|
||||
/* should not reach this */
|
||||
return 0;
|
||||
#endif /* 16BIT */
|
||||
}
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
/* Internal function to build a single 16-bit table - the table consists of
|
||||
* 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount
|
||||
* to shift the input values right (or 16-number_of_signifiant_bits).
|
||||
@@ -3801,6 +3876,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
|
||||
last++;
|
||||
}
|
||||
}
|
||||
#endif /* 16BIT */
|
||||
|
||||
/* Build a single 8-bit table: same as the 16-bit case but much simpler (and
|
||||
* typically much faster). Note that libpng currently does no sBIT processing
|
||||
@@ -3829,6 +3905,7 @@ png_destroy_gamma_table(png_structrp png_ptr)
|
||||
png_free(png_ptr, png_ptr->gamma_table);
|
||||
png_ptr->gamma_table = NULL;
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
if (png_ptr->gamma_16_table != NULL)
|
||||
{
|
||||
int i;
|
||||
@@ -3840,6 +3917,7 @@ png_destroy_gamma_table(png_structrp png_ptr)
|
||||
png_free(png_ptr, png_ptr->gamma_16_table);
|
||||
png_ptr->gamma_16_table = NULL;
|
||||
}
|
||||
#endif /* 16BIT */
|
||||
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
|
||||
@@ -3849,6 +3927,7 @@ png_destroy_gamma_table(png_structrp png_ptr)
|
||||
png_free(png_ptr, png_ptr->gamma_to_1);
|
||||
png_ptr->gamma_to_1 = NULL;
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
if (png_ptr->gamma_16_from_1 != NULL)
|
||||
{
|
||||
int i;
|
||||
@@ -3871,6 +3950,7 @@ png_destroy_gamma_table(png_structrp png_ptr)
|
||||
png_free(png_ptr, png_ptr->gamma_16_to_1);
|
||||
png_ptr->gamma_16_to_1 = NULL;
|
||||
}
|
||||
#endif /* 16BIT */
|
||||
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
|
||||
}
|
||||
|
||||
@@ -3916,6 +3996,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
||||
}
|
||||
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
|
||||
}
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
else
|
||||
{
|
||||
png_byte shift, sig_bit;
|
||||
@@ -3972,24 +4053,20 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
||||
|
||||
png_ptr->gamma_shift = shift;
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
/* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
|
||||
* PNG_COMPOSE). This effectively smashed the background calculation for
|
||||
* 16-bit output because the 8-bit table assumes the result will be reduced
|
||||
* to 8 bits.
|
||||
*/
|
||||
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8))
|
||||
#endif
|
||||
png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
|
||||
png_ptr->screen_gamma > 0 ? png_product2(png_ptr->colorspace.gamma,
|
||||
png_ptr->screen_gamma) : PNG_FP_1);
|
||||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
else
|
||||
png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
|
||||
png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
|
||||
png_ptr->screen_gamma) : PNG_FP_1);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
|
||||
@@ -4009,6 +4086,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
||||
}
|
||||
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
|
||||
}
|
||||
#endif /* 16BIT */
|
||||
}
|
||||
#endif /* READ_GAMMA */
|
||||
|
||||
|
||||
50
png.h
50
png.h
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.1 - March 28, 2013
|
||||
* libpng version 1.6.9 - February 6, 2014
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -11,7 +11,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.1 - March 28, 2013: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.6.9 - February 6, 2014: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@@ -169,9 +169,29 @@
|
||||
* 1.6.0beta01-40 16 10600 16.so.16.0[.0]
|
||||
* 1.6.0rc01-08 16 10600 16.so.16.0[.0]
|
||||
* 1.6.0 16 10600 16.so.16.0[.0]
|
||||
* 1.6.1beta01-10 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1beta01-09 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1rc01 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1 16 10601 16.so.16.1[.0]
|
||||
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
||||
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
||||
* 1.6.2 16 10602 16.so.16.2[.0]
|
||||
* 1.6.3beta01-11 16 10603 16.so.16.3[.0]
|
||||
* 1.6.3rc01 16 10603 16.so.16.3[.0]
|
||||
* 1.6.3 16 10603 16.so.16.3[.0]
|
||||
* 1.6.4beta01-02 16 10604 16.so.16.4[.0]
|
||||
* 1.6.4rc01 16 10604 16.so.16.4[.0]
|
||||
* 1.6.4 16 10604 16.so.16.4[.0]
|
||||
* 1.6.5 16 10605 16.so.16.5[.0]
|
||||
* 1.6.6 16 10606 16.so.16.6[.0]
|
||||
* 1.6.7beta01-04 16 10607 16.so.16.7[.0]
|
||||
* 1.6.7rc01-03 16 10607 16.so.16.7[.0]
|
||||
* 1.6.7 16 10607 16.so.16.7[.0]
|
||||
* 1.6.8beta01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8rc01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8 16 10608 16.so.16.8[.0]
|
||||
* 1.6.9beta01-04 16 10609 16.so.16.9[.0]
|
||||
* 1.6.9rc01-02 16 10609 16.so.16.9[.0]
|
||||
* 1.6.9 16 10609 16.so.16.9[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@@ -203,7 +223,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.1, March 28, 2013, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.9, February 6, 2014, are
|
||||
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
@@ -315,13 +335,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 28, 2013
|
||||
* February 6, 2014
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.1 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.9 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@@ -381,9 +401,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.1"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.9"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.1 - March 28, 2013\n"
|
||||
" libpng version 1.6.9 - February 6, 2014\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@@ -391,7 +411,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 1
|
||||
#define PNG_LIBPNG_VER_RELEASE 9
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@@ -422,7 +442,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10601 /* 1.6.1 */
|
||||
#define PNG_LIBPNG_VER 10609 /* 1.6.9 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@@ -527,7 +547,7 @@ extern "C" {
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_1;
|
||||
typedef char* png_libpng_version_1_6_9;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@@ -709,7 +729,8 @@ typedef png_time * png_timep;
|
||||
typedef const png_time * png_const_timep;
|
||||
typedef png_time * * png_timepp;
|
||||
|
||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
|
||||
defined(PNG_USER_CHUNKS_SUPPORTED)
|
||||
/* png_unknown_chunk is a structure to hold queued chunks for which there is
|
||||
* no specific support. The idea is that we can use this to queue
|
||||
* up private chunks for output even though the library doesn't actually
|
||||
@@ -3183,6 +3204,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
|
||||
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
|
||||
|
||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
/* WRITE APIS
|
||||
* ----------
|
||||
* For write you must initialize a png_image structure to describe the image to
|
||||
@@ -3225,6 +3247,7 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
||||
*
|
||||
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
||||
*/
|
||||
#endif /* PNG_STDIO_SUPPORTED */
|
||||
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
|
||||
/*******************************************************************************
|
||||
* END OF SIMPLIFIED API
|
||||
@@ -3264,7 +3287,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
||||
#endif
|
||||
#define PNG_OPTION_NEXT 2 /* Next option - numbers must be even */
|
||||
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
||||
#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */
|
||||
|
||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||
|
||||
38
pngconf.h
38
pngconf.h
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.1 - March 28, 2013
|
||||
* libpng version 1.6.9 - February 6, 2014
|
||||
*
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -238,6 +238,7 @@
|
||||
# define PNGAPI _stdcall
|
||||
# endif
|
||||
# endif /* compiler/api */
|
||||
|
||||
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
||||
|
||||
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
||||
@@ -360,7 +361,31 @@
|
||||
* version 1.2.41. Disabling these removes the warnings but may also produce
|
||||
* less efficient code.
|
||||
*/
|
||||
# if defined(__GNUC__)
|
||||
# if defined(__clang__)
|
||||
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
|
||||
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
|
||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||
# endif
|
||||
# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
|
||||
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||
# endif
|
||||
# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
|
||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||
# endif
|
||||
# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
|
||||
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||
# endif
|
||||
# if !defined(PNG_PRIVATE)
|
||||
# if __has_extension(attribute_unavailable_with_message)
|
||||
# define PNG_PRIVATE __attribute__((__unavailable__(\
|
||||
"This function is not exported by libpng.")))
|
||||
# endif
|
||||
# endif
|
||||
# ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT __restrict
|
||||
# endif
|
||||
|
||||
# elif defined(__GNUC__)
|
||||
# ifndef PNG_USE_RESULT
|
||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||
# endif
|
||||
@@ -383,12 +408,12 @@
|
||||
__attribute__((__deprecated__))
|
||||
# endif
|
||||
# endif
|
||||
# if ((__GNUC__ != 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
||||
# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
||||
# ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT __restrict
|
||||
# endif
|
||||
# endif /* __GNUC__ == 3.0 */
|
||||
# endif /* __GNUC__ >= 3 */
|
||||
# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
|
||||
# endif /* __GNUC__ >= 3 */
|
||||
|
||||
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
# ifndef PNG_USE_RESULT
|
||||
@@ -418,7 +443,7 @@
|
||||
# ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT __restrict
|
||||
# endif
|
||||
# endif /* _MSC_VER */
|
||||
# endif
|
||||
#endif /* PNG_PEDANTIC_WARNINGS */
|
||||
|
||||
#ifndef PNG_DEPRECATED
|
||||
@@ -439,6 +464,7 @@
|
||||
#ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT /* The C99 "restrict" feature */
|
||||
#endif
|
||||
|
||||
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
||||
|
||||
21
pngdebug.h
21
pngdebug.h
@@ -1,11 +1,11 @@
|
||||
|
||||
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -25,7 +25,7 @@
|
||||
* (actually ((void)0)).
|
||||
*
|
||||
* level: level of detail of message, starting at 0. A level 'n'
|
||||
* message is preceded by 'n' tab characters (not implemented
|
||||
* message is preceded by 'n' 3-space indentations (not implemented
|
||||
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
||||
* defined, to allow debug DLL compilation with no standard IO).
|
||||
* message: a printf(3) style text string. A trailing '\n' is added
|
||||
@@ -77,32 +77,29 @@
|
||||
# endif /* PNG_DEBUG_FILE */
|
||||
|
||||
# if (PNG_DEBUG > 1)
|
||||
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
||||
* non-ISO compilers
|
||||
*/
|
||||
# ifdef __STDC__
|
||||
# ifndef png_debug
|
||||
# define png_debug(l,m) \
|
||||
do { \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
||||
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||
(num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
|
||||
} while (0)
|
||||
# endif
|
||||
# ifndef png_debug1
|
||||
# define png_debug1(l,m,p1) \
|
||||
do { \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
||||
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||
(num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
|
||||
} while (0)
|
||||
# endif
|
||||
# ifndef png_debug2
|
||||
# define png_debug2(l,m,p1,p2) \
|
||||
do { \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
||||
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||
(num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
|
||||
} while (0)
|
||||
# endif
|
||||
# else /* __STDC __ */
|
||||
|
||||
32
pngerror.c
32
pngerror.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -382,6 +382,10 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||
# endif
|
||||
png_error(png_ptr, error_message);
|
||||
}
|
||||
|
||||
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||
PNG_UNUSED(error_message)
|
||||
# endif
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
@@ -391,6 +395,10 @@ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
|
||||
png_warning(png_ptr, error_message);
|
||||
else
|
||||
png_error(png_ptr, error_message);
|
||||
|
||||
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||
PNG_UNUSED(error_message)
|
||||
# endif
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
@@ -400,6 +408,10 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||
png_warning(png_ptr, error_message);
|
||||
else
|
||||
png_error(png_ptr, error_message);
|
||||
|
||||
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||
PNG_UNUSED(error_message)
|
||||
# endif
|
||||
}
|
||||
#endif /* BENIGN_ERRORS */
|
||||
|
||||
@@ -416,7 +428,8 @@ static PNG_CONST char png_digit[16] = {
|
||||
};
|
||||
|
||||
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
|
||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||
#if defined(PNG_WARNINGS_SUPPORTED) || \
|
||||
(defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
|
||||
static void /* PRIVATE */
|
||||
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
||||
error_message)
|
||||
@@ -506,6 +519,10 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
||||
|
||||
else
|
||||
png_chunk_error(png_ptr, error_message);
|
||||
|
||||
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||
PNG_UNUSED(error_message)
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
@@ -513,6 +530,10 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
||||
void /* PRIVATE */
|
||||
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
||||
{
|
||||
# ifndef PNG_WARNINGS_SUPPORTED
|
||||
PNG_UNUSED(message)
|
||||
# endif
|
||||
|
||||
/* This is always supported, but for just read or just write it
|
||||
* unconditionally does the right thing.
|
||||
*/
|
||||
@@ -740,7 +761,12 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
|
||||
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
|
||||
#endif
|
||||
|
||||
/* Here if not setjmp support or if png_ptr is null. */
|
||||
/* If control reaches this point, png_longjmp() must not return. The only
|
||||
* choice is to terminate the whole process (or maybe the thread); to do
|
||||
* this the ANSI-C abort() function is used unless a different method is
|
||||
* implemented by overriding the default configuration setting for
|
||||
* PNG_ABORT().
|
||||
*/
|
||||
PNG_ABORT();
|
||||
}
|
||||
|
||||
|
||||
8
pngmem.c
8
pngmem.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -73,9 +73,10 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||
* to implement a user memory handler. This checks to be sure it isn't
|
||||
* called with big numbers.
|
||||
*/
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
#ifndef PNG_USER_MEM_SUPPORTED
|
||||
PNG_UNUSED(png_ptr)
|
||||
#endif
|
||||
|
||||
if (size > 0 && size <= PNG_SIZE_MAX
|
||||
# ifdef PNG_MAX_MALLOC_64K
|
||||
&& size <= 65536U
|
||||
@@ -95,6 +96,8 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
|
||||
defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
|
||||
* that arises because of the checks in png_realloc_array that are repeated in
|
||||
* png_malloc_array.
|
||||
@@ -156,6 +159,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
|
||||
|
||||
return NULL; /* error */
|
||||
}
|
||||
#endif /* TEXT || sPLT || STORE_UNKNOWN_CHUNKS */
|
||||
|
||||
/* Various functions that have different error handling are derived from this.
|
||||
* png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -151,7 +151,7 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
||||
void /* PRIVATE */
|
||||
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked = png_ptr->sig_bytes,
|
||||
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||
num_to_check = 8 - num_checked;
|
||||
|
||||
if (png_ptr->buffer_size < num_to_check)
|
||||
@@ -285,8 +285,8 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||
if (chunk_name == png_PLTE)
|
||||
png_ptr->mode |= PNG_HAVE_PLTE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
else if (chunk_name == png_PLTE)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
@@ -528,8 +528,8 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||
|
||||
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
else
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
|
||||
334
pngpriv.h
334
pngpriv.h
@@ -2,11 +2,11 @@
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -88,6 +88,94 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Compile time options.
|
||||
* =====================
|
||||
* In a multi-arch build the compiler may compile the code several times for the
|
||||
* same object module, producing different binaries for different architectures.
|
||||
* When this happens configure-time setting of the target host options cannot be
|
||||
* done and this interferes with the handling of the ARM NEON optimizations, and
|
||||
* possibly other similar optimizations. Put additional tests here; in general
|
||||
* this is needed when the same option can be changed at both compile time and
|
||||
* run time depending on the target OS (i.e. iOS vs Android.)
|
||||
*
|
||||
* NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because
|
||||
* this is not possible with certain compilers (Oracle SUN OS CC), as a result
|
||||
* it is necessary to ensure that all extern functions that *might* be used
|
||||
* regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON__
|
||||
* below is one example of this behavior because it is controlled by the
|
||||
* presence or not of -mfpu=neon on the GCC command line, it is possible to do
|
||||
* this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely
|
||||
* do this.
|
||||
*/
|
||||
#ifndef PNG_ARM_NEON_OPT
|
||||
/* ARM NEON optimizations are being controlled by the compiler settings,
|
||||
* typically the target FPU. If the FPU has been set to NEON (-mfpu=neon
|
||||
* with GCC) then the compiler will define __ARM_NEON__ and we can rely
|
||||
* unconditionally on NEON instructions not crashing, otherwise we must
|
||||
* disable use of NEON instructions.
|
||||
*
|
||||
* NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
|
||||
* can only be turned on automatically if that is supported too. If
|
||||
* PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
|
||||
* to compile with an appropriate #error if ALIGNED_MEMORY has been turned
|
||||
* off.
|
||||
*/
|
||||
# if defined(__ARM_NEON__) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||
# define PNG_ARM_NEON_OPT 2
|
||||
# else
|
||||
# define PNG_ARM_NEON_OPT 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
/* NEON optimizations are to be at least considered by libpng, so enable the
|
||||
* callbacks to do this.
|
||||
*/
|
||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
|
||||
|
||||
/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
|
||||
* if possible - if __ARM_NEON__ is set and the compiler version is not known
|
||||
* to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
|
||||
* be:
|
||||
*
|
||||
* 1 The intrinsics code (the default with __ARM_NEON__)
|
||||
* 2 The hand coded assembler (the default without __ARM_NEON__)
|
||||
*
|
||||
* It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
|
||||
* this is *NOT* supported and may cease to work even after a minor revision
|
||||
* to libpng. It *is* valid to do this for testing purposes, e.g. speed
|
||||
* testing or a new compiler, but the results should be communicated to the
|
||||
* libpng implementation list for incorporation in the next minor release.
|
||||
*/
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
# ifdef __ARM_NEON__
|
||||
# if defined(__clang__)
|
||||
/* At present it is unknown by the libpng developers which versions
|
||||
* of clang support the intrinsics, however some or perhaps all
|
||||
* versions do not work with the assembler so this may be
|
||||
* irrelevant, so just use the default (do nothing here.)
|
||||
*/
|
||||
# elif defined(__GNUC__)
|
||||
/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
|
||||
* work, so if this *is* GCC, or G++, look for a version >4.5
|
||||
*/
|
||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||
# endif /* no GNUC support */
|
||||
# endif /* __GNUC__ */
|
||||
# else /* !defined __ARM_NEON__ */
|
||||
/* The 'intrinsics' code simply won't compile without this -mfpu=neon:
|
||||
*/
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||
# endif /* __ARM_NEON__ */
|
||||
# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */
|
||||
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
/* Use the intrinsics code by default. */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 1
|
||||
# endif
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
|
||||
/* 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
|
||||
* so PNG_BUILD_DLL must be set.
|
||||
@@ -630,37 +718,64 @@
|
||||
* architectures where (int) is only 16 bits.
|
||||
*/
|
||||
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
||||
#define PNG_CHUNK(b1,b2,b3,b4) \
|
||||
#define PNG_U32(b1,b2,b3,b4) \
|
||||
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
||||
|
||||
#define png_IHDR PNG_CHUNK( 73, 72, 68, 82)
|
||||
#define png_IDAT PNG_CHUNK( 73, 68, 65, 84)
|
||||
#define png_IEND PNG_CHUNK( 73, 69, 78, 68)
|
||||
#define png_PLTE PNG_CHUNK( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_CHUNK( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_CHUNK( 99, 72, 82, 77)
|
||||
#define png_gAMA PNG_CHUNK(103, 65, 77, 65)
|
||||
#define png_hIST PNG_CHUNK(104, 73, 83, 84)
|
||||
#define png_iCCP PNG_CHUNK(105, 67, 67, 80)
|
||||
#define png_iTXt PNG_CHUNK(105, 84, 88, 116)
|
||||
#define png_oFFs PNG_CHUNK(111, 70, 70, 115)
|
||||
#define png_pCAL PNG_CHUNK(112, 67, 65, 76)
|
||||
#define png_sCAL PNG_CHUNK(115, 67, 65, 76)
|
||||
#define png_pHYs PNG_CHUNK(112, 72, 89, 115)
|
||||
#define png_sBIT PNG_CHUNK(115, 66, 73, 84)
|
||||
#define png_sPLT PNG_CHUNK(115, 80, 76, 84)
|
||||
#define png_sRGB PNG_CHUNK(115, 82, 71, 66)
|
||||
#define png_sTER PNG_CHUNK(115, 84, 69, 82)
|
||||
#define png_tEXt PNG_CHUNK(116, 69, 88, 116)
|
||||
#define png_tIME PNG_CHUNK(116, 73, 77, 69)
|
||||
#define png_tRNS PNG_CHUNK(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_CHUNK(122, 84, 88, 116)
|
||||
/* Constants for known chunk types.
|
||||
*
|
||||
* MAINTAINERS: If you need to add a chunk, define the name here.
|
||||
* For historical reasons these constants have the form png_<name>; i.e.
|
||||
* the prefix is lower case. Please use decimal values as the parameters to
|
||||
* match the ISO PNG specification and to avoid relying on the C locale
|
||||
* interpretation of character values. Please keep the list sorted.
|
||||
*
|
||||
* Notice that PNG_U32 is used to define a 32-bit value for the 4 byte chunk
|
||||
* type. In fact the specification does not express chunk types this way,
|
||||
* however using a 32-bit value means that the chunk type can be read from the
|
||||
* stream using exactly the same code as used for a 32-bit unsigned value and
|
||||
* can be examined far more efficiently (using one arithmetic compare).
|
||||
*
|
||||
* Prior to 1.5.6 the chunk type constants were expressed as C strings. The
|
||||
* libpng API still uses strings for 'unknown' chunks and a macro,
|
||||
* PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
|
||||
* that for portable code numeric values must still be used; the string "IHDR"
|
||||
* is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
|
||||
*
|
||||
* In 1.7.0 the definitions will be made public in png.h to avoid having to
|
||||
* duplicate the same definitions in application code.
|
||||
*/
|
||||
#define png_IDAT PNG_U32( 73, 68, 65, 84)
|
||||
#define png_IEND PNG_U32( 73, 69, 78, 68)
|
||||
#define png_IHDR PNG_U32( 73, 72, 68, 82)
|
||||
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||
#define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
|
||||
#define png_gIFx PNG_U32(103, 73, 70, 120)
|
||||
#define png_hIST PNG_U32(104, 73, 83, 84)
|
||||
#define png_iCCP PNG_U32(105, 67, 67, 80)
|
||||
#define png_iTXt PNG_U32(105, 84, 88, 116)
|
||||
#define png_oFFs PNG_U32(111, 70, 70, 115)
|
||||
#define png_pCAL PNG_U32(112, 67, 65, 76)
|
||||
#define png_pHYs PNG_U32(112, 72, 89, 115)
|
||||
#define png_sBIT PNG_U32(115, 66, 73, 84)
|
||||
#define png_sCAL PNG_U32(115, 67, 65, 76)
|
||||
#define png_sPLT PNG_U32(115, 80, 76, 84)
|
||||
#define png_sRGB PNG_U32(115, 82, 71, 66)
|
||||
#define png_sTER PNG_U32(115, 84, 69, 82)
|
||||
#define png_tEXt PNG_U32(116, 69, 88, 116)
|
||||
#define png_tIME PNG_U32(116, 73, 77, 69)
|
||||
#define png_tRNS PNG_U32(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||
|
||||
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
||||
* macro will fail on top-bit-set values because of the sign extension.
|
||||
*/
|
||||
#define PNG_CHUNK_FROM_STRING(s)\
|
||||
PNG_CHUNK(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
|
||||
PNG_U32(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
|
||||
|
||||
/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
|
||||
* signed and the argument is a (char[]) This macro will fail miserably on
|
||||
@@ -675,8 +790,8 @@
|
||||
(void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0)
|
||||
|
||||
/* Test on flag values as defined in the spec (section 5.4): */
|
||||
#define PNG_CHUNK_ANCILLIARY(c) (1 & ((c) >> 29))
|
||||
#define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLIARY(c))
|
||||
#define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29))
|
||||
#define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c))
|
||||
#define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21))
|
||||
#define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
|
||||
#define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))
|
||||
@@ -694,6 +809,24 @@
|
||||
#include "pngstruct.h"
|
||||
#include "pnginfo.h"
|
||||
|
||||
/* Validate the include paths - the include path used to generate pnglibconf.h
|
||||
* must match that used in the build, or we must be using pnglibconf.h.prebuilt:
|
||||
*/
|
||||
#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
|
||||
# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
|
||||
"-I (include path) error: see the notes in pngpriv.h"
|
||||
/* This means that when pnglibconf.h was built the copy of zlib.h that it
|
||||
* used is not the same as the one being used here. Because the build of
|
||||
* libpng makes decisions to use inflateInit2 and inflateReset2 based on the
|
||||
* zlib version number and because this affects handling of certain broken
|
||||
* PNG files the -I directives must match.
|
||||
*
|
||||
* The most likely explanation is that you passed a -I in CFLAGS, this will
|
||||
* not work; all the preprocessor directories and in particular all the -I
|
||||
* directives must be in CPPFLAGS.
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
||||
* const; this could be changed:
|
||||
*/
|
||||
@@ -1091,7 +1224,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
/* Finish a row while reading, dealing with interlacing passes, etc. */
|
||||
#endif
|
||||
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
|
||||
|
||||
/* Initialize the row buffers, etc. */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
||||
@@ -1102,32 +1235,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
|
||||
png_inforp info_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* These are the functions that do the transformations */
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_filler,(png_row_infop row_info,
|
||||
png_bytep row, png_uint_32 filler, png_uint_32 flags),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_swap_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_write_swap_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_invert_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_write_invert_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* Shared transform functions, defined in pngtran.c */
|
||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
|
||||
@@ -1147,96 +1255,16 @@ PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(int,png_do_rgb_to_gray,(png_structrp png_ptr,
|
||||
png_row_infop row_info, png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_gray_to_rgb,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_PACK_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_unpack,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_unshift,(png_row_infop row_info,
|
||||
png_bytep row, png_const_color_8p sig_bits),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_scale_16_to_8,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_chop,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_quantize,(png_row_infop row_info,
|
||||
png_bytep row, png_const_bytep palette_lookup,
|
||||
png_const_bytep quantize_lookup),PNG_EMPTY);
|
||||
|
||||
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_correct_palette,(png_structrp png_ptr,
|
||||
png_colorp palette, int num_palette),PNG_EMPTY);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_pack,(png_row_infop row_info,
|
||||
png_bytep row, png_uint_32 bit_depth),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_shift,(png_row_infop row_info,
|
||||
png_bytep row, png_const_color_8p bit_depth),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_compose,(png_row_infop row_info,
|
||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_gamma,(png_row_infop row_info,
|
||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_encode_alpha,(png_row_infop row_info,
|
||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_expand_palette,(png_row_infop row_info,
|
||||
png_bytep row, png_const_colorp palette, png_const_bytep trans,
|
||||
int num_trans),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_expand,(png_row_infop row_info,
|
||||
png_bytep row, png_const_color_16p trans_color),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_expand_16,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* The following decodes the appropriate chunks, and does error correction,
|
||||
* then calls the appropriate callback for the chunk if it is valid.
|
||||
*/
|
||||
@@ -1337,7 +1365,6 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
|
||||
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
|
||||
png_uint_32 chunk_name),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
|
||||
/* This is the function that gets called for unknown chunks. The 'keep'
|
||||
@@ -1346,16 +1373,14 @@ PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
|
||||
* just skips the chunk or errors out if it is critical.
|
||||
*/
|
||||
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
|
||||
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
|
||||
(png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
|
||||
/* Exactly as the API png_handle_as_unknown() except that the argument is a
|
||||
* 32-bit chunk name, not a string.
|
||||
*/
|
||||
#endif
|
||||
#endif /* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
|
||||
|
||||
/* Handle the transformations for reading and writing */
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
@@ -1426,13 +1451,6 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
|
||||
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_intrapixel,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_write_intrapixel,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* Added at libpng version 1.6.0 */
|
||||
#ifdef PNG_GAMMA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
|
||||
@@ -1774,7 +1792,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
|
||||
png_size_t size),PNG_EMPTY);
|
||||
#endif /* pCAL || sCAL */
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
|
||||
#if defined(PNG_GAMMA_SUPPORTED) ||\
|
||||
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
|
||||
/* Added at libpng version 1.5.0 */
|
||||
/* This is a utility to provide a*times/div (rounded) and indicate
|
||||
@@ -1891,14 +1909,22 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
|
||||
|
||||
#endif /* SIMPLIFIED READ/WRITE */
|
||||
|
||||
/* These are initialization functions for hardware specific PNG filter
|
||||
* optimizations; list these here then select the appropriate one at compile
|
||||
* time using the macro PNG_FILTER_OPTIMIZATIONS. If the macro is not defined
|
||||
* the generic code is used.
|
||||
*/
|
||||
#ifdef PNG_FILTER_OPTIMIZATIONS
|
||||
PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
||||
unsigned int bpp), PNG_EMPTY);
|
||||
/* This is the initialization function for hardware specific optimizations,
|
||||
* one implementation (for ARM NEON machines) is contained in
|
||||
* arm/filter_neon.c. It need not be defined - the generic code will be used
|
||||
* if not.
|
||||
unsigned int bpp), PNG_EMPTY);
|
||||
/* Just declare the optimization that will be used */
|
||||
#else
|
||||
/* List *all* the possible optimizations here - this branch is required if
|
||||
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
|
||||
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* Maintainer: Put new private prototypes here ^ */
|
||||
|
||||
289
pngread.c
289
pngread.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -305,6 +305,72 @@ png_start_read_image(png_structrp png_ptr)
|
||||
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
|
||||
|
||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
/* Undoes intrapixel differencing,
|
||||
* NOTE: this is apparently only supported in the 'sequential' reader.
|
||||
*/
|
||||
static void
|
||||
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_read_intrapixel");
|
||||
|
||||
if (
|
||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
int bytes_per_pixel;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 3;
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 4;
|
||||
|
||||
else
|
||||
return;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
*(rp) = (png_byte)((256 + *rp + *(rp + 1)) & 0xff);
|
||||
*(rp+2) = (png_byte)((256 + *(rp + 2) + *(rp + 1)) & 0xff);
|
||||
}
|
||||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 6;
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 8;
|
||||
|
||||
else
|
||||
return;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
|
||||
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||
|
||||
void PNGAPI
|
||||
png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
{
|
||||
@@ -489,7 +555,6 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
if (png_ptr->transformations)
|
||||
png_do_read_transformations(png_ptr, &row_info);
|
||||
@@ -1004,7 +1069,7 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
if (transforms & PNG_TRANSFORM_EXPAND)
|
||||
if ((png_ptr->bit_depth < 8) ||
|
||||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
|
||||
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
|
||||
(info_ptr->valid & PNG_INFO_tRNS))
|
||||
png_set_expand(png_ptr);
|
||||
#endif
|
||||
|
||||
@@ -1023,14 +1088,8 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
* [0,65535] to the original [0,7] or [0,31], or whatever range the
|
||||
* colors were originally in:
|
||||
*/
|
||||
if ((transforms & PNG_TRANSFORM_SHIFT)
|
||||
&& png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||
{
|
||||
png_color_8p sig_bit;
|
||||
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
png_set_shift(png_ptr, sig_bit);
|
||||
}
|
||||
if ((transforms & PNG_TRANSFORM_SHIFT) && (info_ptr->valid & PNG_INFO_sBIT))
|
||||
png_set_shift(png_ptr, &info_ptr->sig_bit);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_BGR_SUPPORTED
|
||||
@@ -1125,12 +1184,11 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
|
||||
/* Arguments to png_image_finish_read: */
|
||||
|
||||
/* Encoding of PNG data (used by the color-map code) */
|
||||
/* TODO: change these, dang, ANSI-C reserves the 'E' namespace. */
|
||||
# define E_NOTSET 0 /* File encoding not yet known */
|
||||
# define E_sRGB 1 /* 8-bit encoded to sRGB gamma */
|
||||
# define E_LINEAR 2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
|
||||
# define E_FILE 3 /* 8-bit encoded to file gamma, not sRGB or linear */
|
||||
# define E_LINEAR8 4 /* 8-bit linear: only from a file value */
|
||||
# define P_NOTSET 0 /* File encoding not yet known */
|
||||
# define P_sRGB 1 /* 8-bit encoded to sRGB gamma */
|
||||
# define P_LINEAR 2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
|
||||
# define P_FILE 3 /* 8-bit encoded to file gamma, not sRGB or linear */
|
||||
# define P_LINEAR8 4 /* 8-bit linear: only from a file value */
|
||||
|
||||
/* Color-map processing: after libpng has run on the PNG image further
|
||||
* processing may be needed to conver the data to color-map indicies.
|
||||
@@ -1161,7 +1219,7 @@ typedef struct
|
||||
png_voidp first_row;
|
||||
ptrdiff_t row_bytes; /* step between rows */
|
||||
int file_encoding; /* E_ values above */
|
||||
png_fixed_point gamma_to_linear; /* For E_FILE, reciprocal of gamma */
|
||||
png_fixed_point gamma_to_linear; /* For P_FILE, reciprocal of gamma */
|
||||
int colormap_processing; /* PNG_CMAP_ values above */
|
||||
} png_image_read_control;
|
||||
|
||||
@@ -1293,7 +1351,7 @@ png_image_read_header(png_voidp argument)
|
||||
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||
/* Does the colorspace match sRGB? If there is no color endpoint
|
||||
* (colorant) information assume yes, otherwise require the
|
||||
* 'ENDPOINTS_MATCHE_sRGB' colorspace flag to have been set. If the
|
||||
* 'ENDPOINTS_MATCHP_sRGB' colorspace flag to have been set. If the
|
||||
* colorspace has been determined to be invalid ignore it.
|
||||
*/
|
||||
if ((format & PNG_FORMAT_FLAG_COLOR) != 0 && ((png_ptr->colorspace.flags
|
||||
@@ -1482,17 +1540,24 @@ png_image_skip_unused_chunks(png_structrp png_ptr)
|
||||
*
|
||||
* Or image data handling:
|
||||
*
|
||||
* tRNS, bKGD, gAMA, cHRM, sRGB, iCCP and sBIT.
|
||||
* tRNS, bKGD, gAMA, cHRM, sRGB, [iCCP] and sBIT.
|
||||
*
|
||||
* This provides a small performance improvement and eliminates any
|
||||
* potential vulnerability to security problems in the unused chunks.
|
||||
*
|
||||
* At present the iCCP chunk data isn't used, so iCCP chunk can be ignored
|
||||
* too. This allows the simplified API to be compiled without iCCP support,
|
||||
* however if the support is there the chunk is still checked to detect
|
||||
* errors (which are unfortunately quite common.)
|
||||
*/
|
||||
{
|
||||
static PNG_CONST png_byte chunks_to_process[] = {
|
||||
98, 75, 71, 68, '\0', /* bKGD */
|
||||
99, 72, 82, 77, '\0', /* cHRM */
|
||||
103, 65, 77, 65, '\0', /* gAMA */
|
||||
# ifdef PNG_READ_iCCP_SUPPORTED
|
||||
105, 67, 67, 80, '\0', /* iCCP */
|
||||
# endif
|
||||
115, 66, 73, 84, '\0', /* sBIT */
|
||||
115, 82, 71, 66, '\0', /* sRGB */
|
||||
};
|
||||
@@ -1529,25 +1594,25 @@ set_file_encoding(png_image_read_control *display)
|
||||
{
|
||||
if (png_gamma_not_sRGB(g))
|
||||
{
|
||||
display->file_encoding = E_FILE;
|
||||
display->file_encoding = P_FILE;
|
||||
display->gamma_to_linear = png_reciprocal(g);
|
||||
}
|
||||
|
||||
else
|
||||
display->file_encoding = E_sRGB;
|
||||
display->file_encoding = P_sRGB;
|
||||
}
|
||||
|
||||
else
|
||||
display->file_encoding = E_LINEAR8;
|
||||
display->file_encoding = P_LINEAR8;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
|
||||
{
|
||||
if (encoding == E_FILE) /* double check */
|
||||
if (encoding == P_FILE) /* double check */
|
||||
encoding = display->file_encoding;
|
||||
|
||||
if (encoding == E_NOTSET) /* must be the file encoding */
|
||||
if (encoding == P_NOTSET) /* must be the file encoding */
|
||||
{
|
||||
set_file_encoding(display);
|
||||
encoding = display->file_encoding;
|
||||
@@ -1555,18 +1620,18 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case E_FILE:
|
||||
case P_FILE:
|
||||
value = png_gamma_16bit_correct(value*257, display->gamma_to_linear);
|
||||
break;
|
||||
|
||||
case E_sRGB:
|
||||
case P_sRGB:
|
||||
value = png_sRGB_table[value];
|
||||
break;
|
||||
|
||||
case E_LINEAR:
|
||||
case P_LINEAR:
|
||||
break;
|
||||
|
||||
case E_LINEAR8:
|
||||
case P_LINEAR8:
|
||||
value *= 257;
|
||||
break;
|
||||
|
||||
@@ -1585,9 +1650,9 @@ png_colormap_compose(png_image_read_control *display,
|
||||
png_uint_32 background, int encoding)
|
||||
{
|
||||
/* The file value is composed on the background, the background has the given
|
||||
* encoding and so does the result, the file is encoded with E_FILE and the
|
||||
* encoding and so does the result, the file is encoded with P_FILE and the
|
||||
* file and alpha are 8-bit values. The (output) encoding will always be
|
||||
* E_LINEAR or E_sRGB.
|
||||
* P_LINEAR or P_sRGB.
|
||||
*/
|
||||
png_uint_32 f = decode_gamma(display, foreground, foreground_encoding);
|
||||
png_uint_32 b = decode_gamma(display, background, encoding);
|
||||
@@ -1597,7 +1662,7 @@ png_colormap_compose(png_image_read_control *display,
|
||||
*/
|
||||
f = f * alpha + b * (255-alpha);
|
||||
|
||||
if (encoding == E_LINEAR)
|
||||
if (encoding == P_LINEAR)
|
||||
{
|
||||
/* Scale to 65535; divide by 255, approximately (in fact this is extremely
|
||||
* accurate, it divides by 255.00000005937181414556, with no overflow.)
|
||||
@@ -1607,13 +1672,13 @@ png_colormap_compose(png_image_read_control *display,
|
||||
f = (f+32768) >> 16;
|
||||
}
|
||||
|
||||
else /* E_sRGB */
|
||||
else /* P_sRGB */
|
||||
f = PNG_sRGB_FROM_LINEAR(f);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
/* NOTE: E_LINEAR values to this routine must be 16-bit, but E_FILE values must
|
||||
/* NOTE: P_LINEAR values to this routine must be 16-bit, but P_FILE values must
|
||||
* be 8-bit.
|
||||
*/
|
||||
static void
|
||||
@@ -1623,7 +1688,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
{
|
||||
png_imagep image = display->image;
|
||||
const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) ?
|
||||
E_LINEAR : E_sRGB;
|
||||
P_LINEAR : P_sRGB;
|
||||
const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 &&
|
||||
(red != green || green != blue);
|
||||
|
||||
@@ -1633,18 +1698,18 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
/* Update the cache with whether the file gamma is significantly different
|
||||
* from sRGB.
|
||||
*/
|
||||
if (encoding == E_FILE)
|
||||
if (encoding == P_FILE)
|
||||
{
|
||||
if (display->file_encoding == E_NOTSET)
|
||||
if (display->file_encoding == P_NOTSET)
|
||||
set_file_encoding(display);
|
||||
|
||||
/* Note that the cached value may be E_FILE too, but if it is then the
|
||||
/* Note that the cached value may be P_FILE too, but if it is then the
|
||||
* gamma_to_linear member has been set.
|
||||
*/
|
||||
encoding = display->file_encoding;
|
||||
}
|
||||
|
||||
if (encoding == E_FILE)
|
||||
if (encoding == P_FILE)
|
||||
{
|
||||
png_fixed_point g = display->gamma_to_linear;
|
||||
|
||||
@@ -1652,10 +1717,10 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
green = png_gamma_16bit_correct(green*257, g);
|
||||
blue = png_gamma_16bit_correct(blue*257, g);
|
||||
|
||||
if (convert_to_Y || output_encoding == E_LINEAR)
|
||||
if (convert_to_Y || output_encoding == P_LINEAR)
|
||||
{
|
||||
alpha *= 257;
|
||||
encoding = E_LINEAR;
|
||||
encoding = P_LINEAR;
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1663,11 +1728,11 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
red = PNG_sRGB_FROM_LINEAR(red * 255);
|
||||
green = PNG_sRGB_FROM_LINEAR(green * 255);
|
||||
blue = PNG_sRGB_FROM_LINEAR(blue * 255);
|
||||
encoding = E_sRGB;
|
||||
encoding = P_sRGB;
|
||||
}
|
||||
}
|
||||
|
||||
else if (encoding == E_LINEAR8)
|
||||
else if (encoding == P_LINEAR8)
|
||||
{
|
||||
/* This encoding occurs quite frequently in test cases because PngSuite
|
||||
* includes a gAMA 1.0 chunk with most images.
|
||||
@@ -1676,10 +1741,10 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
green *= 257;
|
||||
blue *= 257;
|
||||
alpha *= 257;
|
||||
encoding = E_LINEAR;
|
||||
encoding = P_LINEAR;
|
||||
}
|
||||
|
||||
else if (encoding == E_sRGB && (convert_to_Y || output_encoding == E_LINEAR))
|
||||
else if (encoding == P_sRGB && (convert_to_Y || output_encoding == P_LINEAR))
|
||||
{
|
||||
/* The values are 8-bit sRGB values, but must be converted to 16-bit
|
||||
* linear.
|
||||
@@ -1688,11 +1753,11 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
green = png_sRGB_table[green];
|
||||
blue = png_sRGB_table[blue];
|
||||
alpha *= 257;
|
||||
encoding = E_LINEAR;
|
||||
encoding = P_LINEAR;
|
||||
}
|
||||
|
||||
/* This is set if the color isn't gray but the output is. */
|
||||
if (encoding == E_LINEAR)
|
||||
if (encoding == P_LINEAR)
|
||||
{
|
||||
if (convert_to_Y)
|
||||
{
|
||||
@@ -1700,7 +1765,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
|
||||
(png_uint_32)2366 * blue;
|
||||
|
||||
if (output_encoding == E_LINEAR)
|
||||
if (output_encoding == P_LINEAR)
|
||||
y = (y + 16384) >> 15;
|
||||
|
||||
else
|
||||
@@ -1709,19 +1774,19 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
y = (y + 128) >> 8;
|
||||
y *= 255;
|
||||
y = PNG_sRGB_FROM_LINEAR((y + 64) >> 7);
|
||||
encoding = E_sRGB;
|
||||
encoding = P_sRGB;
|
||||
}
|
||||
|
||||
blue = red = green = y;
|
||||
}
|
||||
|
||||
else if (output_encoding == E_sRGB)
|
||||
else if (output_encoding == P_sRGB)
|
||||
{
|
||||
red = PNG_sRGB_FROM_LINEAR(red * 255);
|
||||
green = PNG_sRGB_FROM_LINEAR(green * 255);
|
||||
blue = PNG_sRGB_FROM_LINEAR(blue * 255);
|
||||
alpha = PNG_DIV257(alpha);
|
||||
encoding = E_sRGB;
|
||||
encoding = P_sRGB;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1730,7 +1795,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
|
||||
/* Store the value. */
|
||||
{
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
# ifdef PNG_FORMAT_AFIRST_SUPPORTED
|
||||
const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
|
||||
(image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||
# else
|
||||
@@ -1742,7 +1807,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
# define bgr 0
|
||||
# endif
|
||||
|
||||
if (output_encoding == E_LINEAR)
|
||||
if (output_encoding == P_LINEAR)
|
||||
{
|
||||
png_uint_16p entry = png_voidcast(png_uint_16p, display->colormap);
|
||||
|
||||
@@ -1797,7 +1862,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
}
|
||||
}
|
||||
|
||||
else /* output encoding is E_sRGB */
|
||||
else /* output encoding is P_sRGB */
|
||||
{
|
||||
png_bytep entry = png_voidcast(png_bytep, display->colormap);
|
||||
|
||||
@@ -1839,7 +1904,7 @@ make_gray_file_colormap(png_image_read_control *display)
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<256; ++i)
|
||||
png_create_colormap_entry(display, i, i, i, i, 255, E_FILE);
|
||||
png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -1850,7 +1915,7 @@ make_gray_colormap(png_image_read_control *display)
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<256; ++i)
|
||||
png_create_colormap_entry(display, i, i, i, i, 255, E_sRGB);
|
||||
png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -1889,13 +1954,13 @@ make_ga_colormap(png_image_read_control *display)
|
||||
while (i < 231)
|
||||
{
|
||||
unsigned int gray = (i * 256 + 115) / 231;
|
||||
png_create_colormap_entry(display, i++, gray, gray, gray, 255, E_sRGB);
|
||||
png_create_colormap_entry(display, i++, gray, gray, gray, 255, P_sRGB);
|
||||
}
|
||||
|
||||
/* 255 is used here for the component values for consistency with the code
|
||||
* that undoes premultiplication in pngwrite.c.
|
||||
*/
|
||||
png_create_colormap_entry(display, i++, 255, 255, 255, 0, E_sRGB);
|
||||
png_create_colormap_entry(display, i++, 255, 255, 255, 0, P_sRGB);
|
||||
|
||||
for (a=1; a<5; ++a)
|
||||
{
|
||||
@@ -1903,7 +1968,7 @@ make_ga_colormap(png_image_read_control *display)
|
||||
|
||||
for (g=0; g<6; ++g)
|
||||
png_create_colormap_entry(display, i++, g*51, g*51, g*51, a*51,
|
||||
E_sRGB);
|
||||
P_sRGB);
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -1927,7 +1992,7 @@ make_rgb_colormap(png_image_read_control *display)
|
||||
|
||||
for (b=0; b<6; ++b)
|
||||
png_create_colormap_entry(display, i++, r*51, g*51, b*51, 255,
|
||||
E_sRGB);
|
||||
P_sRGB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1950,11 +2015,11 @@ png_image_read_colormap(png_voidp argument)
|
||||
const png_structrp png_ptr = image->opaque->png_ptr;
|
||||
const png_uint_32 output_format = image->format;
|
||||
const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) ?
|
||||
E_LINEAR : E_sRGB;
|
||||
P_LINEAR : P_sRGB;
|
||||
|
||||
unsigned int cmap_entries;
|
||||
unsigned int output_processing; /* Output processing option */
|
||||
unsigned int data_encoding = E_NOTSET; /* Encoding libpng must produce */
|
||||
unsigned int data_encoding = P_NOTSET; /* Encoding libpng must produce */
|
||||
|
||||
/* Background information; the background color and the index of this color
|
||||
* in the color-map if it exists (else 256).
|
||||
@@ -1974,7 +2039,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_ptr->num_trans > 0) /* alpha in input */ &&
|
||||
((output_format & PNG_FORMAT_FLAG_ALPHA) == 0) /* no alpha in output */)
|
||||
{
|
||||
if (output_encoding == E_LINEAR) /* compose on black */
|
||||
if (output_encoding == P_LINEAR) /* compose on black */
|
||||
back_b = back_g = back_r = 0;
|
||||
|
||||
else if (display->background == NULL /* no way to remove it */)
|
||||
@@ -1998,7 +2063,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
}
|
||||
}
|
||||
|
||||
else if (output_encoding == E_LINEAR)
|
||||
else if (output_encoding == P_LINEAR)
|
||||
back_b = back_r = back_g = 65535;
|
||||
|
||||
else
|
||||
@@ -2056,7 +2121,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
trans = png_ptr->trans_color.gray;
|
||||
|
||||
if ((output_format & PNG_FORMAT_FLAG_ALPHA) == 0)
|
||||
back_alpha = output_encoding == E_LINEAR ? 65535 : 255;
|
||||
back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
|
||||
}
|
||||
|
||||
/* png_create_colormap_entry just takes an RGBA and writes the
|
||||
@@ -2074,7 +2139,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
*/
|
||||
if (i != trans)
|
||||
png_create_colormap_entry(display, i, val, val, val, 255,
|
||||
E_FILE/*8-bit with file gamma*/);
|
||||
P_FILE/*8-bit with file gamma*/);
|
||||
|
||||
/* Else this entry is transparent. The colors don't matter if
|
||||
* there is an alpha channel (back_alpha == 0), but it does no
|
||||
@@ -2090,7 +2155,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
}
|
||||
|
||||
/* We need libpng to preserve the original encoding. */
|
||||
data_encoding = E_FILE;
|
||||
data_encoding = P_FILE;
|
||||
|
||||
/* The rows from libpng, while technically gray values, are now also
|
||||
* color-map indicies; however, they may need to be expanded to 1
|
||||
@@ -2119,7 +2184,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
* ensuring that the corresponding gray level matches the background
|
||||
* color exactly.
|
||||
*/
|
||||
data_encoding = E_sRGB;
|
||||
data_encoding = P_sRGB;
|
||||
|
||||
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
||||
png_error(png_ptr, "gray[16] color-map: too few entries");
|
||||
@@ -2143,7 +2208,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_color_16 c;
|
||||
png_uint_32 gray = back_g;
|
||||
|
||||
if (output_encoding == E_LINEAR)
|
||||
if (output_encoding == P_LINEAR)
|
||||
{
|
||||
gray = PNG_sRGB_FROM_LINEAR(gray * 255);
|
||||
|
||||
@@ -2151,7 +2216,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
* matches.
|
||||
*/
|
||||
png_create_colormap_entry(display, gray, back_g, back_g,
|
||||
back_g, 65535, E_LINEAR);
|
||||
back_g, 65535, P_LINEAR);
|
||||
}
|
||||
|
||||
/* The background passed to libpng, however, must be the
|
||||
@@ -2172,7 +2237,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
break;
|
||||
}
|
||||
|
||||
back_alpha = output_encoding == E_LINEAR ? 65535 : 255;
|
||||
back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
|
||||
}
|
||||
|
||||
/* output_processing means that the libpng-processed row will be
|
||||
@@ -2209,7 +2274,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
* worry about tRNS matching - tRNS is ignored if there is an alpha
|
||||
* channel.
|
||||
*/
|
||||
data_encoding = E_sRGB;
|
||||
data_encoding = P_sRGB;
|
||||
|
||||
if (output_format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
@@ -2252,13 +2317,13 @@ png_image_read_colormap(png_voidp argument)
|
||||
|
||||
cmap_entries = make_gray_colormap(display);
|
||||
|
||||
if (output_encoding == E_LINEAR)
|
||||
if (output_encoding == P_LINEAR)
|
||||
{
|
||||
gray = PNG_sRGB_FROM_LINEAR(gray * 255);
|
||||
|
||||
/* And make sure the corresponding palette entry matches. */
|
||||
png_create_colormap_entry(display, gray, back_g, back_g,
|
||||
back_g, 65535, E_LINEAR);
|
||||
back_g, 65535, P_LINEAR);
|
||||
}
|
||||
|
||||
/* The background passed to libpng, however, must be the sRGB
|
||||
@@ -2289,7 +2354,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
{
|
||||
png_uint_32 gray = (i * 256 + 115) / 231;
|
||||
png_create_colormap_entry(display, i++, gray, gray, gray,
|
||||
255, E_sRGB);
|
||||
255, P_sRGB);
|
||||
}
|
||||
|
||||
/* NOTE: this preserves the full precision of the application
|
||||
@@ -2297,7 +2362,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
*/
|
||||
background_index = i;
|
||||
png_create_colormap_entry(display, i++, back_r, back_g, back_b,
|
||||
output_encoding == E_LINEAR ? 65535U : 255U, output_encoding);
|
||||
output_encoding == P_LINEAR ? 65535U : 255U, output_encoding);
|
||||
|
||||
/* For non-opaque input composite on the sRGB background - this
|
||||
* requires inverting the encoding for each component. The input
|
||||
@@ -2307,7 +2372,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
* represents. Consequently 'G' is always sRGB encoded, while
|
||||
* 'A' is linear. We need the linear background colors.
|
||||
*/
|
||||
if (output_encoding == E_sRGB) /* else already linear */
|
||||
if (output_encoding == P_sRGB) /* else already linear */
|
||||
{
|
||||
/* This may produce a value not exactly matching the
|
||||
* background, but that's ok because these numbers are only
|
||||
@@ -2337,7 +2402,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_create_colormap_entry(display, i++,
|
||||
PNG_sRGB_FROM_LINEAR(gray + back_rx),
|
||||
PNG_sRGB_FROM_LINEAR(gray + back_gx),
|
||||
PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, E_sRGB);
|
||||
PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, P_sRGB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2364,7 +2429,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
*/
|
||||
png_set_rgb_to_gray_fixed(png_ptr, PNG_ERROR_ACTION_NONE, -1,
|
||||
-1);
|
||||
data_encoding = E_sRGB;
|
||||
data_encoding = P_sRGB;
|
||||
|
||||
/* The output will now be one or two 8-bit gray or gray+alpha
|
||||
* channels. The more complex case arises when the input has alpha.
|
||||
@@ -2409,7 +2474,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_gamma_not_sRGB(png_ptr->colorspace.gamma))
|
||||
{
|
||||
cmap_entries = make_gray_file_colormap(display);
|
||||
data_encoding = E_FILE;
|
||||
data_encoding = P_FILE;
|
||||
}
|
||||
|
||||
else
|
||||
@@ -2428,18 +2493,18 @@ png_image_read_colormap(png_voidp argument)
|
||||
* it. Achieve this simply by ensuring that the entry
|
||||
* selected for the background really is the background color.
|
||||
*/
|
||||
if (data_encoding == E_FILE) /* from the fixup above */
|
||||
if (data_encoding == P_FILE) /* from the fixup above */
|
||||
{
|
||||
/* The app supplied a gray which is in output_encoding, we
|
||||
* need to convert it to a value of the input (E_FILE)
|
||||
* need to convert it to a value of the input (P_FILE)
|
||||
* encoding then set this palette entry to the required
|
||||
* output encoding.
|
||||
*/
|
||||
if (output_encoding == E_sRGB)
|
||||
gray = png_sRGB_table[gray]; /* now E_LINEAR */
|
||||
if (output_encoding == P_sRGB)
|
||||
gray = png_sRGB_table[gray]; /* now P_LINEAR */
|
||||
|
||||
gray = PNG_DIV257(png_gamma_16bit_correct(gray,
|
||||
png_ptr->colorspace.gamma)); /* now E_FILE */
|
||||
png_ptr->colorspace.gamma)); /* now P_FILE */
|
||||
|
||||
/* And make sure the corresponding palette entry contains
|
||||
* exactly the required sRGB value.
|
||||
@@ -2448,14 +2513,14 @@ png_image_read_colormap(png_voidp argument)
|
||||
back_g, 0/*unused*/, output_encoding);
|
||||
}
|
||||
|
||||
else if (output_encoding == E_LINEAR)
|
||||
else if (output_encoding == P_LINEAR)
|
||||
{
|
||||
gray = PNG_sRGB_FROM_LINEAR(gray * 255);
|
||||
|
||||
/* And make sure the corresponding palette entry matches.
|
||||
*/
|
||||
png_create_colormap_entry(display, gray, back_g, back_g,
|
||||
back_g, 0/*unused*/, E_LINEAR);
|
||||
back_g, 0/*unused*/, P_LINEAR);
|
||||
}
|
||||
|
||||
/* The background passed to libpng, however, must be the
|
||||
@@ -2485,7 +2550,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
* to do it once and using PNG_DIV51 on the 6x6x6 reduced RGB cube.
|
||||
* Consequently we always want libpng to produce sRGB data.
|
||||
*/
|
||||
data_encoding = E_sRGB;
|
||||
data_encoding = P_sRGB;
|
||||
|
||||
/* Is there any transparency or alpha? */
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
@@ -2505,7 +2570,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
|
||||
/* Add a transparent entry. */
|
||||
png_create_colormap_entry(display, cmap_entries, 255, 255,
|
||||
255, 0, E_sRGB);
|
||||
255, 0, P_sRGB);
|
||||
|
||||
/* This is stored as the background index for the processing
|
||||
* algorithm.
|
||||
@@ -2526,7 +2591,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
*/
|
||||
for (b=0; b<256; b = (b << 1) | 0x7f)
|
||||
png_create_colormap_entry(display, cmap_entries++,
|
||||
r, g, b, 128, E_sRGB);
|
||||
r, g, b, 128, P_sRGB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2555,7 +2620,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_create_colormap_entry(display, cmap_entries, back_r,
|
||||
back_g, back_b, 0/*unused*/, output_encoding);
|
||||
|
||||
if (output_encoding == E_LINEAR)
|
||||
if (output_encoding == P_LINEAR)
|
||||
{
|
||||
r = PNG_sRGB_FROM_LINEAR(back_r * 255);
|
||||
g = PNG_sRGB_FROM_LINEAR(back_g * 255);
|
||||
@@ -2595,11 +2660,11 @@ png_image_read_colormap(png_voidp argument)
|
||||
*/
|
||||
for (b=0; b<256; b = (b << 1) | 0x7f)
|
||||
png_create_colormap_entry(display, cmap_entries++,
|
||||
png_colormap_compose(display, r, E_sRGB, 128,
|
||||
png_colormap_compose(display, r, P_sRGB, 128,
|
||||
back_r, output_encoding),
|
||||
png_colormap_compose(display, g, E_sRGB, 128,
|
||||
png_colormap_compose(display, g, P_sRGB, 128,
|
||||
back_g, output_encoding),
|
||||
png_colormap_compose(display, b, E_sRGB, 128,
|
||||
png_colormap_compose(display, b, P_sRGB, 128,
|
||||
back_b, output_encoding),
|
||||
0/*unused*/, output_encoding);
|
||||
}
|
||||
@@ -2658,7 +2723,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
num_trans = 0;
|
||||
|
||||
output_processing = PNG_CMAP_NONE;
|
||||
data_encoding = E_FILE; /* Don't change from color-map indicies */
|
||||
data_encoding = P_FILE; /* Don't change from color-map indicies */
|
||||
cmap_entries = png_ptr->num_palette;
|
||||
if (cmap_entries > 256)
|
||||
cmap_entries = 256;
|
||||
@@ -2680,13 +2745,13 @@ png_image_read_colormap(png_voidp argument)
|
||||
* on the sRGB color in 'back'.
|
||||
*/
|
||||
png_create_colormap_entry(display, i,
|
||||
png_colormap_compose(display, colormap[i].red, E_FILE,
|
||||
png_colormap_compose(display, colormap[i].red, P_FILE,
|
||||
trans[i], back_r, output_encoding),
|
||||
png_colormap_compose(display, colormap[i].green, E_FILE,
|
||||
png_colormap_compose(display, colormap[i].green, P_FILE,
|
||||
trans[i], back_g, output_encoding),
|
||||
png_colormap_compose(display, colormap[i].blue, E_FILE,
|
||||
png_colormap_compose(display, colormap[i].blue, P_FILE,
|
||||
trans[i], back_b, output_encoding),
|
||||
output_encoding == E_LINEAR ? trans[i] * 257U :
|
||||
output_encoding == P_LINEAR ? trans[i] * 257U :
|
||||
trans[i],
|
||||
output_encoding);
|
||||
}
|
||||
@@ -2695,7 +2760,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
else
|
||||
png_create_colormap_entry(display, i, colormap[i].red,
|
||||
colormap[i].green, colormap[i].blue,
|
||||
i < num_trans ? trans[i] : 255U, E_FILE/*8-bit*/);
|
||||
i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
|
||||
}
|
||||
|
||||
/* The PNG data may have indicies packed in fewer than 8 bits, it
|
||||
@@ -2723,12 +2788,12 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_error(png_ptr, "bad data option (internal error)");
|
||||
break;
|
||||
|
||||
case E_sRGB:
|
||||
case P_sRGB:
|
||||
/* Change to 8-bit sRGB */
|
||||
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
|
||||
/* FALL THROUGH */
|
||||
|
||||
case E_FILE:
|
||||
case P_FILE:
|
||||
if (png_ptr->bit_depth > 8)
|
||||
png_set_scale_16(png_ptr);
|
||||
break;
|
||||
@@ -2805,7 +2870,6 @@ png_image_read_and_map(png_voidp argument)
|
||||
break;
|
||||
|
||||
default:
|
||||
passes = 0;
|
||||
png_error(png_ptr, "unknown interlace type");
|
||||
}
|
||||
|
||||
@@ -3124,7 +3188,6 @@ png_image_read_composite(png_voidp argument)
|
||||
break;
|
||||
|
||||
default:
|
||||
passes = 0;
|
||||
png_error(png_ptr, "unknown interlace type");
|
||||
}
|
||||
|
||||
@@ -3273,11 +3336,15 @@ png_image_read_background(png_voidp argument)
|
||||
break;
|
||||
|
||||
default:
|
||||
passes = 0;
|
||||
png_error(png_ptr, "unknown interlace type");
|
||||
}
|
||||
|
||||
switch (png_get_bit_depth(png_ptr, info_ptr))
|
||||
/* Use direct access to info_ptr here because otherwise the simplified API
|
||||
* would require PNG_EASY_ACCESS_SUPPORTED (just for this.) Note this is
|
||||
* checking the value after libpng expansions, not the original value in the
|
||||
* PNG.
|
||||
*/
|
||||
switch (info_ptr->bit_depth)
|
||||
{
|
||||
default:
|
||||
png_error(png_ptr, "unexpected bit depth");
|
||||
@@ -3285,7 +3352,7 @@ png_image_read_background(png_voidp argument)
|
||||
|
||||
case 8:
|
||||
/* 8-bit sRGB gray values with an alpha channel; the alpha channel is
|
||||
* to be removed by composing on a backgroundi: either the row if
|
||||
* to be removed by composing on a background: either the row if
|
||||
* display->background is NULL or display->background->green if not.
|
||||
* Unlike the code above ALPHA_OPTIMIZED has *not* been done.
|
||||
*/
|
||||
@@ -3425,8 +3492,10 @@ png_image_read_background(png_voidp argument)
|
||||
unsigned int outchannels = 1+preserve_alpha;
|
||||
int swap_alpha = 0;
|
||||
|
||||
if (preserve_alpha && (image->format & PNG_FORMAT_FLAG_AFIRST))
|
||||
swap_alpha = 1;
|
||||
# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||
if (preserve_alpha && (image->format & PNG_FORMAT_FLAG_AFIRST))
|
||||
swap_alpha = 1;
|
||||
# endif
|
||||
|
||||
for (pass = 0; pass < passes; ++pass)
|
||||
{
|
||||
|
||||
6
pngrio.c
6
pngrio.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -102,6 +102,7 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||
png_ptr->read_data_fn = read_data_fn;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
/* It is an error to write to a read device */
|
||||
if (png_ptr->write_data_fn != NULL)
|
||||
{
|
||||
@@ -110,6 +111,7 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||
"Can't set both read_data_fn and write_data_fn in the"
|
||||
" same structure");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
png_ptr->output_flush_fn = NULL;
|
||||
|
||||
785
pngrtran.c
785
pngrtran.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -223,6 +223,8 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
|
||||
*/
|
||||
# ifdef PNG_READ_sRGB_SUPPORTED
|
||||
png_ptr->flags |= PNG_FLAG_ASSUME_sRGB;
|
||||
# else
|
||||
PNG_UNUSED(png_ptr)
|
||||
# endif
|
||||
if (is_screen)
|
||||
output_gamma = PNG_GAMMA_sRGB;
|
||||
@@ -1056,9 +1058,6 @@ png_set_read_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
|
||||
{
|
||||
png_debug(1, "in png_set_read_user_transform_fn");
|
||||
|
||||
if (!png_rtran_ok(png_ptr, 0))
|
||||
return;
|
||||
|
||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
png_ptr->transformations |= PNG_USER_TRANSFORM;
|
||||
png_ptr->read_user_transform_fn = read_user_transform_fn;
|
||||
@@ -1117,19 +1116,25 @@ png_init_palette_transformations(png_structrp png_ptr)
|
||||
|
||||
/* Ignore if all the entries are opaque (unlikely!) */
|
||||
for (i=0; i<png_ptr->num_trans; ++i)
|
||||
{
|
||||
if (png_ptr->trans_alpha[i] == 255)
|
||||
continue;
|
||||
else if (png_ptr->trans_alpha[i] == 0)
|
||||
input_has_transparency = 1;
|
||||
else
|
||||
{
|
||||
input_has_transparency = 1;
|
||||
input_has_alpha = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If no alpha we can optimize. */
|
||||
if (!input_has_alpha)
|
||||
{
|
||||
/* Any alpha means background and associative alpha processing is
|
||||
* required, however if the alpha is 0 or 1 throughout OPTIIMIZE_ALPHA
|
||||
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
||||
* and ENCODE_ALPHA are irrelevant.
|
||||
*/
|
||||
png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
|
||||
@@ -1194,7 +1199,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
|
||||
if (!input_has_alpha)
|
||||
{
|
||||
/* Any alpha means background and associative alpha processing is
|
||||
* required, however if the alpha is 0 or 1 throughout OPTIIMIZE_ALPHA
|
||||
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
|
||||
* and ENCODE_ALPHA are irrelevant.
|
||||
*/
|
||||
# ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
@@ -1879,31 +1884,34 @@ png_init_read_transformations(png_structrp png_ptr)
|
||||
* the number of significant bits is 0 then no shift is done (this is an
|
||||
* error condition which is silently ignored.)
|
||||
*/
|
||||
if (shift > 0 && shift < 8) for (i=0; i<istop; ++i)
|
||||
{
|
||||
int component = png_ptr->palette[i].red;
|
||||
if (shift > 0 && shift < 8)
|
||||
for (i=0; i<istop; ++i)
|
||||
{
|
||||
int component = png_ptr->palette[i].red;
|
||||
|
||||
component >>= shift;
|
||||
png_ptr->palette[i].red = (png_byte)component;
|
||||
}
|
||||
component >>= shift;
|
||||
png_ptr->palette[i].red = (png_byte)component;
|
||||
}
|
||||
|
||||
shift = 8 - png_ptr->sig_bit.green;
|
||||
if (shift > 0 && shift < 8) for (i=0; i<istop; ++i)
|
||||
{
|
||||
int component = png_ptr->palette[i].green;
|
||||
if (shift > 0 && shift < 8)
|
||||
for (i=0; i<istop; ++i)
|
||||
{
|
||||
int component = png_ptr->palette[i].green;
|
||||
|
||||
component >>= shift;
|
||||
png_ptr->palette[i].green = (png_byte)component;
|
||||
}
|
||||
component >>= shift;
|
||||
png_ptr->palette[i].green = (png_byte)component;
|
||||
}
|
||||
|
||||
shift = 8 - png_ptr->sig_bit.blue;
|
||||
if (shift > 0 && shift < 8) for (i=0; i<istop; ++i)
|
||||
{
|
||||
int component = png_ptr->palette[i].blue;
|
||||
if (shift > 0 && shift < 8)
|
||||
for (i=0; i<istop; ++i)
|
||||
{
|
||||
int component = png_ptr->palette[i].blue;
|
||||
|
||||
component >>= shift;
|
||||
png_ptr->palette[i].blue = (png_byte)component;
|
||||
}
|
||||
component >>= shift;
|
||||
png_ptr->palette[i].blue = (png_byte)component;
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_SHIFT_SUPPORTED */
|
||||
}
|
||||
@@ -1934,6 +1942,9 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
||||
|
||||
info_ptr->bit_depth = 8;
|
||||
info_ptr->num_trans = 0;
|
||||
|
||||
if (png_ptr->palette == NULL)
|
||||
png_error (png_ptr, "Palette is NULL in indexed image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2112,303 +2123,6 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Transform the row. The order of transformations is significant,
|
||||
* and is very touchy. If you add a transformation, take care to
|
||||
* decide how it fits in with the other transformations here.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_debug(1, "in png_do_read_transformations");
|
||||
|
||||
if (png_ptr->row_buf == NULL)
|
||||
{
|
||||
/* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
|
||||
* error is incredibly rare and incredibly easy to debug without this
|
||||
* information.
|
||||
*/
|
||||
png_error(png_ptr, "NULL row buffer");
|
||||
}
|
||||
|
||||
/* The following is debugging; prior to 1.5.4 the code was never compiled in;
|
||||
* in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
|
||||
* PNG_WARN_UNINITIALIZED_ROW removed. In 1.6 the new flag is set only for
|
||||
* all transformations, however in practice the ROW_INIT always gets done on
|
||||
* demand, if necessary.
|
||||
*/
|
||||
if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
|
||||
!(png_ptr->flags & PNG_FLAG_ROW_INIT))
|
||||
{
|
||||
/* Application has failed to call either png_read_start_image() or
|
||||
* png_read_update_info() after setting transforms that expand pixels.
|
||||
* This check added to libpng-1.2.19 (but not enabled until 1.5.4).
|
||||
*/
|
||||
png_error(png_ptr, "Uninitialized row");
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_EXPAND)
|
||||
{
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
png_do_expand_palette(row_info, png_ptr->row_buf + 1,
|
||||
png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (png_ptr->num_trans &&
|
||||
(png_ptr->transformations & PNG_EXPAND_tRNS))
|
||||
png_do_expand(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->trans_color));
|
||||
|
||||
else
|
||||
png_do_expand(row_info, png_ptr->row_buf + 1,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
|
||||
!(png_ptr->transformations & PNG_COMPOSE) &&
|
||||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
0 /* at_start == false, because SWAP_ALPHA happens later */);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
|
||||
{
|
||||
int rgb_error =
|
||||
png_do_rgb_to_gray(png_ptr, row_info,
|
||||
png_ptr->row_buf + 1);
|
||||
|
||||
if (rgb_error)
|
||||
{
|
||||
png_ptr->rgb_to_gray_status=1;
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
PNG_RGB_TO_GRAY_WARN)
|
||||
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
PNG_RGB_TO_GRAY_ERR)
|
||||
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||
*
|
||||
* In most cases, the "simple transparency" should be done prior to doing
|
||||
* gray-to-RGB, or you will have to test 3x as many bytes to check if a
|
||||
* pixel is transparent. You would also need to make sure that the
|
||||
* transparency information is upgraded to RGB.
|
||||
*
|
||||
* To summarize, the current flow is:
|
||||
* - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
|
||||
* with background "in place" if transparent,
|
||||
* convert to RGB if necessary
|
||||
* - Gray + alpha -> composite with gray background and remove alpha bytes,
|
||||
* convert to RGB if necessary
|
||||
*
|
||||
* To support RGB backgrounds for gray images we need:
|
||||
* - Gray + simple transparency -> convert to RGB + simple transparency,
|
||||
* compare 3 or 6 bytes and composite with
|
||||
* background "in place" if transparent
|
||||
* (3x compare/pixel compared to doing
|
||||
* composite with gray bkgrnd)
|
||||
* - Gray + alpha -> convert to RGB + alpha, composite with background and
|
||||
* remove alpha bytes (3x float
|
||||
* operations/pixel compared with composite
|
||||
* on gray background)
|
||||
*
|
||||
* Greg's change will do this. The reason it wasn't done before is for
|
||||
* performance, as this increases the per-pixel operations. If we would check
|
||||
* in advance if the background was gray or RGB, and position the gray-to-RGB
|
||||
* transform appropriately, then it would save a lot of work/time.
|
||||
*/
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
/* If gray -> RGB, do so now only if background is non-gray; else do later
|
||||
* for performance reasons
|
||||
*/
|
||||
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
!(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
|
||||
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
if (png_ptr->transformations & PNG_COMPOSE)
|
||||
png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_GAMMA) &&
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
/* Because RGB_TO_GRAY does the gamma transform. */
|
||||
!(png_ptr->transformations & PNG_RGB_TO_GRAY) &&
|
||||
#endif
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
/* Because PNG_COMPOSE does the gamma transform if there is something to
|
||||
* do (if there is an alpha channel or transparency.)
|
||||
*/
|
||||
!((png_ptr->transformations & PNG_COMPOSE) &&
|
||||
((png_ptr->num_trans != 0) ||
|
||||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
|
||||
#endif
|
||||
/* Because png_init_read_transformations transforms the palette, unless
|
||||
* RGB_TO_GRAY will do the transform.
|
||||
*/
|
||||
(png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
|
||||
png_do_gamma(row_info, png_ptr->row_buf + 1, png_ptr);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
|
||||
(png_ptr->transformations & PNG_COMPOSE) &&
|
||||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
0 /* at_start == false, because SWAP_ALPHA happens later */);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_ENCODE_ALPHA) &&
|
||||
(row_info->color_type & PNG_COLOR_MASK_ALPHA))
|
||||
png_do_encode_alpha(row_info, png_ptr->row_buf + 1, png_ptr);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SCALE_16_TO_8)
|
||||
png_do_scale_16_to_8(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||
/* There is no harm in doing both of these because only one has any effect,
|
||||
* by putting the 'scale' option first if the app asks for scale (either by
|
||||
* calling the API or in a TRANSFORM flag) this is what happens.
|
||||
*/
|
||||
if (png_ptr->transformations & PNG_16_TO_8)
|
||||
png_do_chop(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_QUANTIZE)
|
||||
{
|
||||
png_do_quantize(row_info, png_ptr->row_buf + 1,
|
||||
png_ptr->palette_lookup, png_ptr->quantize_index);
|
||||
|
||||
if (row_info->rowbytes == 0)
|
||||
png_error(png_ptr, "png_do_quantize returned rowbytes=0");
|
||||
}
|
||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
||||
/* Do the expansion now, after all the arithmetic has been done. Notice
|
||||
* that previous transformations can handle the PNG_EXPAND_16 flag if this
|
||||
* is efficient (particularly true in the case of gamma correction, where
|
||||
* better accuracy results faster!)
|
||||
*/
|
||||
if (png_ptr->transformations & PNG_EXPAND_16)
|
||||
png_do_expand_16(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
/* NOTE: moved here in 1.5.4 (from much later in this list.) */
|
||||
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
|
||||
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SHIFT)
|
||||
png_do_unshift(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->shift));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_PACK_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACK)
|
||||
png_do_unpack(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
/* Added at libpng-1.5.10 */
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
png_ptr->num_palette_max >= 0)
|
||||
png_do_check_palette_indexes(png_ptr, row_info);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_BGR_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_BGR)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_do_read_filler(row_info, png_ptr->row_buf + 1,
|
||||
(png_uint_32)png_ptr->filler, png_ptr->flags);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||
png_do_read_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
||||
png_do_read_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_16BIT_SUPPORTED
|
||||
#ifdef PNG_READ_SWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
{
|
||||
if (png_ptr->read_user_transform_fn != NULL)
|
||||
(*(png_ptr->read_user_transform_fn)) /* User read transform function */
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||
if (png_ptr->user_transform_depth)
|
||||
row_info->bit_depth = png_ptr->user_transform_depth;
|
||||
|
||||
if (png_ptr->user_transform_channels)
|
||||
row_info->channels = png_ptr->user_transform_channels;
|
||||
#endif
|
||||
row_info->pixel_depth = (png_byte)(row_info->bit_depth *
|
||||
row_info->channels);
|
||||
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_PACK_SUPPORTED
|
||||
/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel,
|
||||
* without changing the actual values. Thus, if you had a row with
|
||||
@@ -2416,7 +2130,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
* the numbers 0 or 1. If you would rather they contain 0 and 255, use
|
||||
* png_do_shift() after this.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_unpack");
|
||||
@@ -2514,7 +2228,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
* a row of bit depth 8, but only 5 are significant, this will shift
|
||||
* the values back to 0 through 31.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_unshift(png_row_infop row_info, png_bytep row,
|
||||
png_const_color_8p sig_bits)
|
||||
{
|
||||
@@ -2653,7 +2367,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
||||
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
/* Scale rows of bit depth 16 down to 8 accurately */
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_scale_16_to_8");
|
||||
@@ -2711,7 +2425,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
/* Simply discard the low byte. This was the default behavior prior
|
||||
* to libpng-1.5.4.
|
||||
*/
|
||||
@@ -2739,7 +2453,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_read_swap_alpha");
|
||||
@@ -2836,7 +2550,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_uint_32 row_width;
|
||||
@@ -2938,7 +2652,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
/* Add filler channel if we have RGB color */
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
png_uint_32 filler, png_uint_32 flags)
|
||||
{
|
||||
@@ -3125,7 +2839,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
/* Expand grayscale files to RGB, with or without alpha */
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_uint_32 i;
|
||||
@@ -3264,7 +2978,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
* calculated to make the sum 32768. This will result in different rounding
|
||||
* to that used above.
|
||||
*/
|
||||
int /* PRIVATE */
|
||||
static int
|
||||
png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
|
||||
{
|
||||
@@ -3458,73 +3172,14 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
return rgb_error;
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
||||
|
||||
#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
|
||||
/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
|
||||
* large of png_color. This lets grayscale images be treated as
|
||||
* paletted. Most useful for gamma correction and simplification
|
||||
* of code. This API is not used internally.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_build_grayscale_palette(int bit_depth, png_colorp palette)
|
||||
{
|
||||
int num_palette;
|
||||
int color_inc;
|
||||
int i;
|
||||
int v;
|
||||
|
||||
png_debug(1, "in png_do_build_grayscale_palette");
|
||||
|
||||
if (palette == NULL)
|
||||
return;
|
||||
|
||||
switch (bit_depth)
|
||||
{
|
||||
case 1:
|
||||
num_palette = 2;
|
||||
color_inc = 0xff;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
num_palette = 4;
|
||||
color_inc = 0x55;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
num_palette = 16;
|
||||
color_inc = 0x11;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
num_palette = 256;
|
||||
color_inc = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
num_palette = 0;
|
||||
color_inc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
|
||||
{
|
||||
palette[i].red = (png_byte)v;
|
||||
palette[i].green = (png_byte)v;
|
||||
palette[i].blue = (png_byte)v;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
/* Replace any alpha or transparency with the supplied background color.
|
||||
* "background" is already in the screen gamma, while "background_1" is
|
||||
* at a gamma of 1.0. Paletted files have already been taken care of.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
{
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
@@ -4264,7 +3919,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
* is 16, use gamma_16_table and gamma_shift. Build these with
|
||||
* build_gamma_table().
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
{
|
||||
png_const_bytep gamma_table = png_ptr->gamma_table;
|
||||
@@ -4465,7 +4120,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
* linear.) Called only with color types that have an alpha channel. Needs the
|
||||
* from_1 tables.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
@@ -4531,7 +4186,7 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
/* Expands a palette row to an RGB or RGBA row depending
|
||||
* upon whether you supply trans and num_trans.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
|
||||
{
|
||||
@@ -4684,7 +4339,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
/* If the bit depth < 8, it is expanded to 8. Also, if the already
|
||||
* expanded transparency value is supplied, an alpha channel is built.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
png_const_color_16p trans_color)
|
||||
{
|
||||
@@ -4914,7 +4569,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
/* If the bit depth is 8 and the color type is not a palette type expand the
|
||||
* whole row to 16 bits. Has no effect otherwise.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_expand_16(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
if (row_info->bit_depth == 8 &&
|
||||
@@ -4942,7 +4597,7 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_quantize(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep palette_lookup, png_const_bytep quantize_lookup)
|
||||
{
|
||||
@@ -5034,69 +4689,303 @@ png_do_quantize(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
/* Undoes intrapixel differencing */
|
||||
/* Transform the row. The order of transformations is significant,
|
||||
* and is very touchy. If you add a transformation, take care to
|
||||
* decide how it fits in with the other transformations here.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_debug(1, "in png_do_read_intrapixel");
|
||||
png_debug(1, "in png_do_read_transformations");
|
||||
|
||||
if (
|
||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
if (png_ptr->row_buf == NULL)
|
||||
{
|
||||
int bytes_per_pixel;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
/* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
|
||||
* error is incredibly rare and incredibly easy to debug without this
|
||||
* information.
|
||||
*/
|
||||
png_error(png_ptr, "NULL row buffer");
|
||||
}
|
||||
|
||||
if (row_info->bit_depth == 8)
|
||||
/* The following is debugging; prior to 1.5.4 the code was never compiled in;
|
||||
* in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
|
||||
* PNG_WARN_UNINITIALIZED_ROW removed. In 1.6 the new flag is set only for
|
||||
* all transformations, however in practice the ROW_INIT always gets done on
|
||||
* demand, if necessary.
|
||||
*/
|
||||
if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
|
||||
!(png_ptr->flags & PNG_FLAG_ROW_INIT))
|
||||
{
|
||||
/* Application has failed to call either png_read_start_image() or
|
||||
* png_read_update_info() after setting transforms that expand pixels.
|
||||
* This check added to libpng-1.2.19 (but not enabled until 1.5.4).
|
||||
*/
|
||||
png_error(png_ptr, "Uninitialized row");
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_EXPAND)
|
||||
{
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 3;
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 4;
|
||||
|
||||
else
|
||||
return;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
*(rp) = (png_byte)((256 + *rp + *(rp + 1)) & 0xff);
|
||||
*(rp+2) = (png_byte)((256 + *(rp + 2) + *(rp + 1)) & 0xff);
|
||||
}
|
||||
png_do_expand_palette(row_info, png_ptr->row_buf + 1,
|
||||
png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
|
||||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
|
||||
else
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 6;
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 8;
|
||||
if (png_ptr->num_trans &&
|
||||
(png_ptr->transformations & PNG_EXPAND_tRNS))
|
||||
png_do_expand(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->trans_color));
|
||||
|
||||
else
|
||||
return;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
|
||||
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||
}
|
||||
png_do_expand(row_info, png_ptr->row_buf + 1,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
|
||||
!(png_ptr->transformations & PNG_COMPOSE) &&
|
||||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
0 /* at_start == false, because SWAP_ALPHA happens later */);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
|
||||
{
|
||||
int rgb_error =
|
||||
png_do_rgb_to_gray(png_ptr, row_info,
|
||||
png_ptr->row_buf + 1);
|
||||
|
||||
if (rgb_error)
|
||||
{
|
||||
png_ptr->rgb_to_gray_status=1;
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
PNG_RGB_TO_GRAY_WARN)
|
||||
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
PNG_RGB_TO_GRAY_ERR)
|
||||
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||
*
|
||||
* In most cases, the "simple transparency" should be done prior to doing
|
||||
* gray-to-RGB, or you will have to test 3x as many bytes to check if a
|
||||
* pixel is transparent. You would also need to make sure that the
|
||||
* transparency information is upgraded to RGB.
|
||||
*
|
||||
* To summarize, the current flow is:
|
||||
* - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
|
||||
* with background "in place" if transparent,
|
||||
* convert to RGB if necessary
|
||||
* - Gray + alpha -> composite with gray background and remove alpha bytes,
|
||||
* convert to RGB if necessary
|
||||
*
|
||||
* To support RGB backgrounds for gray images we need:
|
||||
* - Gray + simple transparency -> convert to RGB + simple transparency,
|
||||
* compare 3 or 6 bytes and composite with
|
||||
* background "in place" if transparent
|
||||
* (3x compare/pixel compared to doing
|
||||
* composite with gray bkgrnd)
|
||||
* - Gray + alpha -> convert to RGB + alpha, composite with background and
|
||||
* remove alpha bytes (3x float
|
||||
* operations/pixel compared with composite
|
||||
* on gray background)
|
||||
*
|
||||
* Greg's change will do this. The reason it wasn't done before is for
|
||||
* performance, as this increases the per-pixel operations. If we would check
|
||||
* in advance if the background was gray or RGB, and position the gray-to-RGB
|
||||
* transform appropriately, then it would save a lot of work/time.
|
||||
*/
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
/* If gray -> RGB, do so now only if background is non-gray; else do later
|
||||
* for performance reasons
|
||||
*/
|
||||
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
!(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
|
||||
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
if (png_ptr->transformations & PNG_COMPOSE)
|
||||
png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_GAMMA) &&
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
/* Because RGB_TO_GRAY does the gamma transform. */
|
||||
!(png_ptr->transformations & PNG_RGB_TO_GRAY) &&
|
||||
#endif
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
/* Because PNG_COMPOSE does the gamma transform if there is something to
|
||||
* do (if there is an alpha channel or transparency.)
|
||||
*/
|
||||
!((png_ptr->transformations & PNG_COMPOSE) &&
|
||||
((png_ptr->num_trans != 0) ||
|
||||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
|
||||
#endif
|
||||
/* Because png_init_read_transformations transforms the palette, unless
|
||||
* RGB_TO_GRAY will do the transform.
|
||||
*/
|
||||
(png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
|
||||
png_do_gamma(row_info, png_ptr->row_buf + 1, png_ptr);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
|
||||
(png_ptr->transformations & PNG_COMPOSE) &&
|
||||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
0 /* at_start == false, because SWAP_ALPHA happens later */);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_ENCODE_ALPHA) &&
|
||||
(row_info->color_type & PNG_COLOR_MASK_ALPHA))
|
||||
png_do_encode_alpha(row_info, png_ptr->row_buf + 1, png_ptr);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SCALE_16_TO_8)
|
||||
png_do_scale_16_to_8(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||
/* There is no harm in doing both of these because only one has any effect,
|
||||
* by putting the 'scale' option first if the app asks for scale (either by
|
||||
* calling the API or in a TRANSFORM flag) this is what happens.
|
||||
*/
|
||||
if (png_ptr->transformations & PNG_16_TO_8)
|
||||
png_do_chop(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_QUANTIZE)
|
||||
{
|
||||
png_do_quantize(row_info, png_ptr->row_buf + 1,
|
||||
png_ptr->palette_lookup, png_ptr->quantize_index);
|
||||
|
||||
if (row_info->rowbytes == 0)
|
||||
png_error(png_ptr, "png_do_quantize returned rowbytes=0");
|
||||
}
|
||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
||||
/* Do the expansion now, after all the arithmetic has been done. Notice
|
||||
* that previous transformations can handle the PNG_EXPAND_16 flag if this
|
||||
* is efficient (particularly true in the case of gamma correction, where
|
||||
* better accuracy results faster!)
|
||||
*/
|
||||
if (png_ptr->transformations & PNG_EXPAND_16)
|
||||
png_do_expand_16(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
/* NOTE: moved here in 1.5.4 (from much later in this list.) */
|
||||
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
|
||||
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SHIFT)
|
||||
png_do_unshift(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->shift));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_PACK_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACK)
|
||||
png_do_unpack(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
/* Added at libpng-1.5.10 */
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
png_ptr->num_palette_max >= 0)
|
||||
png_do_check_palette_indexes(png_ptr, row_info);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_BGR_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_BGR)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_do_read_filler(row_info, png_ptr->row_buf + 1,
|
||||
(png_uint_32)png_ptr->filler, png_ptr->flags);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||
png_do_read_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
||||
png_do_read_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_16BIT_SUPPORTED
|
||||
#ifdef PNG_READ_SWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
{
|
||||
if (png_ptr->read_user_transform_fn != NULL)
|
||||
(*(png_ptr->read_user_transform_fn)) /* User read transform function */
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||
if (png_ptr->user_transform_depth)
|
||||
row_info->bit_depth = png_ptr->user_transform_depth;
|
||||
|
||||
if (png_ptr->user_transform_channels)
|
||||
row_info->channels = png_ptr->user_transform_channels;
|
||||
#endif
|
||||
row_info->pixel_depth = (png_byte)(row_info->bit_depth *
|
||||
row_info->channels);
|
||||
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||
|
||||
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
92
pngrutil.c
92
pngrutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
#define png_strtod(p,a,b) strtod(a,b)
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
|
||||
{
|
||||
@@ -221,7 +219,7 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
|
||||
|
||||
if (png_crc_error(png_ptr))
|
||||
{
|
||||
if (PNG_CHUNK_ANCILLIARY(png_ptr->chunk_name) ?
|
||||
if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) ?
|
||||
!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) :
|
||||
(png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE))
|
||||
{
|
||||
@@ -250,7 +248,7 @@ png_crc_error(png_structrp png_ptr)
|
||||
png_uint_32 crc;
|
||||
int need_crc = 1;
|
||||
|
||||
if (PNG_CHUNK_ANCILLIARY(png_ptr->chunk_name))
|
||||
if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name))
|
||||
{
|
||||
if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
|
||||
(PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
|
||||
@@ -280,6 +278,10 @@ png_crc_error(png_structrp png_ptr)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
|
||||
defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_sCAL_SUPPORTED) ||\
|
||||
defined(PNG_READ_sPLT_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) ||\
|
||||
defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_SEQUENTIAL_READ_SUPPORTED)
|
||||
/* Manage the read buffer; this simply reallocates the buffer if it is not small
|
||||
* enough (or if it is not allocated). The routine returns a pointer to the
|
||||
* buffer; if an error occurs and 'warn' is set the routine returns NULL, else
|
||||
@@ -327,6 +329,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
||||
|
||||
return buffer;
|
||||
}
|
||||
#endif /* PNG_READ_iCCP|iTXt|pCAL|sCAL|sPLT|tEXt|zTXt|SEQUENTIAL_READ */
|
||||
|
||||
/* png_inflate_claim: claim the zstream for some nefarious purpose that involves
|
||||
* decompression. Returns Z_OK on success, else a zlib error code. It checks
|
||||
@@ -334,7 +337,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
||||
* chunk apparently owns the stream. Prior to release it does a png_error.
|
||||
*/
|
||||
static int
|
||||
png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
{
|
||||
if (png_ptr->zowner != 0)
|
||||
{
|
||||
@@ -369,6 +372,22 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
*/
|
||||
{
|
||||
int ret; /* zlib return code */
|
||||
# if PNG_ZLIB_VERNUM >= 0x1240
|
||||
|
||||
# if defined(PNG_SET_OPTION_SUPPORTED) && \
|
||||
defined(PNG_MAXIMUM_INFLATE_WINDOW)
|
||||
int window_bits;
|
||||
|
||||
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
||||
PNG_OPTION_ON)
|
||||
window_bits = 15;
|
||||
|
||||
else
|
||||
window_bits = 0;
|
||||
# else
|
||||
# define window_bits 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Set this for safety, just in case the previous owner left pointers to
|
||||
* memory allocations.
|
||||
@@ -380,8 +399,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
|
||||
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
|
||||
{
|
||||
# if ZLIB_VERNUM < 0x1240
|
||||
PNG_UNUSED(window_bits)
|
||||
# if PNG_ZLIB_VERNUM < 0x1240
|
||||
ret = inflateReset(&png_ptr->zstream);
|
||||
# else
|
||||
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
||||
@@ -390,7 +408,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
|
||||
else
|
||||
{
|
||||
# if ZLIB_VERNUM < 0x1240
|
||||
# if PNG_ZLIB_VERNUM < 0x1240
|
||||
ret = inflateInit(&png_ptr->zstream);
|
||||
# else
|
||||
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
||||
@@ -408,6 +426,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
# ifdef window_bits
|
||||
# undef window_bits
|
||||
# endif
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||
@@ -580,14 +602,8 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
if (limit < *newlength)
|
||||
*newlength = limit;
|
||||
|
||||
/* Now try to claim the stream; the 'warn' setting causes zlib to be told
|
||||
* to use the maximum window size during inflate; this hides errors in the
|
||||
* deflate header window bits value which is used if '0' is passed. In
|
||||
* fact this only has an effect with zlib versions 1.2.4 and later - see
|
||||
* the comments in png_inflate_claim above.
|
||||
*/
|
||||
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name,
|
||||
png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN ? 15 : 0);
|
||||
/* Now try to claim the stream. */
|
||||
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name);
|
||||
|
||||
if (ret == Z_OK)
|
||||
{
|
||||
@@ -1357,8 +1373,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
read_length -= keyword_length+2;
|
||||
|
||||
if (png_inflate_claim(png_ptr, png_iCCP,
|
||||
png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN ? 15 : 0) == Z_OK)
|
||||
if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
|
||||
{
|
||||
Byte profile_header[132];
|
||||
Byte local_buffer[PNG_INFLATE_BUF_SIZE];
|
||||
@@ -2857,7 +2872,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||
(keep == PNG_HANDLE_CHUNK_IF_SAFE &&
|
||||
PNG_CHUNK_ANCILLIARY(png_ptr->chunk_name)))
|
||||
PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
|
||||
{
|
||||
if (!png_cache_unknown_chunk(png_ptr, length))
|
||||
keep = PNG_HANDLE_CHUNK_NEVER;
|
||||
@@ -2891,7 +2906,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
*/
|
||||
if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
|
||||
(keep == PNG_HANDLE_CHUNK_IF_SAFE &&
|
||||
PNG_CHUNK_ANCILLIARY(png_ptr->chunk_name)))
|
||||
PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
|
||||
{
|
||||
# ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
switch (png_ptr->user_chunk_cache_max)
|
||||
@@ -2922,9 +2937,8 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# else /* no store support! */
|
||||
# else /* no store support: the chunk must be handled by the user callback */
|
||||
PNG_UNUSED(info_ptr)
|
||||
# error untested code (reading unknown chunks with no store support)
|
||||
# endif
|
||||
|
||||
/* Regardless of the error handling below the cached data (if any) can be
|
||||
@@ -3684,7 +3698,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
|
||||
for (i = 0; i < row_info->width; i++)
|
||||
{
|
||||
png_byte v[8];
|
||||
png_byte v[8]; /* SAFE; pixel_depth does not exceed 64 */
|
||||
int j;
|
||||
|
||||
memcpy(v, sp, pixel_bytes);
|
||||
@@ -3862,7 +3876,6 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
if (pb < pa) pa = pb, a = b;
|
||||
if (pc < pa) a = c;
|
||||
|
||||
c = b;
|
||||
a += *row;
|
||||
*row++ = (png_byte)a;
|
||||
}
|
||||
@@ -3870,12 +3883,13 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
|
||||
static void
|
||||
png_init_filter_functions(png_structrp pp)
|
||||
/* This function is called once for every PNG image to set the
|
||||
/* This function is called once for every PNG image (except for PNG images
|
||||
* that only use PNG_FILTER_VALUE_NONE for all rows) to set the
|
||||
* implementations required to reverse the filtering of PNG rows. Reversing
|
||||
* the filter is the first transformation performed on the row data. It is
|
||||
* performed in place, therefore an implementation can be selected based on
|
||||
* the image pixel format. If the implementation depends on image width then
|
||||
* take care to ensure that it works corretly if the image is interlaced -
|
||||
* take care to ensure that it works correctly if the image is interlaced -
|
||||
* interlacing causes the actual row width to vary.
|
||||
*/
|
||||
{
|
||||
@@ -3912,10 +3926,13 @@ png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row,
|
||||
* PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic
|
||||
* implementations. See png_init_filter_functions above.
|
||||
*/
|
||||
if (pp->read_filter[0] == NULL)
|
||||
png_init_filter_functions(pp);
|
||||
if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST)
|
||||
{
|
||||
if (pp->read_filter[0] == NULL)
|
||||
png_init_filter_functions(pp);
|
||||
|
||||
pp->read_filter[filter-1](row_info, row, prev_row);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
@@ -3983,7 +4000,7 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
|
||||
png_ptr->zstream.avail_out = out;
|
||||
}
|
||||
|
||||
else /* check for end */
|
||||
else /* after last row, checking for end */
|
||||
{
|
||||
png_ptr->zstream.next_out = tmpbuf;
|
||||
png_ptr->zstream.avail_out = (sizeof tmpbuf);
|
||||
@@ -3998,10 +4015,13 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
|
||||
*/
|
||||
ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
|
||||
|
||||
/* Take the unconsumed output back (so, in the 'check' case this just
|
||||
* counts up).
|
||||
*/
|
||||
avail_out += png_ptr->zstream.avail_out;
|
||||
/* Take the unconsumed output back. */
|
||||
if (output != NULL)
|
||||
avail_out += png_ptr->zstream.avail_out;
|
||||
|
||||
else /* avail_out counts the extra bytes */
|
||||
avail_out += (sizeof tmpbuf) - png_ptr->zstream.avail_out;
|
||||
|
||||
png_ptr->zstream.avail_out = 0;
|
||||
|
||||
if (ret == Z_STREAM_END)
|
||||
@@ -4040,7 +4060,7 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
|
||||
if (output != NULL)
|
||||
png_error(png_ptr, "Not enough image data");
|
||||
|
||||
else /* checking */
|
||||
else /* the deflate stream contained extra data */
|
||||
png_chunk_benign_error(png_ptr, "Too much image data");
|
||||
}
|
||||
}
|
||||
@@ -4451,7 +4471,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
* IDAT stream has a bogus deflate header window_bits value, but this should
|
||||
* not be happening any longer!)
|
||||
*/
|
||||
if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
|
||||
if (png_inflate_claim(png_ptr, png_IDAT) != Z_OK)
|
||||
png_error(png_ptr, png_ptr->zstream.msg);
|
||||
|
||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||
|
||||
15
pngset.c
15
pngset.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -238,16 +238,7 @@ png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
||||
/* Check for potential overflow */
|
||||
if (width >
|
||||
(PNG_UINT_32_MAX >> 3) /* 8-byte RRGGBBAA pixels */
|
||||
- 48 /* bigrowbuf hack */
|
||||
- 1 /* filter byte */
|
||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
||||
- 8) /* extra max_pixel_depth pad */
|
||||
info_ptr->rowbytes = 0;
|
||||
else
|
||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||
}
|
||||
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
@@ -536,7 +527,7 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
# endif
|
||||
))
|
||||
{
|
||||
png_chunk_report(png_ptr, "Invalid palette", PNG_CHUNK_ERROR);
|
||||
png_error(png_ptr, "Invalid palette");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
113
pngtest.c
113
pngtest.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -43,8 +43,35 @@
|
||||
|
||||
#include "png.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED /* else nothing can be done */
|
||||
#include "zlib.h"
|
||||
/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
|
||||
* simply as a result of re-ordering them. This may be fixed in 1.7
|
||||
*
|
||||
* pngtest allocates a single row buffer for each row and overwrites it,
|
||||
* therefore if the write side doesn't support the writing of interlaced images
|
||||
* nothing can be done for an interlaced image (and the code below will fail
|
||||
* horribly trying to write extra data after writing garbage).
|
||||
*/
|
||||
#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\
|
||||
defined PNG_READ_bKGD_SUPPORTED &&\
|
||||
defined PNG_READ_cHRM_SUPPORTED &&\
|
||||
defined PNG_READ_gAMA_SUPPORTED &&\
|
||||
defined PNG_READ_oFFs_SUPPORTED &&\
|
||||
defined PNG_READ_pCAL_SUPPORTED &&\
|
||||
defined PNG_READ_pHYs_SUPPORTED &&\
|
||||
defined PNG_READ_sBIT_SUPPORTED &&\
|
||||
defined PNG_READ_sCAL_SUPPORTED &&\
|
||||
defined PNG_READ_sRGB_SUPPORTED &&\
|
||||
defined PNG_READ_tEXt_SUPPORTED &&\
|
||||
defined PNG_READ_tIME_SUPPORTED &&\
|
||||
defined PNG_READ_zTXt_SUPPORTED &&\
|
||||
defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
|
||||
#ifdef PNG_ZLIB_HEADER
|
||||
# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
|
||||
#else
|
||||
# include "zlib.h"
|
||||
#endif
|
||||
|
||||
/* Copied from pngpriv.h but only used in error messages below. */
|
||||
#ifndef PNG_ZBUF_SIZE
|
||||
# define PNG_ZBUF_SIZE 8192
|
||||
@@ -100,10 +127,6 @@ static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */
|
||||
static int error_count = 0; /* count calls to png_error */
|
||||
static int warning_count = 0; /* count calls to png_warning */
|
||||
|
||||
#ifdef __TURBOC__
|
||||
#include <mem.h>
|
||||
#endif
|
||||
|
||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
||||
#ifndef png_jmpbuf
|
||||
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
|
||||
@@ -557,7 +580,8 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
/* We must free the list element too, but first kill
|
||||
the memory that is to be freed. */
|
||||
memset(ptr, 0x55, pinfo->size);
|
||||
png_free_default(png_ptr, pinfo);
|
||||
if (pinfo)
|
||||
free(pinfo);
|
||||
pinfo = NULL;
|
||||
break;
|
||||
}
|
||||
@@ -576,7 +600,8 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
if (verbose)
|
||||
printf("Freeing %p\n", ptr);
|
||||
|
||||
png_free_default(png_ptr, ptr);
|
||||
if (ptr)
|
||||
free(ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
|
||||
@@ -707,18 +732,18 @@ static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
|
||||
static void
|
||||
write_sTER_chunk(png_structp write_ptr)
|
||||
{
|
||||
png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
|
||||
png_byte sTER[5] = {115, 84, 69, 82, '\0'};
|
||||
|
||||
if (verbose)
|
||||
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
|
||||
|
||||
png_write_chunk(write_ptr, png_sTER, &user_chunk_data.sTER_mode, 1);
|
||||
png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
write_vpAg_chunk(png_structp write_ptr)
|
||||
{
|
||||
png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'};
|
||||
png_byte vpAg[5] = {118, 112, 65, 103, '\0'};
|
||||
|
||||
png_byte vpag_chunk_data[9];
|
||||
|
||||
@@ -731,7 +756,7 @@ write_vpAg_chunk(png_structp write_ptr)
|
||||
png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width);
|
||||
png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height);
|
||||
vpag_chunk_data[8] = user_chunk_data.vpAg_units;
|
||||
png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9);
|
||||
png_write_chunk(write_ptr, vpAg, vpag_chunk_data, 9);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -812,6 +837,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_structp write_ptr;
|
||||
png_infop write_info_ptr;
|
||||
png_infop write_end_info_ptr;
|
||||
int interlace_preserved = 1;
|
||||
#else
|
||||
png_structp write_ptr = NULL;
|
||||
png_infop write_info_ptr = NULL;
|
||||
@@ -820,7 +846,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_bytep row_buf;
|
||||
png_uint_32 y;
|
||||
png_uint_32 width, height;
|
||||
int num_pass, pass;
|
||||
int num_pass = 1, pass;
|
||||
int bit_depth, color_type;
|
||||
|
||||
row_buf = NULL;
|
||||
@@ -1026,10 +1052,26 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
&color_type, &interlace_type, &compression_type, &filter_type))
|
||||
{
|
||||
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
color_type, interlace_type, compression_type, filter_type);
|
||||
#else
|
||||
color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
|
||||
#ifndef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* num_pass will not be set below, set it here if the image is
|
||||
* interlaced: what happens is that write interlacing is *not* turned
|
||||
* on an the partial interlaced rows are written directly.
|
||||
*/
|
||||
switch (interlace_type)
|
||||
{
|
||||
case PNG_INTERLACE_NONE:
|
||||
num_pass = 1;
|
||||
break;
|
||||
|
||||
case PNG_INTERLACE_ADAM7:
|
||||
num_pass = 7;
|
||||
break;
|
||||
|
||||
default:
|
||||
png_error(read_ptr, "invalid interlace type");
|
||||
/*NOT REACHED*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1173,7 +1215,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_sCAL_SUPPORTED
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
|
||||
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
||||
{
|
||||
int unit;
|
||||
double scal_width, scal_height;
|
||||
@@ -1321,14 +1364,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||
pngtest_debug("Writing row data");
|
||||
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
num_pass = png_set_interlace_handling(read_ptr);
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
png_set_interlace_handling(write_ptr);
|
||||
# endif
|
||||
#else
|
||||
num_pass = 1;
|
||||
if (png_set_interlace_handling(write_ptr) != num_pass)
|
||||
png_error(write_ptr, "png_set_interlace_handling: inconsistent num_pass");
|
||||
#endif
|
||||
|
||||
#ifdef PNGTEST_TIMING
|
||||
@@ -1374,11 +1413,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
|
||||
#endif
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
|
||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
# ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
|
||||
# endif
|
||||
# ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
pngtest_debug("Reading and writing end_info data");
|
||||
@@ -1558,15 +1599,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
|
||||
if (interlace_preserved) /* else the files will be changed */
|
||||
{
|
||||
int wrote_question = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
static int wrote_question = 0;
|
||||
png_size_t num_in, num_out;
|
||||
char inbuf[256], outbuf[256];
|
||||
|
||||
|
||||
num_in = fread(inbuf, 1, sizeof inbuf, fpin);
|
||||
num_out = fread(outbuf, 1, sizeof outbuf, fpout);
|
||||
|
||||
@@ -1945,9 +1985,10 @@ main(void)
|
||||
{
|
||||
fprintf(STDERR,
|
||||
" test ignored because libpng was not built with read support\n");
|
||||
return 0;
|
||||
/* And skip this test */
|
||||
return PNG_LIBPNG_VER < 10600 ? 0 : 77;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_1 Your_png_h_is_not_version_1_6_1;
|
||||
typedef png_libpng_version_1_6_9 Your_png_h_is_not_version_1_6_9;
|
||||
|
||||
19
pngtrans.c
19
pngtrans.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -57,7 +57,9 @@ png_set_packing(png_structrp png_ptr)
|
||||
if (png_ptr->bit_depth < 8)
|
||||
{
|
||||
png_ptr->transformations |= PNG_PACK;
|
||||
png_ptr->usr_bit_depth = 8;
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
png_ptr->usr_bit_depth = 8;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -782,6 +784,17 @@ png_set_user_transform_info(png_structrp png_ptr, png_voidp
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||
(png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
|
||||
{
|
||||
png_app_error(png_ptr,
|
||||
"info change after png_start_read_image or png_read_update_info");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||
|
||||
8
pngwio.c
8
pngwio.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -149,8 +149,11 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||
# else
|
||||
png_ptr->output_flush_fn = output_flush_fn;
|
||||
# endif
|
||||
#else
|
||||
PNG_UNUSED(output_flush_fn)
|
||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* It is an error to read while writing a png file */
|
||||
if (png_ptr->read_data_fn != NULL)
|
||||
{
|
||||
@@ -160,5 +163,6 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||
"Can't set both read_data_fn and write_data_fn in the"
|
||||
" same structure");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
|
||||
169
pngwrite.c
169
pngwrite.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -494,51 +494,50 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
|
||||
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
/* Set the zlib control values to defaults; they can be overridden by the
|
||||
* application after the struct has been created.
|
||||
*/
|
||||
png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
|
||||
|
||||
/* Set the zlib control values to defaults; they can be overridden by the
|
||||
* application after the struct has been created.
|
||||
*/
|
||||
png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
|
||||
|
||||
/* The 'zlib_strategy' setting is irrelevant because png_default_claim in
|
||||
* pngwutil.c defaults it according to whether or not filters will be used,
|
||||
* and ignores this setting.
|
||||
*/
|
||||
png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
|
||||
png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
|
||||
png_ptr->zlib_mem_level = 8;
|
||||
png_ptr->zlib_window_bits = 15;
|
||||
png_ptr->zlib_method = 8;
|
||||
/* The 'zlib_strategy' setting is irrelevant because png_default_claim in
|
||||
* pngwutil.c defaults it according to whether or not filters will be
|
||||
* used, and ignores this setting.
|
||||
*/
|
||||
png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
|
||||
png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
|
||||
png_ptr->zlib_mem_level = 8;
|
||||
png_ptr->zlib_window_bits = 15;
|
||||
png_ptr->zlib_method = 8;
|
||||
|
||||
#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||
png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
|
||||
png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
|
||||
png_ptr->zlib_text_mem_level = 8;
|
||||
png_ptr->zlib_text_window_bits = 15;
|
||||
png_ptr->zlib_text_method = 8;
|
||||
png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
|
||||
png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
|
||||
png_ptr->zlib_text_mem_level = 8;
|
||||
png_ptr->zlib_text_window_bits = 15;
|
||||
png_ptr->zlib_text_method = 8;
|
||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||
|
||||
/* This is a highly dubious configuration option; by default it is off, but
|
||||
* it may be appropriate for private builds that are testing extensions not
|
||||
* conformant to the current specification, or of applications that must not
|
||||
* fail to write at all costs!
|
||||
*/
|
||||
# ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
|
||||
/* This is a highly dubious configuration option; by default it is off,
|
||||
* but it may be appropriate for private builds that are testing
|
||||
* extensions not conformant to the current specification, or of
|
||||
* applications that must not fail to write at all costs!
|
||||
*/
|
||||
#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
|
||||
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||
/* In stable builds only warn if an application error can be completely
|
||||
* handled.
|
||||
*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* App warnings are warnings in release (or release candidate) builds but
|
||||
* are errors during development.
|
||||
*/
|
||||
# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
/* App warnings are warnings in release (or release candidate) builds but
|
||||
* are errors during development.
|
||||
*/
|
||||
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
/* TODO: delay this, it can be done in png_init_io() (if the app doesn't
|
||||
* do it itself) avoiding setting the default function if it is not
|
||||
* required.
|
||||
@@ -608,6 +607,71 @@ png_write_image(png_structrp png_ptr, png_bytepp image)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
/* Performs intrapixel differencing */
|
||||
static void
|
||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_write_intrapixel");
|
||||
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
int bytes_per_pixel;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 3;
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 4;
|
||||
|
||||
else
|
||||
return;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
||||
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 6;
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 8;
|
||||
|
||||
else
|
||||
return;
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
}
|
||||
}
|
||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||
|
||||
/* Called by user to write a row of image data */
|
||||
void PNGAPI
|
||||
png_write_row(png_structrp png_ptr, png_const_bytep row)
|
||||
@@ -1639,14 +1703,16 @@ png_write_image_16bit(png_voidp argument)
|
||||
|
||||
if (image->format & PNG_FORMAT_FLAG_ALPHA)
|
||||
{
|
||||
if (image->format & PNG_FORMAT_FLAG_AFIRST)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if (image->format & PNG_FORMAT_FLAG_AFIRST)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
aindex = channels;
|
||||
}
|
||||
|
||||
@@ -1795,14 +1861,16 @@ png_write_image_8bit(png_voidp argument)
|
||||
png_bytep row_end;
|
||||
int aindex;
|
||||
|
||||
if (image->format & PNG_FORMAT_FLAG_AFIRST)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||
if (image->format & PNG_FORMAT_FLAG_AFIRST)
|
||||
{
|
||||
aindex = -1;
|
||||
++input_row; /* To point to the first component */
|
||||
++output_row;
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
# endif
|
||||
aindex = channels;
|
||||
|
||||
/* Use row_end in place of a loop counter: */
|
||||
@@ -1882,7 +1950,8 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
const png_uint_32 format = image->format;
|
||||
const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
|
||||
|
||||
# ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
|
||||
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
|
||||
const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
|
||||
(format & PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||
# else
|
||||
|
||||
203
pngwtran.c
203
pngwtran.c
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.9 [February 6, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@@ -14,90 +14,14 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
|
||||
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||
/* Transform the data according to the user's wishes. The order of
|
||||
* transformations is significant.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_debug(1, "in png_do_write_transformations");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
if (png_ptr->write_user_transform_fn != NULL)
|
||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||
function */
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACK)
|
||||
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||
(png_uint_32)png_ptr->bit_depth);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SHIFT)
|
||||
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->shift));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
||||
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_BGR)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
||||
* row_info bit depth should be 8 (one pixel per byte). The channels
|
||||
* should be 1 (this only happens on grayscale and paletted images).
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
{
|
||||
png_debug(1, "in png_do_pack");
|
||||
@@ -242,7 +166,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
* would pass 3 as bit_depth, and this routine would translate the
|
||||
* data to 0 to 15.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_shift(png_row_infop row_info, png_bytep row,
|
||||
png_const_color_8p bit_depth)
|
||||
{
|
||||
@@ -381,7 +305,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_write_swap_alpha");
|
||||
@@ -475,7 +399,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_write_invert_alpha");
|
||||
@@ -568,70 +492,81 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
/* Undoes intrapixel differencing */
|
||||
/* Transform the data according to the user's wishes. The order of
|
||||
* transformations is significant.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_debug(1, "in png_do_write_intrapixel");
|
||||
png_debug(1, "in png_do_write_transformations");
|
||||
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
int bytes_per_pixel;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 3;
|
||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
if (png_ptr->write_user_transform_fn != NULL)
|
||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||
function */
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#endif
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 4;
|
||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||
#endif
|
||||
|
||||
else
|
||||
return;
|
||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
||||
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
||||
}
|
||||
}
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACK)
|
||||
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||
(png_uint_32)png_ptr->bit_depth);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 6;
|
||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SHIFT)
|
||||
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->shift));
|
||||
#endif
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 8;
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
||||
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
else
|
||||
return;
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
}
|
||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_BGR)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -1744,6 +1744,9 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
||||
{
|
||||
if (comp.input_len > PNG_UINT_31_MAX-prefix_len)
|
||||
png_error(png_ptr, "iTXt: uncompressed text too long");
|
||||
|
||||
/* So the string will fit in a chunk: */
|
||||
comp.output_len = (png_uint_32)/*SAFE*/comp.input_len;
|
||||
}
|
||||
|
||||
png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.6.1 - March 28, 2013
|
||||
libpng version 1.6.9 - February 6, 2014
|
||||
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source
|
||||
*
|
||||
* libpng version 1.6.1 - March 28, 2013
|
||||
* libpng version 1.6.9 - February 6, 2014
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
Makefiles for libpng version 1.6.1 - March 28, 2013
|
||||
Makefiles for libpng version 1.6.9 - February 6, 2014
|
||||
|
||||
pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng16.so.16.1.6.1)
|
||||
(gcc, creates libpng16.so.16.1.6.9)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
@@ -20,7 +20,7 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||
(gcc, creates libpng16.so.16.1.6.1)
|
||||
(gcc, creates libpng16.so.16.1.6.9)
|
||||
makefile.freebsd => FreeBSD makefile
|
||||
makefile.gcc => Generic gcc makefile
|
||||
makefile.hpgcc => HPUX makefile using gcc
|
||||
@@ -35,12 +35,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.sggcc => Silicon Graphics (gcc,
|
||||
creates libpng16.so.16.1.6.1)
|
||||
creates libpng16.so.16.1.6.9)
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||
creates libpng16.so.16.1.6.1)
|
||||
creates libpng16.so.16.1.6.9)
|
||||
makefile.so9 => Solaris 9 makefile (gcc,
|
||||
creates libpng16.so.16.1.6.1)
|
||||
creates libpng16.so.16.1.6.9)
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.sunos => Sun 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 ""
|
||||
PNG_DFN "EXPORTS"
|
||||
PNG_DFN ";Version 1.6.1"
|
||||
PNG_DFN ";Version 1.6.9"
|
||||
|
||||
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
||||
|
||||
@@ -33,20 +33,20 @@ clean :
|
||||
|
||||
|
||||
# Other dependencies.
|
||||
png.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngpread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngset.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngget.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngrtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngrutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngerror.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngmem.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngrio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngwio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngtrans.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngwrite.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngwtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
pngwutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
|
||||
png.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngpread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngset.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngget.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngrtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngrutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngerror.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngmem.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngrio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngwio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngtrans.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngwrite.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngwtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
pngwutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||
|
||||
pngtest.obj : png.h, pngconf.h
|
||||
pngtest.obj : png.h, pngconf.h, pnglibconf.h
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
# Modeled after libxml-config.
|
||||
|
||||
version=1.6.1
|
||||
version=1.6.9
|
||||
prefix=""
|
||||
libdir=""
|
||||
libs=""
|
||||
|
||||
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
|
||||
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: 1.6.1
|
||||
Version: 1.6.9
|
||||
Libs: -L${libdir} -lpng16
|
||||
Cflags: -I${includedir}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# makefile for libpng on Solaris 2.x with cc
|
||||
# Contributed by William L. Sebok, based on makefile.linux
|
||||
# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1998 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -45,8 +45,8 @@ ZLIBINC=/usr/include
|
||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g
|
||||
LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
@@ -77,8 +77,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -196,7 +199,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) $(SUN_CC_FLAGS) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -205,7 +208,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
|
||||
$(CC) $(SUN_CC_FLAGS) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -222,20 +225,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# makefile for libpng on Solaris 2.x with cc
|
||||
# Contributed by William L. Sebok, based on makefile.linux
|
||||
# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1998 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -45,8 +45,8 @@ ZLIBINC=/usr/include
|
||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS= $(SUN_CC_FLAGS) # $(WARNMORE) -g
|
||||
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
@@ -77,8 +77,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -196,7 +199,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) $(SUN_CC_FLAGS) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -205,7 +208,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
|
||||
$(CC) $(SUN_CC_FLAGS) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -222,20 +225,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng using gcc (generic, static library)
|
||||
# Copyright (C) 2002, 2006-2009 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2000 Cosmin Truta
|
||||
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -21,7 +21,7 @@ RANLIB = ranlib
|
||||
RM_F = rm -f
|
||||
LN_SF = ln -f -s
|
||||
|
||||
LIBNAME=libpng16
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
|
||||
prefix=/usr/local
|
||||
@@ -41,42 +41,37 @@ DESTDIR=
|
||||
DI=$(DESTDIR)$(INCPATH)
|
||||
DL=$(DESTDIR)$(LIBPATH)
|
||||
|
||||
CDEBUG = -g -DPNG_DEBUG=5
|
||||
LDDEBUG =
|
||||
CRELEASE = -O2
|
||||
LDRELEASE = -s
|
||||
WARNMORE=-W -Wall
|
||||
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
|
||||
LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm $(LDRELEASE)
|
||||
|
||||
# File extensions
|
||||
O=.o
|
||||
A=.a
|
||||
E=
|
||||
WARNMORE =
|
||||
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
|
||||
LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
# Variables
|
||||
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
|
||||
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
||||
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
||||
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
||||
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
||||
|
||||
# Targets
|
||||
all: $(LIBNAME)$(A) pngtest$(E)
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: $(LIBNAME).a pngtest$(E)
|
||||
|
||||
include scripts/pnglibconf.mak
|
||||
REMOVE = $(RM_F)
|
||||
DFNFLAGS = $(DEFS) $(CPPFLAGS)
|
||||
|
||||
$(LIBNAME)$(A): $(OBJS)
|
||||
$(LIBNAME).a: $(OBJS)
|
||||
$(AR_RC) $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
test: pngtest$(E)
|
||||
./pngtest$(E)
|
||||
|
||||
pngtest$(E): pngtest$(O) $(LIBNAME)$(A)
|
||||
$(LD) -o $@ pngtest$(O) $(LDFLAGS)
|
||||
pngtest$(E): pngtest.o $(LIBNAME).a
|
||||
$(LD) -o $@ pngtest.o $(LDFLAGS)
|
||||
|
||||
install: $(LIBNAME)$(A)
|
||||
install: $(LIBNAME).a
|
||||
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
||||
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
||||
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
||||
@@ -92,30 +87,30 @@ install: $(LIBNAME)$(A)
|
||||
$(DI)/$(LIBNAME)/pnglibconf.h
|
||||
-@$(RM_F) -r $(DI)/libpng
|
||||
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
||||
-@$(RM_F) $(DL)/$(LIBNAME)$(A)
|
||||
-@$(RM_F) $(DL)/libpng$(A)
|
||||
cp $(LIBNAME)$(A) $(DL)/$(LIBNAME)$(A)
|
||||
chmod 644 $(DL)/$(LIBNAME)$(A)
|
||||
(cd $(DL); $(LN_SF) $(LIBNAME)$(A) libpng$(A))
|
||||
-@$(RM_F) $(DL)/$(LIBNAME).a
|
||||
-@$(RM_F) $(DL)/libpng.a
|
||||
cp $(LIBNAME).a $(DL)/$(LIBNAME).a
|
||||
chmod 644 $(DL)/$(LIBNAME).a
|
||||
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
||||
(cd $(DI); $(LN_SF) libpng/* .;)
|
||||
|
||||
clean:
|
||||
$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png pnglibconf.h
|
||||
$(RM_F) *.o $(LIBNAME).a pngtest pngout.png pnglibconf.h
|
||||
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -9,9 +9,10 @@
|
||||
# Modified for LC56/ATARI assumes libz.lib is in same dir and uses default
|
||||
# rules for library management
|
||||
#
|
||||
CFLAGS=-I..\zlib -O
|
||||
CPPFLAGS = -I..\zlib
|
||||
CFLAGS = -O
|
||||
LBR = png.lib
|
||||
LDFLAGS=-lpng -lz -lm
|
||||
LDFLAGS = -L. -L..\zlib -lpng -lz -lm
|
||||
|
||||
# where make install puts libpng.a and png.h
|
||||
prefix=/usr/local
|
||||
@@ -36,6 +37,9 @@ OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
||||
|
||||
all: $(LBR) pngtest.ttp
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
$(LBR): $(OBJS)
|
||||
|
||||
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
|
||||
|
||||
@@ -43,7 +43,8 @@ LDEBUG=$(LDEBUG) -N
|
||||
# -d merge duplicate strings
|
||||
# -k- turn off standard stack frame
|
||||
# -w display all warnings
|
||||
CFLAGS=-I$(ZLIB_DIR) -O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
|
||||
CPPFLAGS=-I$(ZLIB_DIR)
|
||||
CFLAGS=-O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
|
||||
|
||||
# -M generate map file
|
||||
LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
|
||||
@@ -89,10 +90,11 @@ LIBNAME=libpng.lib
|
||||
# Braces let make "batch" calls to the compiler,
|
||||
# 2 calls instead of 12; space is important.
|
||||
.c.obj:
|
||||
$(CC) $(CFLAGS) -c {$*.c }
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
|
||||
|
||||
.c.exe:
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib.lib $(NOEHLIB)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
|
||||
$(LIBNAME) zlib.lib $(NOEHLIB)
|
||||
|
||||
.obj.exe:
|
||||
$(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB)
|
||||
@@ -114,21 +116,21 @@ test: pngtest.exe
|
||||
pnglibconf.h: scripts\pnglibconf.h.prebuilt
|
||||
copy scripts\pnglibconf.h.prebuilt $@
|
||||
|
||||
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtest.obj: pngtest.c png.h pngconf.h pnglibconf.h
|
||||
|
||||
$(LIBNAME): $(OBJS)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# makefile for libpng on BeOS x86 ELF with gcc
|
||||
# modified from makefile.linux by Sander Stoks
|
||||
# Copyright (C) 2002, 2006, 2008, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1999 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
#
|
||||
@@ -40,8 +40,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
|
||||
# On BeOS, -O1 is actually better than -O3. This is a known bug but it's
|
||||
# still here in R4.5
|
||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O1 -funroll-loops \
|
||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=-W -Wall -O1 -funroll-loops $(ALIGN) # $(WARNMORE) -g
|
||||
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz
|
||||
LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz
|
||||
|
||||
@@ -76,6 +76,9 @@ OBJSDLL = $(OBJS)
|
||||
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
# try include scripts/pnglibconf.mak for more options
|
||||
@@ -176,14 +179,14 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) $(CFLAGS) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) $(CFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) -Wl,-rpath $(ZLIBLIB):$(DL) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtestd pngtest.png
|
||||
|
||||
test-installed:
|
||||
$(CC) $(CFLAGS) \
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -196,20 +199,20 @@ clean:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -51,7 +51,8 @@ LDEBUG=$(LDEBUG) -N
|
||||
# -w set all warnings on
|
||||
# -O2 optimize for speed
|
||||
# -Z global optimization
|
||||
CFLAGS=-O2 -Z -X- -w -I$(ZLIB_DIR) -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
|
||||
CPPFLAGS=-I$(ZLIB_DIR)
|
||||
CFLAGS=-O2 -Z -X- -w -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
|
||||
|
||||
# -M generate map file
|
||||
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
|
||||
@@ -99,10 +100,11 @@ LIBNAME=libpng$(MODEL).lib
|
||||
# Braces let make "batch" calls to the compiler,
|
||||
# 2 calls instead of 12; space is important.
|
||||
.c.obj:
|
||||
$(CC) $(CFLAGS) -c {$*.c }
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
|
||||
|
||||
.c.exe:
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
|
||||
$(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
|
||||
|
||||
## Major targets
|
||||
|
||||
@@ -121,21 +123,21 @@ test: pngtest$(MODEL).exe
|
||||
|
||||
## Minor Targets
|
||||
|
||||
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
$(LIBNAME): $(OBJS)
|
||||
-del $(LIBNAME)
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
|
||||
VERMAJ = 1
|
||||
VERMIN = 6
|
||||
VERMIC = 1
|
||||
VERMIC = 9
|
||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||
NAME = libpng
|
||||
PACKAGE = $(NAME)-$(VER)
|
||||
|
||||
BIN = libpng16-0.dll
|
||||
LIB = libpng16.a libpng16.dll.a libpng.a libpng.dll.a
|
||||
INCLUDE = png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
INCLUDE = png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
PC = libpng16.pc libpng.pc
|
||||
|
||||
MANIFESTVERBIN = "Libpng-$(VER): Binary files"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng on Darwin / Mac OS X
|
||||
# Copyright (C) 2002, 2004, 2006, 2008, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2004, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2001 Christoph Pfisterer
|
||||
# derived from makefile.linux:
|
||||
# Copyright (C) 1998, 1999 Greg Roelofs
|
||||
@@ -37,8 +37,9 @@ RANLIB=ranlib
|
||||
RM_F=/bin/rm -f
|
||||
ARCH=-arch ppc -arch i386 -arch x86_64
|
||||
|
||||
# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops
|
||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops $(ARCH)
|
||||
CPPFLAGS=-I$(ZLIBINC)
|
||||
# CFLAGS=-W -Wall -O3 -funroll-loops
|
||||
CFLAGS=-W -Wall -O -funroll-loops $(ARCH)
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz $(ARCH)
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
@@ -69,8 +70,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fno-common -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -176,14 +180,14 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtestd pngtest.png
|
||||
|
||||
test-installed:
|
||||
$(CC) $(CFLAGS) \
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -199,20 +203,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng on DEC Alpha Unix
|
||||
# Copyright (C) 2000-2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2000-2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -53,13 +53,17 @@ DM=$(DESTDIR)$(MANPATH)
|
||||
ZLIBLIB=../zlib
|
||||
ZLIBINC=../zlib
|
||||
|
||||
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=-std -w1 -O # -g
|
||||
LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
|
||||
|
||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -161,7 +165,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -w1 -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -w1 -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -170,7 +174,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -w1 -I$(ZLIBINC) \
|
||||
$(CC) -w1 $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) -R$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -183,20 +187,20 @@ clean:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# DJGPP (DOS gcc) makefile for libpng
|
||||
# Copyright (C) 2002, 2006, 2009-2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2009-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -13,7 +13,8 @@ INCPATH=$(prefix)/include
|
||||
LIBPATH=$(prefix)/lib
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-I../zlib -O -DPNG_NO_SNPRINTF
|
||||
CPPFLAGS=-I../zlib -DPNG_NO_SNPRINTF
|
||||
CFLAGS=-O
|
||||
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
||||
|
||||
RANLIB=ranlib
|
||||
@@ -22,6 +23,9 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o pngwtran.o \
|
||||
pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a pngtest
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -43,20 +47,20 @@ clean:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
|
||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs
|
||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs
|
||||
# and Glenn Randers-Pehrson
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
#
|
||||
@@ -54,8 +54,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
|
||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||
|
||||
CFLAGS=-W -Wall -D_REENTRANT -O2 \
|
||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
CPPFLAGS=-D_REENTRANT # -DPNG_DEBUG=5
|
||||
CFLAGS=-W -Wall -O2 $(ALIGN) # $(WARNMORE) -g
|
||||
|
||||
LDFLAGS=-L. -lpng16
|
||||
LDFLAGS_A=libpng.a -lz -lm
|
||||
@@ -90,6 +90,9 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||
|
||||
@@ -111,7 +114,7 @@ libpng.pc:
|
||||
-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
|
||||
|
||||
libpng.syms: png.h pngconf.h pnglibconf.h
|
||||
$(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\
|
||||
awk -F '[\t [\\]();]' -v PNGMAJ=$(PNGMAJ) 'BEGIN{printf("PNG16_%s {global:\n",PNGMAJ)}\
|
||||
{ for (i=1;i+2<=NF;++i)\
|
||||
if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\
|
||||
@@ -220,14 +223,14 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtestd pngtest.png
|
||||
|
||||
test-installed:
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -244,20 +247,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# makefile for libpng under FreeBSD
|
||||
# Copyright (C) 2014 Glenn Randers-Pehrson and Andrey A. Chernov
|
||||
# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -17,7 +18,7 @@ NO_OBJ= YES
|
||||
# where make install puts libpng.a and png.h
|
||||
DESTDIR= ${PREFIX}
|
||||
LIBDIR= /lib
|
||||
INCS= png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
INCS= png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
INCSDIR= /include/libpng
|
||||
INCDIR= ${INCSDIR} # for 4.x bsd.lib.mk
|
||||
MAN= libpng.3 libpngpf.3 png.5
|
||||
@@ -30,17 +31,21 @@ SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \
|
||||
ZLIBLIB= /usr/lib
|
||||
ZLIBINC= /usr/include
|
||||
|
||||
LDADD+= -lm -lz
|
||||
#LDADD+= -lm -lz -lssp_nonshared # for OSVERSION < 800000 ?
|
||||
LDADD+= -lm -lz
|
||||
#LDADD+= -lm -lz -lssp_nonshared # for OSVERSION < 800000 ?
|
||||
|
||||
DPADD+= ${LIBM} ${LIBZ}
|
||||
DPADD+= ${LIBM} ${LIBZ}
|
||||
|
||||
CFLAGS+= -I. -I${ZLIBINC}
|
||||
CPPFLAGS+= -I. -I${ZLIBINC}
|
||||
CFLAGS+= -W -Wall
|
||||
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
pngtest: pngtest.o libpng.a
|
||||
${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -L${ZLIBLIB} \
|
||||
-lpng ${LDADD}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng using gcc (generic, static library)
|
||||
# Copyright (C) 2008 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2000 Cosmin Truta
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
@@ -18,25 +18,21 @@ AR_RC = ar rcs
|
||||
RANLIB = ranlib
|
||||
RM_F = rm -f
|
||||
|
||||
CDEBUG = -g -DPNG_DEBUG=5
|
||||
LDDEBUG =
|
||||
CRELEASE = -O2
|
||||
LDRELEASE = -s
|
||||
#CFLAGS = -W -Wall $(CDEBUG)
|
||||
CFLAGS = -W -Wall $(CRELEASE)
|
||||
#LDFLAGS = $(LDDEBUG)
|
||||
LDFLAGS = $(LDRELEASE)
|
||||
WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
|
||||
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
|
||||
LDFLAGS =
|
||||
LIBS = -lz -lm
|
||||
|
||||
# File extensions
|
||||
O=.o
|
||||
A=.a
|
||||
EXE=
|
||||
EXEEXT =
|
||||
|
||||
# Variables
|
||||
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
|
||||
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
||||
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
||||
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
||||
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
||||
|
||||
# Targets
|
||||
all: static
|
||||
@@ -45,43 +41,43 @@ all: static
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
cp scripts/pnglibconf.h.prebuilt $@
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) -I$(ZLIBINC) $<
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
static: libpng$(A) pngtest$(EXE)
|
||||
static: libpng.a pngtest$(EXEEXT)
|
||||
|
||||
shared:
|
||||
@echo This is a generic makefile that cannot create shared libraries.
|
||||
@echo Please use a configuration that is specific to your platform.
|
||||
@false
|
||||
|
||||
libpng$(A): $(OBJS)
|
||||
libpng.a: $(OBJS)
|
||||
$(AR_RC) $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
test: pngtest$(EXE)
|
||||
./pngtest$(EXE)
|
||||
test: pngtest$(EXEEXT)
|
||||
./pngtest$(EXEEXT)
|
||||
|
||||
pngtest$(EXE): pngtest$(O) libpng$(A)
|
||||
$(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest$(O) libpng$(A) $(LIBS)
|
||||
pngtest$(EXEEXT): pngtest.o libpng.a
|
||||
$(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png pnglibconf.h
|
||||
$(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h
|
||||
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
|
||||
# Copyright (C) 1999-2002, 2006, 2009, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1999-2002, 2006, 2009, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
||||
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
||||
#
|
||||
@@ -36,11 +36,11 @@ LN_SF=ln -sf
|
||||
RANLIB=ranlib
|
||||
RM_F=/bin/rm -f
|
||||
|
||||
CFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
|
||||
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
|
||||
CPPFLAGS=-I$(ZLIBINC) \
|
||||
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_UNISTD_H -DUSE_MMAP
|
||||
CFLAGS=-O -Ae -Wl,+vnocompatwarnings +DD64 +Z
|
||||
# Caution: be sure you have built zlib with the same CFLAGS.
|
||||
CCFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
|
||||
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
|
||||
CCFLAGS=-O -Ae -Wl,+vnocompatwarnings +DD64 +Z
|
||||
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
|
||||
@@ -75,8 +75,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) +z -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -179,7 +182,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -188,7 +191,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) $(CCFLAGS) \
|
||||
$(CC) $(CPPFLAGS) $(CCFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -205,20 +208,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
|
||||
# Copyright (C) 2002, 2006-2008, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2001, Laurent faillie
|
||||
# Copyright (C) 1998, 1999 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
@@ -53,8 +53,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
|
||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||
|
||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
|
||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=-W -Wall -O3 -funroll-loops $(ALIGN) # $(WARNMORE) -g
|
||||
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
@@ -86,8 +86,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -185,7 +188,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -194,7 +197,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -211,20 +214,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
|
||||
# Copyright (C) 1999-2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
||||
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
||||
#
|
||||
@@ -14,7 +14,8 @@ ZLIBINC=/opt/zlib/include
|
||||
# Note that if you plan to build a libpng shared library, zlib must also
|
||||
# be a shared library, which zlib's configure does not do. After running
|
||||
# zlib's configure, edit the appropriate lines of makefile to read:
|
||||
# CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
|
||||
# CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP
|
||||
# CFLAGS=-O1 -fPIC
|
||||
# LDSHARED=ld -b
|
||||
# SHAREDLIB=libz.sl
|
||||
|
||||
@@ -44,9 +45,10 @@ LIBPATH=$(exec_prefix)/lib
|
||||
MANPATH=$(prefix)/man
|
||||
BINPATH=$(exec_prefix)/bin
|
||||
|
||||
CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
|
||||
CPPFLAGS=-I$(ZLIBINC)
|
||||
CFLAGS=-O -Ae +DA1.1 +DS2.0
|
||||
# Caution: be sure you have built zlib with the same CFLAGS.
|
||||
CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
|
||||
CCFLAGS=-O -Ae +DA1.1 +DS2.0
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
|
||||
# override DESTDIR= on the make install command line to easily support
|
||||
@@ -72,8 +74,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) +z -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -176,7 +181,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -185,7 +190,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) $(CCFLAGS) \
|
||||
$(CC) $(CPPFLAGS) $(CCFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -202,20 +207,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile for libpng (static)
|
||||
# IBM C version 3.x for Win32 and OS/2
|
||||
# Copyright (C) 2006 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2006, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2000 Cosmin Truta
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -23,7 +23,8 @@ LD = ilink
|
||||
AR = ilib
|
||||
RM = del
|
||||
|
||||
CFLAGS = -I$(ZLIBINC) -Mc -O2 -W3
|
||||
CPPFLAGS = -I$(ZLIBINC)
|
||||
CFLAGS = -Mc -O2 -W3
|
||||
LDFLAGS =
|
||||
|
||||
# File extensions
|
||||
@@ -39,6 +40,9 @@ OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||
LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A)
|
||||
|
||||
# Targets
|
||||
.c$(O):
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
all: libpng$(A) pngtest$(E)
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -63,20 +67,20 @@ clean:
|
||||
$(RM) pngtest$(E)
|
||||
$(RM) pngout.png
|
||||
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for libpng
|
||||
# Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later
|
||||
|
||||
# Copyright (C) 2006 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2006, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
|
||||
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
@@ -32,7 +32,8 @@ CALLING=r # __fastcall
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
CC=icl -c
|
||||
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) -nologo
|
||||
CPPFLAGS=-I$(ZLIBINC)
|
||||
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -nologo
|
||||
LD=link
|
||||
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
|
||||
|
||||
@@ -48,50 +49,50 @@ all: test
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
cp scripts/pnglibconf.h.prebuilt $@
|
||||
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
libpng.lib: $(OBJS)
|
||||
if exist libpng.lib del libpng.lib
|
||||
@@ -101,7 +102,7 @@ pngtest.exe: pngtest.obj libpng.lib
|
||||
$(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
|
||||
|
||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
test: pngtest.exe
|
||||
pngtest.exe
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2009, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -26,14 +26,15 @@ LIBPATH=$(prefix)/lib
|
||||
# you execute make install.
|
||||
DESTDIR=
|
||||
|
||||
CC=cc
|
||||
CFLAGS=-I../zlib -O
|
||||
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
||||
CC = cc
|
||||
CPPFLAGS = -I../zlib
|
||||
CFLAGS = -O
|
||||
LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
|
||||
# flags for ansi2knr
|
||||
ANSI2KNRFLAGS=
|
||||
|
||||
RANLIB=ranlib
|
||||
#RANLIB=echo
|
||||
RANLIB = ranlib
|
||||
#RANLIB = echo
|
||||
|
||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
@@ -48,12 +49,12 @@ pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
# general rule to allow ansi2knr to work
|
||||
.c.o:
|
||||
./ansi2knr $*.c T$*.c
|
||||
$(CC) $(CFLAGS) -c T$*.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
|
||||
rm -f T$*.c $*.o
|
||||
mv T$*.o $*.o
|
||||
|
||||
ansi2knr: ansi2knr.c
|
||||
$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
|
||||
|
||||
libpng.a: ansi2knr $(OBJS)
|
||||
ar rc $@ $(OBJS)
|
||||
@@ -90,20 +91,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
|
||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and
|
||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
|
||||
# Glenn Randers-Pehrson
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
#
|
||||
@@ -10,7 +10,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 1
|
||||
RELEASE = 9
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).so
|
||||
@@ -48,7 +48,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
|
||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||
|
||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops \
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS= -W -Wall -O3 -funroll-loops \
|
||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
|
||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
||||
@@ -82,6 +83,9 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||
|
||||
@@ -196,14 +200,14 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtestd pngtest.png
|
||||
|
||||
test-installed:
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -220,20 +224,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) Glenn Randers-Pehrson
|
||||
# Copyright (C) 1998-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -22,7 +22,8 @@ LIBPATH=$(prefix)/lib
|
||||
DESTDIR=
|
||||
|
||||
CC=cc
|
||||
CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
|
||||
CPPFLAGS=-I../zlib -DSYSV -Dmips
|
||||
CFLAGS=-O -systype sysv -w
|
||||
#CFLAGS=-O
|
||||
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
||||
|
||||
@@ -33,6 +34,9 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a pngtest
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -75,20 +79,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
# Copyright (C) 2006, 2009 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2006, 2009, 2014 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
# -------- Microsoft C 5.1 and later, does not use assembler code --------
|
||||
MODEL=L
|
||||
CFLAGS=-Oait -Gs -nologo -W3 -A$(MODEL) -I..\zlib
|
||||
CPPFLAGS=-I..\zlib
|
||||
CFLAGS=-Oait -Gs -nologo -W3 -A$(MODEL)
|
||||
#-Ox generates bad code with MSC 5.1
|
||||
CC=cl
|
||||
LD=link
|
||||
@@ -31,50 +32,50 @@ all: libpng.lib
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
cp scripts/pnglibconf.h.prebuilt $@
|
||||
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
||||
del libpng.lib
|
||||
@@ -83,7 +84,7 @@ libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
||||
lib libpng $(OBJS3);
|
||||
|
||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||
|
||||
pngtest.exe: pngtest.obj libpng.lib
|
||||
$(LD) $(LDFLAGS) pngtest.obj,,,libpng.lib ..\zlib\zlib.lib ;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
|
||||
#
|
||||
# Portions taken from makefile.linux:
|
||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and
|
||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
|
||||
# Glenn Randers-Pehrson
|
||||
# Copyright (C) 2000 Cosmin Truta
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
@@ -18,7 +18,7 @@ exec_prefix=$(prefix)
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 1
|
||||
RELEASE = 9
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).dll
|
||||
@@ -44,20 +44,13 @@ LN_SF=ln -sf
|
||||
#ARCH = -march=pentium3
|
||||
#ARCH = -march=i686
|
||||
ARCH =
|
||||
CDEBUG = -g -DPNG_DEBUG=5
|
||||
LDDEBUG =
|
||||
CRELEASE = -O2
|
||||
LDRELEASE = -s
|
||||
#CFLAGS = -W -Wall $(CDEBUG)
|
||||
CFLAGS = -W -Wall $(CRELEASE) $(ARCH)
|
||||
#LDFLAGS = $(LDDEBUG)
|
||||
LDFLAGS = $(LDRELEASE)
|
||||
CPPFLAGS = # -DPNG_DEBUG=5
|
||||
CFLAGS = -W -Wall -O2 $(ARCH) # -g
|
||||
LDFLAGS =
|
||||
LIBS = -lz -lm
|
||||
|
||||
# File extensions
|
||||
O=.o
|
||||
A=.a
|
||||
EXE=.exe
|
||||
EXEEXT=.exe
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
LIBPATH=$(exec_prefix)/lib
|
||||
@@ -81,9 +74,9 @@ DL=$(DESTDIR)$(LIBPATH)
|
||||
DM=$(DESTDIR)$(MANPATH)
|
||||
|
||||
# Variables
|
||||
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
|
||||
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
||||
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
||||
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
||||
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
||||
|
||||
# Targets
|
||||
all: static shared
|
||||
@@ -92,10 +85,10 @@ all: static shared
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
cp scripts/pnglibconf.h.prebuilt $@
|
||||
|
||||
.c$(O):
|
||||
$(CC) -c $(CFLAGS) -I$(ZLIBINC) $<
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||
|
||||
static: libpng$(A) pngtest$(EXE)
|
||||
static: libpng.a pngtest$(EXEEXT)
|
||||
|
||||
shared: $(LIBSOMAJ)
|
||||
$(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
|
||||
@@ -106,7 +99,7 @@ $(LIBSO): $(LIBSOMAJ)
|
||||
$(LIBSOMAJ):
|
||||
$(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
|
||||
|
||||
libpng$(A): $(OBJS)
|
||||
libpng.a: $(OBJS)
|
||||
$(AR_RC) $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
@@ -175,30 +168,30 @@ install-config: libpng-config
|
||||
|
||||
install: install-static install-shared install-man install-config
|
||||
|
||||
test: pngtest$(EXE)
|
||||
./pngtest$(EXE)
|
||||
test: pngtest$(EXEEXT)
|
||||
./pngtest$(EXEEXT)
|
||||
|
||||
pngtest$(EXE): pngtest$(O) libpng$(A)
|
||||
$(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest$(O) libpng$(A) $(LIBS)
|
||||
pngtest$(EXEEXT): pngtest.o libpng.a
|
||||
$(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png pnglibconf.h $(LIBSO) \
|
||||
$(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h $(LIBSO) \
|
||||
$(LIBSOMAJ) libpng-config
|
||||
|
||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# make obj && make depend && make && make test
|
||||
# make includes && make install
|
||||
# Copyright (C) 2002 Patrick R.L. Welche
|
||||
# Copyright (C) 2007, 2009 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2007, 2009, 2014 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
|
||||
|
||||
LIB= png16
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.6.1
|
||||
SHLIB_MINOR= 1.6.9
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
@@ -34,6 +34,9 @@ CPPFLAGS+=-I${.CURDIR}
|
||||
|
||||
CLEANFILES+=pngtest.o pngtest pnglibconf.h
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
cp scripts/pnglibconf.h.prebuilt $@
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# make obj && make depend && make && make test
|
||||
# make includes && make install
|
||||
# Copyright (C) 2002 Patrick R.L. Welche
|
||||
# Copyright (C) 2007-2009 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
||||
|
||||
LIB= png
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.1
|
||||
SHLIB_MINOR= 1.6.9
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
@@ -34,6 +34,9 @@ CPPFLAGS+=-I${.CURDIR}
|
||||
|
||||
CLEANFILES+=pngtest.o pngtest pnglibconf.h
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
cp scripts/pnglibconf.h.prebuilt $@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
# Copyright (C) 2007-2009 Glenn Randers-Pehrson
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.1
|
||||
SHLIB_MINOR= 1.6.9
|
||||
|
||||
LIB= png
|
||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||
@@ -28,8 +28,11 @@ NOPROFILE= Yes
|
||||
CLEANFILES+= pngtest.o pngtest pnglibconf.h
|
||||
|
||||
MAN= libpng.3 libpngpf.3 png.5
|
||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
|
||||
libpng-manual.txt
|
||||
DOCS= ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
|
||||
libpng-manual.txt
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
|
||||
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
|
||||
# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1998 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
#
|
||||
@@ -37,7 +37,8 @@ exec_prefix=$(prefix)
|
||||
ZLIBLIB=../zlib
|
||||
ZLIBINC=../zlib
|
||||
|
||||
CFLAGS= -dy -belf -I$(ZLIBINC) -O3
|
||||
CPPFLAGS=-I$(ZLIBINC)
|
||||
CFLAGS= -dy -belf -O3
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
@@ -68,8 +69,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -175,14 +179,14 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) $(CFLAGS) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtestd pngtest.png
|
||||
|
||||
test-installed:
|
||||
$(CC) $(CFLAGS) \
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
@@ -199,20 +203,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
|
||||
# Copyright (C) 2001-2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2001-2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -42,8 +42,9 @@ ZLIBINC=../zlib
|
||||
# See "man abi". zlib must be built with the same ABI.
|
||||
ABI=
|
||||
|
||||
WARNMORE= # -g -DPNG_DEBUG=5
|
||||
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -fPIC -mabi=n32
|
||||
WARNMORE=
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g
|
||||
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
|
||||
-set_version sgi$(PNGMAJ).0
|
||||
@@ -74,6 +75,9 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a pngtest shared libpng.pc libpng-config
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -182,7 +186,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) \
|
||||
-rpath $(ZLIBLIB):$(DL) \
|
||||
@@ -192,7 +196,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) \
|
||||
-rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
|
||||
@@ -209,20 +213,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
|
||||
# Copyright (C) 2001-2002, 2006, 2007, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2001-2002, 2006, 2007, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -44,8 +44,9 @@ ABI=
|
||||
|
||||
WARNMORE=-fullwarn
|
||||
# Note: -KPIC is the default anyhow
|
||||
#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC # -g -DPNG_DEBUG=5
|
||||
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE)
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
#CFLAGS= $(ABI) -O $(WARNMORE) -KPIC # -g
|
||||
CFLAGS=$(ABI) -O $(WARNMORE)
|
||||
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
||||
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
|
||||
@@ -77,6 +78,9 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a pngtest shared libpng.pc libpng-config
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -182,7 +186,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) \
|
||||
-rpath $(ZLIBLIB):$(DL) \
|
||||
@@ -192,7 +196,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) \
|
||||
-rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
|
||||
@@ -210,20 +214,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# makefile for libpng on Solaris 9 (beta) with Forte cc
|
||||
# Updated by Chad Schrock for Solaris 9
|
||||
# Contributed by William L. Sebok, based on makefile.linux
|
||||
# Copyright (C) 2002, 2006, 2008, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1998-2001 Greg Roelofs
|
||||
# Copyright (C) 1996-1997 Andreas Dilger
|
||||
#
|
||||
@@ -46,8 +46,9 @@ ZLIBINC=/usr/include
|
||||
#WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||
#CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
|
||||
CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
#CFLAGS=-W -Wall -O3 $(WARNMORE) -g
|
||||
CFLAGS=-O3
|
||||
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
@@ -78,8 +79,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -194,7 +198,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
|
||||
@@ -203,7 +207,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
-L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -220,20 +224,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng on Solaris 2.x with gcc
|
||||
# Copyright (C) 2004, 2006-2008, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2004, 2006-2008, 2010-2014 Glenn Randers-Pehrson
|
||||
# Contributed by William L. Sebok, based on makefile.linux
|
||||
# Copyright (C) 1998 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
@@ -42,7 +42,8 @@ ZLIBINC=/usr/local/include
|
||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O \
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS= -W -Wall -O \
|
||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
@@ -74,8 +75,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||
|
||||
@@ -191,7 +195,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
|
||||
@@ -200,7 +204,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
-L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -217,20 +221,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng on Solaris 2.x with gcc
|
||||
# Copyright (C) 2004, 2006-2008, 2010-2011 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2004, 2006-2008, 2010-2014 Glenn Randers-Pehrson
|
||||
# Contributed by William L. Sebok, based on makefile.linux
|
||||
# Copyright (C) 1998 Greg Roelofs
|
||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||
@@ -42,8 +42,8 @@ ZLIBINC=/usr/local/include
|
||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O \
|
||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=-W -Wall -O # $(WARNMORE) -g
|
||||
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
@@ -74,6 +74,9 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||
|
||||
@@ -191,7 +194,7 @@ install: install-static install-shared install-man install-config
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
|
||||
@@ -200,7 +203,7 @@ test-dd:
|
||||
test-installed:
|
||||
echo
|
||||
echo Testing installed dynamic shared library.
|
||||
$(CC) -I$(ZLIBINC) \
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||
-L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||
@@ -217,20 +220,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -27,12 +27,12 @@ DESTDIR=
|
||||
ZLIBLIB=../zlib
|
||||
ZLIBINC=../zlib
|
||||
|
||||
CC=cc
|
||||
AR_RC=ar rc
|
||||
MKDIR_P=mkdir
|
||||
LN_SF=ln -sf
|
||||
RANLIB=ranlib
|
||||
RM_F=rm -f
|
||||
CC = cc
|
||||
AR_RC = ar rc
|
||||
MKDIR_P = mkdir
|
||||
LN_SF = ln -sf
|
||||
RANLIB = ranlib
|
||||
RM_F = rm -f
|
||||
AWK = awk
|
||||
SED = sed
|
||||
CPP = $(CC) -E
|
||||
@@ -40,13 +40,17 @@ ECHO = echo
|
||||
|
||||
DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
|
||||
DFA_EXTRA = # extra files that can be used to control configuration
|
||||
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS = -O # -g
|
||||
LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
|
||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a pngtest
|
||||
|
||||
# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
|
||||
@@ -105,20 +109,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# makefile for libpng
|
||||
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
|
||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
@@ -39,13 +39,17 @@ LN_SF=ln -f -s
|
||||
RANLIB=ranlib
|
||||
RM_F=/bin/rm -f
|
||||
|
||||
CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -DPNG_DEBUG=5
|
||||
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||
CFLAGS=-O # $(WARNMORE)
|
||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||
|
||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
all: libpng.a pngtest
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
@@ -88,20 +92,20 @@ writelock:
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user