[libpng17] Imported from libpng-1.7.0beta31.tar

This commit is contained in:
Glenn Randers-Pehrson 2014-02-05 22:35:26 -06:00
parent fb1305faeb
commit 9a3f244085
13 changed files with 121 additions and 74 deletions

View File

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

2
README
View File

@ -1,4 +1,4 @@
README for libpng version 1.7.0beta31 - February 2, 2014 (shared library 17.0)
README for libpng version 1.7.0beta31 - February 6, 2014 (shared library 17.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.

View File

@ -36,30 +36,7 @@
# include <setjmp.h> /* because png.h did *not* include this */
#endif
#if defined(PNG_INFO_IMAGE_SUPPORTED) && defined(PNG_READ_SUPPORTED)
/* Valid transformations to perform on read: */
#define READ_TRANSFORMS (PNG_TRANSFORM_STRIP_16|PNG_TRANSFORM_STRIP_ALPHA|\
PNG_TRANSFORM_PACKING|PNG_TRANSFORM_PACKSWAP|PNG_TRANSFORM_EXPAND|\
PNG_TRANSFORM_INVERT_MONO|PNG_TRANSFORM_SHIFT|PNG_TRANSFORM_BGR|\
PNG_TRANSFORM_SWAP_ALPHA|PNG_TRANSFORM_SWAP_ENDIAN|\
PNG_TRANSFORM_INVERT_ALPHA|PNG_TRANSFORM_GRAY_TO_RGB|\
PNG_TRANSFORM_EXPAND_16|PNG_TRANSFORM_SCALE_16)
/* Valid transformations to perform on write: */
#define WRITE_TRANSFORMS (PNG_TRANSFORM_PACKING|PNG_TRANSFORM_PACKSWAP|\
PNG_TRANSFORM_INVERT_MONO|PNG_TRANSFORM_SHIFT|PNG_TRANSFORM_BGR|\
PNG_TRANSFORM_SWAP_ALPHA|PNG_TRANSFORM_SWAP_ENDIAN|\
PNG_TRANSFORM_INVERT_ALPHA|PNG_TRANSFORM_STRIP_FILLER|\
PNG_TRANSFORM_STRIP_FILLER_BEFORE|PNG_TRANSFORM_STRIP_FILLER_AFTER)
/* Reversible transforms */
#define RW_TRANSFORMS (READ_TRANSFORMS & WRITE_TRANSFORMS)
/* All transforms: this is a safety feature; examine png.h and set it to the
* mask that should correspond to all the transforms.
*/
#define ALL_TRANSFORMS 0xffff
#if defined(PNG_INFO_IMAGE_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)
/* If a transform is valid on both read and write this implies that if the
* transform is applied to read it must also be applied on write to produce
* meaningful data. This is because these transforms when performed on read
@ -119,21 +96,44 @@ static struct transform_info
png_byte tested; /* the transform was tested somewhere */
} transform_info[] =
{
/* List ALL the PNG_TRANSFORM_ macros here. Check for support using the READ
* macros; even if the transform is supported on write it cannot be tested
* without the read support.
*/
# define T(name,chunk,cm_required,cm_absent,bd,when)\
{ #name, PNG_TRANSFORM_ ## name, CHUNK_ ## chunk,\
COLOR_MASK_ ## cm_required, COLOR_MASK_ ## cm_absent, BD_ ## bd,\
TRANSFORM_ ## when, 0/*!tested*/ }
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
T(STRIP_16, NONE, X, X, 16, R),
/* drops the bottom 8 bits when bit depth is 16 */
#endif
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
T(STRIP_ALPHA, NONE, A, X, ALL, R),
/* removes the alpha channel if present */
T(PACKING, NONE, X, X, LOW, RW),
#endif
#ifdef PNG_WRITE_PACK_SUPPORTED
# define TRANSFORM_RW_PACK TRANSFORM_RW
#else
# define TRANSFORM_RW_PACK TRANSFORM_R
#endif
#ifdef PNG_READ_PACK_SUPPORTED
T(PACKING, NONE, X, X, LOW, RW_PACK),
/* unpacks low-bit-depth components into 1 byte per component on read,
* reverses this on write.
*/
T(PACKSWAP, NONE, X, X, LOW, RW),
#endif
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
# define TRANSFORM_RW_PACKSWAP TRANSFORM_RW
#else
# define TRANSFORM_RW_PACKSWAP TRANSFORM_R
#endif
#ifdef PNG_READ_PACKSWAP_SUPPORTED
T(PACKSWAP, NONE, X, X, LOW, RW_PACKSWAP),
/* reverses the order of low-bit-depth components packed into a byte */
#endif
#ifdef PNG_READ_EXPAND_SUPPORTED
T(EXPAND, NONE, P, X, ALL, R),
/* expands PLTE PNG files to RGB (no tRNS) or RGBA (tRNS) *
* Note that the 'EXPAND' transform does lots of different things: */
@ -141,24 +141,68 @@ static struct transform_info
/* expands grayscale PNG files to RGB, or RGBA */
T(EXPAND, tRNS, X, A, ALL, R),
/* expands the tRNS chunk in files without alpha */
T(INVERT_MONO, NONE, X, C, ALL, RW),
#endif
#ifdef PNG_WRITE_INVERT_SUPPORTED
# define TRANSFORM_RW_INVERT TRANSFORM_RW
#else
# define TRANSFORM_RW_INVERT TRANSFORM_R
#endif
#ifdef PNG_READ_INVERT_SUPPORTED
T(INVERT_MONO, NONE, X, C, ALL, RW_INVERT),
/* converts gray-scale components to 1..0 from 0..1 */
T(SHIFT, sBIT, X, X, ALL, RW),
#endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED
# define TRANSFORM_RW_SHIFT TRANSFORM_RW
#else
# define TRANSFORM_RW_SHIFT TRANSFORM_R
#endif
#ifdef PNG_READ_SHIFT_SUPPORTED
T(SHIFT, sBIT, X, X, ALL, RW_SHIFT),
/* reduces component values to the original range based on the sBIT chunk,
* this is only partially reversible - the low bits are lost and cannot be
* recovered on write. In fact write code replicates the bits to generate
* new low-order bits.
*/
T(BGR, NONE, C, P, TRUE, RW),
#endif
#ifdef PNG_WRITE_BGR_SUPPORTED
# define TRANSFORM_RW_BGR TRANSFORM_RW
#else
# define TRANSFORM_RW_BGR TRANSFORM_R
#endif
#ifdef PNG_READ_BGR_SUPPORTED
T(BGR, NONE, C, P, TRUE, RW_BGR),
/* reverses the rgb component values of true-color pixels */
T(SWAP_ALPHA, NONE, A, X, TRUE, RW),
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
# define TRANSFORM_RW_SWAP_ALPHA TRANSFORM_RW
#else
# define TRANSFORM_RW_SWAP_ALPHA TRANSFORM_R
#endif
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
T(SWAP_ALPHA, NONE, A, X, TRUE, RW_SWAP_ALPHA),
/* swaps the alpha channel of RGBA or GA pixels to the front - ARGB or
* AG, on write reverses the process.
*/
T(SWAP_ENDIAN, NONE, X, P, 16, RW),
#endif
#ifdef PNG_WRITE_SWAP_SUPPORTED
# define TRANSFORM_RW_SWAP TRANSFORM_RW
#else
# define TRANSFORM_RW_SWAP TRANSFORM_R
#endif
#ifdef PNG_READ_SWAP_SUPPORTED
T(SWAP_ENDIAN, NONE, X, P, 16, RW_SWAP),
/* byte-swaps 16-bit component values */
T(INVERT_ALPHA, NONE, A, X, TRUE, RW),
#endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
# define TRANSFORM_RW_INVERT_ALPHA TRANSFORM_RW
#else
# define TRANSFORM_RW_INVERT_ALPHA TRANSFORM_R
#endif
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
T(INVERT_ALPHA, NONE, A, X, TRUE, RW_INVERT_ALPHA),
/* converts an alpha channel from 0..1 to 1..0 */
#endif
#ifdef PNG_WRITE_FILLER_SUPPORTED
T(STRIP_FILLER_BEFORE, NONE, A, P, TRUE, W), /* 'A' for a filler! */
/* on write skips a leading filler channel; testing requires data with a
* filler channel so this is produced from RGBA or GA images by removing
@ -166,6 +210,8 @@ static struct transform_info
*/
T(STRIP_FILLER_AFTER, NONE, A, P, TRUE, W),
/* on write strips a trailing filler channel */
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
T(GRAY_TO_RGB, NONE, X, C, ALL, R),
/* expands grayscale images to RGB, also causes the palette part of
* 'EXPAND' to happen. Low bit depth grayscale images are expanded to
@ -177,6 +223,8 @@ static struct transform_info
/* The 'palette' side effect mentioned above; a bit bogus but this is the
* way the libpng code works.
*/
#endif
#ifdef PNG_READ_EXPAND_16_SUPPORTED
T(EXPAND_16, NONE, X, X, PAL, R),
/* expands images to 16-bits per component, as a side effect expands
* palette images to RGB and expands the tRNS chunk if present, so it can
@ -186,8 +234,11 @@ static struct transform_info
/* side effect of EXPAND_16 - expands the tRNS chunk in an RGB or G 16-bit
* image.
*/
#endif
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
T(SCALE_16, NONE, X, X, 16, R)
/* scales 16-bit components to 8-bits. */
#endif
#undef T
};
@ -252,21 +303,20 @@ transform_name(int t)
return "invalid transform";
}
/* Variables calculated by validate_T below and used to record all the supported
* transforms. Need (unsigned int) here because of the places where these
* values are used (unsigned compares in the 'exhaustive' iterator.)
*/
static unsigned int read_transforms, write_transforms, rw_transforms;
static void
validate_T(void)
/* Validate the above table - this is done mainly to ensure that all the
* transforms are being tested.
*/
/* Validate the above table - this just builds the above values */
{
unsigned int i;
int read_transforms = 0;
int write_transforms = 0;
int all_transforms = 0;
for (i=0; i<TTABLE_SIZE; ++i)
{
all_transforms |= transform_info[i].transform;
if (transform_info[i].when & TRANSFORM_R)
read_transforms |= transform_info[i].transform;
@ -274,13 +324,10 @@ validate_T(void)
write_transforms |= transform_info[i].transform;
}
if (read_transforms != READ_TRANSFORMS ||
write_transforms != WRITE_TRANSFORMS ||
all_transforms != ALL_TRANSFORMS)
{
fprintf(stderr, "pngimage: transform_info incorrect\n");
exit(99); /* internal test error */
}
/* Reversible transforms are those which are supported on both read and
* write.
*/
rw_transforms = read_transforms & write_transforms;
}
/* FILE DATA HANDLING
@ -1335,7 +1382,7 @@ test_one_file(struct display *dp, const char *filename)
* we should get back to the place where we started.
*/
#ifdef PNG_WRITE_SUPPORTED
if ((current & WRITE_TRANSFORMS) == current)
if ((current & write_transforms) == current)
{
/* All transforms reversible: write the PNG with the transformations
* reversed, then read it back in with no transformations. The
@ -1375,19 +1422,19 @@ test_one_file(struct display *dp, const char *filename)
do
{
if (next == READ_TRANSFORMS) /* Everything tested */
if (next == read_transforms) /* Everything tested */
goto combo;
++next;
} /* skip known bad combos if the relevant option is set; skip
* combos involving known bad single transforms in all cases.
*/
while ( (next & READ_TRANSFORMS) <= current
while ( (next & read_transforms) <= current
|| (next & active) == 0 /* skip cases that do nothing */
|| (next & bad_transforms) != 0
|| skip_transform(dp, next));
assert((next & READ_TRANSFORMS) == next);
assert((next & read_transforms) == next);
current = next;
}
@ -1412,7 +1459,7 @@ combo:
if (bad_combo != ~0U)
printf("%s[0x%x]: PROBLEM: 0x%x[0x%x] ANTIDOTE: 0x%x\n",
dp->filename, active, bad_combo, bad_combo_list,
RW_TRANSFORMS & ~bad_combo_list);
rw_transforms & ~bad_combo_list);
else
printf("%s: no %sbad combos found\n", dp->filename,

View File

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

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "February 2, 2014"
.TH LIBPNG 3 "February 6, 2014"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta31
.SH SYNOPSIS
@ -494,7 +494,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.7.0beta31 - February 2, 2014
libpng version 1.7.0beta31 - February 6, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -505,7 +505,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.7.0beta31 - February 2, 2014
libpng versions 0.97, January 1998, through 1.7.0beta31 - February 6, 2014
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -5765,7 +5765,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVII. Y2K Compliance in libpng
February 2, 2014
February 6, 2014
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@ -6035,7 +6035,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.7.0beta31 - February 2, 2014:
Libpng version 1.7.0beta31 - February 6, 2014:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -6058,7 +6058,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta31, February 2, 2014, are
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta31, February 6, 2014, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@ -6157,7 +6157,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
February 2, 2014
February 6, 2014
.\" end of man page

View File

@ -1,4 +1,4 @@
.TH LIBPNGPF 3 "February 2, 2014"
.TH LIBPNGPF 3 "February 6, 2014"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta31
(private functions)

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "February 2, 2014"
.TH PNG 5 "February 6, 2014"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

4
png.c
View File

@ -696,13 +696,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.7.0beta31 - February 2, 2014" PNG_STRING_NEWLINE \
"libpng version 1.7.0beta31 - February 6, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.7.0beta31 - February 2, 2014\
return "libpng version 1.7.0beta31 - February 6, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.7.0beta31 - February 2, 2014
* libpng version 1.7.0beta31 - February 6, 2014
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
VisualStudio instructions
libpng version 1.7.0beta31 - February 2, 2014
libpng version 1.7.0beta31 - February 6, 2014
Copyright (c) 1998-2010 Glenn Randers-Pehrson

View File

@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
* libpng version 1.7.0beta31 - February 2, 2014
* libpng version 1.7.0beta31 - February 6, 2014
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
*

View File

@ -1,5 +1,5 @@
Makefiles for libpng version 1.7.0beta31 - February 2, 2014
Makefiles for libpng version 1.7.0beta31 - February 6, 2014
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile

View File

@ -2,7 +2,7 @@
/* pnglibconf.h - library build configuration */
/* Libpng version 1.7.0beta31 - February 2, 2014 */
/* Libpng version 1.7.0beta31 - February 6, 2014 */
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */