Fixed point APIs are now supported throughout (no missing APIs).
  Internal fixed point arithmetic support exists for all internal floating
    point operations.
  sCAL validates the floating point strings it is passed.
  Safe, albeit rudimentary, Watcom support is provided by PNG_API_RULE==2
  Two new APIs exist to get the number of passes without turning on the
    PNG_INTERLACE transform and to get the number of rows in the current
    pass.
  A new test program, pngvalid.c, validates the gamma code.
  Errors in the 16 bit gamma correction (overflows) have been corrected.
  cHRM chunk testing is done consistently (previously the floating point
    API bypassed it, because the test really didn't work on FP, now the test
    is performed on the actual values to be stored in the PNG file so it
    works in the FP case too.)
  Most floating point APIs now simply call the fixed point APIs after
    converting the values to the fixed point form used in the PNG file.
  The standard headers no longer include zlib.h, which is currently only
    required for pngstruct.h and can therefore be internal.
  (Patches by John Bowler)
This commit is contained in:
Glenn Randers-Pehrson 2010-07-29 17:39:14 -05:00
parent d7aa6aa916
commit 31aee0d0c0
44 changed files with 4989 additions and 1723 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.0beta36 - July 24, 2010
Libpng 1.5.0beta36 - July 29, 2010
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -226,7 +226,7 @@ version 1.5.0beta24 [May 7, 2010]
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
Added more blank lines for readability.
version 1.5.0beta25 [July 24, 2010]
version 1.5.0beta25 [July 29, 2010]
In pngpread.c: png_push_have_row() add check for new_row > height
Removed the now-redundant check for out-of-bounds new_row from example.c
@ -287,7 +287,27 @@ version 1.5.0beta35 [July 24, 2010]
Moved the definition of png_snprintf() outside of the enclosing
#ifdef blocks in pngconf.h
version 1.5.0beta36 [July 24, 2010]
version 1.5.0beta36 [July 29, 2010]
Patches by John Bowler:
Fixed point APIs are now supported throughout (no missing APIs).
Internal fixed point arithmetic support exists for all internal floating
point operations.
sCAL validates the floating point strings it is passed.
Safe, albeit rudimentary, Watcom support is provided by PNG_API_RULE==2
Two new APIs exist to get the number of passes without turning on the
PNG_INTERLACE transform and to get the number of rows in the current
pass.
A new test program, pngvalid.c, validates the gamma code.
Errors in the 16 bit gamma correction (overflows) have been corrected.
Gamma handling arithmetic is in a new file, pngarith.c
cHRM chunk testing is done consistently (previously the floating point
API bypassed it, because the test really didn't work on FP, now the test
is performed on the actual values to be stored in the PNG file so it
works in the FP case too.)
Most floating point APIs now simply call the fixed point APIs after
converting the values to the fixed point form used in the PNG file.
The standard headers no longer include zlib.h, which is currently only
required for pngstruct.h and can therefore be internal.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

22
CHANGES
View File

@ -2769,7 +2769,27 @@ version 1.5.0beta35 [July 24, 2010]
Moved the definition of png_snprintf() outside of the enclosing
#ifdef blocks in pngconf.h
version 1.5.0beta36 [July 24, 2010]
version 1.5.0beta36 [July 29, 2010]
Patches by John Bowler:
Fixed point APIs are now supported throughout (no missing APIs).
Internal fixed point arithmetic support exists for all internal floating
point operations.
sCAL validates the floating point strings it is passed.
Safe, albeit rudimentary, Watcom support is provided by PNG_API_RULE==2
Two new APIs exist to get the number of passes without turning on the
PNG_INTERLACE transform and to get the number of rows in the current
pass.
A new test program, pngvalid.c, validates the gamma code.
Errors in the 16 bit gamma correction (overflows) have been corrected.
Gamma handling arithmetic is in a new file, pngarith.c
cHRM chunk testing is done consistently (previously the floating point
API bypassed it, because the test really didn't work on FP, now the test
is performed on the actual values to be stored in the PNG file so it
works in the FP case too.)
Most floating point APIs now simply call the fixed point APIs after
converting the values to the fixed point form used in the PNG file.
The standard headers no longer include zlib.h, which is currently only
required for pngstruct.h and can therefore be internal.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -8,10 +8,12 @@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
AUTOMAKE_OPTIONS = foreign color-tests
# test programs - run on make check, make distcheck
check_PROGRAMS= pngtest
check_PROGRAMS= pngtest pngvalid
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh
pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh pngvalid
TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages
@ -25,11 +27,10 @@ bin_SCRIPTS= @binconfigs@
# rules to build libpng, only build the old library on request
lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# EXTRA_LTLIBRARIES= libpng.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_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 pngpriv.h pngstruct.h pnginfo.h pngdebug.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngarith.c pngerror.c\
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.11 from Makefile.am.
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -40,7 +40,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = pngtest$(EXEEXT)
check_PROGRAMS = pngtest$(EXEEXT) pngvalid$(EXEEXT)
TESTS = test-pngtest.sh pngvalid$(EXEEXT)
@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_1 = -Wl,--version-script=libpng.vers
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_2 = -export-symbols libpng.sym
subdir = .
@ -89,20 +90,21 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD =
am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS =
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
$(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) \
@ -115,6 +117,9 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) --tag=CC \
am_pngtest_OBJECTS = pngtest.$(OBJEXT)
pngtest_OBJECTS = $(am_pngtest_OBJECTS)
pngtest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
am_pngvalid_OBJECTS = pngvalid.$(OBJEXT)
pngvalid_OBJECTS = $(am_pngvalid_OBJECTS)
pngvalid_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -131,9 +136,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(pngtest_SOURCES)
$(pngtest_SOURCES) $(pngvalid_SOURCES)
DIST_SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(pngtest_SOURCES)
$(pngtest_SOURCES) $(pngvalid_SOURCES)
man3dir = $(mandir)/man3
man5dir = $(mandir)/man5
NROFF = nroff
@ -305,7 +310,8 @@ PNGLIB_BASENAME = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
AUTOMAKE_OPTIONS = foreign color-tests
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh
pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS_ENVIRONMENT = srcdir=$(srcdir)
# man pages
@ -316,11 +322,10 @@ bin_SCRIPTS = @binconfigs@
# rules to build libpng, only build the old library on request
lib_LTLIBRARIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# EXTRA_LTLIBRARIES= libpng.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_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 pngpriv.h pngstruct.h pnginfo.h pngdebug.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngarith.c pngerror.c\
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
@ -461,6 +466,9 @@ clean-checkPROGRAMS:
pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES)
@rm -f pngtest$(EXEEXT)
$(LINK) $(pngtest_OBJECTS) $(pngtest_LDADD) $(LIBS)
pngvalid$(EXEEXT): $(pngvalid_OBJECTS) $(pngvalid_DEPENDENCIES)
@rm -f pngvalid$(EXEEXT)
$(LINK) $(pngvalid_OBJECTS) $(pngvalid_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@ -503,6 +511,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Plo@am__quote@
@ -518,6 +527,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngvalid.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -547,12 +557,19 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo: png.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-png.lo `test -f 'png.c' || echo '$(srcdir)/'`png.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo: pngset.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngset.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo' libtool=yes @AMDEPBACKSLASH@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.lo: pngarith.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.lo `test -f 'pngarith.c' || echo '$(srcdir)/'`pngarith.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngarith.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngarith.lo `test -f 'pngarith.c' || echo '$(srcdir)/'`pngarith.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo: pngerror.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngerror.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo: pngget.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo `test -f 'pngget.c' || echo '$(srcdir)/'`pngget.c
@ -561,26 +578,19 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo: pngget.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngget.lo `test -f 'pngget.c' || echo '$(srcdir)/'`pngget.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo: pngrutil.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrutil.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo' libtool=yes @AMDEPBACKSLASH@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo: pngmem.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngmem.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo: pngtrans.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngtrans.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo' libtool=yes @AMDEPBACKSLASH@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo: pngpread.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngpread.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo: pngwutil.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwutil.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo: pngread.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngread.lo `test -f 'pngread.c' || echo '$(srcdir)/'`pngread.c
@ -596,6 +606,34 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo: pngrio.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrio.lo `test -f 'pngrio.c' || echo '$(srcdir)/'`pngrio.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo: pngrtran.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrtran.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo: pngrutil.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrutil.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrutil.lo `test -f 'pngrutil.c' || echo '$(srcdir)/'`pngrutil.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo: pngset.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngset.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngset.lo `test -f 'pngset.c' || echo '$(srcdir)/'`pngset.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo: pngtrans.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngtrans.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngtrans.lo `test -f 'pngtrans.c' || echo '$(srcdir)/'`pngtrans.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo: pngwio.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.lo `test -f 'pngwio.c' || echo '$(srcdir)/'`pngwio.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwio.Plo
@ -610,13 +648,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo: pngwrite.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.lo `test -f 'pngwrite.c' || echo '$(srcdir)/'`pngwrite.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo: pngrtran.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngrtran.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngrtran.lo `test -f 'pngrtran.c' || echo '$(srcdir)/'`pngrtran.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo: pngwtran.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo `test -f 'pngwtran.c' || echo '$(srcdir)/'`pngwtran.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.Plo
@ -624,26 +655,12 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo: pngwtran.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwtran.lo `test -f 'pngwtran.c' || echo '$(srcdir)/'`pngwtran.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo: pngmem.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngmem.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo' libtool=yes @AMDEPBACKSLASH@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo: pngwutil.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngwutil.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngmem.lo `test -f 'pngmem.c' || echo '$(srcdir)/'`pngmem.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo: pngerror.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngerror.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngerror.lo `test -f 'pngerror.c' || echo '$(srcdir)/'`pngerror.c
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo: pngpread.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo -MD -MP -MF $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Tpo -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Tpo $(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pngpread.c' object='libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngpread.lo `test -f 'pngpread.c' || echo '$(srcdir)/'`pngpread.c
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
mostlyclean-libtool:
-rm -f *.lo
@ -983,7 +1000,8 @@ distdir: $(DISTFILES)
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
@ -1027,17 +1045,17 @@ dist dist-all: distdir
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac

View File

@ -55,8 +55,10 @@
#include <stdlib.h> /* for exit() prototype */
#include <setjmp.h>
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include <zlib.h>
#include "png.h" /* libpng header from the local directory */
#include "readpng2.h" /* typedefs, common macros, public prototypes */
@ -216,7 +218,11 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
mainprog_info *mainprog_ptr;
int color_type, bit_depth;
png_uint_32 width, height;
#ifdef PNG_FLOATING_POINT_SUPPORTED
double gamma;
#else
png_fixed_point gamma;
#endif
/* setjmp() doesn't make sense here, because we'd either have to exit(),
@ -327,11 +333,19 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
* "gamma" value for the entire display system, i.e., the product of
* LUT_exponent and CRT_exponent. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
else
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
#else
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
else
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
#endif
/* we'll let libpng expand interlaced images, too */

View File

@ -485,9 +485,6 @@ int main(int argc, char **argv)
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
"is displayed) to quit.\n"
"\n", PROGNAME,
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
(int)strlen(PROGNAME), " ",
#endif
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
exit(1);
}

View File

@ -64,7 +64,7 @@ ZOBJS = adler32$(O) crc32$(O) \
zutil$(O)
# libpng
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
PNGSRCS=png$(C) pngarith$(C) pngerror$(C) pngget$(C) pngmem$(C) \
pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
pngset$(C) pngtrans$(C)
@ -80,7 +80,7 @@ PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
# Headers the PNG library uses
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
PNGOBJS=png$(O) pngarith$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
pngset$(O) pngtrans$(O)

View File

@ -12,9 +12,14 @@ everything = off
# Just switch on the progressive read code
option PROGRESSIVE_READ on
# You must choose fixed or floating point arithmetic:
option FLOATING_POINT on
# option FIXED_POINT on
# You may choose fixed or floating point APIs:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
option FLOATING_ARITHMETIC on
# option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, rpng2-x, requires the following. Take a look

View File

@ -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.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 2010]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2010 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)

1320
png.c

File diff suppressed because it is too large Load Diff

634
png.h

File diff suppressed because it is too large Load Diff

