Compare commits

..

20 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
60d7c022e5 [devel] Imported from libpng-1.5.4beta04.tar 2011-06-16 09:10:57 -05:00
Glenn Randers-Pehrson
850769f787 [devel] Revised contrib/visupng, gregbook, and pngminim
to demonstrate chop_16_to_8
2011-06-16 09:08:53 -05:00
Glenn Randers-Pehrson
5f0b9276ec [devel] Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again.
If this is not enabled, png_set_strip_16() and png_do_scale_16_to_8()
aren't built.
2011-06-16 09:05:40 -05:00
Glenn Randers-Pehrson
733b131545 [devel] Added information about "chop_16" to the manual. 2011-06-15 13:21:01 -05:00
Glenn Randers-Pehrson
ef217b76a3 [devel] Updated comments that mention 1.5.3; changed them to 1.5.4. 2011-06-15 12:58:27 -05:00
Glenn Randers-Pehrson
b0791f75ad [devel] Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. 2011-06-15 12:07:20 -05:00
Glenn Randers-Pehrson
039ad872fe [devel] Bump version to libpng-1.5.4beta04 2011-06-15 11:51:55 -05:00
Glenn Randers-Pehrson
903c64dce8 [devel] Added "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c 2011-06-15 11:50:23 -05:00
Glenn Randers-Pehrson
8f4edd07be [devel] Imported from libpng-1.5.4beta03.tar 2011-06-15 08:21:56 -05:00
Glenn Randers-Pehrson
be720edba7 [devel] Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
2011-06-15 08:20:37 -05:00
Glenn Randers-Pehrson
140504b11a [devel] Add synopsis for png_set_chop_16() to manual
and fix some other small typos.
2011-06-15 08:10:13 -05:00
John Bowler
cd3b0cc4d9 [devel] Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06
  Also removed a spurious (totally unused and confusing) member from png_info.
  The palette expand optimization prevented expansion to an intermediate RGBA
    form if tRNS was present but alpha was marked to be stripped; this exposed
    a check for tRNS in png_do_expand_palette() which is inconsistent with the
    code elsewhere in libpng.
2011-06-14 23:01:07 -05:00
Glenn Randers-Pehrson
06a9684cfa [devel] Bump version to libpng-1.5.4beta03 2011-06-14 11:06:42 -05:00
Glenn Randers-Pehrson
45599ad00f [devel] Imported from libpng-1.5.4beta02.tar 2011-06-14 07:17:29 -05:00
Glenn Randers-Pehrson
677819fe66 [devel] Check for READ_CHOP_16_TO_8 support in pngvalid,
not libpng version for presence of png_set_chop_16_to_8(), in pngvalid.c
2011-06-14 07:10:47 -05:00
Glenn Randers-Pehrson
2232baa41b [devel] Made png_set_chop_16() API removeable
by disabling PNG_CHOP_16_TO_8_SUPPORTED
2011-06-14 06:59:46 -05:00
Glenn Randers-Pehrson
7dffa41643 [devel] Use the old scaling method for background if png_set_chop_16() was
called.
2011-06-14 06:30:12 -05:00
John Bowler
550bab03fb [devel] Removed the ACCURATE and LEGACY options (they are no longer useable)
Fixed some compiliation problems with scaling options.
2011-06-14 06:17:26 -05:00
Glenn Randers-Pehrson
413138a5ca [devel] Added png_set_chop_16() API. 2011-06-13 22:07:37 -05:00
John Bowler
74945f2f04 [devel] Fix and clarify LEGACY 16-to-8 scaling. 2011-06-13 20:50:42 -05:00
47 changed files with 447 additions and 220 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.5.4beta01 - June 14, 2011
Libpng 1.5.4beta04 - June 16, 2011
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.
@@ -9,20 +9,20 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.5.4beta01.tar.xz (LZMA-compressed, recommended)
1.5.4beta01.tar.gz
1.5.4beta01.tar.bz2
1.5.4beta04.tar.xz (LZMA-compressed, recommended)
1.5.4beta04.tar.gz
1.5.4beta04.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp154b01.7z (LZMA-compressed, recommended)
lp154b01.zip
lp154b04.7z (LZMA-compressed, recommended)
lp154b04.zip
Other information:
1.5.4beta01-README.txt
1.5.4beta01-LICENSE.txt
1.5.4beta04-README.txt
1.5.4beta04-LICENSE.txt
Changes since the last public release (1.5.2):
@@ -193,6 +193,33 @@ Version 1.5.4beta01 [June 14, 2011]
outside of an unknown-chunk block in png.h because they are also
needed for other uses.
Version 1.5.4beta02 [June 14, 2011]
Fixed and clarified LEGACY 16-to-8 scaling code.
Added png_set_chop_16() API, to match inaccurate results from previous
libpng versions.
Removed the ACCURATE and LEGACY options (they are no longer useable)
Use the old scaling method for background if png_set_chop_16() was
called.
Made png_set_chop_16() API removeable with PNG_NO_READ_CHOP_16_TO_8_SUPPORTED
Version 1.5.4beta03 [June 15, 2011]
Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06
Also removed a spurious and confusing "trans" member ("trans") from png_info.
The palette expand optimization prevented expansion to an intermediate RGBA
form if tRNS was present but alpha was marked to be stripped; this exposed
a check for tRNS in png_do_expand_palette() which is inconsistent with the
code elsewhere in libpng.
Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
Version 1.5.4beta04 [June 16, 2011]
Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms.
Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is
not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built.
Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

27
CHANGES
View File

@@ -3456,6 +3456,33 @@ Version 1.5.4beta01 [June 14, 2011]
outside of an unknown-chunk block in png.h because they are also
needed for other uses.
Version 1.5.4beta02 [June 14, 2011]
Fixed and clarified LEGACY 16-to-8 scaling code.
Added png_set_chop_16() API, to match inaccurate results from previous
libpng versions.
Removed the ACCURATE and LEGACY options (they are no longer useable)
Use the old scaling method for background if png_set_chop_16() was
called.
Made png_set_chop_16() API removeable by disabling PNG_CHOP_16_TO_8_SUPPORTED
Version 1.5.4beta03 [June 15, 2011]
Fixed a problem in png_do_expand_palette() exposed by optimization in
1.5.3beta06
Also removed a spurious and confusing "trans" member ("trans") from png_info.
The palette expand optimization prevented expansion to an intermediate RGBA
form if tRNS was present but alpha was marked to be stripped; this exposed
a check for tRNS in png_do_expand_palette() which is inconsistent with the
code elsewhere in libpng.
Correction to the expand_16 code; removed extra instance of
png_set_scale_16_to_8 from pngpriv.h
Version 1.5.4beta04 [June 16, 2011]
Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms.
Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is
not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built.
Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@@ -260,7 +260,7 @@ install(CODE ${PNG_CONFIG_INSTALL_CODE})
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 15.${PNGLIB_RELEASE}.1.5.4beta01
# VERSION 15.${PNGLIB_RELEASE}.1.5.4beta04
VERSION 15.${PNGLIB_RELEASE}.0
SOVERSION 15
CLEAN_DIRECT_OUTPUT 1)

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.5.4beta01, June 14, 2011, are
libpng versions 1.2.6, August 15, 2004, through 1.5.4beta04, June 16, 2011, are
Copyright (c) 2004, 2006-2011 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
June 14, 2011
June 16, 2011

