[libpng15] Remove simplified interface

This commit is contained in:
John Bowler 2011-11-23 15:34:43 -06:00 committed by Glenn Randers-Pehrson
parent 12fb29f951
commit 4491fa237f
35 changed files with 298 additions and 5755 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.7beta05 - November 22, 2011 Libpng 1.5.7beta05 - November 23, 2011
This is not intended to be a public release. It will be replaced 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. within a few weeks by a public version or by another test version.
@ -99,13 +99,17 @@ Version 1.5.7beta04 [November 17, 2011]
Also removed a duplicate setting of this flag. Also removed a duplicate setting of this flag.
Added files that were omitted from the libpng-1.5.7beta03 zip distribution. Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
Version 1.5.7beta05 [November 22, 2011] Version 1.5.7beta05 [November 23, 2011]
Removed "zTXt" from warning in generic chunk decompression function. Removed "zTXt" from warning in generic chunk decompression function.
Validate time settings passed to pngset() and png_convert_to_rfc1123() Validate time settings passed to pngset() and png_convert_to_rfc1123()
(Frank Busse). (Frank Busse).
Allow row_stride==0 to indicate default stride in simplified API.
Added MINGW support to CMakeLists.txt Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk. Reject invalid compression flag or method when reading the iTXt chunk.
Backed out 'simplified' API changes. The API seems too complex and there
is a lack of consensus or enthusiasm for the proposals. The API also
reveals significant bugs inside libpng (double gamma correction and the
known bug of being unable to retrieve a corrected palette.) It seems
better to wait until the bugs, at least, are corrected.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -3744,13 +3744,17 @@ Version 1.5.7beta04 [November 17, 2011]
Also removed a duplicate setting of this flag. Also removed a duplicate setting of this flag.
Added files that were omitted from the libpng-1.5.7beta03 zip distribution. Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
Version 1.5.7beta05 [November 22, 2011] Version 1.5.7beta05 [November 23, 2011]
Removed "zTXt" from warning in generic chunk decompression function. Removed "zTXt" from warning in generic chunk decompression function.
Validate time settings passed to pngset() and png_convert_to_rfc1123() Validate time settings passed to pngset() and png_convert_to_rfc1123()
(Frank Busse). (Frank Busse).
Allow row_stride==0 to indicate default stride in simplified API.
Added MINGW support to CMakeLists.txt Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk. Reject invalid compression flag or method when reading the iTXt chunk.
Backed out 'simplified' API changes. The API seems too complex and there
is a lack of consensus or enthusiasm for the proposals. The API also
reveals significant bugs inside libpng (double gamma correction and the
known bug of being unable to retrieve a corrected palette.) It seems
better to wait until the bugs, at least, are corrected.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 18, 2011, are libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 23, 2011, are
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
November 18, 2011 November 23, 2011

View File

@ -18,13 +18,12 @@ pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh TESTS = test-pngtest.sh
# Do the following only if the contrib directory is present. # Only do the following if the contrib directory is present.
check_PROGRAMS+= pngvalid pngstest check_PROGRAMS+= pngvalid
pngvalid_SOURCES = pngvalid.c pngvalid_SOURCES = pngvalid.c
pngstest_SOURCES = contrib/libtests/pngstest.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS += test-pngvalid-simple.sh test-pngvalid-full.sh test-pngstest.sh TESTS += test-pngvalid-simple.sh test-pngvalid-full.sh
# man pages # man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5 dist_man_MANS= libpng.3 libpngpf.3 png.5
@ -132,7 +131,7 @@ $(srcdir)/scripts/pnglibconf.h.prebuilt:
# The following is necessary to ensure that the local pnglibconf.h is used, not # The following is necessary to ensure that the local pnglibconf.h is used, not
# an installed one (this can happen immediately after on a clean system if # an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.) # 'make test' is the first thing the user does.)
contrib/libtests/pngstest.o pngvalid.o pngtest.o: pnglibconf.h pngvalid.o pngtest.o: pnglibconf.h
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually # We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
# be built with PNG_USE_READ_MACROS; this prevents the read macros from # be built with PNG_USE_READ_MACROS; this prevents the read macros from

View File