140
pngconf.h
View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.0beta36 - July 24, 2010
* libpng version 1.5.0beta36 - July 29, 2010
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -22,14 +22,6 @@
#ifndef PNGCONF_H
#define PNGCONF_H
/* Need the time information for converting tIME chunks, it
* defines struct tm:
*/
#ifdef PNG_CONVERT_tIME_SUPPORTED
/* "time.h" functions are not supported on WindowsCE */
# include <time.h>
#endif
/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
* definition file for machine specific limits, this may impact the
* correctness of the definitons below (see uses of INT_MAX).
@ -38,6 +30,23 @@
# include <limits.h>
#endif
/* For the memory copy APIs (i.e. the standard definitions of these),
* because this file defines png_memcpy and so on the base APIs must
* be defined here.
*/
#ifdef BSD
# include <strings.h>
#else
# include <string.h>
#endif
/* For png_FILE_p - this provides the standard definition of a
* FILE
*/
#ifdef PNG_STDIO_SUPPORTED
# include <stdio.h>
#endif
/* This controls optimization of the reading of 16 and 32 bit values
* from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used to the function is called.
@ -171,9 +180,20 @@
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
defined(_M_X64) || defined(_M_IA64) )
/* Windows system (DOS doesn't support DLLs) running on x86/x64.
* Includes builds under Cygwin or MinGW.
/* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
* builds under Cygwin or MinGW. Also includes Watcom builds but these need
* special treatment because they are not compatible with GCC or Visual C
* because of different calling conventions.
*/
# if PNG_API_RULE == 2
/* If this line results in an error, either because __watcall is not
* understood or because of a redefine just below you cannot use *this*
* build of the library with the compiler you are using. *This* build was
* build using Watcom and applications must also be built using Watcom!
*/
# define PNGCAPI __watcall
# endif
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
@ -266,7 +286,7 @@
#endif
#ifndef PNG_EXPORT
# define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT_TYPE(type) (PNGAPI name) PNGARG(args) attributes
extern PNG_EXPORT_TYPE(type) (PNGAPI name) PNGARG(args) attributes
#endif
/* Use PNG_REMOVED to comment out a removed interface. */
@ -351,6 +371,22 @@
#ifndef PNG_PRIVATE
# define PNG_PRIVATE /* This is a private libpng function */
#endif
#ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# else /* No floating point APIs */
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)
# endif
#endif
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
# ifdef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# else /* No fixed point APIs */
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)
# endif
#endif
/* The following uses const char * instead of char * for error
* and warning message functions, so some compilers won't complain.
@ -454,13 +490,14 @@ typedef size_t png_size_t;
#endif
/* Typedef for floating-point numbers that are converted
* to fixed-point with a multiple of 100,000, e.g., int_gamma
* to fixed-point with a multiple of 100,000, e.g., gamma
*/
typedef png_int_32 png_fixed_point;
/* Add typedefs for pointers */
typedef void FAR * png_voidp;
typedef png_byte FAR * png_bytep;
typedef PNG_CONST png_byte FAR * png_const_bytep;
typedef png_uint_32 FAR * png_uint_32p;
typedef png_int_32 FAR * png_int_32p;
typedef png_uint_16 FAR * png_uint_16p;
@ -468,6 +505,7 @@ typedef png_int_16 FAR * png_int_16p;
typedef PNG_CONST char FAR * png_const_charp;
typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
typedef png_size_t FAR * png_size_tp;
#ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p;
@ -493,81 +531,6 @@ typedef double FAR * FAR * png_doublepp;
/* Pointers to pointers to pointers; i.e., pointer to array */
typedef char FAR * FAR * FAR * png_charppp;
#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */
/* Users may want to use these so they are not private. Any library
* functions that are passed far data must be model-independent.
*/
/* Memory model/platform independent fns */
#ifndef PNG_ABORT
# ifdef _WINDOWS_
# define PNG_ABORT() ExitProcess(0)
# else
# define PNG_ABORT() abort()
# endif
#endif
#ifdef USE_FAR_KEYWORD
/* Use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
# define png_strcpy _fstrcpy
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
# define png_strlen _fstrlen
# define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy
# define png_memset _fmemset
# define png_sprintf sprintf
#else
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strcpy lstrcpyA
# define png_strncpy lstrcpynA
# define png_strlen lstrlenA
# define png_memcmp memcmp
# define png_memcpy CopyMemory
# define png_memset memset
# define png_sprintf wsprintfA
# else
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strcpy strcpy
# define png_strncpy strncpy /* Added to v 1.2.6 */
# define png_strlen strlen
# define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy
# define png_memset memset
# define png_sprintf sprintf
# endif
#endif
#ifndef PNG_NO_SNPRINTF
# ifdef _MSC_VER
# define png_snprintf _snprintf /* Added to v 1.2.19 */
# define png_snprintf2 _snprintf
# define png_snprintf6 _snprintf
# else
# define png_snprintf snprintf /* Added to v 1.2.19 */
# define png_snprintf2 snprintf
# define png_snprintf6 snprintf
# endif
#else
/* You don't have or don't want to use snprintf(). Caution: Using
* sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from
* Portable OpenSSH).
*/
# define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
#endif
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
* to png_alloc_size_t are not necessary; in fact, it is recommended
@ -598,6 +561,5 @@ typedef char FAR * FAR * FAR * png_charppp;
# endif
# endif
#endif
/* End of memory model/platform independent support */
#endif /* PNGCONF_H */

View File

@ -5,7 +5,7 @@
* (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 version 1.5.0 - July 24, 2010
* Last changed in libpng version 1.5.0 - July 29, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -237,6 +237,30 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
#endif
#endif /* PNG_READ_SUPPORTED */
#ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void
png_fixed_error(png_structp png_ptr, png_const_charp name, double value)
{
# define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1)
int iin;
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
png_memcpy(msg, fixed_message, fixed_message_ln);
iin = 0;
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
{
msg[fixed_message_ln + iin] = name[iin];
++iin;
}
msg[fixed_message_ln + iin] = 0;
/* To discover 'value' put a breakpoint here: */
png_error(png_ptr, msg);
value = value; png_ptr = png_ptr; /* Quiet the compiler */
}
#endif
#endif
#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.

186
pngget.c
View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.4.1 [July 24, 2010]
* Last changed in libpng 1.4.1 [July 29, 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.)
@ -254,7 +254,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
@ -276,7 +276,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
@ -290,42 +290,106 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
return (0);
}
#if defined(PNG_INCH_CONVERSIONS_SUPPORTED) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
static png_uint_32
ppi_from_ppm(png_uint_32 ppm)
{
#if 0
/* The convertion is *(2.54/100), in binary (32 digits):
* .00000110100000001001110101001001
*/
png_uint_32 t1001, t1101;
ppm >>= 1; /* .1 */
t1001 = ppm + (ppm >> 3); /* .1001 */
t1101 = t1001 + (ppm >> 1); /* .1101 */
ppm >>= 20; /* .000000000000000000001 */
t1101 += t1101 >> 15; /* .1101000000000001101 */
t1001 >>= 11; /* .000000000001001 */
t1001 += t1001 >> 12; /* .000000000001001000000001001 */
ppm += t1001; /* .000000000001001000001001001 */
ppm += t1101; /* .110100000001001110101001001 */
return (ppm + 16) >> 5;/* .00000110100000001001110101001001 */
#else
/* The argument is a PNG unsigned integer, so it is not permitted
* to be bigger than 2^31.
*/
png_fixed_point result;
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, ppm, 127, 5000))
return result;
/* Overflow. */
return 0;
#endif
}
png_uint_32 PNGAPI
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5));
return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
}
png_uint_32 PNGAPI
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5));
return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
}
png_uint_32 PNGAPI
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5));
return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr));
}
#ifdef PNG_FIXED_POINT_SUPPORTED
static png_fixed_point
png_fixed_inches_from_microns(png_structp png_ptr, png_int_32 microns)
{
/* Convert from metres * 1,000,000 to inches * 100,000, meters to
* inches is simply *(100/2.54), so we want *(10/2.54) == 1000/254.
* Notice that this can overflow - a warning is output and 0 is
* returned.
*/
return png_muldiv_warn(png_ptr, microns, 500, 127);
}
png_fixed_point PNGAPI
png_get_x_offset_inches_fixed(png_structp png_ptr, png_infop info_ptr)
{
return png_fixed_inches_from_microns(png_ptr,
png_get_x_offset_microns(png_ptr, info_ptr));
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point PNGAPI
png_get_y_offset_inches_fixed(png_structp png_ptr, png_infop info_ptr)
{
return png_fixed_inches_from_microns(png_ptr,
png_get_y_offset_microns(png_ptr, info_ptr));
}
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
{
return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
*.00003937);
/* To avoid the overflow do the conversion directly in floating
* point.
*/
return png_get_x_offset_microns(png_ptr, info_ptr) * .00003937f;
}
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
{
return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
*.00003937);
/* To avoid the overflow do the conversion directly in floating
* point.
*/
return png_get_y_offset_microns(png_ptr, info_ptr) * .00003937f;
}
#endif
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
@ -364,7 +428,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
return (retval);
}
#endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
/* png_get_channels really belongs in here, too, but it's been around longer */
@ -419,26 +483,27 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL)
*white_x = (double)info_ptr->x_white;
*white_x = png_float(png_ptr, info_ptr->x_white, "cHRM white X");
if (white_y != NULL)
*white_y = (double)info_ptr->y_white;
*white_y = png_float(png_ptr, info_ptr->y_white, "cHRM white Y");
if (red_x != NULL)
*red_x = (double)info_ptr->x_red;
*red_x = png_float(png_ptr, info_ptr->x_red, "cHRM red X");
if (red_y != NULL)
*red_y = (double)info_ptr->y_red;
*red_y = png_float(png_ptr, info_ptr->y_red, "cHRM red Y");
if (green_x != NULL)
*green_x = (double)info_ptr->x_green;
*green_x = png_float(png_ptr, info_ptr->x_green, "cHRM green X");
if (green_y != NULL)
*green_y = (double)info_ptr->y_green;
*green_y = png_float(png_ptr, info_ptr->y_green, "cHRM green Y");
if (blue_x != NULL)
*blue_x = (double)info_ptr->x_blue;
*blue_x = png_float(png_ptr, info_ptr->x_blue, "cHRM blue X");
if (blue_y != NULL)
*blue_y = (double)info_ptr->y_blue;
*blue_y = png_float(png_ptr, info_ptr->y_blue, "cHRM blue Y");
return (PNG_INFO_cHRM);
}
return (0);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
@ -451,21 +516,21 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{
if (white_x != NULL)
*white_x = info_ptr->int_x_white;
*white_x = info_ptr->x_white;
if (white_y != NULL)
*white_y = info_ptr->int_y_white;
*white_y = info_ptr->y_white;
if (red_x != NULL)
*red_x = info_ptr->int_x_red;
*red_x = info_ptr->x_red;
if (red_y != NULL)
*red_y = info_ptr->int_y_red;
*red_y = info_ptr->y_red;
if (green_x != NULL)
*green_x = info_ptr->int_x_green;
*green_x = info_ptr->x_green;
if (green_y != NULL)
*green_y = info_ptr->int_y_green;
*green_y = info_ptr->y_green;
if (blue_x != NULL)
*blue_x = info_ptr->int_x_blue;
*blue_x = info_ptr->x_blue;
if (blue_y != NULL)
*blue_y = info_ptr->int_y_blue;
*blue_y = info_ptr->y_blue;
return (PNG_INFO_cHRM);
}
return (0);
@ -474,36 +539,30 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
png_uint_32 PNGFAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *file_gamma)
{
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL)
{
*file_gamma = (double)info_ptr->gamma;
*file_gamma = info_ptr->gamma;
return (PNG_INFO_gAMA);
}
return (0);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *int_file_gamma)
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL)
{
*int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA);
}
return (0);
png_fixed_point igamma;
png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma);
if (ok)
*file_gamma = png_float(png_ptr, igamma, "png_get_gAMA");
return ok;
}
#endif
#endif
@ -529,7 +588,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen)
png_bytepp profile, png_uint_32 *proflen)
{
png_debug1(1, "in %s retrieval function", "iCCP");
@ -668,6 +727,25 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
/*TODO: make this work */
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
"sCAL height");
return (PNG_INFO_sCAL);
}
return(0);
}
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
@ -677,15 +755,14 @@ png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_pixel_width;
*height = info_ptr->scal_pixel_height;
*width = atof(info_ptr->scal_s_width);
*height = atof(info_ptr->scal_s_height);
return (PNG_INFO_sCAL);
}
return(0);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height)
@ -702,7 +779,6 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
return(0);
}
#endif
#endif
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI

View File

@ -5,7 +5,7 @@
* (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 version 1.5.0 - July 24, 2010
* Last changed in libpng version 1.5.0 - July 29, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@ -82,12 +82,12 @@ struct png_info_def
* and initialize the appropriate fields below.
*/
#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
#if defined(PNG_gAMA_SUPPORTED)
/* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/
float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
png_fixed_point gamma;
#endif
#ifdef PNG_sRGB_SUPPORTED
@ -191,16 +191,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* colors in the image as the creator. Values are in the range
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
float x_white;
float y_white;
float x_red;
float y_red;
float x_green;
float y_green;
float x_blue;
float y_blue;
#endif
png_fixed_point x_white;
png_fixed_point y_white;
png_fixed_point x_red;
png_fixed_point y_red;
png_fixed_point x_green;
png_fixed_point y_green;
png_fixed_point x_blue;
png_fixed_point y_blue;
#endif
#ifdef PNG_pCAL_SUPPORTED
@ -237,8 +235,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
png_charp iccp_name; /* profile name */
png_charp iccp_profile; /* International Color Consortium profile data */
/* Note to maintainer: should be png_bytep */
png_bytep iccp_profile; /* International Color Consortium profile data */
png_uint_32 iccp_proflen; /* ICC profile data length */
png_byte iccp_compression; /* Always zero */
#endif
@ -254,19 +251,13 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height corresponsing to one pixel
* in the image. This external representation is converted to double
* here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero.
*/
png_byte scal_unit; /* unit of physical scale */
#ifdef PNG_FLOATING_POINT_SUPPORTED
double scal_pixel_width; /* width of one pixel */
double scal_pixel_height; /* height of one pixel */
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_charp scal_s_width; /* string containing height */
png_charp scal_s_height; /* string containing width */
#endif
#endif
#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
@ -275,20 +266,5 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytepp row_pointers; /* the image bits */
#endif
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
png_fixed_point int_x_white;
png_fixed_point int_y_white;
png_fixed_point int_x_red;
png_fixed_point int_y_red;
png_fixed_point int_x_green;
png_fixed_point int_y_green;
png_fixed_point int_x_blue;
png_fixed_point int_y_blue;
#endif
};
#endif /* PNGINFO_H */

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)