2
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.5.4beta01 - June 14, 2011 (shared library 15.0)
README for libpng version 1.5.4beta04 - June 16, 2011 (shared library 15.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.

22
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for libpng 1.5.4beta01.
# Generated by GNU Autoconf 2.68 for libpng 1.5.4beta04.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.5.4beta01'
PACKAGE_STRING='libpng 1.5.4beta01'
PACKAGE_VERSION='1.5.4beta04'
PACKAGE_STRING='libpng 1.5.4beta04'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
@@ -1307,7 +1307,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.5.4beta01 to adapt to many kinds of systems.
\`configure' configures libpng 1.5.4beta04 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1377,7 +1377,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.5.4beta01:";;
short | recursive ) echo "Configuration of libpng 1.5.4beta04:";;
esac
cat <<\_ACEOF
@@ -1485,7 +1485,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.5.4beta01
libpng configure 1.5.4beta04
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1908,7 +1908,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.5.4beta01, which was
It was created by libpng $as_me 1.5.4beta04, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2723,7 +2723,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.5.4beta01'
VERSION='1.5.4beta04'
cat >>confdefs.h <<_ACEOF
@@ -2787,7 +2787,7 @@ fi
PNGLIB_VERSION=1.5.4beta01
PNGLIB_VERSION=1.5.4beta04
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=4
@@ -13040,7 +13040,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.5.4beta01, which was
This file was extended by libpng $as_me 1.5.4beta04, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -13106,7 +13106,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libpng config.status 1.5.4beta01
libpng config.status 1.5.4beta04
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

View File

@@ -18,12 +18,12 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.5.4beta01], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.5.4beta04], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.5.4beta01
PNGLIB_VERSION=1.5.4beta04
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=4

View File

@@ -229,8 +229,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16)
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_set_chop_16(png_ptr);
# else
png_set_strip_16(png_ptr);
# endif
#endif
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);

View File

@@ -311,8 +311,14 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16)
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_set_chop_16(png_ptr);
# else
png_set_strip_16(png_ptr);
# endif
#endif
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);

View File

@@ -37,3 +37,4 @@ option SETJMP on
option STDIO on
option READ_EXPAND on
option READ_16_TO_8 on
option READ_16_TO_8_ACCURATE_SCALE on

View File

@@ -37,4 +37,5 @@ option READ_bKGD on
option READ_GAMMA on
option READ_EXPAND on
option READ_16_TO_8 on
option READ_CHOP_16_TO_8 on
option READ_GRAY_TO_RGB on

View File

@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
{
fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n");
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
exit(1);
}

View File

@@ -175,8 +175,14 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// expand images of all color-type and bit-depth to 3x8 bit RGB images
// let the library process things like alpha, transparency, background
if (iBitDepth == 16)
png_set_strip_16(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (iBitDepth == 16)
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_set_chop_16(png_ptr);
# else
png_set_strip_16(png_ptr);
# endif
#endif
if (iColorType == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
if (iBitDepth < 8)

View File

@@ -2,7 +2,7 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2011 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)

View File

@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.4beta01 - June 14, 2011
libpng version 1.5.4beta04 - June 16, 2011
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
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:
libpng versions 0.97, January 1998, through 1.5.4beta01 - June 14, 2011
libpng versions 0.97, January 1998, through 1.5.4beta04 - June 16, 2011
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -647,12 +647,12 @@ If you intend to display the PNG or to incorporate it in other image data you
need to tell libpng information about your display or drawing surface so that
libpng can convert the values in the image to match the display.
From libpng-1.5.3 this information can be set before reading the PNG file
From libpng-1.5.4 this information can be set before reading the PNG file
header. In earlier versions png_set_gamma() existed but behaved incorrectly if
called before the PNG file header had been read and png_set_alpha_mode() did not
exist.
If you need to support versions prior to libpng-1.5.3 test the version number
If you need to support versions prior to libpng-1.5.4 test the version number
and follow the procedures described in the appropriate manual page.
You give libpng the encoding expected by your system expressed as a 'gamma'
@@ -673,7 +673,7 @@ documentation!
Many systems permit the system gamma to be changed via a lookup table in the
display driver, a few systems, including older Macs, change the response by
default. As of 1.5.3 three special values are available to handle common
default. As of 1.5.4 three special values are available to handle common
situations:
PNG_DEFAULT_sRGB: Indicates that the system conforms to the IEC 61966-2-1
@@ -844,12 +844,17 @@ color!)
You set the transforms you need later, either as flags to the high level
interface or libpng API calls for the low level interface. For reference the
settings required are:
settings and API calls required are:
8-bit values:
PNG_TRANSFORM_STRIP_16 | PNG_EXPAND
png_set_expand(png_ptr); png_set_strip_16(png_ptr);
If you must get exactly the same inaccurate results
produced by default in versions prior to libpng-1.5.4,
use PNG_TRANSFORM_CHOP_16 and png_set_chop_16(png_ptr)
instead.
16-bit values:
PNG_TRANSFORM_EXPAND_16
png_set_expand_16(png_ptr);
@@ -859,9 +864,9 @@ color data you can add PNG_TRANSFORM_GRAY_TO_RGB or png_set_gray_to_rgb(png_ptr)
to the list.
Calling png_set_background before the PNG file header is read will not work
prior to libpng-1.5.3. Because the failure may result in unexpected warnings or
prior to libpng-1.5.4. Because the failure may result in unexpected warnings or
errors it is therefore much safer to call png_set_background after the head has
been read. Unfortunately this means that prior to libpng-1.5.3 it cannot be
been read. Unfortunately this means that prior to libpng-1.5.4 it cannot be
used with the high level interface.
The high-level read interface
@@ -968,9 +973,9 @@ for use in later transformations. Important information copied in is:
1) The PNG file gamma from the gAMA chunk. This overwrites the default value
provided by an earlier call to png_set_gamma or png_set_alpha_mode.
2) Prior to libpng-1.5.3 the background color from a bKGd chunk. This
2) Prior to libpng-1.5.4 the background color from a bKGd chunk. This
damages the information provided by an earlier call to png_set_background
resulting in expected behavior. Libpng-1.5.3 no longer does this.
resulting in expected behavior. Libpng-1.5.4 no longer does this.
3) The number of significant bits in each component value. Libpng uses this to
optimize gamma handling by reducing the internal lookup table sizes.
@@ -1634,7 +1639,7 @@ can be determined.
The png_set_background() function has been described already, it tells libpng to
composite images with alpha or simple transparency against the supplied
background color. For compatibility with versions of libpng earlier than
libpng-1.5.3 it is recommended that you call the function after reading the file
libpng-1.5.4 it is recommended that you call the function after reading the file
header, even if you don't want to use the color in a bKGD chunk, if one exists.
If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid),
@@ -1671,7 +1676,7 @@ image_background->gray.
If you didn't call png_set_gamma() before reading the file header, for example
if you need your code to remain compatible with older versions of libpng prior
to libpng-1.5.3, this is the place to call it.
to libpng-1.5.4, this is the place to call it.
Do not call it if you called png_set_alpha_mode(); doing so will damage the
settings put in place by png_set_alpha_mode(). (If png_set_alpha_mode() is
@@ -4090,20 +4095,23 @@ PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
will lead to a link failure.
Prior to libpng-1.5.3, the zlib compressor used the same set of parameters
Prior to libpng-1.5.4, the zlib compressor used the same set of parameters
when compressing the IDAT data and textual data such as zTXt and iCCP.
In libpng-1.5.3 we reinitialized the zlib stream for each type of data.
In libpng-1.5.4 we reinitialized the zlib stream for each type of data.
We added five png_set_text_*() functions for setting the parameters to
use with textual data.
Prior to libpng-1.5.3, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
Prior to libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
option was off by default, and slightly inaccurate scaling occurred.
This option can no longer be turned off, and 16-to-8 scaling is always
accurate. This change will result in some different results while
reading 16-bit images, with none of the pixels being off-by-one any
longer (see Clause 13.12 of the PNG specification).
longer (see Clause 13.12 of the PNG specification). If you must
have exactly the same inaccurate results that libpng produced by
default previously, then you can use the png_set_chop_16() API instead
of png_set_strip_16().
Prior to libpng-1.5.3, the png_set_user_limits() function could only be
Prior to libpng-1.5.4, the png_set_user_limits() function could only be
used to reduce the width and height limits from the value of
PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said
that it could be used to override them. Now this function will reduce or
@@ -4417,13 +4425,13 @@ Other rules can be inferred by inspecting the libpng source.
XIV. Y2K Compliance in libpng
June 14, 2011
June 16, 2011
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.5.4beta01 are Y2K compliant. It is my belief that earlier
upward through 1.5.4beta04 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that

View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "June 14, 2011"
.TH LIBPNG 3 "June 16, 2011"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta01
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta04
.SH SYNOPSIS
\fI\fB
@@ -540,6 +540,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta01
\fI\fB
\fBvoid png_set_chop_16 (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_set_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
\fI\fB
@@ -951,7 +955,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.5.4beta01 - June 14, 2011
libpng version 1.5.4beta04 - June 16, 2011
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -962,7 +966,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.5.4beta01 - June 14, 2011
libpng versions 0.97, January 1998, through 1.5.4beta04 - June 16, 2011
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -1598,12 +1602,12 @@ If you intend to display the PNG or to incorporate it in other image data you
need to tell libpng information about your display or drawing surface so that
libpng can convert the values in the image to match the display.
From libpng-1.5.3 this information can be set before reading the PNG file
From libpng-1.5.4 this information can be set before reading the PNG file
header. In earlier versions png_set_gamma() existed but behaved incorrectly if
called before the PNG file header had been read and png_set_alpha_mode() did not
exist.
If you need to support versions prior to libpng-1.5.3 test the version number
If you need to support versions prior to libpng-1.5.4 test the version number
and follow the procedures described in the appropriate manual page.
You give libpng the encoding expected by your system expressed as a 'gamma'
@@ -1624,7 +1628,7 @@ documentation!
Many systems permit the system gamma to be changed via a lookup table in the
display driver, a few systems, including older Macs, change the response by
default. As of 1.5.3 three special values are available to handle common
default. As of 1.5.4 three special values are available to handle common
situations:
PNG_DEFAULT_sRGB: Indicates that the system conforms to the IEC 61966-2-1
@@ -1795,12 +1799,17 @@ color!)
You set the transforms you need later, either as flags to the high level
interface or libpng API calls for the low level interface. For reference the
settings required are:
settings and API calls required are:
8-bit values:
PNG_TRANSFORM_STRIP_16 | PNG_EXPAND
png_set_expand(png_ptr); png_set_strip_16(png_ptr);
If you must get exactly the same inaccurate results
produced by default in versions prior to libpng-1.5.4,
use PNG_TRANSFORM_CHOP_16 and png_set_chop_16(png_ptr)
instead.
16-bit values:
PNG_TRANSFORM_EXPAND_16
png_set_expand_16(png_ptr);
@@ -1810,9 +1819,9 @@ color data you can add PNG_TRANSFORM_GRAY_TO_RGB or png_set_gray_to_rgb(png_ptr)
to the list.
Calling png_set_background before the PNG file header is read will not work
prior to libpng-1.5.3. Because the failure may result in unexpected warnings or
prior to libpng-1.5.4. Because the failure may result in unexpected warnings or
errors it is therefore much safer to call png_set_background after the head has
been read. Unfortunately this means that prior to libpng-1.5.3 it cannot be
been read. Unfortunately this means that prior to libpng-1.5.4 it cannot be
used with the high level interface.
.SS The high-level read interface
@@ -1919,9 +1928,9 @@ for use in later transformations. Important information copied in is:
1) The PNG file gamma from the gAMA chunk. This overwrites the default value
provided by an earlier call to png_set_gamma or png_set_alpha_mode.
2) Prior to libpng-1.5.3 the background color from a bKGd chunk. This
2) Prior to libpng-1.5.4 the background color from a bKGd chunk. This
damages the information provided by an earlier call to png_set_background
resulting in expected behavior. Libpng-1.5.3 no longer does this.
resulting in expected behavior. Libpng-1.5.4 no longer does this.
3) The number of significant bits in each component value. Libpng uses this to
optimize gamma handling by reducing the internal lookup table sizes.
@@ -2585,7 +2594,7 @@ can be determined.
The png_set_background() function has been described already, it tells libpng to
composite images with alpha or simple transparency against the supplied
background color. For compatibility with versions of libpng earlier than
libpng-1.5.3 it is recommended that you call the function after reading the file
libpng-1.5.4 it is recommended that you call the function after reading the file
header, even if you don't want to use the color in a bKGD chunk, if one exists.
If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid),
@@ -2622,7 +2631,7 @@ image_background->gray.
If you didn't call png_set_gamma() before reading the file header, for example
if you need your code to remain compatible with older versions of libpng prior
to libpng-1.5.3, this is the place to call it.
to libpng-1.5.4, this is the place to call it.
Do not call it if you called png_set_alpha_mode(); doing so will damage the
settings put in place by png_set_alpha_mode(). (If png_set_alpha_mode() is
@@ -5041,20 +5050,23 @@ PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
will lead to a link failure.
Prior to libpng-1.5.3, the zlib compressor used the same set of parameters
Prior to libpng-1.5.4, the zlib compressor used the same set of parameters
when compressing the IDAT data and textual data such as zTXt and iCCP.
In libpng-1.5.3 we reinitialized the zlib stream for each type of data.
In libpng-1.5.4 we reinitialized the zlib stream for each type of data.
We added five png_set_text_*() functions for setting the parameters to
use with textual data.
Prior to libpng-1.5.3, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
Prior to libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
option was off by default, and slightly inaccurate scaling occurred.
This option can no longer be turned off, and 16-to-8 scaling is always
accurate. This change will result in some different results while
reading 16-bit images, with none of the pixels being off-by-one any
longer (see Clause 13.12 of the PNG specification).
longer (see Clause 13.12 of the PNG specification). If you must
have exactly the same inaccurate results that libpng produced by
default previously, then you can use the png_set_chop_16() API instead
of png_set_strip_16().
Prior to libpng-1.5.3, the png_set_user_limits() function could only be
Prior to libpng-1.5.4, the png_set_user_limits() function could only be
used to reduce the width and height limits from the value of
PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said
that it could be used to override them. Now this function will reduce or
@@ -5368,13 +5380,13 @@ Other rules can be inferred by inspecting the libpng source.
.SH XIV. Y2K Compliance in libpng
June 14, 2011
June 16, 2011
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.5.4beta01 are Y2K compliant. It is my belief that earlier
upward through 1.5.4beta04 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@@ -5565,8 +5577,9 @@ the first widely used release:
1.5.2 15 10502 15.so.15.2[.0]
1.5.3beta01-10 15 10503 15.so.15.3[.0]
1.5.3rc01-02 15 10503 15.so.15.3[.0]
1.5.3beta11 [no 1.5.3] 15 10503 15.so.15.3[.0]
1.5.4beta01 15 10504 15.so.15.4[.0]
1.5.3beta11 15 10503 15.so.15.3[.0]
1.5.3 [omitted]
1.5.4beta01-03 15 10504 15.so.15.4[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -5623,7 +5636,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.5.4beta01 - June 14, 2011:
Libpng version 1.5.4beta04 - June 16, 2011:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -5646,7 +5659,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.4beta01, June 14, 2011, are
libpng versions 1.2.6, August 15, 2004, through 1.5.4beta04, June 16, 2011, 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
@@ -5745,7 +5758,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
June 14, 2011
June 16, 2011
.\" end of man page

View File

@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "June 14, 2011"
.TH LIBPNGPF 3 "June 16, 2011"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta01
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.4beta04
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"

2
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "June 14, 2011"
.TH PNG 5 "June 16, 2011"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

14
png.c
View File

@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_4beta01 Your_png_h_is_not_version_1_5_4beta01;
typedef png_libpng_version_1_5_4beta04 Your_png_h_is_not_version_1_5_4beta04;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -617,13 +617,13 @@ png_get_copyright(png_const_structp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.5.4beta01 - June 14, 2011" PNG_STRING_NEWLINE \
"libpng version 1.5.4beta04 - June 16, 2011" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 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.5.4beta01 - June 14, 2011\
return "libpng version 1.5.4beta04 - June 16, 2011\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -2369,7 +2369,7 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth)
else
shift = 0; /* keep all 16 bits */
if (png_ptr->transformations & PNG_16_TO_8)
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_CHOP_16_TO_8))
{
/* PNG_MAX_GAMMA_8 is the number of bits to keep - effectively
* the significant bits in the *input* when the output will
@@ -2385,12 +2385,12 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth)
png_ptr->gamma_shift = shift;
#ifdef PNG_16BIT_SUPPORTED
/* NOTE: prior to 1.5.3 this test used to include PNG_BACKGROUND (now
/* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
* PNG_COMPOSE). This effectively smashed the background calculation for
* 16-bit output because the 8-bit table assumes the result will be reduced
* to 8 bits.
*/
if (png_ptr->transformations & PNG_16_TO_8)
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_CHOP_16_TO_8))
#endif
png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
png_ptr->screen_gamma > 0 ? png_product2(png_ptr->gamma,

40
png.h
View File

@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.4beta01 - June 14, 2011
* libpng version 1.5.4beta04 - June 16, 2011
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.4beta01 - June 14, 2011: Glenn
* libpng versions 0.97, January 1998, through 1.5.4beta04 - June 16, 2011: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -152,8 +152,9 @@
* 1.5.2 15 10502 15.so.15.2[.0]
* 1.5.3beta01-10 15 10503 15.so.15.3[.0]
* 1.5.3rc01-02 15 10503 15.so.15.3[.0]
* 1.5.3beta11 [no 1.5.3] 15 10503 15.so.15.3[.0]
* 1.5.4beta01 15 10504 15.so.15.4[.0]
* 1.5.3beta11 15 10503 15.so.15.3[.0]
* 1.5.3 [omitted]
* 1.5.4beta01-03 15 10504 15.so.15.4[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -185,7 +186,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.5.4beta01, June 14, 2011, are
* libpng versions 1.2.6, August 15, 2004, through 1.5.4beta04, June 16, 2011, are
* Copyright (c) 2004, 2006-2011 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:
@@ -297,13 +298,13 @@
* Y2K compliance in libpng:
* =========================
*
* June 14, 2011
* June 16, 2011
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.5.4beta01 are Y2K compliant. It is my belief that
* upward through 1.5.4beta04 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -358,9 +359,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.4beta01"
#define PNG_LIBPNG_VER_STRING "1.5.4beta04"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.4beta01 - June 14, 2011\n"
" libpng version 1.5.4beta04 - June 16, 2011\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@@ -373,7 +374,7 @@
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
#define PNG_LIBPNG_VER_BUILD 01
#define PNG_LIBPNG_VER_BUILD 04
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@@ -520,7 +521,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_5_4beta01;
typedef char* png_libpng_version_1_5_4beta04;
/* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to
@@ -597,7 +598,7 @@ typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
* and whether that contents is compressed or not. The "key" field
* points to a regular zero-terminated C string. The "text", "lang", and
* "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
* However, the * structure returned by png_get_text() will always contain
* However, the structure returned by png_get_text() will always contain
* regular zero-terminated C strings (possibly empty), never NULL pointers,
* so they can be safely used in printf() and other string-handling functions.
*/
@@ -899,8 +900,9 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
/* Added to libpng-1.4.0 */
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
/* Added to libpng-1.5.3 */
/* Added to libpng-1.5.4 */
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
#define PNG_TRANSFORM_CHOP_16 0x8000 /* read only */
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1403,7 +1405,7 @@ PNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr));
#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Handle alpha and tRNS by replacing with a background color. Prior to
* libpng-1.5.3 this API must not be called before the PNG file header has been
* libpng-1.5.4 this API must not be called before the PNG file header has been
* read. Doing so will result in unexpected behavior and possible warnings or
* errors if the PNG file contains a bKGD chunk.
*/
@@ -1422,8 +1424,14 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr,
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Strip the second byte of information from a 16-bit depth file. */
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
/* Scale a 16-bit depth file down to 8-bit, accurately. */
PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT(229, void, png_set_chop_16, (png_structp png_ptr));
# endif
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
@@ -2566,7 +2574,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
* scripts/symbols.def as well.
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL(228);
PNG_EXPORT_LAST_ORDINAL(229);
#endif
#ifdef __cplusplus

View File

@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.4beta01 - June 14, 2011
* libpng version 1.5.4beta04 - June 16, 2011
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -507,7 +507,7 @@ png_default_error,(png_structp png_ptr, png_const_charp error_message),
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
/* Check on NULL only added in 1.5.3 */
/* Check on NULL only added in 1.5.4 */
if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */

View File

@@ -138,7 +138,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans; /* alpha values for paletted image */
png_bytep trans_alpha; /* alpha values for paletted image */
png_color_16 trans_color; /* transparent color for non-palette image */
#endif

View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@@ -6,7 +6,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -116,7 +116,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#endif
/* If warnings or errors are turned off the code is disabled or redirected here.
* From 1.5.3 functions have been added to allow very limited formatting of
* From 1.5.4 functions have been added to allow very limited formatting of
* error and warning messages - this code will also be disabled here.
*/
#ifdef PNG_WARNINGS_SUPPORTED
@@ -295,10 +295,10 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_RGB_TO_GRAY_ERR 0x200000L
#define PNG_RGB_TO_GRAY_WARN 0x400000L
#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.3 */
#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.4 */
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
/* 0x4000000L unused */
#define PNG_CHOP_16_TO_8 0x4000000L
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
@@ -325,9 +325,9 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.3 */
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.3 */
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.3 */
#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
@@ -338,7 +338,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* 0x400000L unused */
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */
#define PNG_FLAG_ZTXT_CUSTOM_STRATEGY 0x1000000L /* 5 lines added */
#define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000L /* to libpng-1.5.3 */
#define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000L /* to libpng-1.5.4 */
#define PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL 0x4000000L
#define PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS 0x8000000L
#define PNG_FLAG_ZTXT_CUSTOM_METHOD 0x10000000L
@@ -452,7 +452,7 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
/* Gamma values (new at libpng-1.5.3): */
/* Gamma values (new at libpng-1.5.4): */
#define PNG_GAMMA_MAC_OLD 151724 /* Assume '1.8' is really 2.2/1.45! */
#define PNG_GAMMA_MAC_INVERSE 65909
#define PNG_GAMMA_sRGB_INVERSE 45455
@@ -819,7 +819,12 @@ PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
png_bytep row));
#endif
@@ -1128,7 +1133,7 @@ PNG_EXTERN png_charp png_format_number(png_const_charp start, png_charp end,
#endif
#ifdef PNG_WARNINGS_SUPPORTED
/* New defines and members adding in libpng-1.5.3 */
/* New defines and members adding in libpng-1.5.4 */
# define PNG_WARNING_PARAMETER_SIZE 32
# define PNG_WARNING_PARAMETER_COUNT 8

View File

@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -1289,8 +1289,18 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Tell libpng to strip 16-bit/color files down to 8 bits per color.
*/
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr);
# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Added at libpng-1.5.4. "chop_16" produces the same result that "strip_16"
* did in earlier versions, while "strip_16" is now more accurate.
*/
else
if (transforms & PNG_TRANSFORM_CHOP_16)
png_set_chop_16(png_ptr);
#endif
#endif
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
@@ -1387,7 +1397,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_gray_to_rgb(png_ptr);
#endif
/* Added at libpng-1.5.3 */
/* Added at libpng-1.5.4 */
#ifdef PNG_READ_EXPAND_16_SUPPORTED
if (transforms & PNG_TRANSFORM_EXPAND_16)
png_set_expand_16(png_ptr);

View File

@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -133,7 +133,8 @@ png_set_background(png_structp png_ptr,
#endif /* READ_BACKGROUND */
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Strip 16-bit depth files to 8-bit depth */
/* Scale 16-bit depth files to 8-bit depth */
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
void PNGAPI
png_set_strip_16(png_structp png_ptr)
{
@@ -143,8 +144,29 @@ png_set_strip_16(png_structp png_ptr)
return;
png_ptr->transformations |= PNG_16_TO_8;
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_ptr->transformations &= ~PNG_CHOP_16_TO_8;
# endif
}
#endif
# endif
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Chop 16-bit depth files to 8-bit depth */
void PNGAPI
png_set_chop_16(png_structp png_ptr)
{
png_debug(1, "in png_set_chop_16");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_CHOP_16_TO_8;
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
png_ptr->transformations &= ~PNG_16_TO_8;
# endif
}
# endif
#endif /* PNG_READ_16_TO_8_SUPPORTED */
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
void PNGAPI
@@ -757,12 +779,12 @@ png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
if (png_ptr == NULL)
return;
/* New in libpng-1.5.3 - reserve particular negative values as flags. */
/* New in libpng-1.5.4 - reserve particular negative values as flags. */
scrn_gamma = translate_gamma_flags(png_ptr, scrn_gamma, 1/*screen*/);
file_gamma = translate_gamma_flags(png_ptr, file_gamma, 0/*file*/);
#if PNG_LIBPNG_VER >= 10600
/* Checking the gamma values for being >0 was added in 1.5.3 along with the
/* Checking the gamma values for being >0 was added in 1.5.4 along with the
* premultiplied alpha support; this actually hides an undocumented feature
* of the previous implementation which allowed gamma processing to be
* disabled in background handling. There is no evidence (so far) that this
@@ -1137,7 +1159,7 @@ png_init_palette_transformations(png_structp png_ptr)
static void /* PRIVATE */
png_init_rgb_transformations(png_structp png_ptr)
{
/* Added to libpng-1.5.3: check the color type to determine whether there
/* Added to libpng-1.5.4: check the color type to determine whether there
* is any alpha or transparency in the image and simply cancel the
* background and alpha mode stuff if there isn't.
*/
@@ -1242,9 +1264,9 @@ png_init_read_transformations(png_structp png_ptr)
*/
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Prior to 1.5.3 these tests were performed from png_set_gamma, 1.5.3 adds
/* Prior to 1.5.4 these tests were performed from png_set_gamma, 1.5.4 adds
* png_set_alpha_mode and this is another source for a default file gamma so
* the test needs to be performed later - here. In addition prior to 1.5.3
* the test needs to be performed later - here. In addition prior to 1.5.4
* the tests were repeated for the PALETTE color type here - this is no
* longer necessary (and doesn't seem to have been necessary before.)
*/
@@ -1269,7 +1291,7 @@ png_init_read_transformations(png_structp png_ptr)
else if (png_ptr->screen_gamma != 0)
/* The converse - assume the file matches the screen, note that this
* perhaps undesireable default can (from 1.5.3) be changed by calling
* perhaps undesireable default can (from 1.5.4) be changed by calling
* png_set_alpha_mode (even if the alpha handling mode isn't required
* or isn't changed from the default.)
*/
@@ -1279,7 +1301,7 @@ png_init_read_transformations(png_structp png_ptr)
/* Just in case the following prevents any processing - file and screen
* are both assumed to be linear and there is no way to introduce a
* third gamma value other than png_set_background with 'UNIQUE', and,
* prior to 1.5.3
* prior to 1.5.4
*/
png_ptr->screen_gamma = png_ptr->gamma = PNG_FP_1;
@@ -1312,7 +1334,7 @@ png_init_read_transformations(png_structp png_ptr)
* 6) PNG_GAMMA
* 7) PNG_STRIP_ALPHA (if compose)
* 8) PNG_ENCODE_ALPHA
* 9) PNG_16_TO_8 (strip16)
* 9) PNG_16_TO_8 or PNG_CHOP_16_TO_8 (strip16/chop16)
* 10) PNG_QUANTIZE (converts to palette)
* 11) PNG_EXPAND_16
* 12) PNG_GRAY_TO_RGB iff PNG_BACKGROUND_IS_GRAY
@@ -1340,12 +1362,12 @@ png_init_read_transformations(png_structp png_ptr)
PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
/* Kill the tRNS chunk itself too. Prior to 1.5.3 this did not happen
/* Kill the tRNS chunk itself too. Prior to 1.5.4 this did not happen
* so transparency information would remain just so long as it wasn't
* expanded. This produces unexpected API changes if the set of things
* that do PNG_EXPAND_tRNS changes (perfectly possible given the
* documentation - which says ask for what you want, accept what you
* get.) This makes the behavior consistent from 1.5.3:
* get.) This makes the behavior consistent from 1.5.4:
*/
png_ptr->num_trans = 0;
}
@@ -1438,25 +1460,24 @@ png_init_read_transformations(png_structp png_ptr)
*
* The PNG_BACKGROUND_EXPAND code above does not expand to 16 bits at
* present, so that case is ok (until do_expand_16 is moved.)
*
* NOTE: this discards the low 16 bits of the user supplied background
* color, but until expand_16 works properly there is no choice!
*/
#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
# define CHOP(x) (x)=((png_uint_16)(((png_uint_32)(x)*255+32895) >> 16))
#else
# define CHOP(x) ((png_uint_16)((2*(png_uint_32)(x) + 257)/514))
#endif
CHOP(png_ptr->background.red);
CHOP(png_ptr->background.green);
CHOP(png_ptr->background.blue);
CHOP(png_ptr->background.gray);
# undef CHOP
}
#endif
#endif /* PNG_READ_BACKGROUND_SUPPORTED && PNG_READ_EXPAND_16_SUPPORTED */
/* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the
* background support (see the comments in scripts/pnglibconf.dfa), this
* allows pre-multiplication of the alpha channel to be implemented as
* compositing on black. This is probably sub-optimal and has been done in
* 1.5.3 betas simply to enable external critique and testing (i.e. to
* 1.5.4 betas simply to enable external critique and testing (i.e. to
* implement the new API quickly, without lots of internal changes.)
*/
@@ -1475,7 +1496,7 @@ png_init_read_transformations(png_structp png_ptr)
* the gamma tables will not be built even if composition is required on a
* gamma encoded value.
*
* In 1.5.3 this is addressed below by an additional check on the individual
* In 1.5.4 this is addressed below by an additional check on the individual
* file gamma - if it is not 1.0 both RGB_TO_GRAY and COMPOSE need the
* tables.
*/
@@ -1486,9 +1507,11 @@ png_init_read_transformations(png_structp png_ptr)
|| ((png_ptr->transformations & PNG_COMPOSE)
&& (png_gamma_significant(png_ptr->gamma)
|| png_gamma_significant(png_ptr->screen_gamma)
# ifdef PNG_READ_BACKGROUND_SUPPORTED
|| (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_UNIQUE
&& png_gamma_significant(png_ptr->background_gamma))))
|| ((png_ptr->transformations & PNG_ENCODE_ALPHA)
&& png_gamma_significant(png_ptr->background_gamma))
# endif
)) || ((png_ptr->transformations & PNG_ENCODE_ALPHA)
&& png_gamma_significant(png_ptr->screen_gamma))
)
{
@@ -1841,7 +1864,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* The following used to be conditional on PNG_GAMMA (prior to 1.5.3),
/* The following used to be conditional on PNG_GAMMA (prior to 1.5.4),
* however it seems that the code in png_init_read_transformations, which has
* been called before this from png_read_update_info->png_read_start_row
* sometimes does the gamma transform and cancels the flag.
@@ -1851,13 +1874,15 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_16_TO_8_SUPPORTED
#ifdef PNG_READ_16BIT_SUPPORTED
if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))
if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_CHOP_16_TO_8)) &&
(info_ptr->bit_depth == 16))
info_ptr->bit_depth = 8;
#else
/* Force chopping 16-bit input down to 8 */
if (info_ptr->bit_depth == 16)
{
png_ptr->transformations |=PNG_16_TO_8;
if (!(png_ptr->transformations & PNG_CHOP_16_TO_8))
png_ptr->transformations |=PNG_16_TO_8;
info_ptr->bit_depth = 8;
}
#endif
@@ -1948,7 +1973,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
/* Adding in 1.5.3: cache the above value in png_struct so that we can later
/* Adding in 1.5.4: cache the above value in png_struct so that we can later
* check in png_rowbytes that the user buffer won't get overwritten. Note
* that the field is not always set - if png_read_update_info isn't called
* the application has to either not do any transforms or get the calculation
@@ -1973,15 +1998,15 @@ png_do_read_transformations(png_structp png_ptr)
if (png_ptr->row_buf == NULL)
{
/* Prior to 1.5.3 this output row/pass where the NULL pointer is, but this
/* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
* error is incredibly rare and incredibly easy to debug without this
* information.
*/
png_error(png_ptr, "NULL row buffer");
}
/* The following is debugging; prior to 1.5.3 the code was never compiled in;
* in 1.5.3 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
/* The following is debugging; prior to 1.5.4 the code was never compiled in;
* in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
* PNG_WARN_UNINITIALIZED_ROW removed. In 1.5 the new flag is set only for
* selected new APIs to ensure that there is no API change.
*/
@@ -1990,7 +2015,7 @@ png_do_read_transformations(png_structp png_ptr)
{
/* Application has failed to call either png_read_start_image() or
* png_read_update_info() after setting transforms that expand pixels.
* This check added to libpng-1.2.19 (but not enabled until 1.5.3).
* This check added to libpng-1.2.19 (but not enabled until 1.5.4).
*/
png_error(png_ptr, "Uninitialized row");
}
@@ -2121,9 +2146,13 @@ png_do_read_transformations(png_structp png_ptr)
png_do_encode_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr);
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
if (png_ptr->transformations & PNG_16_TO_8)
png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1);
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
else if (png_ptr->transformations & PNG_CHOP_16_TO_8)
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
# endif
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
@@ -2148,7 +2177,7 @@ png_do_read_transformations(png_structp png_ptr)
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/*NOTE: moved here in 1.5.3 (from much later in this list.) */
/*NOTE: moved here in 1.5.4 (from much later in this list.) */
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
@@ -2453,11 +2482,11 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Chop rows of bit depth 16 down to 8 */
/* Scale rows of bit depth 16 down to 8 accurately */
void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row)
png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_chop");
png_debug(1, "in png_do_scale_16_to_8");
if (row_info->bit_depth == 16)
{
@@ -2499,17 +2528,9 @@ png_do_chop(png_row_infop row_info, png_bytep row)
* (V * 255 + 32895) >> 16
*/
#ifdef PNG_LEGACY_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
*dp = *sp + ((((int)(*(sp + 1)) - *sp) > 128) ? 1 : 0);
#else
png_int_32 tmp = *sp++; /* must be signed! */
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
tmp += (((int)*sp++ - tmp + 128) * 65535) >> 24;
# else
sp++;
# endif
*dp++ = (png_byte)tmp;
#endif
}
row_info->bit_depth = 8;
@@ -2517,7 +2538,33 @@ png_do_chop(png_row_infop row_info, png_bytep row)
row_info->rowbytes = row_info->width * row_info->channels;
}
}
#endif
void /* PRIVATE */
/* Simply discard the low byte. This was the default behavior prior
* to libpng-1.5.4.
*/
png_do_chop(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_chop");
if (row_info->bit_depth == 16)
{
png_bytep sp = row; /* source */
png_bytep dp = row; /* destinaton */
png_bytep ep = sp + row_info->rowbytes; /* end+1 */
while (sp < ep)
{
*dp++ = *sp++;
sp++;
}
row_info->bit_depth = 8;
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
row_info->rowbytes = row_info->width * row_info->channels;
}
}
#endif /* PNG_READ_16_TO_8_SUPPORTED */
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */
@@ -4411,7 +4458,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
if (row_info->bit_depth == 8)
{
{
if (trans_alpha != NULL)
if (num_trans > 0)
{
sp = row + (png_size_t)row_width - 1;
dp = row + (png_size_t)(row_width << 2) - 1;
@@ -4465,7 +4512,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
*/
void /* PRIVATE */
png_do_expand(png_row_infop row_info, png_bytep row,
png_const_color_16p trans_value)
png_const_color_16p trans_color)
{
int shift, value;
png_bytep sp, dp;
@@ -4477,7 +4524,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
{
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
{
png_uint_16 gray = (png_uint_16)(trans_value ? trans_value->gray : 0);
png_uint_16 gray = (png_uint_16)(trans_color ? trans_color->gray : 0);
if (row_info->bit_depth < 8)
{
@@ -4569,7 +4616,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
row_info->rowbytes = row_width;
}
if (trans_value != NULL)
if (trans_color != NULL)
{
if (row_info->bit_depth == 8)
{
@@ -4621,13 +4668,13 @@ png_do_expand(png_row_infop row_info, png_bytep row,
row_width);
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_value)
else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_color)
{
if (row_info->bit_depth == 8)
{
png_byte red = (png_byte)(trans_value->red & 0xff);
png_byte green = (png_byte)(trans_value->green & 0xff);
png_byte blue = (png_byte)(trans_value->blue & 0xff);
png_byte red = (png_byte)(trans_color->red & 0xff);
png_byte green = (png_byte)(trans_color->green & 0xff);
png_byte blue = (png_byte)(trans_color->blue & 0xff);
sp = row + (png_size_t)row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 2) - 1;
for (i = 0; i < row_width; i++)
@@ -4645,12 +4692,12 @@ png_do_expand(png_row_infop row_info, png_bytep row,
}
else if (row_info->bit_depth == 16)
{
png_byte red_high = (png_byte)((trans_value->red >> 8) & 0xff);
png_byte green_high = (png_byte)((trans_value->green >> 8) & 0xff);
png_byte blue_high = (png_byte)((trans_value->blue >> 8) & 0xff);
png_byte red_low = (png_byte)(trans_value->red & 0xff);
png_byte green_low = (png_byte)(trans_value->green & 0xff);
png_byte blue_low = (png_byte)(trans_value->blue & 0xff);
png_byte red_high = (png_byte)((trans_color->red >> 8) & 0xff);
png_byte green_high = (png_byte)((trans_color->green >> 8) & 0xff);
png_byte blue_high = (png_byte)((trans_color->blue >> 8) & 0xff);
png_byte red_low = (png_byte)(trans_color->red & 0xff);
png_byte green_low = (png_byte)(trans_color->green & 0xff);
png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
sp = row + row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 3) - 1;
for (i = 0; i < row_width; i++)

View File

@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -2679,7 +2679,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
{
png_debug(1, "in png_combine_row");
/* Added in 1.5.3: the row_info should match the information returned by any
/* Added in 1.5.4: the row_info should match the information returned by any
* call to png_read_update_info at this point. Do not continue if we got
* this wrong.
*/

View File

@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.5.1 [February 3, 2011]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@@ -5,7 +5,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -68,7 +68,7 @@ struct png_struct_def
uInt zbuf_size; /* size of zbuf (typically 65536) */
#ifdef PNG_WRITE_SUPPORTED
/* Added in 1.5.3: state to keep track of whether the zstream has been
/* Added in 1.5.4: state to keep track of whether the zstream has been
* initialized and if so whether it is for IDAT or some other chunk.
*/
#define PNG_ZLIB_UNINITIALIZED 0
@@ -78,7 +78,7 @@ struct png_struct_def
#define PNG_ZLIB_IN_USE 4 /* a flag value */
png_uint_32 zlib_state; /* State of zlib initialization */
/* End of material added at libpng 1.5.3 */
/* End of material added at libpng 1.5.4 */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
@@ -86,7 +86,7 @@ struct png_struct_def
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
#endif
/* Added at libpng 1.5.3 */
/* Added at libpng 1.5.4 */
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED)
int zlib_text_level; /* holds zlib compression level */
@@ -95,7 +95,7 @@ struct png_struct_def
int zlib_text_mem_level; /* holds zlib compression memory level */
int zlib_text_strategy; /* holds zlib compression strategy */
#endif
/* End of material added at libpng 1.5.3 */
/* End of material added at libpng 1.5.4 */
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
@@ -111,7 +111,7 @@ struct png_struct_def
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
png_size_t info_rowbytes; /* Added in 1.5.3: cache of updated row bytes */
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */

View File

@@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -918,7 +918,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
/* Normally one would use Z_DEFAULT_STRATEGY for text compression.
* This is here just to make pngtest replicate the results from libpng
* versions prior to 1.5.3, and to test this new API.
* versions prior to 1.5.4, and to test this new API.
*/
png_set_text_compression_strategy(write_ptr, Z_FILTERED);
#endif
@@ -1794,4 +1794,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_4beta01 Your_png_h_is_not_version_1_5_4beta01;
typedef png_libpng_version_1_5_4beta04 Your_png_h_is_not_version_1_5_4beta04;

View File

@@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@@ -1,7 +1,7 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 2011 Glenn Randers-Pehrson
* Written by John Cunningham Bowler
*
@@ -3429,7 +3429,7 @@ read_palette(store_palette palette, int *npalette, png_structp pp, png_infop pi)
if ((png_get_tRNS(pp, pi, &trans_alpha, &num, 0) & PNG_INFO_tRNS) != 0 &&
(trans_alpha != NULL || num != 1/*returns 1 for a transparent color*/) &&
/* Oops, if a palette tRNS gets expanded png_read_update_info (at least so
* far as 1.5.3) does not zap the trans_alpha pointer, only num_trans, so
* far as 1.5.4) does not zap the trans_alpha pointer, only num_trans, so
* in the above call we get a success, we get a pointer (who knows what
* to) and we get num_trans == 0:
*/
@@ -5241,6 +5241,8 @@ IT(expand_16);
#endif /* PNG_READ_EXPAND_16_SUPPORTED */
#ifdef PNG_READ_16_TO_8_SUPPORTED
# if !defined(PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED) && \
!defined(PNG_READ_CHOP_16_TO_8_SUPPORTED) /* the default before 1.5.4 */
/* png_set_strip_16 */
static void
image_transform_png_set_strip_16_set(PNG_CONST image_transform *this,
@@ -5265,6 +5267,8 @@ image_transform_png_set_strip_16_mod(PNG_CONST image_transform *this,
# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
/* The strip 16 algorithm drops the low 8 bits rather than calculating
* 1/257, so we need to adjust the permitted errors appropriately:
* Notice that this is only relevant prior to the addition of the
* png_set_chop_16 API in 1.5.4 (but 1.5.4+ always defines the above!)
*/
{
PNG_CONST double d = (255-128.5)/65535;
@@ -5294,6 +5298,61 @@ image_transform_png_set_strip_16_add(image_transform *this,
IT(strip_16);
#undef PT
#define PT ITSTRUCT(strip_16)
#endif
#ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED /* API added in 1.5.4 */
/* png_set_chop_16 */
static void
image_transform_png_set_chop_16_set(PNG_CONST image_transform *this,
transform_display *that, png_structp pp, png_infop pi)
{
png_set_chop_16(pp);
this->next->set(this->next, that, pp, pi);
}
static void
image_transform_png_set_chop_16_mod(PNG_CONST image_transform *this,
image_pixel *that, png_structp pp, PNG_CONST transform_display *display)
{
if (that->bit_depth == 16)
{
that->sample_depth = that->bit_depth = 8;
if (that->red_sBIT > 8) that->red_sBIT = 8;
if (that->green_sBIT > 8) that->green_sBIT = 8;
if (that->blue_sBIT > 8) that->blue_sBIT = 8;
if (that->alpha_sBIT > 8) that->alpha_sBIT = 8;
/* From 1.5.4 there is a separate API to do the low byte drop; see the
* comments above for why this requires the following:
*/
{
PNG_CONST double d = (255-128.5)/65535;
that->rede += d;
that->greene += d;
that->bluee += d;
that->alphae += d;
}
}
this->next->mod(this->next, that, pp, display);
}
static int
image_transform_png_set_chop_16_add(image_transform *this,
PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth)
{
UNUSED(colour_type)
this->next = *that;
*that = this;
return bit_depth > 8;
}
IT(chop_16);
#undef PT
#define PT ITSTRUCT(chop_16)
#endif /* PNG_READ_CHOP_16_TO_8_SUPPORTED, from libpng 1.5.4 */
#endif /* PNG_READ_16_TO_8_SUPPORTED */
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED

View File

@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -1458,7 +1458,7 @@ png_set_compression_method(png_structp png_ptr, int method)
png_ptr->zlib_method = method;
}
/* The following were added to libpng-1.5.3 */
/* The following were added to libpng-1.5.4 */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
void PNGAPI
png_set_text_compression_level(png_structp png_ptr, int level)
@@ -1539,7 +1539,7 @@ png_set_text_compression_method(png_structp png_ptr, int method)
png_ptr->zlib_text_method = method;
}
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
/* end of API added to libpng-1.5.3 */
/* end of API added to libpng-1.5.4 */
void PNGAPI
png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)

View File

@@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -1017,7 +1017,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
png_write_chunk(png_ptr, png_IDAT, data, length);
png_ptr->mode |= PNG_HAVE_IDAT;
/* Prior to 1.5.3 this code was replicated in every caller (except at the
/* Prior to 1.5.4 this code was replicated in every caller (except at the
* end, where it isn't technically necessary). Since this function has
* flushed the data we can safely reset the zlib output buffer here.
*/

View File

@@ -1,7 +1,7 @@
VisualStudio instructions
libpng version 1.5.4beta01 - June 14, 2011
libpng version 1.5.4beta04 - June 16, 2011
Copyright (c) 1998-2010 Glenn Randers-Pehrson

View File

@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
* libpng version 1.5.4beta01 - June 14, 2011
* libpng version 1.5.4beta04 - June 16, 2011
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
*

View File

@@ -1,9 +1,9 @@
Makefiles for libpng version 1.5.4beta01 - June 14, 2011
Makefiles for libpng version 1.5.4beta04 - June 16, 2011
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
(gcc, creates libpng15.so.15.1.5.4beta01)
(gcc, creates libpng15.so.15.1.5.4beta04)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -20,7 +20,7 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning,
(gcc, creates libpng15.so.15.1.5.4beta01)
(gcc, creates libpng15.so.15.1.5.4beta04)
makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc
@@ -35,12 +35,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc,
creates libpng15.so.15.1.5.4beta01)
creates libpng15.so.15.1.5.4beta04)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng15.so.15.1.5.4beta01)
creates libpng15.so.15.1.5.4beta04)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng15.so.15.1.5.4beta01)
creates libpng15.so.15.1.5.4beta04)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile
@@ -57,7 +57,7 @@ Other supporting scripts:
libpng-config-body.in => used by several makefiles to create libpng-config
libpng-config-head.in => used by several makefiles to create libpng-config
libpng.pc.in => Used by several makefiles to create libpng.pc
pngwin.rc => Used by the visualc6 and visualc71 projects.
pngwin.rc => Used by the visualc71 project.
pngwin.def => Used by makefile.os2
pngwin.dfn => Used to maintain pngwin.def
SCOPTIONS.ppc => Used with smakefile.ppc

View File

@@ -11,7 +11,7 @@
# Modeled after libxml-config.
version=1.5.4beta01
version=1.5.4beta04
prefix=""
libdir=""
libs=""

View File

@@ -5,6 +5,6 @@ includedir=@includedir@/libpng15
Name: libpng
Description: Loads and saves PNG files
Version: 1.5.4beta01
Version: 1.5.4beta04
Libs: -L${libdir} -lpng15
Cflags: -I${includedir}

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng15
LIB= png15
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.4beta01
SHLIB_MINOR= 1.5.4beta04
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
LIB= png
SHLIB_MAJOR= 15
SHLIB_MINOR= 1.5.4beta01
SHLIB_MINOR= 1.5.4beta04
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 15
SHLIB_MINOR= 1.5.4beta01
SHLIB_MINOR= 1.5.4beta04
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \

View File

@@ -293,8 +293,8 @@ option READ enables READ_INTERLACING
# Disabling READ_16BIT does not disable reading 16-bit PNG files, but it
# forces them to be chopped down to 8-bit, and disables any 16-bit
# processing after that has happened. You need to be sure to enable READ_16_TO_8
# when you disable READ_16BIT for this to work properly.
# processing after that has happened. You need to be sure to enable
# READ_16_TO_8 when you disable READ_16BIT for this to work properly.
option READ_16BIT requires READ enables 16BIT
@@ -346,9 +346,6 @@ option INCH_CONVERSIONS
option BUILD_GRAYSCALE_PALETTE
option READ_16_TO_8_ACCURATE_SCALE requires READ
option LEGACY_READ_16_TO_8_ACCURATE_SCALE disabled
# IN DEVELOPMENT
# These are currently experimental features; define them if you want
@@ -553,7 +550,14 @@ option SAVE_INT_32 requires WRITE
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
# added at libpng-1.5.3
# enabled at libpng-1.5.4, was present but disabled by default
option READ_16_TO_8_ACCURATE_SCALE requires READ_16_TO_8
# added at libpng-1.5.4
option READ_CHOP_16_TO_8 requires READ_16_TO_8
option WRITE_OPTIMIZE_CMF requires WRITE
option READ_COMPRESSED_TEXT disabled
@@ -571,7 +575,6 @@ option WRITE_iTXt enables WRITE_COMPRESSED_TEXT
option WRITE_zTXt enables WRITE_COMPRESSED_TEXT
option WRITE_COMPRESSED_TEXT enables WRITE_TEXT
# Turn this off to disable png_read_png() and png_write_png() and
# leave the row_pointers member out of the info structure.

View File

@@ -61,7 +61,6 @@
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_iTXt_SUPPORTED
/*#undef PNG_LEGACY_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
@@ -77,6 +76,7 @@
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_CHOP_16_TO_8_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_EXPAND_16_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED

View File

@@ -5,7 +5,7 @@
LIBRARY
EXPORTS
;Version 1.5.4beta01
;Version 1.5.4beta04
png_access_version_number @1
png_set_sig_bytes @2
png_sig_cmp @3
@@ -234,3 +234,4 @@ EXPORTS
png_set_text_compression_method @226
png_set_alpha_mode @227
png_set_alpha_mode_fixed @228
png_set_chop_16 @229