@ -40,7 +40,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
check_PROGRAMS = pngtest$(EXEEXT) pngvalid$(EXEEXT) pngstest$(EXEEXT) check_PROGRAMS = pngtest$(EXEEXT) pngvalid$(EXEEXT)
@PNG_ARM_NEON_TRUE@am__append_1 = arm/filter_neon.S @PNG_ARM_NEON_TRUE@am__append_1 = arm/filter_neon.S
# Versioned symbols and restricted exports # Versioned symbols and restricted exports
@ -124,9 +124,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) --tag=CC \
$(AM_CFLAGS) $(CFLAGS) \ $(AM_CFLAGS) $(CFLAGS) \
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \ $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
$@ $@
am_pngstest_OBJECTS = pngstest.$(OBJEXT)
pngstest_OBJECTS = $(am_pngstest_OBJECTS)
pngstest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
am_pngtest_OBJECTS = pngtest.$(OBJEXT) am_pngtest_OBJECTS = pngtest.$(OBJEXT)
pngtest_OBJECTS = $(am_pngtest_OBJECTS) pngtest_OBJECTS = $(am_pngtest_OBJECTS)
pngtest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngtest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
@ -154,10 +151,10 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
$(LDFLAGS) -o $@ $(LDFLAGS) -o $@
SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \ SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \ $(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
$(pngstest_SOURCES) $(pngtest_SOURCES) $(pngvalid_SOURCES) $(pngtest_SOURCES) $(pngvalid_SOURCES)
DIST_SOURCES = \ DIST_SOURCES = \
$(am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST) \ $(am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST) \
$(pngstest_SOURCES) $(pngtest_SOURCES) $(pngvalid_SOURCES) $(pngtest_SOURCES) $(pngvalid_SOURCES)
man3dir = $(mandir)/man3 man3dir = $(mandir)/man3
man5dir = $(mandir)/man5 man5dir = $(mandir)/man5
NROFF = nroff NROFF = nroff
@ -184,6 +181,7 @@ distcleancheck_listfiles = find . -type f -print
pkgincludedir = $(includedir)/$(PNGLIB_BASENAME) pkgincludedir = $(includedir)/$(PNGLIB_BASENAME)
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_CCASFLAGS = @AM_CCASFLAGS@
AR = @AR@ AR = @AR@
AS = @AS@ AS = @AS@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
@ -329,16 +327,14 @@ PNGLIB_BASENAME = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# to get red "FAIL" and green "PASS" notations during tests. # to get red "FAIL" and green "PASS" notations during tests.
# AUTOMAKE_OPTIONS = foreign color-tests # AUTOMAKE_OPTIONS = foreign color-tests
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
# test programs - run on make check, make distcheck
TESTS_ENVIRONMENT = srcdir=$(srcdir)
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
pngvalid_SOURCES = pngvalid.c pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngstest_SOURCES = contrib/libtests/pngstest.c
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh \
test-pngstest.sh
TESTS_ENVIRONMENT = srcdir=$(srcdir)
# man pages # man pages
dist_man_MANS = libpng.3 libpngpf.3 png.5 dist_man_MANS = libpng.3 libpngpf.3 png.5
@ -494,9 +490,6 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \ echo " rm -f" $$list; \
rm -f $$list rm -f $$list
pngstest$(EXEEXT): $(pngstest_OBJECTS) $(pngstest_DEPENDENCIES)
@rm -f pngstest$(EXEEXT)
$(LINK) $(pngstest_OBJECTS) $(pngstest_LDADD) $(LIBS)
pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES) pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES)
@rm -f pngtest$(EXEEXT) @rm -f pngtest$(EXEEXT)
$(LINK) $(pngtest_OBJECTS) $(pngtest_LDADD) $(LIBS) $(LINK) $(pngtest_OBJECTS) $(pngtest_LDADD) $(LIBS)
@ -560,7 +553,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwrite.Plo@am__quote@
@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-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)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngstest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngvalid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngvalid.Po@am__quote@
@ -718,20 +710,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la-pngwutil.lo: pngwutil.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @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-pngwutil.lo `test -f 'pngwutil.c' || echo '$(srcdir)/'`pngwutil.c
pngstest.o: contrib/libtests/pngstest.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pngstest.o -MD -MP -MF $(DEPDIR)/pngstest.Tpo -c -o pngstest.o `test -f 'contrib/libtests/pngstest.c' || echo '$(srcdir)/'`contrib/libtests/pngstest.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pngstest.Tpo $(DEPDIR)/pngstest.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='contrib/libtests/pngstest.c' object='pngstest.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pngstest.o `test -f 'contrib/libtests/pngstest.c' || echo '$(srcdir)/'`contrib/libtests/pngstest.c
pngstest.obj: contrib/libtests/pngstest.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pngstest.obj -MD -MP -MF $(DEPDIR)/pngstest.Tpo -c -o pngstest.obj `if test -f 'contrib/libtests/pngstest.c'; then $(CYGPATH_W) 'contrib/libtests/pngstest.c'; else $(CYGPATH_W) '$(srcdir)/contrib/libtests/pngstest.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/pngstest.Tpo $(DEPDIR)/pngstest.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='contrib/libtests/pngstest.c' object='pngstest.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pngstest.obj `if test -f 'contrib/libtests/pngstest.c'; then $(CYGPATH_W) 'contrib/libtests/pngstest.c'; else $(CYGPATH_W) '$(srcdir)/contrib/libtests/pngstest.c'; fi`
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@ -1357,7 +1335,7 @@ $(srcdir)/scripts/pnglibconf.h.prebuilt:
# The following is necessary to ensure that the local pnglibconf.h is used, not # The following is necessary to ensure that the local pnglibconf.h is used, not
# an installed one (this can happen immediately after on a clean system if # an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.) # 'make test' is the first thing the user does.)
contrib/libtests/pngstest.o pngvalid.o pngtest.o: pnglibconf.h pngvalid.o pngtest.o: pnglibconf.h
.dfn.out: .dfn.out:
rm -f $@ dfn.c dfn?.out rm -f $@ dfn.c dfn?.out

2
README
View File

@ -1,4 +1,4 @@
README for libpng version 1.5.7beta05 - November 18, 2011 (shared library 15.0) README for libpng version 1.5.7beta05 - November 23, 2011 (shared library 15.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.

File diff suppressed because it is too large Load Diff

View File

@ -1,289 +0,0 @@
/* timepng.c
*
* Copyright (c) 2011 John Cunningham Bowler
*
* Last changed in libpng 1.5.7 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Load an arbitrary number of PNG files (from the command line, or, if there
* are no arguments on the command line, from stdin) then run a time test by
* reading each file by row. The test does nothing with the read result and
* does no transforms. The only output is a time as a floating point number of
* seconds with 9 decimal digits.
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "png.h"
static int read_png(FILE *fp)
{
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
png_infop info_ptr = NULL;
png_bytep row = NULL, display = NULL;
if (png_ptr == NULL)
return 0;
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
if (row != NULL) free(row);
if (display != NULL) free(display);
return 0;
}
png_init_io(png_ptr, fp);
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL)
png_error(png_ptr, "OOM allocating info structure");
png_read_info(png_ptr, info_ptr);
{
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row = malloc(rowbytes);
display = malloc(rowbytes);
if (row == NULL || display == NULL)
png_error(png_ptr, "OOM allocating row buffers");
{
png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
int passes = png_set_interlace_handling(png_ptr);
int pass;
png_start_read_image(png_ptr);
for (pass = 0; pass < passes; ++pass)
{
png_uint_32 y = height;
/* NOTE: this trashes the row each time; interlace handling won't
* work, but this avoids memory thrashing for speed testing.
*/
while (y-- > 0)
png_read_row(png_ptr, row, display);
}
}
}
/* Make sure to read to the end of the file: */
png_read_end(png_ptr, info_ptr);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
free(row);
free(display);
return 1;
}
static int mytime(struct timespec *t)
{
/* Do the timing using clock_gettime and the per-process timer. */
if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, t))
return 1;
perror("CLOCK_PROCESS_CPUTIME_ID");
fprintf(stderr, "timepng: could not get the time\n");
return 0;
}
static int perform_one_test(FILE *fp, int nfiles)
{
int i;
struct timespec before, after;
/* Clear out all errors: */
rewind(fp);
if (mytime(&before))
{
for (i=0; i<nfiles; ++i)
{
if (read_png(fp))
{
if (ferror(fp))
{
perror("temporary file");
fprintf(stderr, "file %d: error reading PNG data\n", i);
return 0;
}
}
else
{
perror("temporary file");
fprintf(stderr, "file %d: error from libpng\n", i);
return 0;
}
}
}
else
return 0;
if (mytime(&after))
{
/* Work out the time difference and print it - this is the only output,
* so flush it immediately.
*/
unsigned long s = after.tv_sec - before.tv_sec;
long ns = after.tv_nsec - before.tv_nsec;
if (ns < 0)
{
--s;
ns += 1000000000;
if (ns < 0)
{
fprintf(stderr, "timepng: bad clock from kernel\n");
return 0;
}
}
printf("%lu.%.9ld\n", s, ns);
fflush(stdout);
if (ferror(stdout))
{
fprintf(stderr, "timepng: error writing output\n");
return 0;
}
/* Successful return */
return 1;
}
else
return 0;
}
static int add_one_file(FILE *fp, char *name)
{
FILE *ip = fopen(name, "rb");
if (ip != NULL)
{
int ch;
for (;;)
{
ch = getc(ip);
if (ch == EOF) break;
putc(ch, fp);
}
if (ferror(ip))
{
perror(name);
fprintf(stderr, "%s: read error\n", name);
return 0;
}
(void)fclose(ip);
if (ferror(fp))
{
perror("temporary file");
fprintf(stderr, "temporary file write error\n");
return 0;
}
}
else
{
perror(name);
fprintf(stderr, "%s: open failed\n", name);
return 0;
}
return 1;
}
int main(int argc, char **argv)
{
int ok = 0;
FILE *fp = tmpfile();
if (fp != NULL)
{
int err = 0;
int nfiles = 0;
if (argc > 1)
{
int i;
for (i=1; i<argc; ++i)
{
if (add_one_file(fp, argv[i]))
++nfiles;
else
{
err = 1;
break;
}
}
}
else
{
char filename[FILENAME_MAX+1];
while (fgets(filename, FILENAME_MAX+1, stdin))
{
int len = strlen(filename);
if (filename[len-1] == '\n')
{
filename[len-1] = 0;
if (add_one_file(fp, filename))
++nfiles;
else
{
err = 1;
break;
}
}
else
{
fprintf(stderr, "timepng: truncated file name ...%s\n",
filename+len-32);
err = 1;
break;
}
}
if (ferror(stdin))
{
fprintf(stderr, "timepng: stdin: read error\n");
err = 1;
}
}
if (!err)
{
if (nfiles > 0)
ok = perform_one_test(fp, nfiles);
else
fprintf(stderr, "usage: timepng {files} or ls files | timepng\n");
}
(void)fclose(fp);
}
else
fprintf(stderr, "timepng: could not open temporary file\n");
/* Exit code 0 on success. */
return ok == 0;
}

View File

@ -1,188 +0,0 @@
/*-
* convert.c
*
* Convert 8-bit sRGB or 16-bit linear values to another format.
*
* Last changed in libpng 1.5.7 [(PENDING RELEASE)]
* Copyright (c) 2011 Written by John Cunningham Bowler
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#define _ISOC99_SOURCE 1
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <fenv.h>
#include "sRGB.h"
static void
usage(const char *prog)
{
fprintf(stderr,
"%s: usage: %s [-linear|-sRGB] [-gray|-color] component{1,4}\n",
prog, prog);
exit(1);
}
unsigned long
component(const char *prog, const char *arg, int issRGB)
{
char *ep;
unsigned long c = strtoul(arg, &ep, 0);
if (ep <= arg || *ep || c > 65535 || (issRGB && c > 255))
{
fprintf(stderr, "%s: %s: invalid component value (%lu)\n", prog, arg, c);
usage(prog);
}
return c;
}
int
main(int argc, const char **argv)
{
const char *prog = *argv++;
int to_linear = 0, to_gray = 0, to_color = 0;
int channels = 0;
double c[4];
/* FE_TONEAREST is the IEEE754 round to nearest, preferring even, mode; i.e.
* everything rounds to the nearest value except that '.5' rounds to the
* nearest even value.
*/
fesetround(FE_TONEAREST);
c[3] = c[2] = c[1] = c[0] = 0;
while (--argc > 0 && **argv == '-')
{
const char *arg = 1+*argv++;
if (strcmp(arg, "sRGB") == 0)
to_linear = 0;
else if (strcmp(arg, "linear") == 0)
to_linear = 1;
else if (strcmp(arg, "gray") == 0)
to_gray = 1, to_color = 0;
else if (strcmp(arg, "color") == 0)
to_gray = 0, to_color = 1;
else
usage(prog);
}
switch (argc)
{
default:
usage(prog);
break;
case 4:
c[3] = component(prog, argv[3], to_linear);
++channels;
case 3:
c[2] = component(prog, argv[2], to_linear);
++channels;
case 2:
c[1] = component(prog, argv[1], to_linear);
++channels;
case 1:
c[0] = component(prog, argv[0], to_linear);
++channels;
break;
}
if (to_linear)
{
int i;
int components = channels;
if ((components & 1) == 0)
--components;
for (i=0; i<components; ++i) c[i] = linear_from_sRGB(c[i] / 255);
if (components < channels)
c[components] = c[components] / 255;
}
else
{
int i;
for (i=0; i<4; ++i) c[i] /= 65535;
if ((channels & 1) == 0)
{
double alpha = c[channels-1];
if (alpha > 0)
for (i=0; i<channels-1; ++i) c[i] /= alpha;
else
for (i=0; i<channels-1; ++i) c[i] = 1;
}
}
if (to_gray)
{
if (channels < 3)
{
fprintf(stderr, "%s: too few channels (%d) for -gray\n",
prog, channels);
usage(prog);
}
c[0] = YfromRGB(c[0], c[1], c[2]);
channels -= 2;
}
if (to_color)
{
if (channels > 2)
{
fprintf(stderr, "%s: too many channels (%d) for -color\n",
prog, channels);
usage(prog);
}
c[3] = c[1]; /* alpha, if present */
c[2] = c[1] = c[0];
}
if (to_linear)
{
int i;
if ((channels & 1) == 0)
{
double alpha = c[channels-1];
for (i=0; i<channels-1; ++i) c[i] *= alpha;
}
for (i=0; i<channels; ++i) c[i] = nearbyint(c[i] * 65535);
}
else /* to sRGB */
{
int i = (channels+1)&~1;
while (--i >= 0)
c[i] = sRGB_from_linear(c[i]);
for (i=0; i<channels; ++i) c[i] = nearbyint(c[i] * 255);
}
{
int i;
for (i=0; i<channels; ++i) printf(" %g", c[i]);
}
printf("\n");
return 0;
}

View File

@ -1,430 +0,0 @@
/* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables
*
* Last changed in libpng 1.5.7 [(PENDING RELEASE)]
* Copyright (c) 2011 John Cunningham Bowler
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Make a table to convert 8-bit sRGB encoding values into the closest 16-bit
* linear value.
*
* Make two tables to take a linear value scaled to 255*65535 and return an
* approximation to the 8-bit sRGB encoded value. Calculate the error in these
* tables and display it.
*/
#define _C99_SOURCE 1
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
/* pngpriv.h includes the definition of 'PNG_sRGB_FROM_LINEAR' which is required
* to verify the actual code.
*/
#include "../../pngpriv.h"
#include "sRGB.h"
/* The tables are declared 'const' in pngpriv.h, so this redefines the tables to
* be used.
*/
#define png_sRGB_table sRGB_table
#define png_sRGB_base sRGB_base
#define png_sRGB_delta sRGB_delta
static png_uint_16 png_sRGB_table[256];
static png_uint_16 png_sRGB_base[512];
static png_byte png_sRGB_delta[512];
static const unsigned int max_input = 255*65535;
double
fsRGB(double l)
{
return sRGB_from_linear(l/max_input);
}
double
sRGB(unsigned int i)
{
return fsRGB(i);
}
double
finvsRGB(unsigned int i)
{
return 65535 * linear_from_sRGB(i/255.);
}
png_uint_16
invsRGB(unsigned int i)
{
unsigned int x = nearbyint(finvsRGB(i));
if (x > 65535)
{
fprintf(stderr, "invsRGB(%u) overflows to %u\n", i, x);
exit(1);
}
return (png_uint_16)x;
}
int
main(int argc, char **argv)
{
unsigned int i, i16, ibase;
double min_error = 0;
double max_error = 0;
double min_error16 = 0;
double max_error16 = 0;
double adjust;
double adjust_lo = 0.4, adjust_hi = 0.6, adjust_mid = 0.5;
unsigned int ec_lo = 0, ec_hi = 0, ec_mid = 0;
unsigned int error_count = 0;
unsigned int error_count16 = 0;
int test_only = 0;
if (argc > 1)
test_only = strcmp("--test", argv[1]) == 0;
/* Initialize the encoding table first. */
for (i=0; i<256; ++i)
{
png_sRGB_table[i] = invsRGB(i);
}
/* Now work out the decoding tables (this is where the error comes in because
* there are 512 set points and 512 straight lines between them.)
*/
for (;;)
{
if (ec_lo == 0)
adjust = adjust_lo;
else if (ec_hi == 0)
adjust = adjust_hi;
else if (ec_mid == 0)
adjust = adjust_mid;
else if (ec_mid < ec_hi)
adjust = (adjust_mid + adjust_hi)/2;
else if (ec_mid < ec_lo)
adjust = (adjust_mid + adjust_lo)/2;
else
{
fprintf(stderr, "not reached: %u .. %u .. %u\n", ec_lo, ec_mid, ec_hi);
exit(1);
}
/* Calculate the table using the current 'adjust' */
for (i=0; i<=511; ++i)
{
double lo = 255 * sRGB(i << 15);
double hi = 255 * sRGB((i+1) << 15);
unsigned int calc;
calc = nearbyint((lo+adjust) * 256);
if (calc > 65535)
{
fprintf(stderr, "table[%d][0]: overflow %08x (%d)\n", i, calc,
calc);
exit(1);
}
png_sRGB_base[i] = calc;
calc = nearbyint((hi-lo) * 32);
if (calc > 255)
{
fprintf(stderr, "table[%d][1]: overflow %08x (%d)\n", i, calc,
calc);
exit(1);
}
png_sRGB_delta[i] = calc;
}
/* Check the 16-bit linear values alone: */
error_count16 = 0;
for (i16=0; i16 <= 65535; ++i16)
{
unsigned int i = 255*i16;
unsigned int iexact = nearbyint(255*sRGB(i));
unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
if (icalc != iexact)
++error_count16;
}
/* Now try changing the adjustment. */
if (ec_lo == 0)
ec_lo = error_count16;
else if (ec_hi == 0)
ec_hi = error_count16;
else if (ec_mid == 0)
{
ec_mid = error_count16;
printf("/* initial error counts: %u .. %u .. %u */\n", ec_lo, ec_mid,
ec_hi);
}
else if (error_count16 < ec_mid)
{
printf("/* adjust (mid ): %f: %u -> %u */\n", adjust, ec_mid,
error_count16);
ec_mid = error_count16;
adjust_mid = adjust;
}
else if (adjust < adjust_mid && error_count16 < ec_lo)
{
printf("/* adjust (low ): %f: %u -> %u */\n", adjust, ec_lo,
error_count16);
ec_lo = error_count16;
adjust_lo = adjust;
}
else if (adjust > adjust_mid && error_count16 < ec_hi)
{
printf("/* adjust (high): %f: %u -> %u */\n", adjust, ec_hi,
error_count16);
ec_hi = error_count16;
adjust_hi = adjust;
}
else
{
adjust = adjust_mid;
printf("/* adjust: %f: %u */\n", adjust, ec_mid);
break;
}
}
/* For each entry in the table try to adjust it to minimize the error count
* in that entry. Each entry corresponds to 128 input values.
*/
for (ibase=0; ibase<65536; ibase+=128)
{
png_uint_16 base = png_sRGB_base[ibase >> 7], trybase = base, ob=base;
png_byte delta = png_sRGB_delta[ibase >> 7], trydelta = delta, od=delta;
unsigned int ecbase = 0, eco;
for (;;)
{
png_sRGB_base[ibase >> 7] = trybase;
png_sRGB_delta[ibase >> 7] = trydelta;
/* Check the 16-bit linear values alone: */
error_count16 = 0;
for (i16=ibase; i16 < ibase+128; ++i16)
{
unsigned int i = 255*i16;
unsigned int iexact = nearbyint(255*sRGB(i));
unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
if (icalc != iexact)
++error_count16;
}
if (error_count16 == 0)
break;
if (ecbase == 0)
{
eco = ecbase = error_count16;
++trybase; /* First test */
}
else if (error_count16 < ecbase)
{
if (trybase > base)
{
base = trybase;
++trybase;
}
else if (trybase < base)
{
base = trybase;
--trybase;
}
else if (trydelta > delta)
{
delta = trydelta;
++trydelta;
}
else if (trydelta < delta)
{
delta = trydelta;
--trydelta;
}
else
{
fprintf(stderr, "makesRGB: impossible\n");
exit(1);
}
ecbase = error_count16;
}
else
{
if (trybase > base)
trybase = base-1;
else if (trybase < base)
{
trybase = base;
++trydelta;
}
else if (trydelta > delta)
trydelta = delta-1;
else if (trydelta < delta)
break; /* end of tests */
}
}
png_sRGB_base[ibase >> 7] = base;
png_sRGB_delta[ibase >> 7] = delta;
if (base != ob || delta != od)
{
printf("/* table[%u]={%u,%u} -> {%u,%u} %u -> %u errors */\n",
ibase>>7, ob, od, base, delta, eco, ecbase);
}
else if (0)
printf("/* table[%u]={%u,%u} %u errors */\n", ibase>>7, ob, od,
ecbase);
}
/* Only do the full (slow) test at the end: */
min_error = -.4999;
max_error = .4999;
error_count = 0;
for (i=0; i <= max_input; ++i)
{
unsigned int iexact = nearbyint(255*sRGB(i));
unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
if (icalc != iexact)
{
double err = 255*sRGB(i) - icalc;
if (err > (max_error+.001) || err < (min_error-.001))
{
printf(
"/* 0x%08x: exact: %3d, got: %3d [tables: %08x, %08x] (%f) */\n",
i, iexact, icalc, png_sRGB_base[i>>15],
png_sRGB_delta[i>>15], err);
}
++error_count;
if (err > max_error)
max_error = err;
else if (err < min_error)
min_error = err;
}
}
/* Re-check the 16-bit cases too, including the warning if there is an error
* bigger than 1.
*/
error_count16 = 0;
max_error16 = 0;
min_error16 = 0;
for (i16=0; i16 <= 65535; ++i16)
{
unsigned int i = 255*i16;
unsigned int iexact = nearbyint(255*sRGB(i));
unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
if (icalc != iexact)
{
double err = 255*sRGB(i) - icalc;
++error_count16;
if (err > max_error16)
max_error16 = err;
else if (err < min_error16)
min_error16 = err;
if (abs(icalc - iexact) > 1)
printf(
"/* 0x%04x: exact: %3d, got: %3d [tables: %08x, %08x] (%f) */\n",
i16, iexact, icalc, png_sRGB_base[i>>15],
png_sRGB_delta[i>>15], err);
}
}
/* Check the round trip for each 8-bit sRGB value. */
for (i16=0; i16 <= 255; ++i16)
{
unsigned int i = 255 * png_sRGB_table[i16];
unsigned int iexact = nearbyint(255*sRGB(i));
unsigned int icalc = PNG_sRGB_FROM_LINEAR(i);
if (i16 != iexact)
{
fprintf(stderr, "8-bit rounding error: %d -> %d\n", i16, iexact);
exit(1);
}
if (icalc != i16)
{
double finv = finvsRGB(i16);
printf("/* 8-bit roundtrip error: %d -> %f -> %d(%f) */\n",
i16, finv, icalc, fsRGB(255*finv));
}
}
printf("/* error: %g - %g, %u (%g%%) of readings inexact */\n",
min_error, max_error, error_count, (100.*error_count)/max_input);
printf("/* 16-bit error: %g - %g, %u (%g%%) of readings inexact */\n",
min_error16, max_error16, error_count16, (100.*error_count16)/65535);
if (!test_only)
{
printf("PNG_CONST png_uint_16 png_sRGB_table[256] =\n{\n ");
for (i=0; i<255; )
{
do
{
printf("%d,", png_sRGB_table[i++]);
}
while ((i & 0x7) != 0 && i<255);
if (i<255) printf("\n ");
}
printf("%d\n};\n\n", png_sRGB_table[i]);
printf("PNG_CONST png_uint_16 png_sRGB_base[512] =\n{\n ");
for (i=0; i<511; )
{
do
{
printf("%d,", png_sRGB_base[i++]);
}
while ((i & 0x7) != 0 && i<511);
if (i<511) printf("\n ");
}
printf("%d\n};\n\n", png_sRGB_base[i]);
printf("PNG_CONST png_byte png_sRGB_delta[512] =\n{\n ");
for (i=0; i<511; )
{
do
{
printf("%d,", png_sRGB_delta[i++]);
}
while ((i & 0xf) != 0 && i<511);
if (i<511) printf("\n ");
}
printf("%d\n};\n\n", png_sRGB_delta[i]);
}
return 0;
}

View File

@ -1,48 +0,0 @@
/*-
* sRGB.h
*
* Last changed in libpng 1.5.7 [(PENDING RELEASE)]
* Copyright (c) 2011 John Cunningham Bowler
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Utility file; not actually a header, this contains definitions of sRGB
* calculation functions for inclusion in those test programs that need them.
*
* All routines take and return a floating point value in the range
* 0 to 1.0, doing a calculation according to the sRGB specification
* (in fact the source of the numbers is the wikipedia article at
* http://en.wikipedia.org/wiki/SRGB).
*/
static double
sRGB_from_linear(double l)
{
if (l <= 0.0031308)
l *= 12.92;
else
l = 1.055 * pow(l, 1/2.4) - 0.055;
return l;
}
static double
linear_from_sRGB(double s)
{
if (s <= 0.04045)
return s / 12.92;
else
return pow((s+0.055)/1.055, 2.4);
}
static double
YfromRGB(double r, double g, double b)
{
/* Use the sRGB (rounded) coefficients for Rlinear, Glinear, Blinear to get
* the CIE Y value (also linear).
*/
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.7beta05 - November 21, 2011 libpng version 1.5.7beta05 - November 23, 2011
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.5.7beta05 - November 21, 2011 libpng versions 0.97, January 1998, through 1.5.7beta05 - November 23, 2011
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@ -4573,7 +4573,7 @@ Other rules can be inferred by inspecting the libpng source.
XIV. Y2K Compliance in libpng XIV. Y2K Compliance in libpng
November 21, 2011 November 23, 2011
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "November 21, 2011" .TH LIBPNG 3 "November 23, 2011"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05
.SH SYNOPSIS .SH SYNOPSIS
@ -8,36 +8,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05
\fI\fB \fI\fB
\fBint \fP\fIpng_image_begin_read_from_file\fP\fB, (png_imagep \fIimage,
\fBconst char \fI*file_name)\fP\fB);\fP
\fBint \fP\fIpng_image_begin_read_from_stdio\fP\fB, (png_imagep \fIimage,
\fBFILE* \fIfile)\fP\fB);\fP
\fBint, \fP\fIpng_image_begin_read_from_memory\fP\fB, (png_imagep \fIimage,
\fBpng_const_voidp \fP\fImemory\fP\fB, png_size_t \fIsize)\fP\fB);\fP
\fBint \fP\fIpng_image_finish_read\fP\fB, (png_imagep \fIimage,
\fBpng_colorp \fP\fIbackground\fP\fB, void \fP\fI*buffer\fP\fB, png_int_32 \fIrow_stride)\fP\fB);\fP
\fBvoid \fP\fIpng_image_free\fP\fB, (png_imagep \fIimage)\fP\fB);\fP
\fBint \fP\fIpng_image_write_to_file\fP\fB, (png_imagep \fIimage,
\fBconst char \fP\fI*file\fP\fB, int \fP\fIconvert_to_8bit\fP\fB, const void \fI*buffer,
\fBpng_int_32 \fIrow_stride)\fP\fB);\fP
\fBint \fP\fIpng_image_write_to_stdio\fP\fB, (png_imagep \fP\fIimage\fP\fB, FILE \fI*file,
\fBint \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fIrow_stride)\fP\fB);\fP
\fI\fB
\fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP \fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP
\fI\fB \fI\fB
@ -462,36 +432,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05
\fI\fB \fI\fB
\fBint png_image_begin_read_from_file (png_imagep \fP\fIimage\fP\fB, const char \fI*file_name\fP\fB);\fP
\fI\fB
\fBint png_image_begin_read_from_stdio (png_imagep \fP\fIimage\fP\fB, FILE* \fIfile\fP\fB);\fP
\fI\fB
\fBint, png_image_begin_read_from_memory (png_imagep \fP\fIimage\fP\fB, png_const_voidp \fP\fImemory\fP\fB, png_size_t \fIsize\fP\fB);\fP
\fI\fB
\fBint png_image_finish_read (png_imagep \fP\fIimage\fP\fB, png_colorp \fP\fIbackground\fP\fB, void \fP\fI*buffer\fP\fB, png_int_32 \fIrow_stride\fP\fB);\fP
\fI\fB
\fBvoid png_image_free (png_imagep \fIimage\fP\fB);\fP
\fI\fB
\fBint png_image_write_to_file (png_imagep \fP\fIimage\fP\fB, const char \fP\fI*file\fP\fB, int \fP\fIconvert_to_8bit\fP\fB, const void \fI*buffer,
\fBpng_int_32 \fIrow_stride\fP\fB);\fP
\fI\fB
\fBint png_image_write_to_stdio (png_imagep \fP\fIimage\fP\fB, FILE \fP\fI*file\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fIrow_stride)\fP\fB);\fP
\fI\fB
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP \fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
\fI\fB \fI\fB
@ -1037,7 +977,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.7beta05 - November 21, 2011 libpng version 1.5.7beta05 - November 23, 2011
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@ -1048,7 +988,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.5.7beta05 - November 21, 2011 libpng versions 0.97, January 1998, through 1.5.7beta05 - November 23, 2011
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@ -5611,7 +5551,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XIV. Y2K Compliance in libpng .SH XIV. Y2K Compliance in libpng
November 21, 2011 November 23, 2011
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
@ -5876,7 +5816,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.5.7beta05 - November 21, 2011: Libpng version 1.5.7beta05 - November 23, 2011:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -5899,7 +5839,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 21, 2011, are libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 23, 2011, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -5998,7 +5938,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
November 21, 2011 November 23, 2011
.\" end of man page .\" end of man page

View File

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "November 18, 2011" .TH LIBPNGPF 3 "November 23, 2011"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05
(private functions) (private functions)

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "November 18, 2011" .TH PNG 5 "November 23, 2011"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

262
png.c
View File

@ -655,13 +655,13 @@ png_get_copyright(png_const_structp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.5.7beta05 - November 19, 2011" PNG_STRING_NEWLINE \ "libpng version 1.5.7beta05 - November 23, 2011" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.5.7beta05 - November 19, 2011\ return "libpng version 1.5.7beta05 - November 23, 2011\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\ Copyright (c) 1998-2011 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -2864,262 +2864,4 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth)
} }
} }
#endif /* READ_GAMMA */ #endif /* READ_GAMMA */
/* sRGB support */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
/* sRGB conversion tables; these are machine generated with the code in
* contrib/sRGBtables/makesRGB.c. The sRGB to linear table is exact (to the
* nearest 16 bit linear fraction). The inverse (linear to sRGB) table has
* accuracies as follows:
*
* For all possible (255*65535+1) input values:
*
* error: -0.515566 - 0.625971, 79441 (0.475369%) of readings inexact
*
* For the input values corresponding to the 65536 16-bit values:
*
* error: -0.513727 - 0.607759, 308 (0.469978%) of readings inexact
*
* In all cases the inexact readings are off by one.
*/
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
/* The convert-to-sRGB table is only currently required for read. */
PNG_CONST_DATA png_uint_16 png_sRGB_table[256] =
{
0,20,40,60,80,99,119,139,
159,179,199,219,241,264,288,313,
340,367,396,427,458,491,526,562,
599,637,677,718,761,805,851,898,
947,997,1048,1101,1156,1212,1270,1330,
1391,1453,1517,1583,1651,1720,1790,1863,
1937,2013,2090,2170,2250,2333,2418,2504,
2592,2681,2773,2866,2961,3058,3157,3258,
3360,3464,3570,3678,3788,3900,4014,4129,
4247,4366,4488,4611,4736,4864,4993,5124,
5257,5392,5530,5669,5810,5953,6099,6246,
6395,6547,6700,6856,7014,7174,7335,7500,
7666,7834,8004,8177,8352,8528,8708,8889,
9072,9258,9445,9635,9828,10022,10219,10417,
10619,10822,11028,11235,11446,11658,11873,12090,
12309,12530,12754,12980,13209,13440,13673,13909,
14146,14387,14629,14874,15122,15371,15623,15878,
16135,16394,16656,16920,17187,17456,17727,18001,
18277,18556,18837,19121,19407,19696,19987,20281,
20577,20876,21177,21481,21787,22096,22407,22721,
23038,23357,23678,24002,24329,24658,24990,25325,
25662,26001,26344,26688,27036,27386,27739,28094,
28452,28813,29176,29542,29911,30282,30656,31033,
31412,31794,32179,32567,32957,33350,33745,34143,
34544,34948,35355,35764,36176,36591,37008,37429,
37852,38278,38706,39138,39572,40009,40449,40891,
41337,41785,42236,42690,43147,43606,44069,44534,
45002,45473,45947,46423,46903,47385,47871,48359,
48850,49344,49841,50341,50844,51349,51858,52369,
52884,53401,53921,54445,54971,55500,56032,56567,
57105,57646,58190,58737,59287,59840,60396,60955,
61517,62082,62650,63221,63795,64372,64952,65535
};
#endif /* simplified read only */
/* The base/delta tables are required for both read and write (but currently
* only the simplified versions.)
*/
PNG_CONST_DATA png_uint_16 png_sRGB_base[512] =
{
128,1782,3383,4644,5675,6564,7357,8074,
8732,9346,9921,10463,10977,11466,11935,12384,
12816,13233,13634,14024,14402,14769,15125,15473,
15812,16142,16466,16781,17090,17393,17690,17981,
18266,18546,18822,19093,19359,19621,19879,20133,
20383,20630,20873,21113,21349,21583,21813,22041,
22265,22487,22707,22923,23138,23350,23559,23767,
23972,24175,24376,24575,24772,24967,25160,25352,
25542,25730,25916,26101,26284,26465,26645,26823,
27000,27176,27350,27523,27695,27865,28034,28201,
28368,28533,28697,28860,29021,29182,29341,29500,
29657,29813,29969,30123,30276,30429,30580,30730,
30880,31028,31176,31323,31469,31614,31758,31902,
32045,32186,32327,32468,32607,32746,32884,33021,
33158,33294,33429,33564,33697,33831,33963,34095,
34226,34357,34486,34616,34744,34873,35000,35127,
35253,35379,35504,35629,35753,35876,35999,36122,
36244,36365,36486,36606,36726,36845,36964,37083,
37201,37318,37435,37551,37668,37783,37898,38013,
38127,38241,38354,38467,38580,38692,38803,38915,
39026,39136,39246,39356,39465,39574,39682,39790,
39898,40005,40112,40219,40325,40431,40537,40642,
40747,40851,40955,41059,41163,41266,41369,41471,
41573,41675,41777,41878,41979,42079,42179,42279,
42379,42478,42577,42676,42775,42873,42971,43068,
43165,43262,43359,43456,43552,43648,43743,43839,
43934,44028,44123,44217,44311,44405,44499,44592,
44685,44778,44870,44962,45054,45146,45238,45329,
45420,45511,45601,45692,45782,45872,45961,46051,
46140,46229,46318,46406,46494,46583,46670,46758,
46846,46933,47020,47107,47193,47280,47366,47452,
47538,47623,47709,47794,47879,47964,48048,48133,
48217,48301,48385,48468,48552,48635,48718,48801,
48884,48966,49048,49131,49213,49294,49376,49458,
49539,49620,49701,49782,49862,49943,50023,50103,
50183,50263,50342,50422,50501,50580,50659,50738,
50816,50895,50973,51051,51129,51207,51285,51362,
51439,51517,51594,51671,51747,51824,51900,51977,
52053,52129,52205,52280,52356,52432,52507,52582,
52657,52732,52807,52881,52956,53030,53104,53178,
53252,53326,53400,53473,53546,53620,53693,53766,
53839,53911,53984,54056,54129,54201,54273,54345,
54417,54489,54560,54632,54703,54774,54845,54916,
54987,55058,55129,55199,55269,55340,55410,55480,
55550,55620,55689,55759,55828,55898,55967,56036,
56105,56174,56243,56311,56380,56448,56517,56585,
56653,56721,56789,56857,56924,56992,57059,57127,
57194,57261,57328,57395,57462,57529,57595,57662,
57728,57795,57861,57927,57993,58059,58125,58191,
58256,58322,58387,58453,58518,58583,58648,58713,
58778,58843,58908,58972,59037,59101,59165,59230,
59294,59358,59422,59486,59549,59613,59677,59740,
59804,59867,59930,59993,60056,60119,60182,60245,
60308,60370,60433,60495,60558,60620,60682,60744,
60806,60868,60930,60992,61054,61115,61177,61238,
61300,61361,61422,61483,61544,61605,61666,61727,
61788,61848,61909,61969,62030,62090,62150,62211,
62271,62331,62391,62450,62510,62570,62630,62689,
62749,62808,62867,62927,62986,63045,63104,63163,
63222,63281,63340,63398,63457,63515,63574,63632,
63691,63749,63807,63865,63923,63981,64039,64097,
64155,64212,64270,64328,64385,64443,64500,64557,
64614,64672,64729,64786,64843,64900,64956,65013,
65070,65126,65183,65239,65296,65352,65409,65465
};
PNG_CONST_DATA png_byte png_sRGB_delta[512] =
{
207,201,158,129,113,100,90,82,77,72,68,64,61,59,56,54,
52,50,49,47,46,45,43,42,41,40,39,39,38,37,36,36,
35,34,34,33,33,32,32,31,31,30,30,30,29,29,28,28,
28,27,27,27,27,26,26,26,25,25,25,25,24,24,24,24,
23,23,23,23,23,22,22,22,22,22,22,21,21,21,21,21,
21,20,20,20,20,20,20,20,20,19,19,19,19,19,19,19,
19,18,18,18,18,18,18,18,18,18,18,17,17,17,17,17,
17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,15,15,15,15,15,15,15,15,15,15,15,15,
15,15,15,15,14,14,14,14,14,14,14,14,14,14,14,14,
14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,
13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
};
#endif /* SIMPLIFIED READ/WRITE sRGB support */
/* SIMPLIFIED READ/WRITE SUPPORT */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
static int
png_image_free_function(png_voidp argument)
{
png_imagep image = png_voidcast(png_imagep, argument);
png_controlp cp = image->opaque;
png_control c;
/* Double check that we have a png_ptr - it should be impossible to get here
* without one.
*/
if (cp->png_ptr == NULL)
return 0;
/* First free any data held in the control structure. */
# ifdef PNG_STDIO_SUPPORTED
if (cp->owned_file)
{
FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr);
cp->owned_file = 0;
/* Ignore errors here. */
if (fp != NULL)
{
cp->png_ptr->io_ptr = NULL;
(void)fclose(fp);
}
}
# endif
/* Copy the control structure so that the original, allocated, version can be
* safely freed. Notice that a png_error here stops the remainder of the
* cleanup, but this is probably fine because that would indicate bad memory
* problems anyway.
*/
c = *cp;
image->opaque = &c;
png_free(c.png_ptr, cp);
/* Then the structures, calling the correct API. */
if (c.for_write)
{
# ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
png_destroy_write_struct(&c.png_ptr, &c.info_ptr);
# else
png_error(c.png_ptr, "simplified write not supported");
# endif
}
else
{
# ifdef PNG_SIMPLIFIED_READ_SUPPORTED
png_destroy_read_struct(&c.png_ptr, &c.info_ptr, NULL);
# else
png_error(c.png_ptr, "simplified read not supported");
# endif
}
/* Success. */
return 1;
}
void PNGAPI
png_image_free(png_imagep image)
{
/* Safely call the real function, but only if doing so is safe at this point
* (if not inside an error handling context). Otherwise assume
* png_safe_execute will call this API after the return.
*/
if (image != NULL && image->opaque != NULL &&
image->opaque->error_buf == NULL)
{
/* Ignore errors here: */
(void)png_safe_execute(image, png_image_free_function, image);
image->opaque = NULL;
}
}
int /* PRIVATE */
png_image_error(png_imagep image, png_const_charp error_message)
{
/* Utility to log an error. */
png_safecat(image->message, sizeof image->message, 0, error_message);
image->warning_or_error = 1;
png_image_free(image);
return 0;
}
#endif /* SIMPLIFIED READ/WRITE */
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */

303
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.5.7beta05 - November 22, 2011 * libpng version 1.5.7beta05 - November 23, 2011
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.7beta05 - November 22, 2011: Glenn * libpng versions 0.97, January 1998, through 1.5.7beta05 - November 23, 2011: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -195,7 +195,7 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 22, 2011, are * libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 23, 2011, are
* Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -307,7 +307,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* November 22, 2011 * November 23, 2011
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
@ -373,7 +373,7 @@
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.7beta05" #define PNG_LIBPNG_VER_STRING "1.5.7beta05"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.7beta05 - November 22, 2011\n" " libpng version 1.5.7beta05 - November 23, 2011\n"
#define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15 #define PNG_LIBPNG_VER_DLLNUM 15
@ -491,7 +491,6 @@ extern "C" {
* 2. Type definitions (base types are defined in pngconf.h), structure * 2. Type definitions (base types are defined in pngconf.h), structure
* definitions. * definitions.
* 3. Exported library functions. * 3. Exported library functions.
* 4. Simplified API.
* *
* The library source code has additional files (principally pngpriv.h) that * The library source code has additional files (principally pngpriv.h) that
* allow configuration of the library. * allow configuration of the library.
@ -2629,296 +2628,6 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
: (png_int_32)png_get_uint_32(buf))) : (png_int_32)png_get_uint_32(buf)))
#endif #endif
/*******************************************************************************
* SIMPLIFIED API
*******************************************************************************
*
* Please read the documentation in libpng-manual.txt if you don't understand
* what follows.
*
* The simplified API hides the details of both libpng and the PNG file format
* itself. It allows PNG files to be read into a very limited number of
* in-memory bitmap formats or to be written from the same formats. If these
* formats do not accomodate your needs then you can, and should, use the more
* sophisticated APIs above - these support a wide variety of in-memory formats
* and a wide variety of sophisticated transformations to those formats as well
* as a wide variety of APIs to manipulate ancilliary information.
*
* To read a PNG file using the simplified API:
*
* 1) Declare a 'png_image' structure (see below) on the stack and memset() it
* to all zero.
* 2) Call the appropriate png_image_begin_read... function.
* 3) Set the png_image 'format' member to the required format and allocate a
* buffer for the image.
* 4) Call png_image_finish_read to read the image into your buffer.
*
* There are no restrictions on the format of the PNG input itself; all valid
* color types, bit depths, and interlace methods are acceptable, and the
* input image is transformed as necessary to the requested in-memory format
* during the png_image_finish_read() step.
*
* To write a PNG file using the simplified API:
*
* 1) Declare a 'png_image' structure on the stack and memset() it to all zero.
* 2) Initialize the members of the structure that describe the image, setting
* the 'format' member to the format of the image in memory.
* 3) Call the appropriate png_image_write... function with a pointer to the
* image to write the PNG data.
*
* png_image is a structure that describes the in-memory format of an image
* when it is being read or define the in-memory format of an image that you
* need to write:
*
*/
typedef struct png_control *png_controlp;
typedef struct
{
png_uint_32 width; /* Image width in pixels (columns) */
png_uint_32 height; /* Image height in pixels (rows) */
png_uint_32 format; /* Image format as defined below */
png_uint_32 flags; /* A bit mask containing informational flags */
png_controlp opaque; /* Initialize to NULL, free with png_image_free */
/* In the event of an error or warning the following field will be set to a
* non-zero value and the 'message' field will contain a '\0' terminated
* string with the libpng error or warning message. If both warnings and
* an error were encountered, only the error is recorded. If there
* are multiple warnings, only the first one is recorded.
*
* As of libpng-1.5.7 the values are
* 0 - no warning or error
* 1 - error
* 2 - warning
*/
png_uint_32 warning_or_error;
char message[64];
} png_image, *png_imagep;
/* The pixels (samples) of the image have one to four channels whose components
* have original values in the range 0 to 1.0:
*
* 1: A single gray or luminance channel (G).
* 2: A gray/luminance channel and an alpha channel (GA).
* 3: Three red, green, blue color channels (RGB).
* 4: Three color channels and an alpha channel (RGBA).
*
* The channels are encoded in one of two ways:
*
* a) As a small integer, value 0..255, contained in a (png_byte). For the
* alpha channel the original value is simply value/255. For the color or
* luminance channels the value is encoded according to the sRGB specification
* and matches the 8-bit format expected by typical display devices.
*
* The color/gray channels are not scaled (pre-multiplied) by the alpha
* channel and are suitable for passing to color management software.
*
* b) As a value in the range 0..65535, contained in a (png_uint_16). All
* channels can be converted to the original value by dividing by 65535; all
* channels are linear. Color channels use the RGB encoding (RGB end-points) of
* the sRGB specification. This encoding is identified by the
* PNG_FORMAT_FLAG_LINEAR flag below.
*
* When an alpha channel is present it is expected to denote pixel coverage
* of the color or luminance channels and is returned as an associated alpha
* channel: the color/gray channels are scaled (pre-multiplied) by the alpha
* value.
*/
/* PNG_FORMAT_*
*
* #defines to be used in png_image::format. Each #define identifies a
* particular layout of channel data and, if present, alpha values. There are
* separate defines for each of the two channel encodings.
*
* A format is built up using single bit flag values. Not all combinations are
* valid: use the bit flag values below for testing a format returned by the
* read APIs, but set formats from the derived values.
*
* NOTE: libpng can be built with particular features disabled, if you see
* compiler errors because the definition of one of the following flags has been
* compiled out it is because libpng does not have the required support. It is
* possible, however, for the libpng configuration to enable the format on just
* read or just write; in that case you may see an error at run time. You can
* guard against this by checking for the definition of:
*
* PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED
*/
#define PNG_FORMAT_FLAG_ALPHA 0x01 /* format with an alpha channel */
#define PNG_FORMAT_FLAG_COLOR 0x02 /* color format: otherwise grayscale */
#define PNG_FORMAT_FLAG_LINEAR 0x04 /* png_uint_16 channels else png_byte */
#ifdef PNG_FORMAT_BGR_SUPPORTED
# define PNG_FORMAT_FLAG_BGR 0x08 /* BGR colors, else order is RGB */
#endif
#ifdef PNG_FORMAT_AFIRST_SUPPORTED
# define PNG_FORMAT_FLAG_AFIRST 0x10 /* alpha channel comes first */
#endif
/* Supported formats are as follows. Future versions of libpng may support more
* formats; for compatibility with older versions simply check if the format
* macro is defined using #ifdef. These defines describe the in-memory layout
* of the components of the pixels of the image.
*
* First the single byte formats:
*/
#define PNG_FORMAT_GRAY 0
#define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA
#define PNG_FORMAT_AG (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST)
#define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR
#define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR)
#define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA)
#define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST)
#define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA)
#define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST)
/* Then the linear (png_uint_16) formats. When naming these "Y" is used to
* indicate a luminance (gray) channel. The component order within the pixel
* is always the same - there is no provision for swapping the order of the
* components in the linear format.
*/
#define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
#define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA)
#define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR)
#define PNG_FORMAT_LINEAR_RGB_ALPHA \
(PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA)
/* PNG_IMAGE macros
*
* These are convenience macros to derive information from a png_image structure
*/
#define PNG_IMAGE_CHANNELS(fmt)\
(1+((fmt)&(PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA)))
/* Return the total number of channels in a given format: 1..4 */
#define PNG_IMAGE_COMPONENT_SIZE(fmt)\
(((fmt) & PNG_FORMAT_FLAG_LINEAR) ? sizeof (png_uint_16) : sizeof (png_byte))
/* Return the size in bytes of a single component of a pixel in the image. */
#define PNG_IMAGE_PIXEL_SIZE(fmt)\
(PNG_IMAGE_CHANNELS(fmt) * PNG_IMAGE_COMPONENT_SIZE(fmt))
/* Return the size in bytes of a single pixel in the image. */
#define PNG_IMAGE_ROW_STRIDE(image)\
(PNG_IMAGE_CHANNELS((image).format) * (image).width)
/* Return the total number of components in a single row of the image; this
* is the minimum 'row stride', the minimum count of components between each
* row.
*/
#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
(PNG_IMAGE_COMPONENT_SIZE((image).format) * (image).height * (row_stride))
/* Return the size, in bytes, of an image buffer given a png_image and a row
* stride - the number of components to leave space for in each row.
*/
#define PNG_IMAGE_SIZE(image)\
PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image))
/* Return the size, in bytes, of the image in memory given just a png_image;
* the row stride is the minimum stride required for the image.
*/
/* PNG_IMAGE_FLAG_*
*
* Flags containing additional information about the image are held in the
* 'flags' field of png_image.
*/
#define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 1
/* This indicates the the RGB values of the in-memory bitmap do not
* correspond to the red, green and blue end-points defined by sRGB.
*/
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
/* READ APIs
* ---------
*
* The png_image passed to the read APIs must have been initialized by setting
* the png_controlp field 'opaque' to NULL (or, better, memset the whole thing.)
*/
#ifdef PNG_STDIO_SUPPORTED
PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
const char *file_name));
/* The named file is opened for read and the image header is filled in
* from the PNG header in the file.
*/
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
FILE* file));
/* The PNG header is read from the stdio FILE object. */
#endif /* PNG_STDIO_SUPPORTED */
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
png_const_voidp memory, png_size_t size));
/* The PNG header is read from the given memory buffer. */
PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
png_colorp background, void *buffer, png_int_32 row_stride));
/* Finish reading the image into the supplied buffer and clean up the
* png_image structure.
*
* row_stride is the step, in png_byte or png_uint_16 units as appropriate,
* between adjacent rows. A positive stride indicates that the top-most row
* is first in the buffer - the normal top-down arrangement. A negative
* stride indicates that the bottom-most row is first in the buffer.
*
* background need only be supplied if an alpha channel must be removed from
* a png_byte format and the removal is to be done by compositing on a solid
* color; otherwise it may be NULL and any composition will be done directly
* onto the buffer. The value is an sRGB color to use for the background,
* for grayscale output the green channel is used.
*
* For linear output removing the alpha channel is always done by compositing
* on black.
*/
PNG_EXPORT(238, void, png_image_free, (png_imagep image));
/* Free any data allocated by libpng in image->opaque, setting the pointer to
* NULL. May be called at any time after the structure is initialized.
*/
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
/* WRITE APIS
* ----------
* For write you must initialize a png_image structure to describe the image to
* be written:
*
* opaque: must be initialized to NULL
* width: image width in pixels
* height: image height in rows
* format: the format of the data you wish to write
* flags: set to 0 unless one of the defined flags applies; set
* PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB
* values do not correspond to the colors in sRGB.
*/
PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
const char *file, int convert_to_8bit, const void *buffer,
png_int_32 row_stride));
/* Write the image to the named file. */
PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer, png_int_32 row_stride));
/* Write the image to the given (FILE*). */
/* With all write APIs if image is in one of the linear formats with
* (png_uint_16) data then setting convert_to_8_bit will cause the output to be
* a (png_byte) PNG gamma encoded according to the sRGB specification, otherwise
* a 16-bit linear encoded PNG file is written.
*
* With all APIs row_stride is handled as in the read APIs - it is the spacing
* from one row to the next in component sized units (float) and if negative
* indicates a bottom-up row layout in the buffer.
*
* Note that the write API does not support interlacing, sub-8-bit pixels,
* and indexed (paletted) images.
*/
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
/*******************************************************************************
* END OF SIMPLIFIED API
******************************************************************************/
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project /* Maintainer: Put new public prototypes here ^, in libpng.3, and project
* defs * defs
*/ */
@ -2928,7 +2637,7 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
* scripts/symbols.def as well. * scripts/symbols.def as well.
*/ */
#ifdef PNG_EXPORT_LAST_ORDINAL #ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL(240); PNG_EXPORT_LAST_ORDINAL(233);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.5.7beta05 - November 18, 2011 * libpng version 1.5.7beta05 - November 23, 2011
* *
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -673,87 +673,4 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
} }
} }
#endif #endif
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
/* Currently the above both depend on SETJMP_SUPPORTED, however it would be
* possible to implement without setjmp support just so long as there is some
* way to handle the error return here:
*/
PNG_FUNCTION(void /* PRIVATE */,
png_safe_error,(png_structp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* An error is always logged here, overwriting anything (typically a warning)
* that is already there:
*/
if (image != NULL)
{
png_safecat(image->message, sizeof image->message, 0, error_message);
image->warning_or_error = 1;
/* Retrieve the jmp_buf from within the png_control, making this work for
* C++ compilation too is pretty tricky: C++ wants a pointer to the first
* element of a jmp_buf, but C doesn't tell us the type of that.
*/
if (image->opaque != NULL && image->opaque->error_buf != NULL)
longjmp(png_control_jmp_buf(image->opaque), 1);
/* Missing longjmp buffer, the following is to help debugging: */
{
size_t pos = png_safecat(image->message, sizeof image->message, 0,
"bad longjmp: ");
png_safecat(image->message, sizeof image->message, pos, error_message);
}
}
/* Here on an internal programming error. */
abort();
}
#ifdef PNG_WARNINGS_SUPPORTED
void /* PRIVATE */
png_safe_warning(png_structp png_ptr, png_const_charp warning_message)
{
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* A warning is only logged if there is no prior warning or error. */
if (image->warning_or_error == 0)
{
png_safecat(image->message, sizeof image->message, 0, warning_message);
image->warning_or_error = 2;
}
}
#endif
int /* PRIVATE */
png_safe_execute(png_imagep imageIn, int (*function)(png_voidp), png_voidp arg)
{
volatile png_imagep image = imageIn;
volatile int result;
volatile png_voidp saved_error_buf;
jmp_buf safe_jmpbuf;
/* Safely execute function(arg) with png_error returning to this function. */
saved_error_buf = image->opaque->error_buf;
result = setjmp(safe_jmpbuf) == 0;
if (result)
{
image->opaque->error_buf = safe_jmpbuf;
result = function(arg);
}
image->opaque->error_buf = saved_error_buf;
/* And do the cleanup prior to any failure return. */
if (!result)
png_image_free(image);
return result;
}
#endif /* SIMPLIFIED READ/WRITE */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View File

@ -258,26 +258,6 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
# define PNG_EXTERN extern # define PNG_EXTERN extern
#endif #endif
#ifndef PNG_CONST_DATA
/* Some compilers fail if given an "extern const" data declaration followed by a
* "const" definition, therefore declaring const data in pngpriv.h is
* impossible, the following allows a work-round for the problematic compilers
* by defining -DPNG_NO_CONST_DATA on the command line (notice that this does
* not affect static const definitions, where there is no declaration.)
*/
# ifndef PNG_NO_CONST_DATA
/* List of compilers where "extern const" is known to be OK: */
# if defined __GNUC__ || defined _MSC_VER || defined __WATCOMC__
# define PNG_CONST_DATA const
# endif
# endif
/* Default to disabling const data declarations: */
# ifndef PNG_CONST_DATA
# define PNG_CONST_DATA /*const*/
# endif
#endif
/* Some fixed point APIs are still required even if not exported because /* Some fixed point APIs are still required even if not exported because
* they get used by the corresponding floating point APIs. This magic * they get used by the corresponding floating point APIs. This magic
* deals with this: * deals with this:
@ -548,26 +528,6 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
abs((int)((c1).green) - (int)((c2).green)) + \ abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue))) abs((int)((c1).blue) - (int)((c2).blue)))
/* Added to libpng-1.5.7: sRGB conversion tables */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
extern /*PRIVATE*/ PNG_CONST_DATA png_uint_16 png_sRGB_table[256];
/* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
* 0..65535. This table gives the closes 16-bit answers (no errors).
*/
#endif
extern /*PRIVATE*/ PNG_CONST_DATA png_uint_16 png_sRGB_base[512];
extern /*PRIVATE*/ PNG_CONST_DATA png_byte png_sRGB_delta[512];
#define PNG_sRGB_FROM_LINEAR(linear) ((png_sRGB_base[(linear)>>15] +\
((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)
/* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
* encoded value with maximum error 0.646365. Note that the input is not a
* 16-bit value; it has been multiplied by 255! */
#endif /* PNG_SIMPLIFIED_READ/WRITE */
/* Added to libpng-1.2.6 JB */ /* Added to libpng-1.2.6 JB */
#define PNG_ROWBYTES(pixel_bits, width) \ #define PNG_ROWBYTES(pixel_bits, width) \
((pixel_bits) >= 8 ? \ ((pixel_bits) >= 8 ? \
@ -1658,59 +1618,8 @@ PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
int bit_depth)); int bit_depth));
#endif #endif
/* SIMPLIFIED READ/WRITE SUPPORT */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
/* The internal structure that png_image::opaque points to. */
typedef struct png_control
{
png_structp png_ptr;
png_infop info_ptr;
png_voidp error_buf; /* Always a jmp_buf at present. */
png_const_bytep memory; /* Memory buffer. */
png_size_t size; /* Size of the memory buffer. */
unsigned int for_write :1; /* Otherwise it is a read structure */
unsigned int owned_file :1; /* We own the file in io_ptr */
} png_control;
/* Return the pointer to the jmp_buf from a png_control: necessary because C
* does not reveal the type of the elements of jmp_buf.
*/
#ifdef __cplusplus
# define png_control_jmp_buf(pc) (((jmp_buf*)((pc)->error_buf))[0])
#else
# define png_control_jmp_buf(pc) ((pc)->error_buf)
#endif
/* Utility to safely execute a piece of libpng code catching and logging any
* errors that might occur. Returns true on success, false on failure (either
* of the function or as a result of a png_error.)
*/
PNG_FUNCTION(void, png_safe_error, (png_structp png_ptr,
png_const_charp error_message), PNG_NORETURN);
#ifdef PNG_WARNINGS_SUPPORTED
PNG_EXTERN void png_safe_warning(png_structp png_ptr,
png_const_charp warning_message);
#else
# define png_safe_warning 0/*dummy argument*/
#endif
PNG_EXTERN int png_safe_execute PNGARG((png_imagep image,
int (*function)(png_voidp), png_voidp arg));
/* Utility to log an error, this also cleans up the png_image, the function
* always returns 0 (false).
*/
PNG_EXTERN int png_image_error(png_imagep image, png_const_charp error_message);
#endif /* SIMPLIFIED READ/WRITE */
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#include "pngdebug.h" #include "pngdebug.h"
#ifdef __cplusplus #ifdef __cplusplus

1152
pngread.c

File diff suppressed because it is too large Load Diff

View File

@ -1163,6 +1163,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
{ {
pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text); pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
if (verbose)
printf("\nText compression=%d\n", text_ptr->compression);
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
} }
} }

View File

@ -12,9 +12,6 @@
*/ */
#include "pngpriv.h" #include "pngpriv.h"
#if defined PNG_SIMPLIFIED_WRITE_SUPPORTED && defined PNG_STDIO_SUPPORTED
# include <errno.h>
#endif
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
@ -1655,563 +1652,4 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
PNG_UNUSED(params) PNG_UNUSED(params)
} }
#endif #endif
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
/* Initialize the write structure - general purpose utility. */
static int
png_image_write_init(png_imagep image)
{
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, image,
png_safe_error, png_safe_warning);
if (png_ptr != NULL)
{
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr != NULL)
{
png_controlp control = png_voidcast(png_controlp,
png_malloc_warn(png_ptr, sizeof *control));
if (control != NULL)
{
memset(control, 0, sizeof *control);
control->png_ptr = png_ptr;
control->info_ptr = info_ptr;
control->for_write = 1;
image->opaque = control;
return 1;
}
/* Error clean up */
png_destroy_info_struct(png_ptr, &info_ptr);
}
png_destroy_write_struct(&png_ptr, NULL);
}
return png_image_error(image, "png_image_read: out of memory");
}
/* Arguments to png_image_write_main: */
typedef struct
{
/* Arguments: */
png_imagep image;
png_const_voidp buffer;
png_int_32 row_stride;
int convert_to_8bit;
/* Local variables: */
png_const_voidp first_row;
ptrdiff_t row_bytes;
png_voidp local_row;
} png_image_write_control;
/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
* do any necessary byte swapping. The component order is defined by the
* png_image format value.
*/
static int
png_write_image_16bit(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
argument);
png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr;
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
display->first_row);
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
png_uint_16p row_end;
int channels = (image->format & PNG_FORMAT_FLAG_COLOR) ? 3 : 1;
int aindex = 0;
png_uint_32 y = image->height;
if (image->format & PNG_FORMAT_FLAG_ALPHA)
{
if (image->format & PNG_FORMAT_FLAG_AFIRST)
{
aindex = -1;
++input_row; /* To point to the first component */
++output_row;
}
else
aindex = channels;
}
else
png_error(png_ptr, "png_write_image: internal call error");
/* Work out the output row end and count over this, note that the increment
* above to 'row' means that row_end can actually be beyond the end of the
* row; this is correct.
*/
row_end = output_row + image->width * (channels+1);
while (y-- > 0)
{
png_const_uint_16p in_ptr = input_row;
png_uint_16p out_ptr = output_row;
while (out_ptr < row_end)
{
png_uint_16 alpha = in_ptr[aindex];
png_uint_32 reciprocal = 0;
int c;
out_ptr[aindex] = alpha;
/* Calculate a reciprocal. The correct calculation is simply
* component/alpha*65535 << 15. (I.e. 15 bits of precision); this
* allows correct rounding by adding .5 before the shift. 'reciprocal'
* is only initialized when required.
*/
if (alpha > 0 && alpha < 65535)
reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
c = channels;
do /* always at least one channel */
{
png_uint_16 component = *in_ptr++;
/* The following gives 65535 for an alpha of 0, which is fine,
* otherwise if 0/0 is represented as some other value there is more
* likely to be a discontinuity which will probably damage
* compression when moving from a fully transparent area to a
* nearly transparent one. (The assumption here is that opaque
* areas tend not to be 0 intensity.)
*/
if (component >= alpha)
component = 65535;
/* component<alpha, so component/alpha is less than one and
* component*reciprocal is less than 2^31.
*/
else if (component > 0 && alpha < 65535)
{
png_uint_32 calc = component * reciprocal;
calc += 16384; /* round to nearest */
component = (png_uint_16)(calc >> 15);
}
*out_ptr++ = component;
}
while (--c > 0);
/* Skip to next component (skip the intervening alpha channel) */
++in_ptr;
++out_ptr;
}
png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
input_row += display->row_bytes/(sizeof (png_uint_16));
}
return 1;
}
/* Given 16-bit input (1 to 4 channels) write 8-bit output. If an alpha channel
* is present it must be removed from the components, the components are then
* written in sRGB encoding. No components are added or removed.
*/
static int
png_write_image_8bit(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
argument);
png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr;
png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
display->first_row);
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
png_uint_32 y = image->height;
int channels = (image->format & PNG_FORMAT_FLAG_COLOR) ? 3 : 1;
if (image->format & PNG_FORMAT_FLAG_ALPHA)
{
png_bytep row_end;
int aindex;
if (image->format & PNG_FORMAT_FLAG_AFIRST)
{
aindex = -1;
++input_row; /* To point to the first component */
++output_row;
}
else
aindex = channels;
/* Use row_end in place of a loop counter: */
row_end = output_row + image->width * (channels+1);
while (y-- > 0)
{
png_const_uint_16p in_ptr = input_row;
png_bytep out_ptr = output_row;
if (aindex != 0) while (out_ptr < row_end) /* Alpha channel case */
{
png_uint_16 alpha = in_ptr[aindex];
png_uint_32 reciprocal = 0;
int c;
/* Scale and write the alpha channel. See pngrtran.c
* png_do_scale_16_to_8 for a discussion of this calculation. The
* code here has machine native values, so use:
*
* (V * 255 + 32895) >> 16
*/
out_ptr[aindex] = (png_byte)((alpha * 255 + 32895) >> 16);
/* Calculate a reciprocal. As above the calculation can be done to
* 15 bits of accuracy, however the output needs to be scaled in the
* range 0..255*65535, so include that scaling here.
*/
if (alpha > 0 && alpha < 65535)
reciprocal = (((0xffff*0xff)<<7)+(alpha>>1))/alpha;
c = channels;
do /* always at least one channel */
{
/* Need 32 bit accuracy in the sRGB tables */
png_uint_32 component = *in_ptr++;
/* The following gives 1.0 for an alpha of 0, which is fine,
* otherwise if 0/0 is represented as some other value there is
* more likely to be a discontinuity which will probably damage
* compression when moving from a fully transparent area to a
* nearly transparent one. (The assumption here is that opaque
* areas tend not to be 0 intensity.)
*/
if (component >= alpha)
*out_ptr++ = 255;
/* component<alpha, so component/alpha is less than one and
* component*reciprocal is less than 2^31.
*/
else if (component > 0)
{
if (alpha < 65535)
{
component *= reciprocal;
component += 64; /* round to nearest */
component >>= 7;
}
else
component *= 255;
/* Convert the component to sRGB. */
*out_ptr++ = (png_byte)PNG_sRGB_FROM_LINEAR(component);
}
else
*out_ptr++ = 0;
}
while (--c > 0);
/* Skip to next component (skip the intervening alpha channel) */
++in_ptr;
++out_ptr;
} /* while out_ptr < row_end */
png_write_row(png_ptr, png_voidcast(png_const_bytep,
display->local_row));
input_row += display->row_bytes/(sizeof (png_uint_16));
} /* while y */
}
else
{
/* No alpha channel, so the row_end really is the end of the row and it
* is sufficient to loop over the components one by one.
*/
png_bytep row_end = output_row + image->width * channels;
while (y-- > 0)
{
png_const_uint_16p in_ptr = input_row;
png_bytep out_ptr = output_row;
while (out_ptr < row_end)
{
png_uint_32 component = *in_ptr++;
component *= 255;
*out_ptr++ = (png_byte)PNG_sRGB_FROM_LINEAR(component);
}
png_write_row(png_ptr, output_row);
input_row += display->row_bytes/(sizeof (png_uint_16));
}
}
return 1;
}
static int
png_image_write_main(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
argument);
png_imagep image = display->image;
png_structp png_ptr = image->opaque->png_ptr;
png_infop info_ptr = image->opaque->info_ptr;
png_uint_32 format = image->format;
int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0; /* input */
int alpha = (format & PNG_FORMAT_FLAG_ALPHA) != 0;
int write_16bit = linear && !display->convert_to_8bit;
/* Default the 'row_stride' parameter if required. */
if (display->row_stride == 0)
display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
/* Set the required transforms then write the rows in the correct order. */
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
write_16bit ? 16 : 8,
((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* Counter-intuitively the data transformations must be called *after*
* png_write_info, not before as in the read code, but the 'set' functions
* must still be called before. Just set the color space information, never
* write an interlaced image.
*/
if (write_16bit)
{
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB))
png_set_cHRM_fixed(png_ptr, info_ptr,
/* color x y */
/* white */ 31270, 32900,
/* red */ 64000, 33000,
/* green */ 30000, 60000,
/* blue */ 15000, 6000
);
}
else if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB))
png_set_sRGB(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
/* Else writing an 8-bit file and the *colors* aren't sRGB, but the 8-bit
* space must still be gamma encoded.
*/
else
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE);
/* Write the file header. */
png_write_info(png_ptr, info_ptr);
/* Now set up the data transformations (*after* the header is written),
* remove the handled transformations from the 'format' flags for checking.
*
* First check for a little endian system if writing 16 bit files.
*/
if (write_16bit)
{
PNG_CONST png_uint_16 le = 0x0001;
if (*(png_const_bytep)&le)
png_set_swap(png_ptr);
}
# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
if (format & PNG_FORMAT_FLAG_BGR)
{
if (format & PNG_FORMAT_FLAG_COLOR)
png_set_bgr(png_ptr);
format &= ~PNG_FORMAT_FLAG_BGR;
}
# endif
# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
if (format & PNG_FORMAT_FLAG_AFIRST)
{
if (format & PNG_FORMAT_FLAG_ALPHA)
png_set_swap_alpha(png_ptr);
format &= ~PNG_FORMAT_FLAG_AFIRST;
}
# endif
/* That should have handled all (both) the transforms. */
if ((format & ~(png_uint_32)(PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_LINEAR |
PNG_FORMAT_FLAG_ALPHA)) != 0)
png_error(png_ptr, "png_write_image: unsupported transformation");
{
png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
ptrdiff_t row_bytes = display->row_stride;
if (linear)
row_bytes *= sizeof (png_uint_16);
if (row_bytes < 0)
row += (image->height-1) * (-row_bytes);
display->first_row = row;
display->row_bytes = row_bytes;
}
/* Check for the cases that currently require a pre-transform on the row
* before it is written. This only applies when the input is 16-bit and
* either there is an alpha channel or it is converted to 8-bit.
*/
if ((linear && alpha) || display->convert_to_8bit)
{
png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
png_get_rowbytes(png_ptr, info_ptr)));
int result;
display->local_row = row;
if (write_16bit)
result = png_safe_execute(image, png_write_image_16bit, display);
else
result = png_safe_execute(image, png_write_image_8bit, display);
display->local_row = NULL;
png_free(png_ptr, row);
/* Skip the 'write_end' on error: */
if (!result)
return 0;
}
/* Otherwise this is the case where the input is in a format currently
* supported by the rest of the libpng write code; call it directly.
*/
else
{
png_const_bytep row = png_voidcast(png_const_bytep, display->first_row);
ptrdiff_t row_bytes = display->row_bytes;
png_uint_32 y = image->height;
while (y-- > 0)
{
png_write_row(png_ptr, row);
row += row_bytes;
}
}
png_write_end(png_ptr, info_ptr);
return 1;
}
int PNGAPI
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
const void *buffer, png_int_32 row_stride)
{
/* Write the image to the given (FILE*). */
if (image != NULL)
{
if (file != NULL)
{
if (png_image_write_init(image))
{
png_image_write_control display;
int result;
/* This is slightly evil, but png_init_io doesn't do anything other
* than this and we haven't changed the standard IO functions so
* this saves a 'safe' function.
*/
image->opaque->png_ptr->io_ptr = file;
memset(&display, 0, sizeof display);
display.image = image;
display.buffer = buffer;
display.row_stride = row_stride;
display.convert_to_8bit = convert_to_8bit;
result = png_safe_execute(image, png_image_write_main, &display);
png_image_free(image);
return result;
}
else
return 0;
}
else
return png_image_error(image,
"png_image_write_to_stdio: invalid argument");
}
else
return 0;
}
int PNGAPI
png_image_write_to_file(png_imagep image, const char *file_name,
int convert_to_8bit, const void *buffer, png_int_32 row_stride)
{
/* Write the image to the named file. */
if (image != NULL)
{
if (file_name != NULL)
{
FILE *fp = fopen(file_name, "wb");
if (fp != NULL)
{
if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer,
row_stride))
{
int error; /* from fflush/fclose */
/* Make sure the file is flushed correctly. */
if (fflush(fp) == 0 && ferror(fp) == 0)
{
if (fclose(fp) == 0)
return 1;
error = errno; /* from fclose */
}
else
{
error = errno; /* from fflush or ferror */
(void)fclose(fp);
}
(void)remove(file_name);
/* The image has already been cleaned up; this is just used to
* set the error (because the original write succeeded).
*/
return png_image_error(image, strerror(error));
}
else
{
/* Clean up: just the opened file. */
(void)fclose(fp);
(void)remove(file_name);
return 0;
}
}
else
return png_image_error(image, strerror(errno));
}
else
return png_image_error(image,
"png_image_write_to_file: invalid argument");
}
else
return 0;
}
#endif /* PNG_STDIO_SUPPORTED */
#endif /* SIMPLIFIED_WRITE */
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */

View File

@ -7,7 +7,7 @@ WRect
256 256
0 0
8960 8960
9294 9284
2 2
MProject MProject
3 3
@ -25,7 +25,7 @@ $(MAKE) $(__MAKEOPTS__) -f pngconfig.mak
MCommand MCommand
19 19
@type pngconfig.inf @type pngconfig.inf
4 3
5 5
WFileName WFileName
10 10
@ -39,74 +39,54 @@ WFileName
12 12
pngvalid.tgt pngvalid.tgt
8 8
WFileName
12
pngstest.tgt
9
WVList WVList
4 3
10 9
VComponent VComponent
11 10
WRect WRect
0 0
0 0
5638 5632
4174 4164
0 0
0 0
12 11
WFileName WFileName
10 10
libpng.tgt libpng.tgt
0 0
0 0
13 12
VComponent VComponent
14 13
WRect WRect
1280 1280
1550 1540
5638 5632
4174 4164
0 0
0 0
15 14
WFileName WFileName
11 11
pngtest.tgt pngtest.tgt
0 0
1 1
16 15
VComponent VComponent
17 16
WRect WRect
524 518
497 487
5638 5632
4174 4164
0 0
0 0
18 17
WFileName WFileName
12 12
pngvalid.tgt pngvalid.tgt
0 0
1 1
19 9
VComponent
20
WRect
2054
2701
5674
4232
0
0
21
WFileName
12
pngstest.tgt
0
1
19

View File

@ -1,219 +0,0 @@
40
targetIdent
0
MProject
1
MComponent
0
2
WString
4
NEXE
3
WString
5
nc2en
1
0
0
4
MCommand
0
5
MCommand
1035
pngstest --log ../../contrib/pngsuite/basn0g01.png ../../contrib/pngsuite/basn0g02.png ../../contrib/pngsuite/basn0g04.png ../../contrib/pngsuite/basn0g08.png ../../contrib/pngsuite/basn0g16.png ../../contrib/pngsuite/basn2c08.png ../../contrib/pngsuite/basn2c16.png ../../contrib/pngsuite/basn3p01.png ../../contrib/pngsuite/basn3p02.png ../../contrib/pngsuite/basn3p04.png ../../contrib/pngsuite/basn3p08.png ../../contrib/pngsuite/basn4a08.png ../../contrib/pngsuite/basn4a16.png ../../contrib/pngsuite/basn6a08.png ../../contrib/pngsuite/basn6a16.png ../../contrib/pngsuite/ftbbn1g04.png ../../contrib/pngsuite/ftbbn2c16.png ../../contrib/pngsuite/ftbbn3p08.png ../../contrib/pngsuite/ftbgn2c16.png ../../contrib/pngsuite/ftbgn3p08.png ../../contrib/pngsuite/ftbrn2c08.png ../../contrib/pngsuite/ftbwn1g16.png ../../contrib/pngsuite/ftbwn3p08.png ../../contrib/pngsuite/ftbyn3p08.png ../../contrib/pngsuite/ftp0n1g08.png ../../contrib/pngsuite/ftp0n2c08.png ../../contrib/pngsuite/ftp0n3p08.png ../../contrib/pngsuite/ftp1n3p08.png
6
MItem
12
pngstest.exe
7
WString
4
NEXE
8
WVList
6
9
MVState
10
WString
7
WINLINK
11
WString
11
?????Stack:
1
12
WString
4
768k
0
13
MVState
14
WString
7
WINLINK
15
WString
28
?????Library directories(;):
1
16
WString
8
$(%zlib)
0
17
MVState
18
WString
7
WINLINK
19
WString
18
?????Libraries(,):
1
20
WString
19
libpng.lib zlib.lib
0
21
MVState
22
WString
7
WINLINK
23
WString
11
?????Stack:
0
24
WString
4
768k
0
25
MVState
26
WString
7
WINLINK
27
WString
28
?????Library directories(;):
0
28
WString
8
$(%zlib)
0
29
MVState
30
WString
7
WINLINK
31
WString
18
?????Libraries(,):
0
32
WString
19
libpng.lib zlib.lib
0
33
WVList
1
34
ActionStates
35
WString
4
&Run
36
WVList
0
-1
1
1
0
37
WPickList
2
38
MItem
3
*.c
39
WString
4
COBJ
40
WVList
2
41
MVState
42
WString
3
WCC
43
WString
25
n????Include directories:
1
44
WString
39
"$(%zlib);$(%watcom)/h;$(%watcom)/h/nt"
0
45
MVState
46
WString
3
WCC
47
WString
25
n????Include directories:
0
48
WString
39
"$(%zlib);$(%watcom)/h;$(%watcom)/h/nt"
0
49
WVList
0
-1
1
1
0
50
MItem
33
..\..\contrib\libtests\pngstest.c
51
WString
4
COBJ
52
WVList
0
53
WVList
0
38
1
1
0

View File

@ -1,218 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Library|Win32">
<Configuration>Debug Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Library|Win32">
<Configuration>Release Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>pngstest</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(SolutionDir)\zlib.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PNG_USE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;PNG_USE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\contrib\libtests\pngstest.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Library|Win32">
<Configuration>Debug Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Library|Win32">
<Configuration>Release Library</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>pngstest</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(SolutionDir)\zlib.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<LinkIncremental>false</LinkIncremental>
<CustomBuildAfterTargets />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PNG_USE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BrowseInformation>true</BrowseInformation>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;PNG_USE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Full</Optimization>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BrowseInformation>true</BrowseInformation>
<WholeProgramOptimization>true</WholeProgramOptimization>
<FloatingPointExceptions>false</FloatingPointExceptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
<CustomBuildStep>
<Message>Executing libpng simplified API test program</Message>
<Command>"$(OutDir)pngstest.exe" --log --touch "$(IntDir)pngstest.out" ../../../contrib/pngsuite/basn0g01.png ../../../contrib/pngsuite/basn0g02.png ../../../contrib/pngsuite/basn0g04.png ../../../contrib/pngsuite/basn0g08.png ../../../contrib/pngsuite/basn0g16.png ../../../contrib/pngsuite/basn2c08.png ../../../contrib/pngsuite/basn2c16.png ../../../contrib/pngsuite/basn3p01.png ../../../contrib/pngsuite/basn3p02.png ../../../contrib/pngsuite/basn3p04.png ../../../contrib/pngsuite/basn3p08.png ../../../contrib/pngsuite/basn4a08.png ../../../contrib/pngsuite/basn4a16.png ../../../contrib/pngsuite/basn6a08.png ../../../contrib/pngsuite/basn6a16.png ../../../contrib/pngsuite/ftbbn1g04.png ../../../contrib/pngsuite/ftbbn2c16.png ../../../contrib/pngsuite/ftbbn3p08.png ../../../contrib/pngsuite/ftbgn2c16.png ../../../contrib/pngsuite/ftbgn3p08.png ../../../contrib/pngsuite/ftbrn2c08.png ../../../contrib/pngsuite/ftbwn1g16.png ../../../contrib/pngsuite/ftbwn3p08.png ../../../contrib/pngsuite/ftbyn3p08.png ../../../contrib/pngsuite/ftp0n1g08.png ../../../contrib/pngsuite/ftp0n2c08.png ../../../contrib/pngsuite/ftp0n3p08.png ../../../contrib/pngsuite/ftp1n3p08.png</Command>
<Outputs>$(IntDir)pngstest.out</Outputs>
<Inputs>$(OutDir)pngstest.exe</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\contrib\libtests\pngstest.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,7 +1,7 @@
VisualStudio instructions VisualStudio instructions
libpng version 1.5.7beta05 - November 18, 2011 libpng version 1.5.7beta05 - November 23, 2011
Copyright (c) 1998-2010 Glenn Randers-Pehrson Copyright (c) 1998-2010 Glenn Randers-Pehrson

View File

@ -24,13 +24,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngvalid", "pngvalid\pngval
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pnglibconf", "pnglibconf\pnglibconf.vcxproj", "{EB33566E-DA7F-4D28-9077-88C0B7C77E35}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pnglibconf", "pnglibconf\pnglibconf.vcxproj", "{EB33566E-DA7F-4D28-9077-88C0B7C77E35}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngstest", "pngstest\pngstest.vcxproj", "{277AC57F-313B-4D06-B119-A3CDB672D2FF}"
ProjectSection(ProjectDependencies) = postProject
{60F89955-91C6-3A36-8000-13C592FEC2DF} = {60F89955-91C6-3A36-8000-13C592FEC2DF}
{EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {EB33566E-DA7F-4D28-9077-88C0B7C77E35}
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Library|Win32 = Debug Library|Win32 Debug Library|Win32 = Debug Library|Win32

View File

@ -2,7 +2,7 @@
<!-- <!--
* zlib.props - location of zlib source * zlib.props - location of zlib source
* *
* libpng version 1.5.7beta05 - November 18, 2011 * libpng version 1.5.7beta05 - November 23, 2011
* *
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* *

View File

@ -1,5 +1,5 @@
Makefiles for libpng version 1.5.7beta05 - November 18, 2011 Makefiles for libpng version 1.5.7beta05 - November 23, 2011
pnglibconf.h.prebuilt => Stores configuration settings pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile

View File

@ -576,31 +576,3 @@ option WRITE_COMPRESSED_TEXT enables WRITE_TEXT
# leave the row_pointers member out of the info structure. # leave the row_pointers member out of the info structure.
option INFO_IMAGE option INFO_IMAGE
# Simplified API options
# Read:
option SIMPLIFIED_READ requires SEQUENTIAL_READ READ_TRANSFORMS SETJMP
option SIMPLIFIED_READ enables READ_EXPAND READ_16BIT READ_EXPAND_16
option SIMPLIFIED_READ enables READ_SCALE_16_TO_8 READ_RGB_TO_GRAY
option SIMPLIFIED_READ enables READ_ALPHA_MODE READ_BACKGROUND READ_STRIP_ALPHA
option SIMPLIFIED_READ enables READ_FILLER READ_SWAP
option SIMPLIFIED_READ_AFIRST requires SIMPLIFIED_READ disabled
option READ_SWAP_ALPHA enables SIMPLIFIED_READ_AFIRST
option SIMPLIFIED_READ_BGR requires SIMPLIFIED_READ disabled
option READ_BGR enables SIMPLIFIED_READ_BGR
# Write:
option SIMPLIFIED_WRITE requires WRITE STDIO SETJMP
option SIMPLIFIED_WRITE enables WRITE_SWAP WRITE_gAMA WRITE_sRGB WRITE_cHRM
option SIMPLIFIED_WRITE_AFIRST requires SIMPLIFIED_WRITE disabled
option WRITE_SWAP_ALPHA enables SIMPLIFIED_WRITE_AFIRST
option SIMPLIFIED_WRITE_BGR requires SIMPLIFIED_WRITE disabled
option WRITE_BGR enables SIMPLIFIED_WRITE_BGR
# Formats:
option FORMAT_AFIRST if SIMPLIFIED_READ_AFIRST SIMPLIFIED_WRITE_AFIRST
option FORMAT_BGR if SIMPLIFIED_READ_BGR SIMPLIFIED_WRITE_BGR

View File

@ -3,7 +3,7 @@
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* Libpng 1.5.7beta05 - November 18, 2011 */ /* Libpng 1.5.7beta05 - November 23, 2011 */
/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
@ -128,12 +128,6 @@
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED #define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
#define PNG_SETJMP_SUPPORTED #define PNG_SETJMP_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED #define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
#define PNG_SIMPLIFIED_READ_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
#define PNG_sPLT_SUPPORTED #define PNG_sPLT_SUPPORTED
#define PNG_sRGB_SUPPORTED #define PNG_sRGB_SUPPORTED
#define PNG_STDIO_SUPPORTED #define PNG_STDIO_SUPPORTED

View File

@ -239,10 +239,3 @@ EXPORTS
png_get_cHRM_XYZ_fixed @231 png_get_cHRM_XYZ_fixed @231
png_set_cHRM_XYZ @232 png_set_cHRM_XYZ @232
png_set_cHRM_XYZ_fixed @233 png_set_cHRM_XYZ_fixed @233
png_image_begin_read_from_file @234
png_image_begin_read_from_stdio @235
png_image_begin_read_from_memory @236
png_image_finish_read @237
png_image_free @238
png_image_write_to_file @239
png_image_write_to_stdio @240

View File

@ -1,22 +0,0 @@
#!/bin/sh
#
# Run the simplified API tests
err=0
echo >> pngtest-log.txt
echo "============ pngstest.sh ==============" >> pngtest-log.txt
echo "Running test-pngstest.sh on contrib/pngsuite/*.png"
for opts in "" "--background"
do
if ./pngstest --log "$@" $opts ${srcdir}/contrib/pngsuite/*.png \
>>pngtest-log.txt 2>&1
then
echo " PASS: pngstest $opts"
else
echo " FAIL: pngstest $opts"
err=1
fi
done
exit $err