提交 7e3a82cd 编写于 作者: G Glenn Randers-Pehrson

[master] Imported from libpng-1.4.0.tar

上级 115817d1
此差异已折叠。
此差异已折叠。
......@@ -8,15 +8,15 @@ endif()
project(PNG C)
enable_testing()
# Copyright (C) 2007 Glenn Randers-Pehrson
# Copyright (C) 2007-2010 Glenn Randers-Pehrson
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 2)
set(PNGLIB_RELEASE 42)
set(PNGLIB_MINOR 4)
set(PNGLIB_RELEASE 0)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
......@@ -96,6 +96,7 @@ set(CMAKE_DEBUG_POSTFIX "d")
set(libpng_sources
png.h
pngconf.h
pngpriv.h
png.c
pngerror.c
pngget.c
......@@ -128,9 +129,6 @@ if(PNG_SHARED OR NOT MSVC)
add_definitions(-DZLIB_DLL)
endif()
add_definitions(-DLIBPNG_NO_MMX)
add_definitions(-DPNG_NO_MMX_CODE)
if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
endif()
......@@ -193,21 +191,21 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
configure_file(${PNG_SOURCE_DIR}/libpng.pc.in
${PNG_BINARY_DIR}/libpng.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
configure_file(${PNG_SOURCE_DIR}/libpng-config.in
${PNG_BINARY_DIR}/libpng-config)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
configure_file(${PNG_SOURCE_DIR}/libpng.pc.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
configure_file(${PNG_SOURCE_DIR}/libpng-config.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}-config)
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.2.42
VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0
# VERSION 14.${PNGLIB_RELEASE}.1.4.0
VERSION 14.${PNGLIB_RELEASE}.0
SOVERSION 14
CLEAN_DIRECT_OUTPUT 1)
endif()
if(PNG_STATIC)
......@@ -235,8 +233,8 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES png.h pngconf.h DESTINATION include)
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
install(FILES png.h pngconf.h pngpriv.h DESTINATION include)
install(FILES png.h pngconf.h pngpriv.h DESTINATION include/${PNGLIB_NAME})
endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${PNG_BINARY_DIR}/libpng-config DESTINATION bin)
......
Installing libpng version 1.2.42 - January 3, 2010
Installing libpng version 1.4.0 - January 3, 2010
On Unix/Linux and similar systems, you can simply type
......@@ -46,7 +46,7 @@ to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-1.2.42" or "libpng12" and "zlib-1.2.3"
might be called "libpng-1.4.0" or "libpng14" and "zlib-1.2.3"
or "zlib123") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
......@@ -141,23 +141,3 @@ instead, as demonstrated in contrib/visupng of the libpng distribution.
Further information can be found in the README and libpng.txt
files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5.
Using the ./configure script -- 16 December 2002.
=================================================
The ./configure script should work compatibly with what scripts/makefile.*
did, however there are some options you need to add to configure explicitly,
which previously was done semi-automatically (if you didn't edit
scripts/makefile.* yourself, that is)
CFLAGS="-Wall -O -funroll-loops \
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
You can alternatively specify --includedir=/usr/include, /usr/local/include,
/usr/include/png12, or whatever.
Known bugs in libpng version 1.2.42
1. December 4, 2009: The PNG_NO_ERROR_NUMBERS macro was inadvertently
defined in libpng-1.2.41/pngconf.h, which may cause a problem with
building a binary-compatible library.
STATUS: This will be fixed in libpng-1.2.42. In the meantime, simply
delete the definition from line :
2. February 23, 2006: The custom makefiles don't build libpng with -lz.
STATUS: This is a subject of debate. The change will probably be made
as a part of a major overhaul of the makefiles in libpng version 1.4.0.
3. February 24, 2006: The Makefile generated by the "configure" script
fails to install symbolic links
libpng12.so => libpng12.so.0.1.2.9betaN
that are generated by the custom makefiles.
4. September 4, 2007: There is a report that pngtest crashes on MacOS 10.
STATUS: workarounds are
1) Compile without optimization (crashes are observed with
-arch i386 and -O2 or -O3, using gcc-4.0.1).
2) Compile pngtest.c with PNG_DEBUG defined (the bug goes away if
you try to look at it).
3) Ignore the crash. The library itself seems to be OK.
......@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.2.42, January 3, 2010, are
Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
libpng versions 1.2.6, August 15, 2004, through 1.4.0, January 3, 2010, 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
......
......@@ -2,9 +2,9 @@
# Source file for Makefile.in (and hence Makefile)
#
# Makefile.am need only be changed on a major version number
# change (e.g. libpng12 --> libpng14). In that case seach
# change (e.g. libpng12 --> libpng13). In that case seach
# this file for every instance of the old base name (libpng12)
# and change to the new one (libpng14), then change the
# and change to the new one (libpng13), then change the
# -version-number settings below so that the new values have
# the correct major part (first field).
......@@ -16,47 +16,42 @@ AUTOMAKE_OPTIONS = foreign
# test programs - run on make check, make distcheck
check_PROGRAMS= pngtest
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng12.la
pngtest_LDADD = libpng14.la
TESTS = test-pngtest.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir)
TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5
# generate the -config scripts if required
binconfigs= libpng12-config
EXTRA_SCRIPTS= libpng-config libpng12-config
binconfigs= libpng14-config
EXTRA_SCRIPTS= libpng-config libpng14-config
bin_SCRIPTS= @binconfigs@
# rules to build libpng, only build the old library on request
lib_LTLIBRARIES=libpng12.la @compatlib@
lib_LTLIBRARIES=libpng14.la
EXTRA_LTLIBRARIES= libpng.la
libpng12_la_SOURCES = png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
libpng14_la_SOURCES = 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 \
png.h pngconf.h
libpng_la_SOURCES = $(libpng12_la_SOURCES)
png.h pngconf.h pngpriv.h
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng12_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng14_la_CPPFLAGS = @LIBPNG_DEFINES@
# MAJOR UPGRADE: the version-number settings below must be changed.
libpng12_la_LDFLAGS = -no-undefined -export-dynamic \
-version-number 0:@PNGLIB_RELEASE@:0
# -rpath is needed as automake doesn't know the directory
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
-version-number 3:@PNGLIB_RELEASE@:0
libpng14_la_LDFLAGS = -no-undefined -export-dynamic \
-version-number 14:@PNGLIB_RELEASE@:0
if HAVE_LD_VERSION_SCRIPT
# Versioned symbols and restricted exports
libpng12_la_LDFLAGS += -Wl,--version-script=libpng.vers
libpng12_la_DEPENDENCIES = libpng.vers
libpng14_la_LDFLAGS += -Wl,--version-script=libpng.vers
libpng14_la_DEPENDENCIES = libpng.vers
else
# Only restricted exports when possible
libpng12_la_LDFLAGS += -export-symbols libpng.sym
libpng12_la_DEPENDENCIES = libpng.sym
libpng14_la_LDFLAGS += -export-symbols libpng.sym
libpng14_la_DEPENDENCIES = libpng.sym
endif
libpng_la_DEPENDENCIES = $(libpng12_la_DEPENDENCIES)
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
......@@ -68,27 +63,26 @@ pkginclude_HEADERS= png.h pngconf.h
# pkg-config stuff, note that libpng.pc is always required in order
# to get the correct library
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libpng12.pc
pkgconfig_DATA = libpng14.pc
#extra source distribution files.
EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/beos/* \
${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \
${srcdir}/projects/wince.txt \
${srcdir}/projects/netware.txt \
${srcdir}/projects/xcode/* \
${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminim/* \
${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
example.c libpng-1.2.42.txt pngvcrd.c
example.c libpng-1.4.0.txt
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \
CLEANFILES= pngout.png libpng14.pc libpng14-config libpng.vers \
libpng.sym
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
......@@ -122,11 +116,12 @@ test: check
install-data-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.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)/pngconf.h \
pngconf.h
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
# do evil things to libpng to cause libpng12 to be used
# do evil things to libpng to cause libpng14 to be used
install-exec-hook:
cd $(DESTDIR)$(bindir); rm -f libpng-config
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
......@@ -143,10 +138,3 @@ uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config
@if test -n "@compatlib@"; then\
set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\
done;\
fi
此差异已折叠。
README for libpng version 1.2.42 - January 3, 2010 (shared library 12.0)
README for libpng version 1.4.0 - January 3, 2010 (shared library 14.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*.7z or lpng*.zip if you want DOS-style
line endings. You can get UNIX-style line endings from the *.zip file
by using "unzip -a" but there seems to be no simple way to recover
UNIX-style line endings from the *.7z file. The *.tar.xz file is
recommended for *NIX users instead.
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.
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
......@@ -58,7 +54,7 @@ to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions
on the png-mng-implement mailing list and not on material submitted
on the PNG-implement mailing list and not on material submitted
privately to Guy, Andreas, or Glenn. They will forward any good
suggestions to the list.
......@@ -81,12 +77,12 @@ 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.simplesystems.org/pub/png/src/
zlib should be available at the same place that libpng is, or at.
ftp://ftp.info-zip.org/pub/infozip/zlib
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/pngdocs.html
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)
......@@ -108,20 +104,21 @@ This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG
development group.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
Send comments/corrections/commendations to png-mng-implement at
lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net
You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will
read mail addressed to the png-mng-implement list, however.
read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to
the (png-mng-misc at lists.sourceforge.net, subscription required, visit
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
subscribe). On the other hand, please do not send libpng questions to
that address, send them to me or to the png-mng-implement list. I'll
the (png-list at ccrc.wustl.edu, subscription required, write to
majordomo at ccrc.wustl.edu with "subscribe png-list" in your message).
On the other hand,
please do not send libpng questions to that address, send them to me
or to the png-implement list. I'll
get them in the end anyway. If you have a question about something
in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng,
......@@ -129,7 +126,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 twelve years now, and it is official and
been discussing PNG for nine 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.
......@@ -144,7 +141,6 @@ Files in this distribution:
TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance
example.c => Example code for using libpng functions
libpng-*-*-diff.txt => Diff from previous release
libpng.3 => manual page for libpng (includes libpng.txt)
libpng.txt => Description of libpng and its functions
libpngpf.3 => manual page for libpng's private functions
......@@ -175,41 +171,26 @@ Files in this distribution:
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
msvctest => Builds and runs pngtest using a MSVC workspace
pngminim => Simple pnm2pngm and png2pnmm programs
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng
projects => Contains project files and workspaces for
building a DLL
beos => Contains a Beos workspace for building libpng
c5builder => Contains a Borland workspace for building
libpng and zlib
netware.txt => Contains instructions for downloading a set
of project files for building libpng and
zlib on Netware.
visualc6 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
wince.txt => Contains instructions for downloading a
Microsoft Visual C++ (Windows CD Toolkit)
workspace for building libpng and zlib on
WindowsCE
xcode => Contains xcode project files
scripts => Directory containing scripts for building libpng:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static
libpng.a)
makefile.elf => Linux/ELF gcc makefile symbol versioning,
creates libpng12.so.0.1.2.42)
makefile.linux => Linux/ELF makefile (gcc, creates
libpng12.so.0.1.2.42)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng12.so.0.1.2.42, previously
used assembler code tuned for Intel MMX
platform)
makefile.gcc => Generic makefile (gcc, creates static
libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files
with ansi2knr (Requires ansi2knr.c from
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng14.so.14.1.4.0)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng14.so.14.1.4.0)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile
......@@ -219,21 +200,21 @@ Files in this distribution:
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2
(static)
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.mingw => Mingw/gcc makefile
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.ne12bsd => NetBSD/cc makefile, makes libpng12.so
makefile.ne14bsd => NetBSD/cc makefile, makes
libpng14.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.42)
(gcc, creates libpng14.so.14.1.4.0)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.42)
(gcc, creates libpng14.so.14.1.4.0)
makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.42)
(gcc, creates libpng14.so.14.1.4.0)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
......@@ -250,13 +231,14 @@ Files in this distribution:
makefile.tc3 => Turbo C 3.0 makefile
makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
later (previously used assembler code tuned
for Intel MMX platform)
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
later (does not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
pngos2.def => OS/2 module definition file used by makefile.os2
png32ce.def => module definition for makefile.cegccg
pngos2.def => OS/2 module definition file used by
makefile.os2
pngwin.def => module definition file used by
makefile.cygwin and makefile.mingw
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
SCOPTIONS.ppc => Used with smakefile.ppc
......@@ -268,7 +250,7 @@ Good luck, and happy coding.
-Andreas Eric Dilger (former maintainer, 1996-1997)
Internet: adilger at enel.ucalgary.ca
Web: http://members.shaw.ca/adilger/
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc)
......
/*
TODO - list of things to do for libpng:
Final bug fixes.
......@@ -17,9 +18,14 @@ Better filter selection
(counting huffman bits/precompression? filter inertia? filter costs?).
Histogram creation.
Text conversion between different code pages (Latin-1 -> Mac and DOS).
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
Build gamma tables using fixed point (and do away with floating point entirely).
Avoid building gamma tables whenever possible.
Use greater precision when changing to linear gamma for compositing against
background and doing rgb-to-gray transformation.
Investigate pre-incremented loop counters and other loop constructions.
Add interpolated method of handling interlacing.
Provide for conditional compilation of 16-bit support (except for the
initial stripping down to 8-bits when reading a 16-bit PNG datastream).
Switch to the simpler zlib (zlib/libpng) license if legally possible.
*/
Y2K compliance in libpng:
=========================
January 3, 2010
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.2.42 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer
that will hold years up to 65535. The other two hold the date in text
format, and will hold years up to 9999.
The integer is
"png_uint_16 year" in png_time_struct.
The strings are
"png_charp time_buffer" in png_struct and
"near_time_buffer", which is a local character string in png.c.
There are seven time-related functions:
png_convert_to_rfc_1123() in png.c
(formerly png_convert_to_rfc_1152() in error)
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
png_convert_from_time_t() in pngwrite.c
png_get_tIME() in pngget.c
png_handle_tIME() in pngrutil.c, called in pngread.c
png_set_tIME() in pngset.c
png_write_tIME() in pngwutil.c, called in pngwrite.c
All appear to handle dates properly in a Y2K environment. The
png_convert_from_time_t() function calls gmtime() to convert from system
clock time, which returns (year - 1900), which we properly convert to
the full 4-digit year. There is a possibility that applications using
libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
function, or that they are incorrectly passing only a 2-digit year
instead of "year - 1900" into the png_convert_from_struct_tm() function,
but this is not under our control. The libpng documentation has always
stated that it works with 4-digit years, and the APIs have been
documented as such.
The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
integer to hold the year, and can hold years as large as 65535.
zlib, upon which libpng depends, is also Y2K compliant. It contains
no date-related code.
Glenn Randers-Pehrson
libpng maintainer
PNG Development Group
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for libpng 1.2.42.
# Generated by GNU Autoconf 2.65 for libpng 1.4.0.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
......@@ -701,8 +701,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.2.42'
PACKAGE_STRING='libpng 1.2.42'
PACKAGE_VERSION='1.4.0'
PACKAGE_STRING='libpng 1.4.0'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
......@@ -746,7 +746,6 @@ ac_includes_default="\
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
compatlib
binconfigs
pkgconfigdir
PNGLIB_RELEASE
......@@ -756,7 +755,6 @@ PNGLIB_VERSION
SYMBOL_PREFIX
HAVE_LD_VERSION_SCRIPT_FALSE
HAVE_LD_VERSION_SCRIPT_TRUE
LIBPNG_NO_MMX
LIBPNG_DEFINES
LIBOBJS
POW_LIB
......@@ -883,7 +881,6 @@ enable_fast_install
enable_libtool_lock
with_pkgconfigdir
with_binconfigs
with_libpng_compat
'
ac_precious_vars='build_alias
host_alias
......@@ -1435,7 +1432,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.2.42 to adapt to many kinds of systems.
\`configure' configures libpng 1.4.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1505,7 +1502,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.2.42:";;
short | recursive ) echo "Configuration of libpng 1.4.0:";;
esac
cat <<\_ACEOF
......@@ -1533,8 +1530,6 @@ Optional Packages:
libdir/pkgconfig)
--with-binconfigs Generate shell libpng-config scripts as well as
pkg-config data [default=yes]
--with-libpng-compat Generate the obsolete libpng.so library
[default=yes]
Some influential environment variables:
CC C compiler command
......@@ -1612,7 +1607,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.2.42
libpng configure 1.4.0
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
......@@ -2037,7 +2032,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.2.42, which was
It was created by libpng $as_me 1.4.0, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
......@@ -2845,7 +2840,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.2.42'
VERSION='1.4.0'
cat >>confdefs.h <<_ACEOF
......@@ -2909,10 +2904,10 @@ fi
PNGLIB_VERSION=1.2.42
PNGLIB_VERSION=1.4.0
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=42
PNGLIB_MINOR=4
PNGLIB_RELEASE=0
......@@ -5155,13 +5150,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:5158: $ac_compile\"" >&5)
(eval echo "\"\$as_me:5153: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:5161: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:5156: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:5164: output\"" >&5)
(eval echo "\"\$as_me:5159: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
......@@ -6353,7 +6348,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 6356 "configure"' > conftest.$ac_ext
echo '#line 6351 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -7740,11 +7735,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7743: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7738: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7747: \$? = $ac_status" >&5
echo "$as_me:7742: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
......@@ -8079,11 +8074,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8082: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8077: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:8086: \$? = $ac_status" >&5
echo "$as_me:8081: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
......@@ -8184,11 +8179,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8187: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8182: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:8191: \$? = $ac_status" >&5
echo "$as_me:8186: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -8239,11 +8234,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8242: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8237: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:8246: \$? = $ac_status" >&5
echo "$as_me:8241: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -10606,7 +10601,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10609 "configure"
#line 10604 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -10702,7 +10697,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10705 "configure"
#line 10700 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -11421,31 +11416,7 @@ fi
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE" >&5
$as_echo_n "checking if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "$srcdir/pnggccrd.c"
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBPNG_NO_MMX=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
LIBPNG_DEFINES=$LIBPNG_DEFINES
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libraries can be versioned" >&5
......@@ -11521,28 +11492,10 @@ fi
# Allow the old version number library, libpng.so, to be removed from
# the build
# Check whether --with-libpng-compat was given.
if test "${with_libpng_compat+set}" = set; then :
withval=$with_libpng_compat; if test "${withval}" = no; then
compatlib=
{ $as_echo "$as_me:${as_lineno-$LINENO}: libpng.so will not be built" >&5
$as_echo "$as_me: libpng.so will not be built" >&6;}
else
compatlib=libpng.la
fi
else
compatlib=libpng.la
fi
# Config files, substituting as above
ac_config_files="$ac_config_files Makefile libpng.pc:scripts/libpng.pc-configure.in"
ac_config_files="$ac_config_files Makefile libpng.pc:libpng.pc.in"
ac_config_files="$ac_config_files libpng-config:scripts/libpng-config.in"
ac_config_files="$ac_config_files libpng-config:libpng-config.in"
cat >confcache <<\_ACEOF
......@@ -12074,7 +12027,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.2.42, which was
This file was extended by libpng $as_me 1.4.0, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -12140,7 +12093,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libpng config.status 1.2.42
libpng config.status 1.4.0
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
......@@ -12523,8 +12476,8 @@ do
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"libpng.pc") CONFIG_FILES="$CONFIG_FILES libpng.pc:scripts/libpng.pc-configure.in" ;;
"libpng-config") CONFIG_FILES="$CONFIG_FILES libpng-config:scripts/libpng-config.in" ;;
"libpng.pc") CONFIG_FILES="$CONFIG_FILES libpng.pc:libpng.pc.in" ;;
"libpng-config") CONFIG_FILES="$CONFIG_FILES libpng-config:libpng-config.in" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
......
......@@ -18,15 +18,15 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.2.42], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.4.0], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.2.42
PNGLIB_VERSION=1.4.0
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=42
PNGLIB_MINOR=4
PNGLIB_RELEASE=0
dnl End of version number stuff
......@@ -60,18 +60,8 @@ AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
AC_MSG_CHECKING(
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
AC_TRY_COMPILE(
[#include "$srcdir/pnggccrd.c"],
[return 0;],
AC_MSG_RESULT(yes)
LIBPNG_NO_MMX="",
AC_MSG_RESULT(no)
LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE)
LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
LIBPNG_DEFINES=$LIBPNG_DEFINES
AC_SUBST(LIBPNG_DEFINES)
AC_SUBST(LIBPNG_NO_MMX)
AC_MSG_CHECKING([if libraries can be versioned])
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
......@@ -126,23 +116,9 @@ AC_ARG_WITH(binconfigs,
[binconfigs='${binconfigs}'])
AC_SUBST([binconfigs])
# Allow the old version number library, libpng.so, to be removed from
# the build
AC_ARG_WITH(libpng-compat,
AC_HELP_STRING([--with-libpng-compat],
[Generate the obsolete libpng.so library @<:@default=yes@:>@]),
[if test "${withval}" = no; then
compatlib=
AC_MSG_NOTICE([libpng.so will not be built])
else
compatlib=libpng.la
fi],
[compatlib=libpng.la])
AC_SUBST([compatlib])
# Config files, substituting as above
AC_CONFIG_FILES([Makefile libpng.pc:scripts/libpng.pc-configure.in])
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
AC_CONFIG_FILES([libpng-config:libpng-config.in],
[chmod +x libpng-config])
AC_OUTPUT
......@@ -23,9 +23,9 @@
# macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include/libpng12
PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng
#PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng
PNGINC = -I/usr/local/include/libpng14
PNGLIB = -L/usr/local/lib -lpng14 # dynamically linked against libpng
#PNGLIB = /usr/local/lib/libpng14.a # statically linked against libpng
# or:
#PNGINC = -I../..
#PNGLIB = -L../.. -lpng
......
......@@ -26,14 +26,14 @@
# macros --------------------------------------------------------------------
#PNGDIR = /usr/local/lib
#PNGINC = -I/usr/local/include/libpng12
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
#PNGINC = -I/usr/local/include/libpng14
#PNGLIBd = -L$(PNGDIR) -lpng14 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng14.a # statically linked, installed libpng
# or:
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
#PNGDIR = ../libpng
PNGINC = -I$(PNGDIR)
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng14 # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
ZDIR = /usr/local/lib
......
cp ../../pngminus/png2pnm.c pngm2pnm.c
cp ../../../*.h .
cp ../../../*.c .
rm pnggccrd.c pngvcrd.c
rm example.c pngtest.c pngpread.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
......
......@@ -25,7 +25,7 @@ OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngusr.h zlib.h
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies
......
......@@ -16,8 +16,6 @@
/* No 16-bit support beyond reading with strip_16 */
#endif
#define PNG_NO_GLOBAL_ARRAYS
#define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
......@@ -25,8 +23,6 @@
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_ASSEMBLER_CODE
#define PNG_NO_OPTIMIZED_CODE
#define PNG_NO_READ_GAMMA
#define PNG_NO_READ_BACKGROUND
#define PNG_NO_READ_DITHER
......@@ -59,7 +55,6 @@
#define PNG_NO_READ_OPT_PLTE
#define PNG_NO_READ_STRIP_ALPHA
#define PNG_NO_READ_oFFs
#define PNG_NO_WARN_UNINITIALIZED_ROW
#define PNG_NO_WRITE_SUPPORTED
......
cp ../../pngminus/pnm2png.c pnm2pngm.c
cp ../../../*.h .
cp ../../../*.c .
rm pnggccrd.c pngvcrd.c
rm example.c pngtest.c pngr*.c pngpread.c
# Change the next 2 lines if zlib is somewhere else.
cp ../../../../zlib/*.h .
......
......@@ -24,7 +24,7 @@ OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngusr.h zlib.h
.c$(O): png.h pngconf.h pngpriv.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies
......
......@@ -12,8 +12,6 @@
#ifndef MINWRPNGCONF_H
#define MINWRPNGCONF_H
#define PNG_NO_GLOBAL_ARRAYS
#define PNG_NO_READ_SUPPORTED
#define PNG_NO_WARNINGS
......
......@@ -2,7 +2,6 @@ cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
cp ../../../*.h .
cp ../../../*.c .
rm pnggccrd.c pngvcrd.c
rm example.c pngtest.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
......
......@@ -41,7 +41,7 @@ OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h readpng2.h pngusr.h zlib.h
.c$(O): png.h pngconf.h pngpriv.h readpng2.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies
......
......@@ -12,8 +12,6 @@
#ifndef MINPRDPNGCONF_H
#define MINPRDPNGCONF_H
#define PNG_NO_GLOBAL_ARRAYS
#define PNG_NO_WARNINGS
#define png_warning(s1,s2) ""
#define png_chunk_warning(s1,s2) ""
......@@ -21,8 +19,6 @@
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_ASSEMBLER_CODE
#define PNG_NO_OPTIMIZED_CODE
#define PNG_NO_READ_DITHER
#define PNG_NO_READ_INVERT
#define PNG_NO_READ_SHIFT
......@@ -50,7 +46,6 @@
#define PNG_NO_READ_OPT_PLTE
#define PNG_NO_READ_STRIP_ALPHA
#define PNG_NO_READ_oFFs
#define PNG_NO_WARN_UNINITIALIZED_ROW
#define PNG_NO_WRITE_SUPPORTED
......
......@@ -211,8 +211,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (ret != 8)
return FALSE;
ret = !png_sig_cmp (buf, 0, 8);
if (!ret)
ret = png_sig_cmp (buf, 0, 8);
if (ret)
return FALSE;
/* create png and info structures */
......
......@@ -35,7 +35,7 @@ png_cexcept_error(png_structp png_ptr, png_const_charp msg)
{
if(png_ptr)
;
#ifndef PNG_NO_CONSOLE_IO
#ifdef PNG_CONSOLE_IO_SUPPORTED
fprintf(stderr, "libpng error: %s\n", msg);
#endif
{
......@@ -155,7 +155,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// initialize the png structure
#if !defined(PNG_NO_STDIO)
#ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile);
#else
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
......@@ -324,7 +324,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
{
// initialize the png structure
#if !defined(PNG_NO_STDIO)
#ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile);
#else
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
......@@ -395,7 +395,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
return TRUE;
}
#ifdef PNG_NO_STDIO
#ifndef PNG_STDIO_SUPPORTED
static void
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
......
......@@ -22,7 +22,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color BkgColor);
#if defined(PNG_NO_STDIO)
#ifndef PNG_STDIO_SUPPORTED
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
static void png_flush(png_structp png_ptr);
......
......@@ -43,9 +43,9 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
......@@ -77,9 +77,9 @@ PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
......
......@@ -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.2.37 [June 4, 2009]
* Last changed in libpng 1.4.0 [January 3, 2010]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2010 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
......@@ -121,7 +121,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
if (info_ptr == NULL)
{
fclose(fp);
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return (ERROR);
}
......@@ -133,7 +133,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
if (setjmp(png_jmpbuf(png_ptr)))
{
/* Free all of the memory associated with the png_ptr and info_ptr */
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp);
/* If we get here, we had a problem reading the file */
return (ERROR);
......@@ -164,7 +164,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
* adjustment), then you can read the entire image (including
* pixels) into the info structure with this call:
*/
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
#else
/* OK, you're doing it the hard way, with the lower-level functions */
......@@ -175,7 +175,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
png_read_info(png_ptr, info_ptr);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL);
&interlace_type, NULL, NULL);
/* Set up the data transformations you want. Note that these are all
* optional. Only call them if you want/need them. Many of the
......@@ -286,7 +286,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
png_color std_color_cube[MAX_SCREEN_COLORS];
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0);
MAX_SCREEN_COLORS, NULL, 0);
}
/* This reduces the image to the palette supplied in the file */
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
......@@ -365,17 +365,17 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
#ifdef single /* Read the image a single row at a time */
for (y = 0; y < height; y++)
{
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1);
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
}
#else no_single /* Read the image several rows at a time */
for (y = 0; y < height; y += number_of_rows)
{
#ifdef sparkle /* Read the image using the "sparkle" effect. */
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL,
png_read_rows(png_ptr, &row_pointers[y], NULL,
number_of_rows);
#else no_sparkle /* Read the image using the "rectangle" effect */
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
png_read_rows(png_ptr, NULL, &row_pointers[y],
number_of_rows);
#endif no_sparkle /* Use only one of these two methods */
}
......@@ -392,7 +392,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
/* At this point you have read the entire image */
/* Clean up after the read, and free any memory allocated - REQUIRED */
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
/* Close the file */
fclose(fp);
......@@ -425,13 +425,13 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
if (*info_ptr == NULL)
{
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR);
}
if (setjmp(png_jmpbuf((*png_ptr))))
{
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR);
}
......@@ -460,7 +460,7 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
if (setjmp(png_jmpbuf((*png_ptr))))
{
/* Free the png_ptr and info_ptr memory on error */
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
png_destroy_read_struct(png_ptr, info_ptr, NULL);
return (ERROR);
}
......@@ -593,7 +593,7 @@ void write_png(char *file_name /* , ... other image information ... */)
if (info_ptr == NULL)
{
fclose(fp);
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
png_destroy_write_struct(&png_ptr, NULL);
return (ERROR);
}
......@@ -628,7 +628,7 @@ void write_png(char *file_name /* , ... other image information ... */)
* image info living in the structure. You could "|" many
* PNG_TRANSFORM flags into the png_transforms integer here.
*/
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
#else
/* This is the hard way */
......
libpng.txt - A description on how to use and modify libpng
libpng version 1.2.42 - January 3, 2010
libpng version 1.4.0 - January 3, 2010
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
......@@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.2.42 - January 3, 2010
libpng versions 0.97, January 1998, through 1.4.0 - January 3, 2010
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
......@@ -649,11 +649,11 @@ pointer into the info_ptr is returned for any complex types.
whichever are appropriate for the
given color type (png_color_16)
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
&trans_values);
trans - array of transparent
png_get_tRNS(png_ptr, info_ptr, &trans_alpha,
&num_trans, &trans_color);
trans_alpha - array of alpha (transparency)
entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values of
trans_color - graylevel or color sample values of
the single transparent color for
non-paletted images (PNG_INFO_tRNS)
num_trans - number of transparent entries
......@@ -878,7 +878,7 @@ things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
added. It expands the sample depth without changing tRNS to alpha.
As of libpng version 1.2.42, not all possible expansions are supported.
As of libpng version 1.4.0, not all possible expansions are supported.
In the following table, the 01 means grayscale with depth<8, 31 means
indexed with depth<8, other numerals represent the color type, "T" means
......@@ -938,15 +938,6 @@ images) is fully transparent, with
png_set_invert_alpha(png_ptr);
The PNG format only supports pixels with postmultiplied alpha.
If you want to replace the pixels, after reading them, with pixels
that have premultiplied color samples, you can do this with
png_set_premultiply_alpha(png_ptr);
If you do this, any input with a tRNS chunk will be expanded to
have an alpha channel.
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit
files. This code expands to 1 pixel per byte without changing the
......@@ -1147,40 +1138,6 @@ recommended that PNG viewers support gamma correction.
else
png_set_gamma(png_ptr, screen_gamma, 0.45455);
If you need to reduce an RGB file to a paletted file, or if a paletted
file has more entries then will fit on your screen, png_set_dither()
will do that. Note that this is a simple match dither that merely
finds the closest color available. This should work fairly well with
optimized palettes, and fairly badly with linear color cubes. If you
pass a palette that is larger then maximum_colors, the file will
reduce the number of colors in the palette so it will fit into
maximum_colors. If there is a histogram, it will use it to make
more intelligent choices when reducing the palette. If there is no
histogram, it may not do as good a job.
if (color_type & PNG_COLOR_MASK_COLOR)
{
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_PLTE))
{
png_uint_16p histogram = NULL;
png_get_hIST(png_ptr, info_ptr,
&histogram);
png_set_dither(png_ptr, palette, num_palette,
max_screen_colors, histogram, 1);
}
else
{
png_color std_color_cube[MAX_SCREEN_COLORS] =
{ ... colors ... };
png_set_dither(png_ptr, std_color_cube,
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
NULL,0);
}
}
PNG files describe monochrome as black being zero and white being one.
The following code will reverse this (make black be one and white be
zero):
......@@ -1928,11 +1885,11 @@ width, height, bit_depth, and color_type must be the same in each call.
appropriate for the given color type
(png_color_16)
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
trans_values);
trans - array of transparent
png_set_tRNS(png_ptr, info_ptr, trans_alpha,
num_trans, trans_color);
trans_alpha - array of alpha (transparency)
entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values
trans_color - graylevel or color sample values
(in order red, green, blue) of the
single transparent color for
non-paletted images (PNG_INFO_tRNS)
......@@ -2673,10 +2630,10 @@ Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add, change
or delete an include, this is the place to do it.
The includes that are not needed outside libpng are protected by the
PNG_INTERNAL definition, which is only defined for those routines inside
libpng itself. The files in libpng proper only include png.h, which
includes pngconf.h.
The includes that are not needed outside libpng are placed in pngpriv.h,
which is only used by the routines inside libpng itself.
The files in libpng proper only include pngpriv.h and png.h, which
in turn includes pngconf.h.
Configuring zlib:
......@@ -3038,8 +2995,94 @@ which also expands tRNS to alpha was replaced with
png_set_expand_gray_1_2_4_to_8()
which does not. It has been deprecated since libpng-1.0.18 and 1.2.9.
IX. (Omitted)
IX. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x
Private libpng prototypes and macro definitions were moved from
png.h and pngconf.h into a new pngpriv.h header file.
Functions png_set_benign_errors(), png_benign_error(), and
png_chunk_benign_error() were added.
Support for setting the maximum amount of memory that the application
will allocate for reading chunks was added, as a security measure.
The functions png_set_chunk_cache_max() and png_get_chunk_cache_max()
were added to the library.
We implemented support for I/O states by adding png_ptr member io_state
and functions png_get_io_chunk_name() and png_get_io_state() in pngget.c
We added PNG_TRANSFORM_GRAY_TO_RGB to the available high-level
input transforms.
Checking for and reporting of errors in the IHDR chunk is more thorough.
Support for global arrays was removed, to improve thread safety.
Some obsolete/deprecated macros and functions have been removed.
Typecasted NULL definitions such as
#define png_voidp_NULL (png_voidp)NULL
were eliminated. If you used these in your application, just use
NULL instead.
The png_struct and info_struct members "trans" and "trans_values" were
changed to "trans_alpha" and "trans_color", respectively.
The obsolete, unused pnggccrd.c and pngvcrd.c files and related makefiles
were removed.
The PNG_1_0_X and PNG_1_2_X macros were eliminated.
The PNG_LEGACY_SUPPORTED macro was eliminated.
Many WIN32_WCE #ifdefs were removed.
The functions png_read_init(info_ptr), png_write_init(info_ptr),
png_info_init(info_ptr), png_read_destroy(), and png_write_destroy()
have been removed. They have been deprecated since libpng-0.95.
The png_permit_empty_plte() was removed. It has been deprecated
since libpng-1.0.9. Use png_permit_mng_features() instead.
We removed the obsolete stub functions png_get_mmx_flagmask(),
png_set_mmx_thresholds(), png_get_asm_flags(),
png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
png_set_asm_flags(), and png_mmx_supported()
We removed the obsolete png_check_sig(), png_memcpy_check(), and
png_memset_check() functions. Instead use !png_sig_cmp(), png_memcpy(),
and png_memset(), respectively.
The function png_set_gray_1_2_4_to_8() was removed. It has been
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
png_set_expand_gray_1_2_4_to_8() because the former function also
expanded palette images.
We changed the prototype for png_malloc() from
png_malloc(png_structp png_ptr, png_uint_32 size)
to
png_malloc(png_structp png_ptr, png_alloc_size_t size)
The png_calloc() function was added and is used in place of
of "png_malloc(); png_memset();" except in the case in png_read_png()
where the array consists of pointers; in this case a "for" loop is used
after the png_malloc() to set the pointers to NULL, to give robust.
behavior in case the application runs out of memory part-way through
the process.
We changed the prototypes of png_get_compression_buffer_size() and
png_set_compression_buffer_size() to work with png_size_t instead of
png_uint_32.
Support for numbered error messages was removed by default, since we
never got around to actually numbering the error messages. The function
png_set_strip_error_numbers() was removed from the library by default.
The png_zalloc() and png_zfree() functions are no longer exported.
The png_zalloc() function no longer zeroes out the memory that it
allocates.
We removed the trailing '.' from the warning and error messages.
X. Detecting libpng
......@@ -3149,7 +3192,7 @@ We mark all non-exported functions with "/* PRIVATE */"":
The prototypes for non-exported functions (except for those in
pngtest) appear in
the PNG_INTERNAL section of png.h
pngpriv.h
above the comment that says
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
......@@ -3185,7 +3228,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.2.42 are Y2K compliant. It is my belief that earlier
upward through 1.4.0 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
......
......@@ -22,7 +22,7 @@ I_opts="-I${includedir}"
L_opts="-L${libdir}"
R_opts=""
cppflags=""
ccopts="@LIBPNG_NO_MMX@"
ccopts=""
ldopts=""
usage()
......
此差异已折叠。
......@@ -8,4 +8,4 @@ Description: Loads and saves PNG files
Version: @PNGLIB_VERSION@
Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
Libs.private: @LIBS@
Cflags: -I${includedir} @LIBPNG_NO_MMX@
Cflags: -I${includedir}
.TH LIBPNGPF 3 "January 3, 2010"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP
\fB#include \fI"pngpriv.h"
\fI\fB
\fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fI*hi_product,
......@@ -13,7 +15,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
\fBvoid png_build_gamma_table (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fIbit_depth\fP\fB);\fP
\fI\fB
......@@ -37,19 +39,19 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
\fI\fB
......@@ -97,7 +99,19 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
\fBint png_debug(int \fP\fIlevel\fP\fB, png_const_charp \fImessage\fP\fB);\fP
\fI\fB
\fBint png_debug1(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fIp1\fP\fB);\fP
\fI\fB
\fBint png_debug2(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fP\fIp1\fP\fB, \fIp2\fP\fB);\fP
\fI\fB
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
\fI\fB
......@@ -115,7 +129,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_color\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
\fI\fB
......@@ -197,8 +211,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fI\fB
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
......@@ -553,16 +565,12 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBpng_uint_32 png_read_chunk_header (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fBvoid png_read_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_infop \fIend_info_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
......@@ -623,6 +631,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBvoid png_write_destroy (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
......@@ -733,12 +743,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.42
\fI\fB
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
\fI\fB
......@@ -801,6 +805,6 @@ are listed alphabetically here as an aid to libpng maintainers.
See png.h for more information on these functions.
.SH SEE ALSO
.IR libpng(3) ", " png(5)
libpng(3), png(5)
.SH AUTHOR
Glenn Randers-Pehrson
文件模式从 100644 更改为 100755
......@@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
platforms.
.SH "SEE ALSO"
.IR libpng(3) ", " zlib(3) ", " deflate(5) ", and " zlib(5)
.IR libpng(3), zlib(3), deflate(5), and zlib(5)
.LP
PNG specification (second edition), November 2003:
.IP
......@@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
RFC 2083
.IP
.br
ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
ftp://ds.internic.net/rfc/rfc2083.txt
.br
or (as a W3C Recommendation) at
.br
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* Last changed in libpng 1.4.0 [January 3, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
......@@ -16,10 +16,10 @@
* at each function.
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr,
......@@ -230,6 +230,22 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
#endif
#endif /* PNG_READ_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
/* This API only exists if ANSI-C style error handling is used,
* otherwise it is necessary for png_default_error to be overridden.
*/
jmp_buf* PNGAPI
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size)
{
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
return NULL;
png_ptr->longjmp_fn = longjmp_fn;
return &png_ptr->jmpbuf;
}
#endif
/* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This
* function is used by default, or if the program supplies NULL for the
......@@ -274,16 +290,16 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#endif
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr)
if (png_ptr && png_ptr->longjmp_fn)
{
# ifdef USE_FAR_KEYWORD
{
jmp_buf jmpbuf;
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
longjmp(jmpbuf,1);
png_ptr->longjmp_fn(jmpbuf, 1);
}
# else
longjmp(png_ptr->jmpbuf, 1);
png_ptr->longjmp_fn(png_ptr->jmpbuf, 1);
# endif
}
#endif
......
/* pnggccrd.c was removed from libpng-1.2.20. */
/* This code snippet is for use by configure's compilation test. */
#if (!defined _MSC_VER) && \
defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
defined(PNG_MMX_CODE_SUPPORTED)
int PNGAPI png_dummy_mmx_support(void);
static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested
int PNGAPI
png_dummy_mmx_support(void) __attribute__((noinline));
int PNGAPI
png_dummy_mmx_support(void)
{
int result;
#ifdef PNG_MMX_CODE_SUPPORTED // superfluous, but what the heck
__asm__ __volatile__ (
#ifdef __x86_64__
"pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
"pushq %%rcx \n\t" // so does rcx...
"pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
"pushfq \n\t" // save Eflag to stack
"popq %%rax \n\t" // get Eflag from stack into rax
"movq %%rax, %%rcx \n\t" // make another copy of Eflag in rcx
"xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
"pushq %%rax \n\t" // save modified Eflag back to stack
"popfq \n\t" // restore modified value to Eflag reg
"pushfq \n\t" // save Eflag to stack
"popq %%rax \n\t" // get Eflag from stack
"pushq %%rcx \n\t" // save original Eflag to stack
"popfq \n\t" // restore original Eflag
#else
"pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
"pushl %%ecx \n\t" // so does ecx...
"pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux)
"pushfl \n\t" // save Eflag to stack
"popl %%eax \n\t" // get Eflag from stack into eax
"movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx
"xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
"pushl %%eax \n\t" // save modified Eflag back to stack
"popfl \n\t" // restore modified value to Eflag reg
"pushfl \n\t" // save Eflag to stack
"popl %%eax \n\t" // get Eflag from stack
"pushl %%ecx \n\t" // save original Eflag to stack
"popfl \n\t" // restore original Eflag
#endif
"xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag
"jz 0f \n\t" // if same, CPUID instr. is not supported
"xorl %%eax, %%eax \n\t" // set eax to zero
// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode)
"cpuid \n\t" // get the CPU identification info
"cmpl $1, %%eax \n\t" // make sure eax return non-zero value
"jl 0f \n\t" // if eax is zero, MMX is not supported
"xorl %%eax, %%eax \n\t" // set eax to zero and...
"incl %%eax \n\t" // ...increment eax to 1. This pair is
// faster than the instruction "mov eax, 1"
"cpuid \n\t" // get the CPU identification info again
"andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
"cmpl $0, %%edx \n\t" // 0 = MMX not supported
"jz 0f \n\t" // non-zero = yes, MMX IS supported
"movl $1, %%eax \n\t" // set return value to 1
"jmp 1f \n\t" // DONE: have MMX support
"0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
"movl $0, %%eax \n\t" // set return value to 0
"1: \n\t" // .RETURN: target label for jump instructions
#ifdef __x86_64__
"popq %%rdx \n\t" // restore rdx
"popq %%rcx \n\t" // restore rcx
"popq %%rbx \n\t" // restore rbx
#else
"popl %%edx \n\t" // restore edx
"popl %%ecx \n\t" // restore ecx
"popl %%ebx \n\t" // restore ebx
#endif
// "ret \n\t" // DONE: no MMX support
// (fall through to standard C "ret")
: "=a" (result) // output list
: // any variables used on input (none)
// no clobber list
// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
// , "memory" // if write to a variable gcc thought was in a reg
// , "cc" // "condition codes" (flag bits)
);
_mmx_supported = result;
#else
_mmx_supported = 0;
#endif /* PNG_MMX_CODE_SUPPORTED */
return _mmx_supported;
}
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* Last changed in libpng 1.4.0 [January 3, 2010]
* Copyright (c) 1998-2010 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,10 +18,10 @@
* libpng use it at run time with png_set_read_fn(...).
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
/* Read the data from whatever input you are using. The default routine
* reads from a file pointer. Note that this routine sometimes gets called
......@@ -57,13 +57,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns.
*/
#ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
check = (png_size_t)fread(data, (png_size_t)1, length,
(png_FILE_p)png_ptr->io_ptr);
#endif
check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
if (check != length)
png_error(png_ptr, "Read Error");
......@@ -80,7 +74,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
static void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
int check;
png_size_t check;
png_byte *n_data;
png_FILE_p io_ptr;
......@@ -91,12 +85,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)n_data == data)
{
#ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
check = fread(n_data, 1, length, io_ptr);
#endif
}
else
{
......@@ -107,12 +96,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
do
{
read = MIN(NEAR_BUF_SIZE, remaining);
#ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
err = 0;
#else
err = fread(buf, (png_size_t)1, read, io_ptr);
#endif
err = fread(buf, 1, read, io_ptr);
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
if (err != read)
break;
......@@ -169,7 +153,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_warning(png_ptr,
"It's an error to set both read_data_fn and write_data_fn in the ");
png_warning(png_ptr,
"same structure. Resetting write_data_fn to NULL.");
"same structure. Resetting write_data_fn to NULL");
}
#ifdef PNG_WRITE_FLUSH_SUPPORTED
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
pngtest.png

8.4 KB | W: | H:

pngtest.png

8.4 KB | W: | H:

pngtest.png
pngtest.png
pngtest.png
pngtest.png
  • 2-up
  • Swipe
  • Onion skin
此差异已折叠。
/* pnggvrd.c was removed from libpng-1.2.20. */
此差异已折叠。
此差异已折叠。
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* Last changed in libpng 1.4.0 [January 3, 2010]
* Copyright (c) 1998-2010 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,10 +11,10 @@
* and license in png.h
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#include "pngpriv.h"
/* Transform the data according to the user's wishes. The order of
* transformations is significant.
......@@ -93,9 +93,6 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
png_debug(1, "in png_do_pack");
if (row_info->bit_depth == 8 &&
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->channels == 1)
{
switch ((int)bit_depth)
......@@ -219,11 +216,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{
png_debug(1, "in png_do_shift");
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL &&
#else
if (
#endif
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
{
int shift_start[4], shift_dec[4];
......@@ -344,9 +337,6 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_swap_alpha");
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
......@@ -433,9 +423,6 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_invert_alpha");
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
......@@ -525,9 +512,6 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
png_debug(1, "in png_do_write_intrapixel");
if (
#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))
{
int bytes_per_pixel;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册