396
pngpriv.h
View File

@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.5.0beta36 - July 24, 2010
* libpng version 1.5.0beta36 - July 29, 2010
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -32,12 +32,10 @@
#include "pnginfo.h"
#include "pngstruct.h"
/* This is required for the definition of abort(), used as a last ditch
* error handler when all else fails.
*/
#include <stdlib.h>
#ifdef BSD
# include <strings.h>
#else
# include <string.h>
#endif
/* Added at libpng-1.2.9 */
/* Moved to pngpriv.h at libpng-1.5.0 */
@ -53,6 +51,9 @@
#endif
/* Moved to pngpriv.h at libpng-1.5.0 */
/* NOTE: some of these may be used in external applications as these definitions
* were exposed in pngconf.h prior to 1.5.
*/
/* If you are running on a machine where you cannot allocate more
* than 64K of memory at once, uncomment this. While libpng will not
* normally need that much memory in a chunk (unless you load up a very
@ -68,16 +69,12 @@
# define PNG_MAX_MALLOC_64K
#endif
/* Moved to pngpriv.h at libpng-1.5.0 */
/* Feature support: in 1.4 this was in pngconf.h, but these
* features have no affect on the libpng API. Add library
* only features to the end of this list. Add features that
* affect the API to scipts/config.dfn using png_on or png_off
* as determined by the default and update scripts/config.std
/* Just a little check that someone hasn't tried to define something
* contradictory.
*/
/* Added at libpng version 1.4.0 */
#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
# define PNG_WARNINGS_SUPPORTED
#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
# undef PNG_ZBUF_SIZE
# define PNG_ZBUF_SIZE 65536L
#endif
/* If warnings or errors are turned off the code is disabled
@ -90,57 +87,7 @@
#ifndef PNG_ERROR_TEXT_SUPPORTED
# define png_error(s1,s2) png_err(s1)
# define png_chunk_error(s1,s2) png_err(s1)
#endif
/* Added at libpng version 1.4.0 */
#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
# define PNG_CHECK_cHRM_SUPPORTED
#endif
/* Added at libpng version 1.4.0 */
#if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# define PNG_ALIGNED_MEMORY_SUPPORTED
#endif
/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING
* See png[wr]util.c
*/
#if !defined(PNG_NO_POINTER_INDEXING) && \
!defined(PNG_POINTER_INDEXING_SUPPORTED)
# define PNG_POINTER_INDEXING_SUPPORTED
#endif
/* Other defines for things like memory and the like can go here. */
/* This controls how fine the quantizing gets. As this allocates
* a largish chunk of memory (32K), those who are not as concerned
* with quantizing quality can decrease some or all of these.
*/
#ifndef PNG_QUANTIZE_RED_BITS
# define PNG_QUANTIZE_RED_BITS 5
#endif
#ifndef PNG_QUANTIZE_GREEN_BITS
# define PNG_QUANTIZE_GREEN_BITS 5
#endif
#ifndef PNG_QUANTIZE_BLUE_BITS
# define PNG_QUANTIZE_BLUE_BITS 5
#endif
/* This controls how fine the gamma correction becomes when you
* are only interested in 8 bits anyway. Increasing this value
* results in more memory being used, and more pow() functions
* being called to fill in the gamma tables. Don't set this value
* less then 8, and even that may not work (I haven't tested it).
*/
#ifndef PNG_MAX_GAMMA_8
# define PNG_MAX_GAMMA_8 11
#endif
/* This controls how much a difference in gamma we can tolerate before
* we actually start doing gamma conversion.
*/
#ifndef PNG_GAMMA_THRESHOLD
# define PNG_GAMMA_THRESHOLD 0.05
# define png_fixed_error(s1,s2,s3) png_err(s1)
#endif
#ifndef PNG_EXTERN
@ -154,11 +101,30 @@
# define PNG_EXTERN
#endif
/* Some fixed point APIs are still required even if not exported because
* they get used by the corresponding floating point APIs. This magic
* deals with this:
*/
#ifdef PNG_FIXED_POINT_SUPPORTED
# define PNGFAPI PNGAPI
#else
# define PNGFAPI /* PRIVATE */
#endif
/* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability.
*/
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* pngarith.c requires the following ANSI-C constants if the convertion of
* floating point to ASCII is implemented therein:
*
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
* DBL_MIN Smalles normalized fp number (can be set to an arbitrary value)
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
#ifdef PNG_FLOATING_POINT_SUPPORTED
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
/* We need to check that <math.h> hasn't already been included earlier
@ -194,31 +160,85 @@
# endif
#endif
/* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this
* is full, it writes the data to the disk, and does some other
* calculations. Making this an extremely small size will slow
* the library down, but you may want to experiment to determine
* where it becomes significant, if you are concerned with memory
* usage. Note that zlib allocates at least 32Kb also. For readers,
* this describes the size of the buffer available to read the data in.
* Unless this gets smaller than the size of a row (compressed),
* it should not make much difference how big this is.
/* Moved here around 1.5.0beta36 from pngconf.h */
/* Users may want to use these so they are not private. Any library
* functions that are passed far data must be model-independent.
*/
#ifndef PNG_ZBUF_SIZE
# define PNG_ZBUF_SIZE 8192
/* Memory model/platform independent fns */
#ifndef PNG_ABORT
# ifdef _WINDOWS_
# define PNG_ABORT() ExitProcess(0)
# else
# define PNG_ABORT() abort()
# endif
#endif
/* Just a little check that someone hasn't tried to define something
* contradictory.
#ifdef USE_FAR_KEYWORD
/* Use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
# define png_strcpy _fstrcpy
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
# define png_strlen _fstrlen
# define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy
# define png_memset _fmemset
# define png_sprintf sprintf
#else
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strcpy lstrcpyA
# define png_strncpy lstrcpynA
# define png_strlen lstrlenA
# define png_memcmp memcmp
# define png_memcpy CopyMemory
# define png_memset memset
# define png_sprintf wsprintfA
# else
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strcpy strcpy
# define png_strncpy strncpy /* Added to v 1.2.6 */
# define png_strlen strlen
# define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy
# define png_memset memset
# define png_sprintf sprintf
# endif
#endif
/* End of memory model/platform independent support */
#ifndef PNG_NO_SNPRINTF
# ifdef _MSC_VER
# define png_snprintf _snprintf /* Added to v 1.2.19 */
# define png_snprintf2 _snprintf
# define png_snprintf6 _snprintf
# else
# define png_snprintf snprintf /* Added to v 1.2.19 */
# define png_snprintf2 snprintf
# define png_snprintf6 snprintf
# endif
#else
/* You don't have or don't want to use snprintf(). Caution: Using
* sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from
* Portable OpenSSH).
*/
#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
# undef PNG_ZBUF_SIZE
# define PNG_ZBUF_SIZE 65536L
# define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
#endif
/* End of 1.5.0beta36 move from pngconf.h */
/* CONSTANTS and UTILITY MACROS
* These are used internally by libpng and not exposed in the API
*/
/* Various modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created.
*/
@ -276,9 +296,7 @@
#define PNG_STRUCT_INFO 0x0002
/* Scaling factor for filter heuristic weighting calculations */
#define PNG_WEIGHT_SHIFT 8
#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
#define PNG_COST_SHIFT 3
#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
@ -343,6 +361,44 @@
#define PNG_OUT_OF_RANGE(value, ideal, delta) \
( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
/* Convertions between fixed and floating point, only defined if
* required (to make sure the code doesn't accidentally use float
* when it is supposedly disabled.)
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
/* The floating point convertion can't overflow, though it can and
* does lose accuracy relative to the original fixed point value.
* In practice this doesn't matter because png_fixed_point only
* stores numbers with very low precision. The png_ptr and s
* arguments are unused by default but are there in case error
* checking becomes a requirement.
*/
#define png_float(png_ptr, fixed, s) (.00001 * (fixed))
/* The fixed point convertion performs range checking and evaluates
* its argument multiple times, so must be used with care. The
* range checking uses the PNG specification values for a signed
* 32 bit fixed point value except that the values are deliberately
* rounded-to-zero to an integral value - 21474. 's' is a string
* that describes the value being converted.
*
* NOTE: this macro will raise a png_error if the range check fails,
* therefore it is normally only appropriate to use this on values
* that come from API calls or other sources where an out of range
* error indicates a programming error, not a data error!
*
* NOTE: by default this is off - the macro is not used - because the
* function call saves a lot of code.
*/
#ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
#define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s, fp),0))
#else
PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
png_const_charp text));
#endif
#endif
/* Constant strings for known chunk types. If you need to add a chunk,
* define the name here, and add an invocation of the macro wherever it's
* needed.
@ -404,8 +460,8 @@ PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
/* Next four functions are used internally as callbacks. PNGCBAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to PNGCBAPI
* at 1.5.0
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to
* PNGCBAPI at 1.5.0
*/
PNG_EXTERN void PNGCBAPI png_default_read_data PNGARG((png_structp png_ptr,
@ -597,16 +653,9 @@ PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
#endif
#ifdef PNG_WRITE_sCAL_SUPPORTED
# if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
int unit, double width, double height));
# else
# ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
int unit, png_charp width, png_charp height));
#endif
# endif
#endif
/* Called when finished processing a row of data */
PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
@ -945,7 +994,7 @@ PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
#endif
/* Added at libpng version 1.4.0 */
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_CHECK_cHRM_SUPPORTED
PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
@ -953,13 +1002,12 @@ PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_blue_y));
#endif
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_CHECK_cHRM_SUPPORTED
/* Added at libpng version 1.2.34 and 1.4.0 */
/* Currently only used by png_check_cHRM_fixed */
PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
unsigned long *hi_product, unsigned long *lo_product));
#endif
#endif
/* Added at libpng version 1.4.0 */
PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
@ -968,8 +1016,8 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
int filter_type));
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr));
PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr, png_infop end_info_ptr));
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
@ -979,10 +1027,154 @@ PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
int check));
#endif /* USE_FAR_KEYWORD */
#include "pngdebug.h"
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_EXTERN void png_fixed_error PNGARG((png_structp png_ptr,
png_const_charp name, double value));
#endif
/* ASCII to FP interfaces, currently only implemented if sCAL
* support is required.
*/
#if defined(PNG_READ_sCAL_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
/* MAX_DIGITS is actually the maximum number of characters in an sCAL
* width or height, derived from the precision (number of significant
* digits - a build time settable option) and assumpitions about the
* maximum ridiculous exponent.
*/
#define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
PNG_EXTERN void png_ascii_from_fp(png_structp png_ptr, png_charp ascii,
png_size_t size, double fp, unsigned precision);
#endif /* READ_sCAL && FLOATING_POINT */
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
/* An internal API to validate the format of a floating point number.
* The result is the index of the next character. If the number is
* not valid it will be the index of a character in the supposed number.
*
* The format of a number is defined in the PNG extensions specification
* and this API is strictly conformant to that spec, not anyone elses!
*
* The format as a regular expression is:
*
* [+-]?[0-9]+.?([Ee][+-]?[0-9]+)?
*
* or:
*
* [+-]?.[0-9]+(.[0-9]+)?([Ee][+-]?[0-9]+)?
*
* The complexity is that either integer or fraction must be present and the
* fraction is permitted to have no digits only if the integer is present.
*
* NOTE: The dangling E problem.
* There is a PNG valid floating point number in the following:
*
* PNG floating point numb1.ers are not greedy.
*
* Working this out requires *TWO* character lookahead (because of the
* sign), the parser does not do this - it will fail at the 'r' - this
* doesn't matter for PNG sCAL chunk values, but it requires more care
* if the value were ever to be embedded in something more complex. Use
* ANSI-C strtod if you need the lookahead.
*/
/* State table for the parser. */
#define PNG_FP_INTEGER 0 /* before or in integer */
#define PNG_FP_FRACTION 1 /* before or in fraction */
#define PNG_FP_EXPONENT 2 /* before or in exponent */
#define PNG_FP_STATE 3 /* mask for the above */
#define PNG_FP_SAW_SIGN 4 /* Saw +/- in current state */
#define PNG_FP_SAW_DIGIT 8 /* Saw a digit in current state */
#define PNG_FP_SAW_DOT 16 /* Saw a dot in current state */
#define PNG_FP_SAW_E 32 /* Saw an E (or e) in current state */
#define PNG_FP_SAW_ANY 60 /* Saw any of the above 4 */
#define PNG_FP_WAS_VALID 64 /* Preceding substring is a valid fp number */
#define PNG_FP_INVALID 128 /* Available for callers as a distinct value */
/* Result codes for the parser (boolean - true meants ok, false means
* not ok yet.)
*/
#define PNG_FP_MAYBE 0 /* The number may be valid in the future */
#define PNG_FP_OK 1 /* The number is valid */
/* The actual parser. This can be called repeatedly, it updates
* the index into the string and the state variable (which must
* be initialzed to 0). It returns a result code, as above. There
* is no point calling the parser any more if it fails to advance to
* the end of the string - it is stuck on an invalid character (or
* terminated by '\0').
*
* Note that the pointer will consume an E or even an E+ then leave
* a 'maybe' state even though a preceding integer.fraction is valid.
* The PNG_FP_WAS_VALID flag indicates that a preceding substring was
* a valid number. It's possible to recover from this by calling
* the parser again (from the start, with state 0) but with a string
* that omits the last character (i.e. set the size to the index of
* the problem character.) This has not been tested within libpng.
*/
PNG_EXTERN int png_check_fp_number(png_charp string, png_size_t size,
int *statep, png_size_tp whereami);
/* This is the same but it checks a complete string and returns true
* only if it just contains a floating point number.
*/
PNG_EXTERN int png_check_fp_string(png_charp string, png_size_t size);
#endif /* pCAL || sCAL */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
/* Added at libpng version 1.5.0 */
/* This is a utility to provide a*times/div (rounded) and indicate
* if there is an overflow. The result is a boolean - false (0)
* for overflow, true (1) if no overflow, in which case *res
* holds the result.
*/
PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a,
png_int_32 times, png_int_32 div));
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
/* Same deal, but issue a warning on overflow and return 0. */
PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr,
png_fixed_point a, png_int_32 times, png_int_32 div));
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Calculate a reciprocal - used for gamma values. This returns
* 0 if the argument is 0 in order to maintain an undefined value,
* there are no warnings.
*/
PNG_EXTERN png_fixed_point png_reciprocal PNGARG((png_fixed_point a));
/* The same but gives a reciprocal of the product of two fixed point
* values. Accuracy is suitable for gamma calculations but this is
* not exact - use png_muldiv for that.
*/
PNG_EXTERN png_fixed_point png_reciprocal2 PNGARG((png_fixed_point a,
png_fixed_point b));
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Internal fixed point gamma correction. These APIs are called as
* required to convert single values - they don't need to be fast,
* they are not used when processing image pixel values.
*
* While the input is an 'unsigned' value it must actually be the
* correct bit value - 0..255 or 0..65535 as required.
*/
PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr,
unsigned value, png_fixed_point gamma));
PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma));
PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned value,
png_fixed_point gamma));
PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned value,
png_fixed_point gamma));
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
png_byte bit_depth));
#endif
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#include "pngdebug.h"
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -500,6 +500,10 @@ png_start_read_image(png_structp png_ptr)
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
else
png_warning(png_ptr,
"Ignoring extra png_start_read_image() call;"
" row buffer not reallocated");
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
@ -852,7 +856,31 @@ png_read_image(png_structp png_ptr, png_bytepp image)
return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
{
pass = png_set_interlace_handling(png_ptr);
/* And make sure transforms are initialized. */
png_start_read_image(png_ptr);
}
else
{
if (!(png_ptr->transformations & PNG_INTERLACE))
{
/* Caller called png_start_read_image or png_read_update_info without
* first turning on the PNG_INTERLACE transform. We can fix this here,
* but the caller should do it!
*/
png_warning(png_ptr, "Interlace handling should be turned on when "
"using png_read_image");
/* Make sure this is set correctly */
png_ptr->num_rows = png_ptr->height;
}
/* Obtain the pass number, which also turns on the PNG_INTERLACE flag in
* the above error case.
*/
pass = png_set_interlace_handling(png_ptr);
}
#else
if (png_ptr->interlaced)
png_error(png_ptr,
@ -861,9 +889,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
pass = 1;
#endif
image_height=png_ptr->height;
png_ptr->num_rows = image_height; /* Make sure this is set correctly */
for (j = 0; j < pass; j++)
{

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -88,15 +88,14 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
}
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Handle alpha and tRNS via a background color */
void PNGAPI
png_set_background(png_structp png_ptr,
void PNGFAPI
png_set_background_fixed(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma)
int need_expand, png_fixed_point background_gamma)
{
png_debug(1, "in png_set_background");
png_debug(1, "in png_set_background_fixed");
if (png_ptr == NULL)
return;
@ -110,11 +109,22 @@ png_set_background(png_structp png_ptr,
png_ptr->transformations |= PNG_BACKGROUND;
png_memcpy(&(png_ptr->background), background_color,
png_sizeof(png_color_16));
png_ptr->background_gamma = (float)background_gamma;
png_ptr->background_gamma = background_gamma;
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0);
}
#endif
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma)
{
png_set_background_fixed(png_ptr, background_color, background_gamma_code,
need_expand, png_fixed(png_ptr, background_gamma, "png_set_background"));
}
# endif /* FLOATING_POINT */
#endif /* READ_BACKGROUND */
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Strip 16 bit depth files to 8 bit depth */
@ -549,7 +559,7 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
}
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Transform the image from the file_gamma to the screen_gamma. We
* only do transformations on images where the file_gamma and screen_gamma
* are not close reciprocals, otherwise it slows things down slightly, and
@ -559,22 +569,48 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
* are present in the tRNS array for palette images. We can't do it here
* because we don't necessarily have the tRNS chunk yet.
*/
void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
static int /* PRIVATE */
png_gamma_threshold(png_fixed_point scrn_gamma, png_fixed_point file_gamma)
{
png_debug(1, "in png_set_gamma");
/* PNG_GAMMA_THRESHOLD is the threshold for performing gamma
* correction as a difference of the overall transform from 1.0
*
* We want to compare the threshold with s*f - 1, if we get
* overflow here it is because of wacky gamma values so we
* turn on processing anyway.
*/
png_fixed_point gtest;
return !png_muldiv(&gtest, scrn_gamma, file_gamma, PNG_FP_1) ||
png_gamma_significant(gtest);
}
void PNGFAPI
png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
png_fixed_point file_gamma)
{
png_debug(1, "in png_set_gamma_fixed");
if (png_ptr == NULL)
return;
if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
if ((png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
png_gamma_threshold(scrn_gamma, file_gamma))
png_ptr->transformations |= PNG_GAMMA;
png_ptr->gamma = (float)file_gamma;
png_ptr->screen_gamma = (float)scrn_gamma;
png_ptr->gamma = file_gamma;
png_ptr->screen_gamma = scrn_gamma;
}
#endif
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
{
png_set_gamma_fixed(png_ptr,
png_fixed(png_ptr, scrn_gamma, "png_set_gamma screen gamma"),
png_fixed(png_ptr, file_gamma, "png_set_gamma file gamma"));
}
# endif /* FLOATING_POINT_SUPPORTED */
#endif /* READ_GAMMA */
#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand paletted images to RGB, expand grayscale images of
@ -662,12 +698,7 @@ png_set_gray_to_rgb(png_structp png_ptr)
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
void
#ifdef PNG_FIXED_POINT_SUPPORTED
PNGAPI
#else
/* PRIVATE */
#endif
void PNGFAPI
png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green)
{
@ -737,13 +768,12 @@ void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
double green)
{
int red_fixed = (int)((float)red*100000.0 + 0.5);
int green_fixed = (int)((float)green*100000.0 + 0.5);
if (png_ptr == NULL)
return;
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
png_set_rgb_to_gray_fixed(png_ptr, error_action,
png_fixed(png_ptr, red, "rgb to gray red coefficient"),
png_fixed(png_ptr, green, "rgb to gray green coefficient"));
}
#endif /* FLOATING POINT */
@ -886,7 +916,8 @@ png_init_read_transformations(png_structp png_ptr)
int i, istop;
istop=(int)png_ptr->num_trans;
for (i=0; i<istop; i++)
png_ptr->trans_alpha[i] = (png_byte)(255 - png_ptr->trans_alpha[i]);
png_ptr->trans_alpha[i] = (png_byte)(255 -
png_ptr->trans_alpha[i]);
}
}
#endif
@ -898,11 +929,10 @@ png_init_read_transformations(png_structp png_ptr)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
png_ptr->background_1 = png_ptr->background;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0)
&& (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0)
< PNG_GAMMA_THRESHOLD))
&& png_gamma_threshold(png_ptr->screen_gamma, png_ptr->gamma))
{
int i, k;
k=0;
@ -916,7 +946,7 @@ png_init_read_transformations(png_structp png_ptr)
}
if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) &&
png_ptr->gamma != 0.0)
png_ptr->gamma != 0)
{
png_build_gamma_table(png_ptr, png_ptr->bit_depth);
@ -932,6 +962,7 @@ png_init_read_transformations(png_structp png_ptr)
int i;
if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE)
{
back.red = png_ptr->gamma_table[png_ptr->background.red];
back.green = png_ptr->gamma_table[png_ptr->background.green];
back.blue = png_ptr->gamma_table[png_ptr->background.blue];
@ -942,31 +973,33 @@ png_init_read_transformations(png_structp png_ptr)
}
else
{
double g, gs;
png_fixed_point g, gs;
switch (png_ptr->background_gamma_type)
{
case PNG_BACKGROUND_GAMMA_SCREEN:
g = (png_ptr->screen_gamma);
gs = 1.0;
gs = PNG_FP_1;
break;
case PNG_BACKGROUND_GAMMA_FILE:
g = 1.0 / (png_ptr->gamma);
gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
g = png_reciprocal(png_ptr->gamma);
gs = png_reciprocal2(png_ptr->gamma,
png_ptr->screen_gamma);
break;
case PNG_BACKGROUND_GAMMA_UNIQUE:
g = 1.0 / (png_ptr->background_gamma);
gs = 1.0 / (png_ptr->background_gamma *
g = png_reciprocal(png_ptr->background_gamma);
gs = png_reciprocal2(png_ptr->background_gamma,
png_ptr->screen_gamma);
break;
default:
g = 1.0; /* back_1 */
gs = 1.0; /* back */
g = PNG_FP_1; /* back_1 */
gs = PNG_FP_1; /* back */
break;
}
if ( fabs(gs - 1.0) < PNG_GAMMA_THRESHOLD)
if ( png_gamma_significant(gs) )
{
back.red = (png_byte)png_ptr->background.red;
back.green = (png_byte)png_ptr->background.green;
@ -975,24 +1008,18 @@ png_init_read_transformations(png_structp png_ptr)
else
{
back.red = (png_byte)(pow(
(double)png_ptr->background.red/255.0, gs) * 255.0 + .5);
back.green = (png_byte)(pow(
(double)png_ptr->background.green/255.0, gs) * 255.0
+ .5);
back.blue = (png_byte)(pow(
(double)png_ptr->background.blue/255.0, gs) * 255.0
+ .5);
back.red = png_gamma_8bit_correct(png_ptr->background.red,
gs);
back.green = png_gamma_8bit_correct(png_ptr->background.green,
gs);
back.blue = png_gamma_8bit_correct(png_ptr->background.blue,
gs);
}
back_1.red = (png_byte)(pow(
(double)png_ptr->background.red/255.0, g) * 255.0 + .5);
back_1.green = (png_byte)(pow(
(double)png_ptr->background.green/255.0, g) * 255.0 + .5);
back_1.blue = (png_byte)(pow(
(double)png_ptr->background.blue/255.0, g) * 255.0 + .5);
back_1.red = png_gamma_8bit_correct(png_ptr->background.red, g);
back_1.green = png_gamma_8bit_correct(png_ptr->background.green,
g);
back_1.blue = png_gamma_8bit_correct(png_ptr->background.blue,
g);
}
for (i = 0; i < num_palette; i++)
{
@ -1040,57 +1067,56 @@ png_init_read_transformations(png_structp png_ptr)
else
/* color_type != PNG_COLOR_TYPE_PALETTE */
{
double m = (double)(((png_uint_32)1 << png_ptr->bit_depth) - 1);
double g = 1.0;
double gs = 1.0;
png_fixed_point g = PNG_FP_1;
png_fixed_point gs = PNG_FP_1;
switch (png_ptr->background_gamma_type)
{
case PNG_BACKGROUND_GAMMA_SCREEN:
g = (png_ptr->screen_gamma);
gs = 1.0;
g = png_ptr->screen_gamma;
/* gs = PNG_FP_1; */
break;
case PNG_BACKGROUND_GAMMA_FILE:
g = 1.0 / (png_ptr->gamma);
gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
g = png_reciprocal(png_ptr->gamma);
gs = png_reciprocal2(png_ptr->gamma, png_ptr->screen_gamma);
break;
case PNG_BACKGROUND_GAMMA_UNIQUE:
g = 1.0 / (png_ptr->background_gamma);
gs = 1.0 / (png_ptr->background_gamma *
g = png_reciprocal(png_ptr->background_gamma);
gs = png_reciprocal2(png_ptr->background_gamma,
png_ptr->screen_gamma);
break;
}
png_ptr->background_1.gray = (png_uint_16)(pow(
(double)png_ptr->background.gray / m, g) * m + .5);
png_ptr->background_1.gray = png_gamma_correct(png_ptr,
png_ptr->background.gray, g);
png_ptr->background.gray = (png_uint_16)(pow(
(double)png_ptr->background.gray / m, gs) * m + .5);
png_ptr->background.gray = png_gamma_correct(png_ptr,
png_ptr->background.gray, gs);
if ((png_ptr->background.red != png_ptr->background.green) ||
(png_ptr->background.red != png_ptr->background.blue) ||
(png_ptr->background.red != png_ptr->background.gray))
{
/* RGB or RGBA with color background */
png_ptr->background_1.red = (png_uint_16)(pow(
(double)png_ptr->background.red / m, g) * m + .5);
png_ptr->background_1.red = png_gamma_correct(png_ptr,
png_ptr->background.red, g);
png_ptr->background_1.green = (png_uint_16)(pow(
(double)png_ptr->background.green / m, g) * m + .5);
png_ptr->background_1.green = png_gamma_correct(png_ptr,
png_ptr->background.green, g);
png_ptr->background_1.blue = (png_uint_16)(pow(
(double)png_ptr->background.blue / m, g) * m + .5);
png_ptr->background_1.blue = png_gamma_correct(png_ptr,
png_ptr->background.blue, g);
png_ptr->background.red = (png_uint_16)(pow(
(double)png_ptr->background.red / m, gs) * m + .5);
png_ptr->background.red = png_gamma_correct(png_ptr,
png_ptr->background.red, gs);
png_ptr->background.green = (png_uint_16)(pow(
(double)png_ptr->background.green / m, gs) * m + .5);
png_ptr->background.green = png_gamma_correct(png_ptr,
png_ptr->background.green, gs);
png_ptr->background.blue = (png_uint_16)(pow(
(double)png_ptr->background.blue / m, gs) * m + .5);
png_ptr->background.blue = png_gamma_correct(png_ptr,
png_ptr->background.blue, gs);
}
else
@ -1127,7 +1153,7 @@ png_init_read_transformations(png_structp png_ptr)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
else
#endif
#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
#endif /* PNG_READ_GAMMA_SUPPORTED */
#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* No GAMMA transformation */
if ((png_ptr->transformations & PNG_BACKGROUND) &&
@ -1255,12 +1281,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (png_ptr->transformations & PNG_GAMMA)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
info_ptr->gamma = png_ptr->gamma;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_gamma = png_ptr->int_gamma;
#endif
}
#endif
@ -4066,267 +4087,6 @@ png_do_quantize(png_row_infop row_info, png_bytep row,
}
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
#ifdef PNG_FLOATING_POINT_SUPPORTED
#ifdef PNG_READ_GAMMA_SUPPORTED
static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
* tables, we don't make a full table if we are reducing to 8-bit in
* the future. Note also how the gamma_16 tables are segmented so that
* we don't need to allocate > 64K chunks for a full 16-bit table.
*
* See the PNG extensions document for an integer algorithm for creating
* the gamma tables. Maybe we will implement that here someday.
*
* We should only reach this point if
*
* the file_gamma is known (i.e., the gAMA or sRGB chunk is present,
* or the application has provided a file_gamma)
*
* AND
* {
* the screen_gamma is known
*
* OR
*
* RGB_to_gray transformation is being performed
* }
*
* AND
* {
* the screen_gamma is different from the reciprocal of the
* file_gamma by more than the specified threshold
*
* OR
*
* a background color has been specified and the file_gamma
* and screen_gamma are not 1.0, within the specified threshold.
* }
*/
void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr, png_byte bit_depth)
{
png_debug(1, "in png_build_gamma_table");
if (bit_depth <= 8)
{
int i;
double g;
if (png_ptr->screen_gamma > .000001)
g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
else
g = 1.0;
png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
(png_uint_32)256);
for (i = 0; i < 256; i++)
{
png_ptr->gamma_table[i] = (png_byte)(pow((double)i / 255.0,
g) * 255.0 + .5);
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
if (png_ptr->transformations & ((PNG_BACKGROUND) | PNG_RGB_TO_GRAY))
{
g = 1.0 / (png_ptr->gamma);
png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
(png_uint_32)256);
for (i = 0; i < 256; i++)
{
png_ptr->gamma_to_1[i] = (png_byte)(pow((double)i / 255.0,
g) * 255.0 + .5);
}
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
(png_uint_32)256);
if (png_ptr->screen_gamma > 0.000001)
g = 1.0 / png_ptr->screen_gamma;
else
g = png_ptr->gamma; /* Probably doing rgb_to_gray */
for (i = 0; i < 256; i++)
{
png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0,
g) * 255.0 + .5);
}
}
#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */
}
else
{
double g;
int i, j, shift, num;
int sig_bit;
png_uint_32 ig;
if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
{
sig_bit = (int)png_ptr->sig_bit.red;
if ((int)png_ptr->sig_bit.green > sig_bit)
sig_bit = png_ptr->sig_bit.green;
if ((int)png_ptr->sig_bit.blue > sig_bit)
sig_bit = png_ptr->sig_bit.blue;
}
else
{
sig_bit = (int)png_ptr->sig_bit.gray;
}
if (sig_bit > 0)
shift = 16 - sig_bit;
else
shift = 0;
if (png_ptr->transformations & PNG_16_TO_8)
{
if (shift < (16 - PNG_MAX_GAMMA_8))
shift = (16 - PNG_MAX_GAMMA_8);
}
if (shift > 8)
shift = 8;
if (shift < 0)
shift = 0;
png_ptr->gamma_shift = (png_byte)shift;
num = (1 << (8 - shift));
if (png_ptr->screen_gamma > .000001)
g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma);
else
g = 1.0;
png_ptr->gamma_16_table = (png_uint_16pp)png_calloc(png_ptr,
(png_uint_32)(num * png_sizeof(png_uint_16p)));
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
{
double fin, fout;
png_uint_32 last, max;
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(256 * png_sizeof(png_uint_16)));
}
g = 1.0 / g;
last = 0;
for (i = 0; i < 256; i++)
{
fout = ((double)i + 0.5) / 256.0;
fin = pow(fout, g);
max = (png_uint_32)(fin * (double)((png_uint_32)num << 8));
while (last <= max)
{
png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
[(int)(last >> (8 - shift))] = (png_uint_16)(
(png_uint_16)i | ((png_uint_16)i << 8));
last++;
}
}
while (last < ((png_uint_32)num << 8))
{
png_ptr->gamma_16_table[(int)(last & (0xff >> shift))]
[(int)(last >> (8 - shift))] = (png_uint_16)65535L;
last++;
}
}
else
{
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(256 * png_sizeof(png_uint_16)));
ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
for (j = 0; j < 256; j++)
{
png_ptr->gamma_16_table[i][j] =
(png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
65535.0, g) * 65535.0 + .5);
}
}
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY))
{
g = 1.0 / (png_ptr->gamma);
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_calloc(png_ptr,
(png_uint_32)(num * png_sizeof(png_uint_16p )));
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(256 * png_sizeof(png_uint_16)));
ig = (((png_uint_32)i *
(png_uint_32)png_gamma_shift[shift]) >> 4);
for (j = 0; j < 256; j++)
{
png_ptr->gamma_16_to_1[i][j] =
(png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
65535.0, g) * 65535.0 + .5);
}
}
if (png_ptr->screen_gamma > 0.000001)
g = 1.0 / png_ptr->screen_gamma;
else
g = png_ptr->gamma; /* Probably doing rgb_to_gray */
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_calloc(png_ptr,
(png_uint_32)(num * png_sizeof(png_uint_16p)));
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(256 * png_sizeof(png_uint_16)));
ig = (((png_uint_32)i *
(png_uint_32)png_gamma_shift[shift]) >> 4);
for (j = 0; j < 256; j++)
{
png_ptr->gamma_16_from_1[i][j] =
(png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) /
65535.0, g) * 65535.0 + .5);
}
}
}
#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */
}
}
#endif
/* To do: install integer version of png_build_gamma_table here */
#endif
#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */
void /* PRIVATE */

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.4.1 [July 24, 2010]
* Last changed in libpng 1.4.1 [July 29, 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.)
@ -27,6 +27,29 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
png_error(png_ptr, "PNG unsigned integer out of range");
return (i);
}
#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
/* The following is a variation on the above for use with the fixed
* point values used for gAMA and cHRM. Instead of png_error it
* issues a warning and returns (-1) - an invalid value because both
* gAMA and cHRM use *unsigned* integers for fixed point values.
*/
#define PNG_FIXED_ERROR (-1)
png_fixed_point /* PRIVATE */
png_get_fixed_point(png_structp png_ptr, png_bytep buf)
{
png_uint_32 u = png_get_uint_32(buf);
if (u <= PNG_UINT_31_MAX)
return (png_fixed_point)u; /* known to be in range */
/* The caller can turn off the warning by passing NULL. */
if (png_ptr != NULL)
png_warning(png_ptr, "PNG fixed point integer out of range");
return PNG_FIXED_ERROR;
}
#endif
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
/* NOTE: the read macros will obscure these definitions, so that if
* PNG_USE_READ_MACROS is set the library will not use them internally,
@ -46,22 +69,20 @@ png_get_uint_32)(png_bytep buf)
}
/* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format, and it is
* assumed that the machine format for signed integers is the same.
* Only used internally in this file.
* data is stored in the PNG file in two's complement format and there
* is no guarantee that a 'png_int_32' is exactly 32 bits, therefore
* the following code does a two's complement to native convertion.
*/
#if defined(PNG_GET_INT_32_SUPPORTED)
png_int_32 (PNGAPI
png_get_int_32)(png_bytep buf)
{
png_int_32 i = ((png_int_32)(*buf) << 24) +
((png_int_32)(*(buf + 1)) << 16) +
((png_int_32)(*(buf + 2)) << 8) +
(png_int_32)(*(buf + 3));
png_uint_32 u = png_get_uint_32(buf);
if ((u & 0x80000000) == 0) /* negative */
return u;
return (i);
u = (u ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
return -u;
}
#endif
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
png_uint_16 (PNGAPI
@ -677,9 +698,6 @@ void /* PRIVATE */
png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_fixed_point igamma;
#ifdef PNG_FLOATING_POINT_SUPPORTED
float file_gamma;
#endif
png_byte buf[4];
png_debug(1, "in png_handle_gAMA");
@ -718,12 +736,12 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (png_crc_finish(png_ptr, 0))
return;
igamma = (png_fixed_point)png_get_uint_32(buf);
/* Check for zero gamma */
if (igamma == 0)
igamma = png_get_fixed_point(NULL, buf);
/* Check for zero gamma or an error. */
if (igamma <= 0)
{
png_warning(png_ptr,
"Ignoring gAMA chunk with gamma=0");
"Ignoring gAMA chunk with out of range gamma");
return;
}
@ -740,16 +758,12 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_sRGB_SUPPORTED */
#ifdef PNG_FLOATING_POINT_SUPPORTED
file_gamma = (float)igamma / (float)100000.0;
# ifdef PNG_READ_GAMMA_SUPPORTED
png_ptr->gamma = file_gamma;
/* Gamma correction on read is supported. */
png_ptr->gamma = igamma;
# endif
png_set_gAMA(png_ptr, info_ptr, file_gamma);
#else
/* Fixed point must be set! */
/* And set the 'info' structure members. */
png_set_gAMA_fixed(png_ptr, info_ptr, igamma);
#endif
}
#endif
@ -831,13 +845,8 @@ void /* PRIVATE */
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_byte buf[32];
#ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif
png_fixed_point int_x_white, int_y_white, int_x_red, int_y_red, int_x_green,
int_y_green, int_x_blue, int_y_blue;
png_uint_32 uint_x, uint_y;
png_fixed_point x_white, y_white, x_red, y_red, x_green, y_green, x_blue,
y_blue;
png_debug(1, "in png_handle_cHRM");
@ -877,80 +886,54 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (png_crc_finish(png_ptr, 0))
return;
uint_x = png_get_uint_32(buf);
uint_y = png_get_uint_32(buf + 4);
int_x_white = (png_fixed_point)uint_x;
int_y_white = (png_fixed_point)uint_y;
uint_x = png_get_uint_32(buf + 8);
uint_y = png_get_uint_32(buf + 12);
int_x_red = (png_fixed_point)uint_x;
int_y_red = (png_fixed_point)uint_y;
uint_x = png_get_uint_32(buf + 16);
uint_y = png_get_uint_32(buf + 20);
int_x_green = (png_fixed_point)uint_x;
int_y_green = (png_fixed_point)uint_y;
uint_x = png_get_uint_32(buf + 24);
uint_y = png_get_uint_32(buf + 28);
int_x_blue = (png_fixed_point)uint_x;
int_y_blue = (png_fixed_point)uint_y;
#ifdef PNG_FLOATING_POINT_SUPPORTED
white_x = (float)int_x_white / (float)100000.0;
white_y = (float)int_y_white / (float)100000.0;
red_x = (float)int_x_red / (float)100000.0;
red_y = (float)int_y_red / (float)100000.0;
green_x = (float)int_x_green / (float)100000.0;
green_y = (float)int_y_green / (float)100000.0;
blue_x = (float)int_x_blue / (float)100000.0;
blue_y = (float)int_y_blue / (float)100000.0;
#endif
x_white = png_get_fixed_point(NULL, buf);
y_white = png_get_fixed_point(NULL, buf + 4);
x_red = png_get_fixed_point(NULL, buf + 8);
y_red = png_get_fixed_point(NULL, buf + 12);
x_green = png_get_fixed_point(NULL, buf + 16);
y_green = png_get_fixed_point(NULL, buf + 20);
x_blue = png_get_fixed_point(NULL, buf + 24);
y_blue = png_get_fixed_point(NULL, buf + 28);
if (x_white == PNG_FIXED_ERROR ||
y_white == PNG_FIXED_ERROR ||
x_red == PNG_FIXED_ERROR ||
y_red == PNG_FIXED_ERROR ||
x_green == PNG_FIXED_ERROR ||
y_green == PNG_FIXED_ERROR ||
x_blue == PNG_FIXED_ERROR ||
y_blue == PNG_FIXED_ERROR)
{
png_warning(png_ptr, "Ignoring cHRM chunk with negative chromaticities");
return;
}
#ifdef PNG_READ_sRGB_SUPPORTED
if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB))
{
if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) ||
PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) ||
PNG_OUT_OF_RANGE(int_x_red, 64000L, 1000) ||
PNG_OUT_OF_RANGE(int_y_red, 33000, 1000) ||
PNG_OUT_OF_RANGE(int_x_green, 30000, 1000) ||
PNG_OUT_OF_RANGE(int_y_green, 60000L, 1000) ||
PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) ||
PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000))
if (PNG_OUT_OF_RANGE(x_white, 31270, 1000) ||
PNG_OUT_OF_RANGE(y_white, 32900, 1000) ||
PNG_OUT_OF_RANGE(x_red, 64000L, 1000) ||
PNG_OUT_OF_RANGE(y_red, 33000, 1000) ||
PNG_OUT_OF_RANGE(x_green, 30000, 1000) ||
PNG_OUT_OF_RANGE(y_green, 60000L, 1000) ||
PNG_OUT_OF_RANGE(x_blue, 15000, 1000) ||
PNG_OUT_OF_RANGE(y_blue, 6000, 1000))
{
png_warning(png_ptr,
"Ignoring incorrect cHRM value when sRGB is also present");
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
fprintf(stderr, "wx=%f, wy=%f, rx=%f, ry=%f\n",
white_x, white_y, red_x, red_y);
fprintf(stderr, "gx=%f, gy=%f, bx=%f, by=%f\n",
green_x, green_y, blue_x, blue_y);
#else
fprintf(stderr, "wx=%ld, wy=%ld, rx=%ld, ry=%ld\n",
(long)int_x_white, (long)int_y_white,
(long)int_x_red, (long)int_y_red);
fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n",
(long)int_x_green, (long)int_y_green,
(long)int_x_blue, (long)int_y_blue);
#endif
fprintf(stderr, "wx=%d, wy=%d, rx=%d, ry=%d\n",
x_white, y_white, x_red, y_red);
fprintf(stderr, "gx=%d, gy=%d, bx=%d, by=%d\n",
x_green, y_green, x_blue, y_blue);
#endif /* PNG_CONSOLE_IO_SUPPORTED */
}
return;
}
#endif /* PNG_READ_sRGB_SUPPORTED */
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_cHRM(png_ptr, info_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_cHRM_fixed(png_ptr, info_ptr,
int_x_white, int_y_white, int_x_red, int_y_red, int_x_green,
int_y_green, int_x_blue, int_y_blue);
#endif
png_set_cHRM_fixed(png_ptr, info_ptr, x_white, y_white, x_red, y_red,
x_green, y_green, x_blue, y_blue);
}
#endif
@ -1007,48 +990,31 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA))
{
png_fixed_point igamma;
#ifdef PNG_FIXED_POINT_SUPPORTED
igamma=info_ptr->int_gamma;
#else
# ifdef PNG_FLOATING_POINT_SUPPORTED
igamma=(png_fixed_point)(info_ptr->gamma * 100000.);
# endif
#endif
if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
if (PNG_OUT_OF_RANGE(info_ptr->gamma, 45500L, 500))
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
#ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
fprintf(stderr, "incorrect gamma=(%d/100000)\n",
(int)png_ptr->int_gamma);
# else
# ifdef PNG_FLOATING_POINT_SUPPORTED
fprintf(stderr, "incorrect gamma=%f\n", png_ptr->gamma);
# endif
# endif
fprintf(stderr, "incorrect gamma=(%d/100000)\n", info_ptr->gamma);
#endif
}
}
#endif /* PNG_READ_gAMA_SUPPORTED */
#ifdef PNG_READ_cHRM_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
if (PNG_OUT_OF_RANGE(info_ptr->int_x_white, 31270, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_y_white, 32900, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_x_red, 64000L, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_y_red, 33000, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_x_green, 30000, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_y_green, 60000L, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_x_blue, 15000, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->int_y_blue, 6000, 1000))
if (PNG_OUT_OF_RANGE(info_ptr->x_white, 31270, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->y_white, 32900, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->x_red, 64000L, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->y_red, 33000, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->x_green, 30000, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->y_green, 60000L, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->x_blue, 15000, 1000) ||
PNG_OUT_OF_RANGE(info_ptr->y_blue, 6000, 1000))
{
png_warning(png_ptr,
"Ignoring incorrect cHRM value when sRGB is also present");
}
#endif /* PNG_FIXED_POINT_SUPPORTED */
#endif /* PNG_READ_cHRM_SUPPORTED */
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent);
@ -1171,18 +1137,20 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
char umsg[80];
png_snprintf2(umsg, 80,
"Ignoring iCCP chunk with declared size = %lu "
"and actual length = %lu",
(unsigned long)profile_size,
(unsigned long)profile_length);
"Ignoring iCCP chunk with declared size = %u "
"and actual length = %u", profile_size, profile_length);
png_warning(png_ptr, umsg);
}
#else
png_warning(png_ptr,
"Ignoring iCCP chunk with uncompressed size mismatch");
#endif
return;
}
png_set_iCCP(png_ptr, info_ptr, png_ptr->chunkdata,
compression_type, png_ptr->chunkdata + prefix_length, profile_length);
compression_type, (png_bytep)png_ptr->chunkdata + prefix_length,
profile_length);
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
}
@ -1854,16 +1822,8 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void /* PRIVATE */
png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_charp ep;
#ifdef PNG_FLOATING_POINT_SUPPORTED
double width, height;
png_charp vp;
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
png_charp swidth, sheight;
#endif
#endif
png_size_t slength;
png_size_t slength, index;
int state;
png_debug(1, "in png_handle_sCAL");
@ -1897,6 +1857,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
slength = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
if (png_crc_finish(png_ptr, 0))
{
@ -1905,115 +1866,40 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
ep = png_ptr->chunkdata + 1; /* Skip unit byte */
#ifdef PNG_FLOATING_POINT_SUPPORTED
width = png_strtod(png_ptr, ep, &vp);
if (*vp)
/* Validate the unit. */
if (png_ptr->chunkdata[0] != 1 && png_ptr->chunkdata[0] != 2)
{
png_warning(png_ptr, "malformed width string in sCAL chunk");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
return;
}
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
swidth = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1);
if (swidth == NULL)
{
png_warning(png_ptr, "Out of memory while processing sCAL chunk width");
png_warning(png_ptr, "Invalid sCAL ignored: invalid unit");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
return;
}
png_memcpy(swidth, ep, png_strlen(ep));
#endif
#endif
for (ep = png_ptr->chunkdata; *ep; ep++)
/* Empty loop */ ;
ep++;
if (png_ptr->chunkdata + slength < ep)
/* Validate the ASCII numbers, need two ASCII numbers separated by
* a '\0' and they need to fit exactly in the chunk data.
*/
index = 0;
state = 0;
if (png_ptr->chunkdata[1] == 45 /* negative width */ ||
!png_check_fp_number(png_ptr->chunkdata, slength, &state, &index) ||
index >= slength || png_ptr->chunkdata[index++] != 0)
png_warning(png_ptr, "Invalid sCAL chunk ignored: bad width format");
else
{
png_warning(png_ptr, "Truncated sCAL chunk");
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
#endif
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
return;
png_size_t heighti = index;
if (png_ptr->chunkdata[index] == 45 /* negative height */ ||
!png_check_fp_number(png_ptr->chunkdata, slength, &state, &index) ||
index != slength)
png_warning(png_ptr, "Invalid sCAL chunk ignored: bad height format");
else
/* This is the (only) success case. */
png_set_sCAL_s(png_ptr, info_ptr, png_ptr->chunkdata[0],
png_ptr->chunkdata+1, png_ptr->chunkdata+heighti);
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
height = png_strtod(png_ptr, ep, &vp);
if (*vp)
{
png_warning(png_ptr, "malformed height string in sCAL chunk");
/* Clean up - just free the temporarily allocated buffer. */
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
#endif
return;
}
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1);
if (sheight == NULL)
{
png_warning(png_ptr, "Out of memory while processing sCAL chunk height");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
#endif
return;
}
png_memcpy(sheight, ep, png_strlen(ep));
#endif
#endif
if (png_ptr->chunkdata + slength < ep
#ifdef PNG_FLOATING_POINT_SUPPORTED
|| width <= 0. || height <= 0.
#endif
)
{
png_warning(png_ptr, "Invalid sCAL data");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
png_free(png_ptr, sheight);
#endif
return;
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_sCAL(png_ptr, info_ptr, png_ptr->chunkdata[0], width, height);
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_sCAL_s(png_ptr, info_ptr, png_ptr->chunkdata[0], swidth, sheight);
#endif
#endif
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
png_free(png_ptr, sheight);
#endif
}
#endif
@ -3567,4 +3453,37 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_ptr->flags |= PNG_FLAG_ROW_INIT;
}
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
int PNGAPI
png_get_num_passes(png_structp png_ptr)
{
if (png_ptr != NULL)
{
if (png_ptr->interlaced)
return 7;
else
return 1;
}
/* Here on error */
return 0;
}
png_uint_32 PNGAPI
png_get_num_rows(png_structp png_ptr)
{
if (png_ptr != NULL)
{
if (png_ptr->flags & PNG_FLAG_ROW_INIT)
return png_ptr->num_rows;
else
png_error(png_ptr, "Call png_start_read_image or png_read_update_info "
"before png_get_num_rows");
}
/* Here on error */
return 0;
}
#endif /* SEQUENTIAL READ */
#endif /* PNG_READ_SUPPORTED */

306
pngset.c
View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -35,42 +35,7 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
#endif
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y)
{
png_debug1(1, "in %s storage function", "cHRM");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* TODO: call png_check_cHRM_fixed */
info_ptr->x_white = (float)white_x;
info_ptr->y_white = (float)white_y;
info_ptr->x_red = (float)red_x;
info_ptr->y_red = (float)red_y;
info_ptr->x_green = (float)green_x;
info_ptr->y_green = (float)green_y;
info_ptr->x_blue = (float)blue_x;
info_ptr->y_blue = (float)blue_y;
#ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_x_white = (png_fixed_point)(white_x*100000. + 0.5);
info_ptr->int_y_white = (png_fixed_point)(white_y*100000. + 0.5);
info_ptr->int_x_red = (png_fixed_point)( red_x*100000. + 0.5);
info_ptr->int_y_red = (png_fixed_point)( red_y*100000. + 0.5);
info_ptr->int_x_green = (png_fixed_point)(green_x*100000. + 0.5);
info_ptr->int_y_green = (png_fixed_point)(green_y*100000. + 0.5);
info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000. + 0.5);
info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000. + 0.5);
#endif
info_ptr->valid |= PNG_INFO_cHRM;
}
#endif /* PNG_FLOATING_POINT_SUPPORTED */
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
void PNGFAPI
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
@ -86,99 +51,71 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
#endif
{
info_ptr->int_x_white = white_x;
info_ptr->int_y_white = white_y;
info_ptr->int_x_red = red_x;
info_ptr->int_y_red = red_y;
info_ptr->int_x_green = green_x;
info_ptr->int_y_green = green_y;
info_ptr->int_x_blue = blue_x;
info_ptr->int_y_blue = blue_y;
#ifdef PNG_FLOATING_POINT_SUPPORTED
info_ptr->x_white = (float)(white_x/100000.);
info_ptr->y_white = (float)(white_y/100000.);
info_ptr->x_red = (float)( red_x/100000.);
info_ptr->y_red = (float)( red_y/100000.);
info_ptr->x_green = (float)(green_x/100000.);
info_ptr->y_green = (float)(green_y/100000.);
info_ptr->x_blue = (float)( blue_x/100000.);
info_ptr->y_blue = (float)( blue_y/100000.);
#endif
info_ptr->x_white = white_x;
info_ptr->y_white = white_y;
info_ptr->x_red = red_x;
info_ptr->y_red = red_y;
info_ptr->x_green = green_x;
info_ptr->y_green = green_y;
info_ptr->x_blue = blue_x;
info_ptr->y_blue = blue_y;
info_ptr->valid |= PNG_INFO_cHRM;
}
}
#endif /* PNG_FIXED_POINT_SUPPORTED */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y)
{
png_set_cHRM_fixed(png_ptr, info_ptr,
png_fixed(png_ptr, white_x, "cHRM White X"),
png_fixed(png_ptr, white_y, "cHRM White Y"),
png_fixed(png_ptr, red_x, "cHRM Red X"),
png_fixed(png_ptr, red_y, "cHRM Red Y"),
png_fixed(png_ptr, green_x, "cHRM Green X"),
png_fixed(png_ptr, green_y, "cHRM Green Y"),
png_fixed(png_ptr, blue_x, "cHRM Blue X"),
png_fixed(png_ptr, blue_y, "cHRM Blue Y"));
}
#endif /* PNG_FLOATING_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
#ifdef PNG_gAMA_SUPPORTED
void PNGFAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
gamma)
{
png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* Previously these values were limited, however they must be
* wrong, therfore storing them (and setting PNG_INFO_gAMA)
* must be wrong too.
*/
if (gamma > (png_fixed_point)PNG_UINT_31_MAX)
png_warning(png_ptr, "Gamma too large, ignored");
else if (gamma <= 0)
png_warning(png_ptr, "Negative gamma ignored");
else
{
info_ptr->gamma = gamma;
info_ptr->valid |= PNG_INFO_gAMA;
}
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{
double png_gamma;
png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* Check for overflow */
if (file_gamma > 21474.83)
{
png_warning(png_ptr, "Limiting gamma to 21474.83");
png_gamma = 21474.83;
}
else
png_gamma = file_gamma;
info_ptr->gamma = (float)png_gamma;
#ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_gamma = (int)(png_gamma*100000.+.5);
#endif
info_ptr->valid |= PNG_INFO_gAMA;
if (png_gamma == 0.0)
png_warning(png_ptr, "Setting gamma = 0");
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
int_gamma)
{
png_fixed_point png_gamma;
png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL)
return;
if (int_gamma > (png_fixed_point)PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Limiting gamma to 21474.83");
png_gamma = PNG_UINT_31_MAX;
}
else
{
if (int_gamma < 0)
{
png_warning(png_ptr, "Setting negative gamma to zero");
png_gamma = 0;
}
else
png_gamma = int_gamma;
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
info_ptr->gamma = (float)(png_gamma/100000.);
#endif
info_ptr->int_gamma = png_gamma;
info_ptr->valid |= PNG_INFO_gAMA;
if (png_gamma == 0)
png_warning(png_ptr, "Setting gamma = 0");
png_set_gAMA_fixed(png_ptr, info_ptr, png_fixed(png_ptr, file_gamma,
"png_set_gAMA"));
}
#endif
#endif
@ -309,6 +246,17 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_debug1(3, "allocating purpose for info (%lu bytes)",
(unsigned long)length);
/* TODO: validate format of calibration name and unit name */
/* Check that the type matches the specification. */
if (type < 0 || type > 3)
png_error(png_ptr, "Invalid pCAL equation type");
/* Validate params[nparams] */
for (i=0; i<nparams; ++i)
if (!png_check_fp_string(params[i], png_strlen(params[i])))
png_error(png_ptr, "Invalid format for pCAL parameter");
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL)
{
@ -370,75 +318,94 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height)
{
png_debug1(1, "in %s storage function", "sCAL");
if (png_ptr == NULL || info_ptr == NULL)
return;
info_ptr->scal_unit = (png_byte)unit;
info_ptr->scal_pixel_width = width;
info_ptr->scal_pixel_height = height;
info_ptr->valid |= PNG_INFO_sCAL;
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
void PNGFAPI
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int unit, png_charp swidth, png_charp sheight)
{
png_size_t length;
png_size_t lengthw, lengthh;
png_debug1(1, "in %s storage function", "sCAL");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* Double check the unit (should never get here with an invalid
* unit unless this is an API call.)
*/
if (unit != 1 && unit != 2)
png_error(png_ptr, "Invalid sCAL unit");
if (swidth == NULL || (lengthw = png_strlen(swidth)) <= 0 ||
swidth[0] == 45 /*'-'*/ || !png_check_fp_string(swidth, lengthw))
png_error(png_ptr, "Invalid sCAL width");
if (sheight == NULL || (lengthh = png_strlen(sheight)) <= 0 ||
sheight[0] == 45 /*'-'*/ || !png_check_fp_string(sheight, lengthh))
png_error(png_ptr, "Invalid sCAL height");
info_ptr->scal_unit = (png_byte)unit;
length = png_strlen(swidth) + 1;
++lengthw;
png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
png_debug1(3, "allocating unit for info (%u bytes)", lengthw);
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, lengthw);
if (info_ptr->scal_s_width == NULL)
{
png_warning(png_ptr,
"Memory allocation failed while processing sCAL");
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
return;
}
png_memcpy(info_ptr->scal_s_width, swidth, length);
png_memcpy(info_ptr->scal_s_width, swidth, lengthw);
length = png_strlen(sheight) + 1;
++lengthh;
png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
png_debug1(3, "allocating unit for info (%u bytes)", lengthh);
info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length);
info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, lengthh);
if (info_ptr->scal_s_height == NULL)
{
png_free (png_ptr, info_ptr->scal_s_width);
info_ptr->scal_s_width = NULL;
png_warning(png_ptr,
"Memory allocation failed while processing sCAL");
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
return;
}
png_memcpy(info_ptr->scal_s_height, sheight, length);
png_memcpy(info_ptr->scal_s_height, sheight, lengthh);
info_ptr->valid |= PNG_INFO_sCAL;
info_ptr->free_me |= PNG_FREE_SCAL;
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width,
double height)
{
png_debug1(1, "in %s storage function", "sCAL");
/* Check the arguments. */
if (width <= 0)
png_warning(png_ptr, "Invalid sCAL width ignored");
else if (height <= 0)
png_warning(png_ptr, "Invalid sCAL height ignored");
else
{
/* Convert 'width' and 'height' to ASCII. */
char swidth[PNG_sCAL_MAX_DIGITS+1];
char sheight[PNG_sCAL_MAX_DIGITS+1];
png_ascii_from_fp(png_ptr, swidth, sizeof swidth, width,
PNG_sCAL_PRECISION);
png_ascii_from_fp(png_ptr, sheight, sizeof sheight, height,
PNG_sCAL_PRECISION);
png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
}
}
#endif
#endif
@ -543,16 +510,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_set_sRGB(png_ptr, info_ptr, intent);
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_gAMA_fixed(png_ptr, info_ptr, 45455L);
#else
/* Floating point must be set! */
png_set_gAMA(png_ptr, info_ptr, .45455);
#endif
#endif
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_cHRM_fixed(png_ptr, info_ptr,
/* color x y */
/* white */ 31270L, 32900L,
@ -560,16 +521,6 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
/* green */ 30000L, 60000L,
/* blue */ 15000L, 6000L
);
#else
/* Floating point must be supported! */
png_set_cHRM(png_ptr, info_ptr,
/* color x y */
/* while */ .3127, .3290,
/* red */ .64, .33,
/* green */ .30, .60,
/* blue */ .15, .06
);
#endif
#endif /* cHRM */
}
#endif /* sRGB */
@ -579,10 +530,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen)
png_bytep profile, png_uint_32 proflen)
{
png_charp new_iccp_name;
png_charp new_iccp_profile;
png_bytep new_iccp_profile;
png_uint_32 length;
png_debug1(1, "in %s storage function", "iCCP");
@ -598,7 +549,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
return;
}
png_memcpy(new_iccp_name, name, length);
new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen);
new_iccp_profile = (png_bytep)png_malloc_warn(png_ptr, proflen);
if (new_iccp_profile == NULL)
{
@ -844,8 +795,8 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
png_ptr->trans_alpha = info_ptr->trans_alpha = (png_bytep)png_malloc(png_ptr,
(png_size_t)PNG_MAX_PALETTE_LENGTH);
png_ptr->trans_alpha = info_ptr->trans_alpha =
(png_bytep)png_malloc(png_ptr, (png_size_t)PNG_MAX_PALETTE_LENGTH);
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
png_memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
@ -864,7 +815,8 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_warning(png_ptr,
"tRNS chunk has out-of-range samples for bit_depth");
png_memcpy(&(info_ptr->trans_color), trans_color, png_sizeof(png_color_16));
png_memcpy(&(info_ptr->trans_color), trans_color,
png_sizeof(png_color_16));
if (num_trans == 0)
num_trans = 1;

View File

@ -5,7 +5,7 @@
* (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 version 1.5.0 - July 24, 2010
* Last changed in libpng version 1.5.0 - July 29, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@ -20,6 +20,12 @@
#ifndef PNGSTRUCT_H
#define PNGSTRUCT_H
/* zlib.h defines the structure z_stream, an instance of which is included
* in this structure and is required for decompressing the LZ compressed
* data in PNG files.
*/
#include "zlib.h"
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
@ -104,9 +110,7 @@ struct png_struct_def
#ifdef PNG_bKGD_SUPPORTED
png_byte background_gamma_type;
# ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma;
# endif
png_fixed_point background_gamma;
png_color_16 background; /* background color in screen gamma space */
#ifdef PNG_READ_GAMMA_SUPPORTED
png_color_16 background_1; /* background normalized to gamma 1.0 */
@ -121,10 +125,8 @@ struct png_struct_def
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma; /* file gamma value */
float screen_gamma; /* screen gamma value (display_exponent) */
#endif
png_fixed_point gamma; /* file gamma value */
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
@ -154,7 +156,7 @@ struct png_struct_def
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
@ -241,11 +243,6 @@ struct png_struct_def
png_uint_32 mng_features_permitted;
#endif
/* New member added in libpng-1.0.7 */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma;
#endif
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_byte filter_type;

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -31,6 +31,7 @@
* of files at once by typing "pngtest -m file1.png file2.png ..."
*/
#include "zlib.h"
#include "png.h"
/* Copied from pngpriv.h but only used in error messages below. */
#ifndef PNG_ZBUF_SIZE
@ -64,6 +65,17 @@ typedef FILE * png_FILE_p;
# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */
#endif
/* The code uses memcmp and memcpy on large objects (typically row pointers) so
* it is necessary to do soemthing special on certain architectures, note that
* the actual support for this was effectively removed in 1.4, so only the
* memory remains in this program:
*/
#define CVT_PTR(ptr) (ptr)
#define CVT_PTR_NOCHECK(ptr) (ptr)
#define png_memcmp memcmp
#define png_memcpy memcpy
#define png_memset memset
/* Turn on CPU timing
#define PNGTEST_TIMING
*/
@ -957,7 +969,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_iCCP_SUPPORTED
{
png_charp name;
png_charp profile;
png_bytep profile;
png_uint_32 proflen;
int compression_type;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)

2075
pngvalid.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -60,15 +60,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
*/
#ifdef PNG_WRITE_gAMA_SUPPORTED
if (info_ptr->valid & PNG_INFO_gAMA)
{
# ifdef PNG_FLOATING_POINT_SUPPORTED
png_write_gAMA(png_ptr, info_ptr->gamma);
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
png_write_gAMA_fixed(png_ptr, info_ptr->int_gamma);
# endif
#endif
}
png_write_gAMA_fixed(png_ptr, info_ptr->gamma);
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
if (info_ptr->valid & PNG_INFO_sRGB)
@ -78,32 +70,19 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_iCCP_SUPPORTED
if (info_ptr->valid & PNG_INFO_iCCP)
png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
(png_charp)info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
#endif
#ifdef PNG_WRITE_sBIT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sBIT)
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
#endif
#ifdef PNG_WRITE_cHRM_SUPPORTED
if (info_ptr->valid & PNG_INFO_cHRM)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_write_cHRM(png_ptr,
png_write_cHRM_fixed(png_ptr,
info_ptr->x_white, info_ptr->y_white,
info_ptr->x_red, info_ptr->y_red,
info_ptr->x_green, info_ptr->y_green,
info_ptr->x_blue, info_ptr->y_blue);
#else
# ifdef PNG_FIXED_POINT_SUPPORTED
png_write_cHRM_fixed(png_ptr,
info_ptr->int_x_white, info_ptr->int_y_white,
info_ptr->int_x_red, info_ptr->int_y_red,
info_ptr->int_x_green, info_ptr->int_y_green,
info_ptr->int_x_blue, info_ptr->int_y_blue);
# endif
#endif
}
#endif
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
@ -168,7 +147,8 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
{
int j;
for (j = 0; j<(int)info_ptr->num_trans; j++)
info_ptr->trans_alpha[j] = (png_byte)(255 - info_ptr->trans_alpha[j]);
info_ptr->trans_alpha[j] =
(png_byte)(255 - info_ptr->trans_alpha[j]);
}
#endif
png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
@ -198,25 +178,10 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
info_ptr->pcal_units, info_ptr->pcal_params);
#endif
#ifdef PNG_sCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_sCAL)
#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
#else /* !FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sCAL)
png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit,
info_ptr->scal_s_width, info_ptr->scal_s_height);
#endif /* FIXED_POINT */
#endif /* FLOATING_POINT */
#else /* !WRITE_sCAL */
png_warning(png_ptr,
"png_write_sCAL not supported; sCAL chunk not written");
#endif /* WRITE_sCAL */
#endif /* sCAL */
#ifdef PNG_WRITE_pHYs_SUPPORTED

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.5.0 [July 24, 2010]
* Last changed in libpng 1.5.0 [July 29, 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.)
@ -32,7 +32,9 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
#ifdef PNG_SAVE_INT_32_SUPPORTED
/* The png_save_int_32 function assumes integers are stored in two's
* complement format. If this isn't the case, then this routine needs to
* be modified to write data in two's complement format.
* be modified to write data in two's complement format. Note that,
* the following works correctly even if png_int_32 has more than 32 bits
* (compare the more complex code required on read for sign extention.)
*/
void PNGAPI
png_save_int_32(png_bytep buf, png_int_32 i)
@ -770,23 +772,6 @@ png_write_IEND(png_structp png_ptr)
#ifdef PNG_WRITE_gAMA_SUPPORTED
/* Write a gAMA chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
png_write_gAMA(png_structp png_ptr, double file_gamma)
{
PNG_gAMA;
png_uint_32 igamma;
png_byte buf[4];
png_debug(1, "in png_write_gAMA");
/* file_gamma is saved in 1/100,000ths */
igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5);
png_save_uint_32(buf, igamma);
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
void /* PRIVATE */
png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
{
@ -800,7 +785,6 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
}
#endif
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
/* Write a sRGB chunk */
@ -1044,53 +1028,6 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
#ifdef PNG_WRITE_cHRM_SUPPORTED
/* Write the cHRM chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y)
{
PNG_cHRM;
png_byte buf[32];
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y,
int_green_x, int_green_y, int_blue_x, int_blue_y;
png_debug(1, "in png_write_cHRM");
int_white_x = (png_uint_32)(white_x * 100000.0 + 0.5);
int_white_y = (png_uint_32)(white_y * 100000.0 + 0.5);
int_red_x = (png_uint_32)(red_x * 100000.0 + 0.5);
int_red_y = (png_uint_32)(red_y * 100000.0 + 0.5);
int_green_x = (png_uint_32)(green_x * 100000.0 + 0.5);
int_green_y = (png_uint_32)(green_y * 100000.0 + 0.5);
int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5);
int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5);
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
{
/* Each value is saved in 1/100,000ths */
png_save_uint_32(buf, int_white_x);
png_save_uint_32(buf + 4, int_white_y);
png_save_uint_32(buf + 8, int_red_x);
png_save_uint_32(buf + 12, int_red_y);
png_save_uint_32(buf + 16, int_green_x);
png_save_uint_32(buf + 20, int_green_y);
png_save_uint_32(buf + 24, int_blue_x);
png_save_uint_32(buf + 28, int_blue_y);
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
}
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
void /* PRIVATE */
png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y,
@ -1124,7 +1061,6 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
}
}
#endif
#endif
#ifdef PNG_WRITE_tRNS_SUPPORTED
/* Write the tRNS chunk */
@ -1691,27 +1627,6 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
#ifdef PNG_WRITE_sCAL_SUPPORTED
/* Write the sCAL chunk */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
void /* PRIVATE */
png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
{
PNG_sCAL;
char buf[64];
png_size_t total_len;
png_debug(1, "in png_write_sCAL");
buf[0] = (char)unit;
png_snprintf(buf + 1, 63, "%12.12e", width);
total_len = 1 + png_strlen(buf + 1) + 1;
png_snprintf(buf + total_len, 64 - total_len, "%12.12e", height);
total_len += png_strlen(buf + total_len);
png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len);
}
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
void /* PRIVATE */
png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_charp height)
@ -1740,8 +1655,6 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len);
}
#endif
#endif
#endif
#ifdef PNG_WRITE_pHYs_SUPPORTED
/* Write the pHYs chunk */

View File

@ -1,5 +1,5 @@
Makefiles for libpng version 1.5.0beta36 - July 24, 2010
Makefiles for libpng version 1.5.0beta36 - July 29, 2010
pnglibconf.h => Stores configuration settings
makefile.linux => Linux/ELF makefile

View File

@ -1,5 +1,5 @@
# DJGPP (DOS gcc) makefile for libpng
# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
# Copyright (C) 2002, 2006, 2009-2010 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
# This code is released under the libpng license.

View File

@ -50,8 +50,14 @@ OBJS3=pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
all: test
# see scripts/pnglibconf.mak for more options
# to support watcom calling conventions it is necessary to set PNG_API_RULE to 2
# in pnglibconf.h - copy scripts/pnglibconf.h, delete the first line and change
# the definition of PNG_API_RULE from 0 to 2.
#
# If you know how to do this with the Watcom build system please supply a patch
# for this makefile to the PNG implementation list.
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
@echo please copy scripts/pnglibconf.h and change PNG_API_RULE to 2
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)

View File

@ -1,7 +1,7 @@
#!/bin/awk -f
# scripts/options.awk - library build configuration control
#
# last changed in libpng version 1.5.0 - July 24, 2010
# last changed in libpng version 1.5.0 - July 29, 2010
#
# Copyright (c) 1998-2010 Glenn Randers-Pehrson
#

View File

@ -6,7 +6,7 @@
#
com pnglibconf.h - library build configuration
com
com libpng version PNGLIB_VERSION - last changed on July 24, 2010
com libpng version PNGLIB_VERSION - last changed on July 29, 2010
com
com Copyright (c) 1998-2010 Glenn Randers-Pehrson
com
@ -134,6 +134,17 @@ logunsupported = 1
@# include "pngusr.h"
@#endif
# This is a special fixup for the Watcom C compiler on Windows, which has
# multiple procedure call standards. Unless PNG_API_RULE is set explicitly
# (i.e. if it is not defined at this point) it will be forced to '2' here when
# using Watcom. This indicates to the other header files that Watcom behaviour
# is required where appropriate.
@#ifdef __WATCOMC__
@# ifndef PNG_API_RULE
@# define PNG_API_RULE 2 /* Use Watcom calling conventions */
@# endif
@#endif
# Note that PNG_USR_CONFIG only has an effect when building
# pnglibconf.h
setting USER_CONFIG requires USER_PRIVATEBUILD USER_DLLFNAME_POSTFIX
@ -166,8 +177,14 @@ option WRITE_INT_FUNCTIONS disabled
option WRITE enables WRITE_INT_FUNCTIONS
# Generic options - affect both read and write.
option WARNINGS
option BENIGN_ERRORS
option MNG_FEATURES
# Arithmetic options, the first is the big switch that chooses between internal
# floating and fixed point arithmetic implementations - it does not affect any
# APIs. The second two (the _POINT settings) switch off individual APIs.
option FLOATING_ARITHMETIC
option FLOATING_POINT enables ok_math
option FIXED_POINT enables ok_math
@ -287,8 +304,8 @@ option SEQUENTIAL_READ requires READ
option READ_COMPOSITE_NODIV requires READ
= NO_READ_COMPOSITE_NODIV PNG_NO_READ_COMPOSITED_NODIV
# Inch conversions: not switched on by default
option INCH_CONVERSIONS requires FLOATING_POINT
# Inch conversions
option INCH_CONVERSIONS
= INCH_CONVERSIONS PNG_INCH_CONVERSIONS
# IN DEVELOPMENT
@ -319,6 +336,8 @@ option WRITE_USER_TRANSFORM requires WRITE_TRANSFORMS
# trouble if left undefined
option WRITE_INTERLACING requires WRITE
# The following depends, internally, on WEIGHT_SHIFT and COST_SHIFT
# where are set below.
option WRITE_WEIGHTED_FILTER requires WRITE FLOATING_POINT
option WRITE_FLUSH requires WRITE
@ -349,6 +368,81 @@ option WRITE_ANCILLARY_CHUNKS requires WRITE
option READ_TEXT requires READ_ANCILLARY_CHUNKS enables TEXT
option WRITE_TEXT requires WRITE_ANCILLARY_CHUNKS enables TEXT
# Moved to pnglibconf.h at libpng-1.5.0
# Feature support: in 1.4 this was in pngconf.h, but the following
# features have no affect on the libpng API. Add library
# only features to the end of this list. Add features that
# affect the API above. (Note: the list of chunks follows
# the library-only settings.)
#
# BUILD TIME ONLY OPTIONS
# These options do not affect the API but rather alter how the
# API is implemented, they get recorded in pnglibconf.h, but
# can't be changed by the application.
# Check the correctness of cHRM chunks
option CHECK_cHRM requires cHRM
#
# Artificially align memory - the code typically aligns to 8 byte
# boundaries if this is switched on, it's a small waste of space
# but can help (in theory) on some architectures. Only affects
# internal structures. Added at libpng 1.4.0
option ALIGN_MEMORY
# Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING
# See png[wr]util.c, normally this should always be *on*
option POINTER_INDEXING
# Other defines for things like memory and the like can go here.
# BUILD TIME SETTINGS
# Like build time options these do not affect the API, but they
# may be useful to applications because they record details of
# how the API will behave particularly with regard to overall
# accuracy.
# This controls how fine the quantizing gets. As this allocates
# a largish chunk of memory (32K), those who are not as concerned
# with quantizing quality can decrease some or all of these.
setting QUANTIZE_RED_BITS default 5
setting QUANTIZE_GREEN_BITS default 5
setting QUANTIZE_BLUE_BITS default 5
# This controls how fine the gamma correction becomes when you
# are only interested in 8 bits anyway. Increasing this value
# results in more memory being used, and more pow() functions
# being called to fill in the gamma tables. Don't set this value
# less then 8, and even that may not work (I haven't tested it).
setting MAX_GAMMA_8 default 11
# This controls how much a difference in gamma we can tolerate before
# we actually start doing gamma conversion, it's a fixed point value,
# so the default below is 0.05, meaning libpng ignores corrections in
# the range 0.95 to 1.05
setting GAMMA_THRESHOLD_FIXED default 5000
# Scaling factor for filter heuristic weighting calculations
setting WEIGHT_SHIFT default 8
setting COST_SHIFT default 3
# Precision to use when converting a floating point value to a PNG
# extension format string in an sCAL chunk (only relevant if the
# floating point API is enabled)
setting sCAL_PRECISION default 5
# This is the size of the compression buffer, and thus the size of
# an IDAT chunk. Make this whatever size you feel is best for your
# machine. One of these will be allocated per png_struct. When this
# is full, it writes the data to the disk, and does some other
# calculations. Making this an extremely small size may slow
# the library down, but you may want to experiment to determine
# where it becomes significant, if you are concerned with memory
# usage. Note that zlib allocates at least 32Kb also. For readers,
# this describes the size of the buffer available to read the data in.
# Unless this gets smaller than the size of a row (compressed),
# it should not make much difference how big this is.
setting ZBUF_SIZE default 8192
# Ancillary chunks
chunk bKGD
chunk cHRM
@ -389,13 +483,8 @@ option WRITE_UNKNOWN_CHUNKS requires WRITE
option HANDLE_AS_UNKNOWN
option GET_INT_32 requires READ
# png_get_int_32 is required by the ancillary chunks oFFs and pCAL
option READ_oFFs enables GET_INT_32
option READ_pCAL enables GET_INT_32
option SAVE_INT_32 requires WRITE
# Likewise for png_save_int_32
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
option WRITE_oFFs enables SAVE_INT_32
option WRITE_pCAL enables SAVE_INT_32

View File

@ -1,7 +1,7 @@
/* libpng-1.5.0beta36 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* last changed in libpng version 1.5.0 - July 24, 2010 */
/* last changed in libpng version 1.5.0 - July 29, 2010 */
/* Copyright (c) 1998-2010 Glenn Randers-Pehrson */
@ -15,20 +15,33 @@
#ifndef PNGLCONF_H
#define PNGLCONF_H
/* settings */
#define PNG_MAX_GAMMA_8 11
#define PNG_CALLOC_SUPPORTED
#define PNG_QUANTIZE_RED_BITS 5
#define PNG_USER_WIDTH_MAX 1000000L
#define PNG_QUANTIZE_GREEN_BITS 5
#define PNG_API_RULE 0
#define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_USER_CHUNK_CACHE_MAX 0
#define PNG_USER_HEIGHT_MAX 1000000L
#define PNG_sCAL_PRECISION 5
#define PNG_COST_SHIFT 3
#define PNG_WEIGHT_SHIFT 8
#define PNG_USER_CHUNK_MALLOC_MAX 0
#define PNG_DEFAULT_READ_MACROS 1
#define PNG_ZBUF_SIZE 8192
#define PNG_GAMMA_THRESHOLD_FIXED 5000
/* end of settings */
/* options */
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
#define PNG_WARNINGS_SUPPORTED
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_INTERLACING_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
#define PNG_ALIGN_MEMORY_SUPPORTED
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
#define PNG_FIXED_POINT_SUPPORTED
@ -112,7 +125,6 @@
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_GET_INT_32_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED
@ -144,6 +156,7 @@
#define PNG_READ_zTXt_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_CHECK_cHRM_SUPPORTED
#define PNG_tIME_SUPPORTED
#define PNG_pHYs_SUPPORTED
#define PNG_READ_iTXt_SUPPORTED

View File

@ -217,3 +217,13 @@ EXPORTS
png_save_uint_32 @205
png_save_int_32 @206
png_save_uint_16 @207
png_set_gamma_fixed @208
png_set_filter_heuristics_fixed @209
png_get_pixel_aspect_ratio_fixed @210
png_get_x_offset_inches_fixed @211
png_get_y_offset_inches_fixed @212
png_set_sCAL_fixed @213
png_get_sCAL_fixed @214
png_get_num_passes @215
png_get_num_rows @216
png_set_background_fixed @217

View File

@ -1,7 +1,7 @@
/* pngwin.dfn - define format of pngwin.def
*
* Last changed in libpng version 1.5.0 [July 24, 2010]
* Last changed in libpng version 1.5.0 [July 29, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.

View File

@ -1,7 +1,7 @@
/* sym.dfn - define format of libpng.sym
*
* Last changed in libpng version 1.5.0 [July 24, 2010]
* Last changed in libpng version 1.5.0 [July 29, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.

View File

@ -213,3 +213,13 @@ EXPORTS
png_save_uint_32 @205
png_save_int_32 @206
png_save_uint_16 @207
png_set_gamma_fixed @208
png_set_filter_heuristics_fixed @209
png_get_pixel_aspect_ratio_fixed @210
png_get_x_offset_inches_fixed @211
png_get_y_offset_inches_fixed @212
png_set_sCAL_fixed @213
png_get_sCAL_fixed @214
png_get_num_passes @215
png_get_num_rows @216
png_set_background_fixed @217

View File

@ -1,7 +1,7 @@
/* symbols.dfn - find all exported symbols
*
* Last changed in libpng version 1.5.0 [July 24, 2010]
* Last changed in libpng version 1.5.0 [July 29, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.

View File

@ -1,7 +1,7 @@
/* vers.dfn - define format of libpng.vers
*
* Last changed in libpng version 1.5.0 [July 24, 2010]
* Last changed in libpng version 1.5.0 [July 29, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.