mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
14 Commits
v1.6.17rc0
...
v1.6.18bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd85b5713c | ||
|
|
a21a5b22c1 | ||
|
|
d344589703 | ||
|
|
218a6fe9e5 | ||
|
|
c98f7fb4e3 | ||
|
|
f17e6c3046 | ||
|
|
6eecfe3886 | ||
|
|
b383798ac9 | ||
|
|
ea037b01eb | ||
|
|
04445235f1 | ||
|
|
778ccbbafa | ||
|
|
c5370ede95 | ||
|
|
2b66107abb | ||
|
|
0aabfe2a4c |
84
ANNOUNCE
84
ANNOUNCE
@@ -1,4 +1,4 @@
|
||||
Libpng 1.6.17rc04 - March 16, 2015
|
||||
Libpng 1.6.18beta01 - April 1, 2015
|
||||
|
||||
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.
|
||||
@@ -8,82 +8,30 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
1.6.17rc04.tar.xz (LZMA-compressed, recommended)
|
||||
1.6.17rc04.tar.gz
|
||||
1.6.18beta01.tar.xz (LZMA-compressed, recommended)
|
||||
1.6.18beta01.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lp1617r04.7z (LZMA-compressed, recommended)
|
||||
lp1617r04.zip
|
||||
lp1618b01.7z (LZMA-compressed, recommended)
|
||||
lp1618b01.zip
|
||||
|
||||
Other information:
|
||||
|
||||
1.6.17rc04-README.txt
|
||||
1.6.17rc04-LICENSE.txt
|
||||
libpng-1.6.17rc04-*.asc (armored detached GPG signatures)
|
||||
1.6.18beta01-README.txt
|
||||
1.6.18beta01-LICENSE.txt
|
||||
libpng-1.6.18beta01-*.asc (armored detached GPG signatures)
|
||||
|
||||
Changes since the last public release (1.6.16):
|
||||
Changes since the last public release (1.6.17):
|
||||
|
||||
Version 1.6.17beta01 [January 29, 2015]
|
||||
Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
|
||||
Corrected the width limit calculation in png_check_IHDR().
|
||||
Removed user limits from pngfix. Also pass NULL pointers to
|
||||
png_read_row to skip the unnecessary row de-interlace stuff.
|
||||
Added testing of png_set_packing() to pngvalid.c
|
||||
Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
|
||||
Implement previously untested cases of libpng transforms in pngvalid.c
|
||||
Fixed byte order in 2-byte filler, in png_do_read_filler().
|
||||
Made the check for out-of-range values in png_set_tRNS() detect
|
||||
values that are exactly 2^bit_depth, and work on 16-bit platforms.
|
||||
Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
|
||||
Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
|
||||
pngset.c to avoid warnings about dead code.
|
||||
Added "& 0xff" to many instances of expressions that are typecast
|
||||
to (png_byte), to avoid Coverity gripes.
|
||||
|
||||
Version 1.6.17beta02 [February 7, 2015]
|
||||
Work around one more Coverity-scan dead-code warning.
|
||||
Do not build png_product2() when it is unused.
|
||||
|
||||
Version 1.6.17beta03 [February 17, 2015]
|
||||
Display user limits in the output from pngtest.
|
||||
Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
|
||||
and 1-million-row default limits in pnglibconf.dfa, that can be reset
|
||||
by the user at build time or run time. This provides a more robust
|
||||
defense against DOS and as-yet undiscovered overflows.
|
||||
|
||||
Version 1.6.17beta04 [February 21, 2015]
|
||||
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
|
||||
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
|
||||
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
|
||||
|
||||
Version 1.6.17beta05 [February 25, 2015]
|
||||
Restored compiling of png_reciprocal2 with PNG_NO_16BIT.
|
||||
|
||||
Version 1.6.17beta06 [February 27, 2015]
|
||||
Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
|
||||
of png.h.
|
||||
Avoid runtime checks when converting integer to png_byte with
|
||||
Visual Studio (Sergey Kosarevsky)
|
||||
|
||||
Version 1.6.17rc01 [March 4, 2015]
|
||||
No changes.
|
||||
|
||||
Version 1.6.17rc02 [March 9, 2015]
|
||||
Removed some comments that the configure script did not handle
|
||||
properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
|
||||
Free the unknown_chunks structure even when it contains no data.
|
||||
|
||||
Version 1.6.17rc03 [March 12, 2015]
|
||||
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||
|
||||
Version 1.6.17rc04 [March 16, 2015]
|
||||
Remove pnglibconf.h, pnglibconf.c, and pnglibconf.out instead of
|
||||
pnglibconf.* in "make clean" (Cosmin).
|
||||
Fix bug in calculation of maxbits, in png_write_sBIT, introduced
|
||||
in libpng-1.6.17beta01 (John Bowler).
|
||||
Version 1.6.18beta01 [April 1, 2015]
|
||||
Removed PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED macros. They
|
||||
have been combined with PNG_SET_USER_LIMITS_SUPPORTED (resolves
|
||||
bug report by Andrew Church).
|
||||
Fixed rgb_to_gray checks and added tRNS checks to pngvalid.c. This
|
||||
fixes some arithmetic errors that caused some tests to fail on
|
||||
some 32-bit platforms.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
||||
27
CHANGES
27
CHANGES
@@ -5186,6 +5186,33 @@ Version 1.6.17rc04 [March 16, 2015]
|
||||
Fix bug in calculation of maxbits, in png_write_sBIT, introduced
|
||||
in libpng-1.6.17beta01 (John Bowler).
|
||||
|
||||
Version 1.6.17rc05 [March 21, 2015]
|
||||
Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
|
||||
is not supported (John Bowler). This fixes an error introduced in
|
||||
libpng-1.6.17beta06.
|
||||
Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
|
||||
the Coverity scan without them.
|
||||
|
||||
Version 1.6.17rc06 [March 23, 2015]
|
||||
Remove pnglibconf.dfn and pnglibconf.pre with "make clean".
|
||||
Reformatted some "&0xff" instances to "& 0xff".
|
||||
Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
|
||||
value was wrong. It's not clear if this affected the final stored
|
||||
value; in the obvious code path the upper and lower 8-bits of the
|
||||
alpha value were identical and the alpha was truncated to 8-bits
|
||||
rather than dividing by 257 (John Bowler).
|
||||
|
||||
Version 1.6.17 [March 26, 2015]
|
||||
No changes.
|
||||
|
||||
Version 1.6.18beta01 [April 1, 2015]
|
||||
Removed PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED macros. They
|
||||
have been combined with PNG_SET_USER_LIMITS_SUPPORTED (resolves
|
||||
bug report by Andrew Church).
|
||||
Fixed rgb_to_gray checks and added tRNS checks to pngvalid.c. This
|
||||
fixes some arithmetic errors that caused some tests to fail on
|
||||
some 32-bit platforms.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
||||
@@ -16,7 +16,7 @@ enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 17)
|
||||
set(PNGLIB_RELEASE 18)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
@@ -261,7 +261,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.17rc04
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.18beta01
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
4
LICENSE
4
LICENSE
@@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.17rc04, March 16, 2015, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.18beta01, April 1, 2015, are
|
||||
Copyright (c) 2004, 2006-2015 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
|
||||
March 16, 2015
|
||||
April 1, 2015
|
||||
|
||||
@@ -134,7 +134,7 @@ SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk
|
||||
CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
||||
check.new pnglibconf.h pngprefix.h symbols.new pngtest-log.txt \
|
||||
pnglibconf.out pnglibconf.c \
|
||||
pnglibconf.out pnglibconf.c pnglibconf.pre pnglibconf.dfn \
|
||||
$(SCRIPT_CLEANFILES)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
||||
|
||||
2
README
2
README
@@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.17rc04 - March 16, 2015 (shared library 16.0)
|
||||
README for libpng version 1.6.18beta01 - April 1, 2015 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
||||
@@ -73,8 +73,9 @@ done
|
||||
# present bad things are happening.
|
||||
#
|
||||
# The autotools generated files:
|
||||
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in\
|
||||
config.sub configure depcomp install-sh ltmain.sh missing test-driver"
|
||||
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
|
||||
config.h.in~ config.sub configure depcomp install-sh ltmain.sh missing\
|
||||
test-driver"
|
||||
#
|
||||
# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
|
||||
# versions than those required by configure.ac):
|
||||
|
||||
@@ -18,7 +18,7 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.17rc04],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng],[1.6.18beta01],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
@@ -39,10 +39,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.17rc04
|
||||
PNGLIB_VERSION=1.6.18beta01
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=17
|
||||
PNGLIB_RELEASE=18
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ make_four_random_bytes(png_uint_32* seed, png_bytep bytes)
|
||||
make_random_bytes(seed, bytes, 4);
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#if defined PNG_READ_SUPPORTED || defined PNG_WRITE_tRNS_SUPPORTED
|
||||
static void
|
||||
randomize(void *pv, size_t size)
|
||||
{
|
||||
@@ -267,7 +267,9 @@ randomize(void *pv, size_t size)
|
||||
}
|
||||
|
||||
#define RANDOMIZE(this) randomize(&(this), sizeof (this))
|
||||
#endif /* READ || WRITE_tRNS */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
static unsigned int
|
||||
random_mod(unsigned int max)
|
||||
{
|
||||
@@ -295,7 +297,8 @@ random_choice(void)
|
||||
/* A numeric ID based on PNG file characteristics. The 'do_interlace' field
|
||||
* simply records whether pngvalid did the interlace itself or whether it
|
||||
* was done by libpng. Width and height must be less than 256. 'palette' is an
|
||||
* index of the palette to use for formats with a palette (0 otherwise.)
|
||||
* index of the palette to use for formats with a palette otherwise a boolean
|
||||
* indicating if a tRNS chunk was generated.
|
||||
*/
|
||||
#define FILEID(col, depth, palette, interlace, width, height, do_interlace) \
|
||||
((png_uint_32)((col) + ((depth)<<3) + ((palette)<<8) + ((interlace)<<13) + \
|
||||
@@ -316,12 +319,16 @@ standard_name(char *buffer, size_t bufsize, size_t pos, png_byte colour_type,
|
||||
png_uint_32 w, png_uint_32 h, int do_interlace)
|
||||
{
|
||||
pos = safecat(buffer, bufsize, pos, colour_types[colour_type]);
|
||||
if (npalette > 0)
|
||||
if (colour_type == 3) /* must have a palette */
|
||||
{
|
||||
pos = safecat(buffer, bufsize, pos, "[");
|
||||
pos = safecatn(buffer, bufsize, pos, npalette);
|
||||
pos = safecat(buffer, bufsize, pos, "]");
|
||||
}
|
||||
|
||||
else if (npalette != 0)
|
||||
pos = safecat(buffer, bufsize, pos, "+tRNS");
|
||||
|
||||
pos = safecat(buffer, bufsize, pos, " ");
|
||||
pos = safecatn(buffer, bufsize, pos, bit_depth);
|
||||
pos = safecat(buffer, bufsize, pos, " bit");
|
||||
@@ -378,25 +385,32 @@ standard_name_from_id(char *buffer, size_t bufsize, size_t pos, png_uint_32 id)
|
||||
|
||||
static int
|
||||
next_format(png_bytep colour_type, png_bytep bit_depth,
|
||||
unsigned int* palette_number, int no_low_depth_gray)
|
||||
unsigned int* palette_number, int low_depth_gray, int tRNS)
|
||||
{
|
||||
if (*bit_depth == 0)
|
||||
{
|
||||
*colour_type = 0;
|
||||
if (no_low_depth_gray)
|
||||
*bit_depth = 8;
|
||||
else
|
||||
if (low_depth_gray)
|
||||
*bit_depth = 1;
|
||||
else
|
||||
*bit_depth = 8;
|
||||
*palette_number = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*colour_type == 3)
|
||||
if (*colour_type < 4/*no alpha channel*/)
|
||||
{
|
||||
/* Add multiple palettes for colour type 3. */
|
||||
if (++*palette_number < PALETTE_COUNT(*bit_depth))
|
||||
/* Add multiple palettes for colour type 3, one image with tRNS
|
||||
* and one without for other non-alpha formats:
|
||||
*/
|
||||
unsigned int pn = ++*palette_number;
|
||||
png_byte ct = *colour_type;
|
||||
|
||||
if (((ct == 0/*GRAY*/ || ct/*RGB*/ == 2) && tRNS && pn < 2) ||
|
||||
(ct == 3/*PALETTE*/ && pn < PALETTE_COUNT(*bit_depth)))
|
||||
return 1;
|
||||
|
||||
/* No: next bit depth */
|
||||
*palette_number = 0;
|
||||
}
|
||||
|
||||
@@ -1959,6 +1973,7 @@ typedef struct png_modifier
|
||||
|
||||
/* Run tests on reading with a combination of transforms, */
|
||||
unsigned int test_transform :1;
|
||||
unsigned int test_tRNS :1; /* Includes tRNS images */
|
||||
|
||||
/* When to use the use_input_precision option, this controls the gamma
|
||||
* validation code checks. If set any value that is within the transformed
|
||||
@@ -1990,6 +2005,16 @@ typedef struct png_modifier
|
||||
unsigned int test_gamma_expand16 :1;
|
||||
unsigned int test_exhaustive :1;
|
||||
|
||||
/* Whether or not to run the low-bit-depth grayscale tests. This fail on
|
||||
* gamma images in some cases because of gross inaccuracies in the grayscale
|
||||
* gamma handling for low bit depth.
|
||||
*/
|
||||
unsigned int test_lbg :1;
|
||||
unsigned int test_lbg_gamma_threshold :1;
|
||||
unsigned int test_lbg_gamma_transform :1;
|
||||
unsigned int test_lbg_gamma_sbit :1;
|
||||
unsigned int test_lbg_gamma_composition :1;
|
||||
|
||||
unsigned int log :1; /* Log max error */
|
||||
|
||||
/* Buffer information, the buffer size limits the size of the chunks that can
|
||||
@@ -2042,6 +2067,11 @@ modifier_init(png_modifier *pm)
|
||||
pm->test_standard = 0;
|
||||
pm->test_size = 0;
|
||||
pm->test_transform = 0;
|
||||
# ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
pm->test_tRNS = 1;
|
||||
# else
|
||||
pm->test_tRNS = 0;
|
||||
# endif
|
||||
pm->use_input_precision = 0;
|
||||
pm->use_input_precision_sbit = 0;
|
||||
pm->use_input_precision_16to8 = 0;
|
||||
@@ -2054,6 +2084,11 @@ modifier_init(png_modifier *pm)
|
||||
pm->test_gamma_background = 0;
|
||||
pm->test_gamma_alpha_mode = 0;
|
||||
pm->test_gamma_expand16 = 0;
|
||||
pm->test_lbg = 1;
|
||||
pm->test_lbg_gamma_threshold = 1;
|
||||
pm->test_lbg_gamma_transform = 1;
|
||||
pm->test_lbg_gamma_sbit = 1;
|
||||
pm->test_lbg_gamma_composition = 1;
|
||||
pm->test_exhaustive = 0;
|
||||
pm->log = 0;
|
||||
|
||||
@@ -3192,6 +3227,45 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
static void
|
||||
set_random_tRNS(png_structp pp, png_infop pi, PNG_CONST png_byte colour_type,
|
||||
PNG_CONST int bit_depth)
|
||||
{
|
||||
/* To make this useful the tRNS color needs to match at least one pixel.
|
||||
* Random values are fine for gray, including the 16-bit case where we know
|
||||
* that the test image contains all the gray values. For RGB we need more
|
||||
* method as only 65536 different RGB values are generated.
|
||||
*/
|
||||
png_color_16 tRNS;
|
||||
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||
|
||||
RANDOMIZE(tRNS);
|
||||
|
||||
if (colour_type & 2/*RGB*/)
|
||||
{
|
||||
if (bit_depth == 8)
|
||||
{
|
||||
tRNS.blue = tRNS.red ^ tRNS.green;
|
||||
tRNS.red &= mask;
|
||||
tRNS.green &= mask;
|
||||
tRNS.blue &= mask;
|
||||
}
|
||||
|
||||
else /* bit_depth == 16 */
|
||||
{
|
||||
tRNS.green = (png_uint_16)(tRNS.red * 257);
|
||||
tRNS.blue = (png_uint_16)(tRNS.green * 17);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
tRNS.gray &= mask;
|
||||
|
||||
png_set_tRNS(pp, pi, NULL, 0, &tRNS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The number of passes is related to the interlace type. There was no libpng
|
||||
* API to determine this prior to 1.5, so we need an inquiry function:
|
||||
*/
|
||||
@@ -3525,6 +3599,11 @@ make_transform_image(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
|
||||
if (colour_type == 3) /* palette */
|
||||
init_standard_palette(ps, pp, pi, 1U << bit_depth, 1/*do tRNS*/);
|
||||
|
||||
# ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
else if (palette_number)
|
||||
set_random_tRNS(pp, pi, colour_type, bit_depth);
|
||||
# endif
|
||||
|
||||
png_write_info(pp, pi);
|
||||
|
||||
if (png_get_rowbytes(pp, pi) !=
|
||||
@@ -3598,19 +3677,20 @@ make_transform_image(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
|
||||
}
|
||||
|
||||
static void
|
||||
make_transform_images(png_store *ps)
|
||||
make_transform_images(png_modifier *pm)
|
||||
{
|
||||
png_byte colour_type = 0;
|
||||
png_byte bit_depth = 0;
|
||||
unsigned int palette_number = 0;
|
||||
|
||||
/* This is in case of errors. */
|
||||
safecat(ps->test, sizeof ps->test, 0, "make standard images");
|
||||
safecat(pm->this.test, sizeof pm->this.test, 0, "make standard images");
|
||||
|
||||
/* Use next_format to enumerate all the combinations we test, including
|
||||
* generating multiple low bit depth palette images.
|
||||
* generating multiple low bit depth palette images. Non-A images (palette
|
||||
* and direct) are created with and without tRNS chunks.
|
||||
*/
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, 0))
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, 1, 1))
|
||||
{
|
||||
int interlace_type;
|
||||
|
||||
@@ -3621,7 +3701,7 @@ make_transform_images(png_store *ps)
|
||||
|
||||
standard_name(name, sizeof name, 0, colour_type, bit_depth,
|
||||
palette_number, interlace_type, 0, 0, 0);
|
||||
make_transform_image(ps, colour_type, bit_depth, palette_number,
|
||||
make_transform_image(&pm->this, colour_type, bit_depth, palette_number,
|
||||
interlace_type, name);
|
||||
}
|
||||
}
|
||||
@@ -4287,6 +4367,7 @@ typedef struct standard_display
|
||||
size_t cbRow; /* Bytes in a row of the output image */
|
||||
int do_interlace; /* Do interlacing internally */
|
||||
int is_transparent; /* Transparency information was present. */
|
||||
int has_tRNS; /* color type GRAY or RGB with a tRNS chunk. */
|
||||
int speed; /* Doing a speed test */
|
||||
int use_update_info;/* Call update_info, not start_image */
|
||||
struct
|
||||
@@ -4619,14 +4700,14 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
|
||||
case 0:
|
||||
dp->transparent.red = dp->transparent.green = dp->transparent.blue =
|
||||
trans_color->gray;
|
||||
dp->is_transparent = 1;
|
||||
dp->has_tRNS = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
dp->transparent.red = trans_color->red;
|
||||
dp->transparent.green = trans_color->green;
|
||||
dp->transparent.blue = trans_color->blue;
|
||||
dp->is_transparent = 1;
|
||||
dp->has_tRNS = 1;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@@ -5518,7 +5599,7 @@ image_pixel_add_alpha(image_pixel *this, PNG_CONST standard_display *display)
|
||||
if (this->colour_type == PNG_COLOR_TYPE_GRAY)
|
||||
{
|
||||
if (this->bit_depth < 8)
|
||||
this->bit_depth = 8;
|
||||
this->bit_depth = this->sample_depth = 8;
|
||||
|
||||
if (this->have_tRNS)
|
||||
{
|
||||
@@ -5553,9 +5634,11 @@ image_pixel_add_alpha(image_pixel *this, PNG_CONST standard_display *display)
|
||||
this->alphaf = 0;
|
||||
else
|
||||
this->alphaf = 1;
|
||||
|
||||
this->colour_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
}
|
||||
else
|
||||
this->alphaf = 1;
|
||||
|
||||
this->colour_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
}
|
||||
|
||||
/* The error in the alpha is zero and the sBIT value comes from the
|
||||
@@ -5848,8 +5931,9 @@ transform_info_imp(transform_display *dp, png_structp pp, png_infop pi)
|
||||
/* If png_set_filler is in action then fake the output color type to include
|
||||
* an alpha channel where appropriate.
|
||||
*/
|
||||
if (dp->output_bit_depth >= 8 && (dp->output_colour_type == PNG_COLOR_TYPE_RGB ||
|
||||
dp->output_colour_type == PNG_COLOR_TYPE_GRAY) && dp->this.filler)
|
||||
if (dp->output_bit_depth >= 8 &&
|
||||
(dp->output_colour_type == PNG_COLOR_TYPE_RGB ||
|
||||
dp->output_colour_type == PNG_COLOR_TYPE_GRAY) && dp->this.filler)
|
||||
dp->output_colour_type |= 4;
|
||||
|
||||
/* Validate the combination of colour type and bit depth that we are getting
|
||||
@@ -6372,6 +6456,13 @@ image_transform_png_set_tRNS_to_alpha_set(PNG_CONST image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
png_set_tRNS_to_alpha(pp);
|
||||
|
||||
/* If there was a tRNS chunk that would get expanded and add an alpha
|
||||
* channel is_transparent must be updated:
|
||||
*/
|
||||
if (that->this.has_tRNS)
|
||||
that->this.is_transparent = 1;
|
||||
|
||||
this->next->set(this->next, that, pp, pi);
|
||||
}
|
||||
|
||||
@@ -6430,6 +6521,7 @@ image_transform_png_set_gray_to_rgb_set(PNG_CONST image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
png_set_gray_to_rgb(pp);
|
||||
/* NOTE: this doesn't result in tRNS expansion. */
|
||||
this->next->set(this->next, that, pp, pi);
|
||||
}
|
||||
|
||||
@@ -6489,6 +6581,10 @@ image_transform_png_set_expand_set(PNG_CONST image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
png_set_expand(pp);
|
||||
|
||||
if (that->this.has_tRNS)
|
||||
that->this.is_transparent = 1;
|
||||
|
||||
this->next->set(this->next, that, pp, pi);
|
||||
}
|
||||
|
||||
@@ -6539,6 +6635,7 @@ image_transform_png_set_expand_gray_1_2_4_to_8_set(
|
||||
png_infop pi)
|
||||
{
|
||||
png_set_expand_gray_1_2_4_to_8(pp);
|
||||
/* NOTE: don't expect this to expand tRNS */
|
||||
this->next->set(this->next, that, pp, pi);
|
||||
}
|
||||
|
||||
@@ -6570,6 +6667,11 @@ image_transform_png_set_expand_16_set(PNG_CONST image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
png_set_expand_16(pp);
|
||||
|
||||
/* NOTE: at present libpng does SET_EXPAND as well, so tRNS is expanded. */
|
||||
if (that->this.has_tRNS)
|
||||
that->this.is_transparent = 1;
|
||||
|
||||
this->next->set(this->next, that, pp, pi);
|
||||
}
|
||||
|
||||
@@ -6940,14 +7042,14 @@ image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this,
|
||||
* When DIGITIZE is set because a pre-1.7 version of libpng is being
|
||||
* tested allow a bigger slack.
|
||||
*
|
||||
* NOTE: this magic number was determined by experiment to be 1.25.
|
||||
* There's no great merit to the value below, however it only affects
|
||||
* the limit used for checking for internal calculation errors, not
|
||||
* the actual limit imposed by pngvalid on the output errors.
|
||||
* NOTE: this magic number was determined by experiment to be about
|
||||
* 1.263. There's no great merit to the value below, however it only
|
||||
* affects the limit used for checking for internal calculation errors,
|
||||
* not the actual limit imposed by pngvalid on the output errors.
|
||||
*/
|
||||
that->pm->limit += pow(
|
||||
# if DIGITIZE
|
||||
1.25
|
||||
1.3
|
||||
# else
|
||||
1.0
|
||||
# endif
|
||||
@@ -7111,7 +7213,8 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
const unsigned int sample_depth = that->sample_depth;
|
||||
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||
sample_depth);
|
||||
const unsigned int gamma_depth = (sample_depth == 16 ? 16 :
|
||||
const unsigned int gamma_depth = (sample_depth == 16 ?
|
||||
PNG_MAX_GAMMA_8 :
|
||||
(pm->assume_16_bit_calculations ? PNG_MAX_GAMMA_8 : sample_depth));
|
||||
int isgray;
|
||||
double r, g, b;
|
||||
@@ -7125,56 +7228,73 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
* will be identical after this operation if there is only one
|
||||
* transform, feel free to delete the png_error checks on this below in
|
||||
* the future (this is just me trying to ensure it works!)
|
||||
*
|
||||
* Interval arithmetic is exact, but to implement it it must be
|
||||
* possible to control the floating point implementation rounding mode.
|
||||
* This cannot be done in ANSI-C, so instead I reduce the 'lo' values
|
||||
* by DBL_EPSILON and increase the 'hi' values by the same.
|
||||
*/
|
||||
# define DD(v,d,r) (digitize(v*(1-DBL_EPSILON), d, r) * (1-DBL_EPSILON))
|
||||
# define DU(v,d,r) (digitize(v*(1+DBL_EPSILON), d, r) * (1+DBL_EPSILON))
|
||||
|
||||
r = rlo = rhi = that->redf;
|
||||
rlo -= that->rede;
|
||||
rlo = digitize(rlo, calc_depth, 1/*round*/);
|
||||
rlo = DD(rlo, calc_depth, 1/*round*/);
|
||||
rhi += that->rede;
|
||||
rhi = digitize(rhi, calc_depth, 1/*round*/);
|
||||
rhi = DU(rhi, calc_depth, 1/*round*/);
|
||||
|
||||
g = glo = ghi = that->greenf;
|
||||
glo -= that->greene;
|
||||
glo = digitize(glo, calc_depth, 1/*round*/);
|
||||
glo = DD(glo, calc_depth, 1/*round*/);
|
||||
ghi += that->greene;
|
||||
ghi = digitize(ghi, calc_depth, 1/*round*/);
|
||||
ghi = DU(ghi, calc_depth, 1/*round*/);
|
||||
|
||||
b = blo = bhi = that->bluef;
|
||||
blo -= that->bluee;
|
||||
blo = digitize(blo, calc_depth, 1/*round*/);
|
||||
blo = DD(blo, calc_depth, 1/*round*/);
|
||||
bhi += that->greene;
|
||||
bhi = digitize(bhi, calc_depth, 1/*round*/);
|
||||
bhi = DU(bhi, calc_depth, 1/*round*/);
|
||||
|
||||
isgray = r==g && g==b;
|
||||
|
||||
if (data.gamma != 1)
|
||||
{
|
||||
PNG_CONST double power = 1/data.gamma;
|
||||
PNG_CONST double abse = calc_depth == 16 ? .5/65535 : .5/255;
|
||||
PNG_CONST double abse = .5/(sample_depth == 16 ? 65535 : 255);
|
||||
|
||||
/* 'abse' is the absolute error permitted in linear calculations. It
|
||||
* is used here to capture the error permitted in the handling
|
||||
* (undoing) of the gamma encoding. Once again digitization occurs
|
||||
* to handle the upper and lower bounds of the values. This is
|
||||
* where the real errors are introduced.
|
||||
/* If a gamma calculation is done it is done using lookup tables of
|
||||
* precision gamma_depth, so the already digitized value above may
|
||||
* need to be further digitized here.
|
||||
*/
|
||||
if (gamma_depth != calc_depth)
|
||||
{
|
||||
rlo = DD(rlo, gamma_depth, 0/*truncate*/);
|
||||
rhi = DU(rhi, gamma_depth, 0/*truncate*/);
|
||||
glo = DD(glo, gamma_depth, 0/*truncate*/);
|
||||
ghi = DU(ghi, gamma_depth, 0/*truncate*/);
|
||||
blo = DD(blo, gamma_depth, 0/*truncate*/);
|
||||
bhi = DU(bhi, gamma_depth, 0/*truncate*/);
|
||||
}
|
||||
|
||||
/* 'abse' is the error in the gamma table calculation itself. */
|
||||
r = pow(r, power);
|
||||
rlo = digitize(pow(rlo, power)-abse, calc_depth, 1);
|
||||
rhi = digitize(pow(rhi, power)+abse, calc_depth, 1);
|
||||
rlo = DD(pow(rlo, power)-abse, calc_depth, 1);
|
||||
rhi = DU(pow(rhi, power)+abse, calc_depth, 1);
|
||||
|
||||
g = pow(g, power);
|
||||
glo = digitize(pow(glo, power)-abse, calc_depth, 1);
|
||||
ghi = digitize(pow(ghi, power)+abse, calc_depth, 1);
|
||||
glo = DD(pow(glo, power)-abse, calc_depth, 1);
|
||||
ghi = DU(pow(ghi, power)+abse, calc_depth, 1);
|
||||
|
||||
b = pow(b, power);
|
||||
blo = digitize(pow(blo, power)-abse, calc_depth, 1);
|
||||
bhi = digitize(pow(bhi, power)+abse, calc_depth, 1);
|
||||
blo = DD(pow(blo, power)-abse, calc_depth, 1);
|
||||
bhi = DU(pow(bhi, power)+abse, calc_depth, 1);
|
||||
}
|
||||
|
||||
/* Now calculate the actual gray values. Although the error in the
|
||||
* coefficients depends on whether they were specified on the command
|
||||
* line (in which case truncation to 15 bits happened) or not (rounding
|
||||
* was used) the maxium error in an individual coefficient is always
|
||||
* 1/32768, because even in the rounding case the requirement that
|
||||
* 2/32768, because even in the rounding case the requirement that
|
||||
* coefficients add up to 32768 can cause a larger rounding error.
|
||||
*
|
||||
* The only time when rounding doesn't occur in 1.5.5 and later is when
|
||||
@@ -7185,19 +7305,19 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
|
||||
{
|
||||
PNG_CONST int do_round = data.gamma != 1 || calc_depth == 16;
|
||||
PNG_CONST double ce = 1. / 32768;
|
||||
PNG_CONST double ce = 2. / 32768;
|
||||
|
||||
graylo = digitize(rlo * (data.red_coefficient-ce) +
|
||||
graylo = DD(rlo * (data.red_coefficient-ce) +
|
||||
glo * (data.green_coefficient-ce) +
|
||||
blo * (data.blue_coefficient-ce), gamma_depth, do_round);
|
||||
if (graylo <= 0)
|
||||
graylo = 0;
|
||||
blo * (data.blue_coefficient-ce), calc_depth, do_round);
|
||||
if (graylo > gray) /* always accept the right answer */
|
||||
graylo = gray;
|
||||
|
||||
grayhi = digitize(rhi * (data.red_coefficient+ce) +
|
||||
grayhi = DU(rhi * (data.red_coefficient+ce) +
|
||||
ghi * (data.green_coefficient+ce) +
|
||||
bhi * (data.blue_coefficient+ce), gamma_depth, do_round);
|
||||
if (grayhi >= 1)
|
||||
grayhi = 1;
|
||||
bhi * (data.blue_coefficient+ce), calc_depth, do_round);
|
||||
if (grayhi < gray)
|
||||
grayhi = gray;
|
||||
}
|
||||
|
||||
/* And invert the gamma. */
|
||||
@@ -7205,11 +7325,25 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
{
|
||||
PNG_CONST double power = data.gamma;
|
||||
|
||||
/* And this happens yet again, shifting the values once more. */
|
||||
if (gamma_depth != sample_depth)
|
||||
{
|
||||
rlo = DD(rlo, gamma_depth, 0/*truncate*/);
|
||||
rhi = DU(rhi, gamma_depth, 0/*truncate*/);
|
||||
glo = DD(glo, gamma_depth, 0/*truncate*/);
|
||||
ghi = DU(ghi, gamma_depth, 0/*truncate*/);
|
||||
blo = DD(blo, gamma_depth, 0/*truncate*/);
|
||||
bhi = DU(bhi, gamma_depth, 0/*truncate*/);
|
||||
}
|
||||
|
||||
gray = pow(gray, power);
|
||||
graylo = digitize(pow(graylo, power), sample_depth, 1);
|
||||
grayhi = digitize(pow(grayhi, power), sample_depth, 1);
|
||||
graylo = DD(pow(graylo, power), sample_depth, 1);
|
||||
grayhi = DU(pow(grayhi, power), sample_depth, 1);
|
||||
}
|
||||
|
||||
# undef DD
|
||||
# undef DU
|
||||
|
||||
/* Now the error can be calculated.
|
||||
*
|
||||
* If r==g==b because there is no overall gamma correction libpng
|
||||
@@ -7260,16 +7394,28 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
{
|
||||
/* There is no need to do the conversions to and from linear space,
|
||||
* so the calculation should be a lot more accurate. There is a
|
||||
* built in 1/32768 error in the coefficients because they only have
|
||||
* 15 bits and are adjusted to make sure they add up to 32768, so
|
||||
* the result may have an additional error up to 1/32768. (Note
|
||||
* that adding the 1/32768 here avoids needing to increase the
|
||||
* global error limits to take this into account.)
|
||||
* built in error in the coefficients because they only have 15 bits
|
||||
* and are adjusted to make sure they add up to 32768. This
|
||||
* involves a integer calculation with truncation of the form:
|
||||
*
|
||||
* ((int)(coefficient * 100000) * 32768)/100000
|
||||
*
|
||||
* This is done to the red and green coefficients (the ones
|
||||
* provided to the API) then blue is calculated from them so the
|
||||
* result adds up to 32768. In the worst case this can result in
|
||||
* a -1 error in red and green and a +2 error in blue. Consequently
|
||||
* the worst case in the calculation below is 2/32768 error.
|
||||
*
|
||||
* TODO: consider fixing this in libpng by rounding the calculation
|
||||
* limiting the error to 1/32768.
|
||||
*
|
||||
* Handling this by adding 2/32768 here avoids needing to increase
|
||||
* the global error limits to take this into account.)
|
||||
*/
|
||||
gray = r * data.red_coefficient + g * data.green_coefficient +
|
||||
b * data.blue_coefficient;
|
||||
err = re * data.red_coefficient + ge * data.green_coefficient +
|
||||
be * data.blue_coefficient + 1./32768 + gray * 5 * DBL_EPSILON;
|
||||
be * data.blue_coefficient + 2./32768 + gray * 5 * DBL_EPSILON;
|
||||
}
|
||||
|
||||
else
|
||||
@@ -7304,7 +7450,7 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
* previously added input quantization error at this point.
|
||||
*/
|
||||
gray = r * data.red_coefficient + g * data.green_coefficient +
|
||||
b * data.blue_coefficient - 1./32768 - out_qe;
|
||||
b * data.blue_coefficient - 2./32768 - out_qe;
|
||||
if (gray <= 0)
|
||||
gray = 0;
|
||||
else
|
||||
@@ -7314,7 +7460,7 @@ image_transform_png_set_rgb_to_gray_mod(PNG_CONST image_transform *this,
|
||||
}
|
||||
|
||||
grayhi = rhi * data.red_coefficient + ghi * data.green_coefficient +
|
||||
bhi * data.blue_coefficient + 1./32768 + out_qe;
|
||||
bhi * data.blue_coefficient + 2./32768 + out_qe;
|
||||
grayhi *= (1 + 6 * DBL_EPSILON);
|
||||
if (grayhi >= 1)
|
||||
grayhi = 1;
|
||||
@@ -7429,6 +7575,9 @@ image_transform_png_set_background_set(PNG_CONST image_transform *this,
|
||||
|
||||
else
|
||||
{
|
||||
if (that->this.has_tRNS)
|
||||
that->this.is_transparent = 1;
|
||||
|
||||
bit_depth = that->this.bit_depth;
|
||||
expand = 1;
|
||||
}
|
||||
@@ -7506,14 +7655,14 @@ image_transform_png_set_background_mod(PNG_CONST image_transform *this,
|
||||
/* Remove the alpha type and set the alpha (not in that order.) */
|
||||
that->alphaf = 1;
|
||||
that->alphae = 0;
|
||||
|
||||
if (that->colour_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
that->colour_type = PNG_COLOR_TYPE_RGB;
|
||||
else if (that->colour_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
that->colour_type = PNG_COLOR_TYPE_GRAY;
|
||||
/* PNG_COLOR_TYPE_PALETTE is not changed */
|
||||
}
|
||||
|
||||
if (that->colour_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
that->colour_type = PNG_COLOR_TYPE_RGB;
|
||||
else if (that->colour_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
that->colour_type = PNG_COLOR_TYPE_GRAY;
|
||||
/* PNG_COLOR_TYPE_PALETTE is not changed */
|
||||
|
||||
this->next->mod(this->next, that, pp, display);
|
||||
}
|
||||
|
||||
@@ -8301,7 +8450,8 @@ perform_transform_test(png_modifier *pm)
|
||||
png_byte bit_depth = 0;
|
||||
unsigned int palette_number = 0;
|
||||
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, 0))
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, pm->test_lbg,
|
||||
pm->test_tRNS))
|
||||
{
|
||||
png_uint_32 counter = 0;
|
||||
size_t base_pos;
|
||||
@@ -8604,7 +8754,9 @@ init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
|
||||
vi->outlog = outlog(dp->pm, in_depth, out_depth);
|
||||
|
||||
if ((dp->this.colour_type & PNG_COLOR_MASK_ALPHA) != 0 ||
|
||||
(dp->this.colour_type == 3 && dp->this.is_transparent))
|
||||
(dp->this.colour_type == 3 && dp->this.is_transparent) ||
|
||||
((dp->this.colour_type == 0 || dp->this.colour_type == 2) &&
|
||||
dp->this.has_tRNS))
|
||||
{
|
||||
vi->do_background = dp->do_background;
|
||||
|
||||
@@ -8634,7 +8786,7 @@ init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
|
||||
vi->background_blue = b;
|
||||
}
|
||||
}
|
||||
else
|
||||
else /* Do not expect any background processing */
|
||||
vi->do_background = 0;
|
||||
|
||||
if (vi->do_background == 0)
|
||||
@@ -9350,6 +9502,7 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
png_uint_32 y;
|
||||
PNG_CONST store_palette_entry *in_palette = dp->this.palette;
|
||||
PNG_CONST int in_is_transparent = dp->this.is_transparent;
|
||||
int process_tRNS;
|
||||
int out_npalette = -1;
|
||||
int out_is_transparent = 0; /* Just refers to the palette case */
|
||||
store_palette out_palette;
|
||||
@@ -9365,6 +9518,7 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
|
||||
processing = (vi.gamma_correction > 0 && !dp->threshold_test)
|
||||
|| in_bd != out_bd || in_ct != out_ct || vi.do_background;
|
||||
process_tRNS = dp->this.has_tRNS && vi.do_background;
|
||||
|
||||
/* TODO: FIX THIS: MAJOR BUG! If the transformations all happen inside
|
||||
* the palette there is no way of finding out, because libpng fails to
|
||||
@@ -9403,8 +9557,8 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
/* Handle input alpha - png_set_background will cause the output
|
||||
* alpha to disappear so there is nothing to check.
|
||||
*/
|
||||
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 || (in_ct == 3 &&
|
||||
in_is_transparent))
|
||||
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 ||
|
||||
(in_ct == 3 && in_is_transparent))
|
||||
{
|
||||
PNG_CONST unsigned int input_alpha = in_ct == 3 ?
|
||||
dp->this.palette[in_index].alpha :
|
||||
@@ -9436,6 +9590,35 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
}
|
||||
}
|
||||
|
||||
else if (process_tRNS)
|
||||
{
|
||||
/* alpha needs to be set appropriately for this pixel, it is
|
||||
* currently 1 and needs to be 0 for an input pixel which matches
|
||||
* the values in tRNS.
|
||||
*/
|
||||
switch (in_ct)
|
||||
{
|
||||
case 0: /* gray */
|
||||
if (sample(std, in_ct, in_bd, x, 0, 0, 0) ==
|
||||
dp->this.transparent.red)
|
||||
alpha = 0;
|
||||
break;
|
||||
|
||||
case 2: /* RGB */
|
||||
if (sample(std, in_ct, in_bd, x, 0, 0, 0) ==
|
||||
dp->this.transparent.red &&
|
||||
sample(std, in_ct, in_bd, x, 1, 0, 0) ==
|
||||
dp->this.transparent.green &&
|
||||
sample(std, in_ct, in_bd, x, 2, 0, 0) ==
|
||||
dp->this.transparent.blue)
|
||||
alpha = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle grayscale or RGB components. */
|
||||
if ((in_ct & PNG_COLOR_MASK_COLOR) == 0) /* grayscale */
|
||||
(void)gamma_component_validate("gray", &vi,
|
||||
@@ -9545,7 +9728,7 @@ gamma_test(png_modifier *pmIn, PNG_CONST png_byte colour_typeIn,
|
||||
|
||||
modification_reset(d.pm->modifications);
|
||||
|
||||
/* Get a png_struct for writing the image. */
|
||||
/* Get a png_struct for reading the image. */
|
||||
pp = set_modifier_for_read(d.pm, &pi, d.this.id, name);
|
||||
standard_palette_init(&d.this);
|
||||
|
||||
@@ -9684,9 +9867,13 @@ perform_gamma_threshold_tests(png_modifier *pm)
|
||||
/* Don't test more than one instance of each palette - it's pointless, in
|
||||
* fact this test is somewhat excessive since libpng doesn't make this
|
||||
* decision based on colour type or bit depth!
|
||||
*
|
||||
* CHANGED: now test two palettes and, as a side effect, images with and
|
||||
* without tRNS.
|
||||
*/
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, 1/*gamma*/))
|
||||
if (palette_number == 0)
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number,
|
||||
pm->test_lbg_gamma_threshold, pm->test_tRNS))
|
||||
if (palette_number < 2)
|
||||
{
|
||||
double test_gamma = 1.0;
|
||||
while (test_gamma >= .4)
|
||||
@@ -9746,7 +9933,8 @@ static void perform_gamma_transform_tests(png_modifier *pm)
|
||||
png_byte bit_depth = 0;
|
||||
unsigned int palette_number = 0;
|
||||
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, 1/*gamma*/))
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number,
|
||||
pm->test_lbg_gamma_transform, pm->test_tRNS))
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
@@ -9776,7 +9964,8 @@ static void perform_gamma_sbit_tests(png_modifier *pm)
|
||||
png_byte colour_type = 0, bit_depth = 0;
|
||||
unsigned int npalette = 0;
|
||||
|
||||
while (next_format(&colour_type, &bit_depth, &npalette, 1/*gamma*/))
|
||||
while (next_format(&colour_type, &bit_depth, &npalette,
|
||||
pm->test_lbg_gamma_sbit, pm->test_tRNS))
|
||||
if ((colour_type & PNG_COLOR_MASK_ALPHA) == 0 &&
|
||||
((colour_type == 3 && sbit < 8) ||
|
||||
(colour_type != 3 && sbit < bit_depth)))
|
||||
@@ -9967,8 +10156,17 @@ static void gamma_composition_test(png_modifier *pm,
|
||||
}
|
||||
|
||||
background.index = 193; /* rgb(193,193,193) to detect errors */
|
||||
|
||||
if (!(colour_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
/* Because, currently, png_set_background is always called with
|
||||
* 'need_expand' false in this case and because the gamma test itself
|
||||
* doesn't cause an expand to 8-bit for lower bit depths the colour must
|
||||
* be reduced to the correct range.
|
||||
*/
|
||||
if (bit_depth < 8)
|
||||
background.gray &= (png_uint_16)((1U << bit_depth)-1);
|
||||
|
||||
/* Grayscale input, we do not convert to RGB (TBD), so we must set the
|
||||
* background to gray - else libpng seems to fail.
|
||||
*/
|
||||
@@ -10017,9 +10215,18 @@ perform_gamma_composition_tests(png_modifier *pm, int do_background,
|
||||
|
||||
/* Skip the non-alpha cases - there is no setting of a transparency colour at
|
||||
* present.
|
||||
*
|
||||
* TODO: incorrect; the palette case sets tRNS and, now RGB and gray do,
|
||||
* however the palette case fails miserably so is commented out below.
|
||||
*/
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number, 1/*gamma*/))
|
||||
if ((colour_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||
while (next_format(&colour_type, &bit_depth, &palette_number,
|
||||
pm->test_lbg_gamma_composition, pm->test_tRNS))
|
||||
if ((colour_type & PNG_COLOR_MASK_ALPHA) != 0
|
||||
#if 0 /* TODO: FIXME */
|
||||
/*TODO: FIXME: this should work */
|
||||
|| colour_type == 3
|
||||
#endif
|
||||
|| (colour_type != 3 && palette_number != 0))
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
@@ -10751,6 +10958,18 @@ int main(int argc, char **argv)
|
||||
pm.ngammas = ARRAY_SIZE(gammas);
|
||||
pm.ngamma_tests = 0; /* default to off */
|
||||
|
||||
/* Low bit depth gray images don't do well in the gamma tests, until
|
||||
* this is fixed turn them off for some gamma cases:
|
||||
*/
|
||||
# ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
pm.test_tRNS = 1;
|
||||
# endif
|
||||
pm.test_lbg = 0;
|
||||
pm.test_lbg_gamma_threshold = 1;
|
||||
pm.test_lbg_gamma_transform = 0/*PNG_LIBPNG_VER >= 10700*/;
|
||||
pm.test_lbg_gamma_sbit = 1;
|
||||
pm.test_lbg_gamma_composition = 0;
|
||||
|
||||
/* And the test encodings */
|
||||
pm.encodings = test_encodings;
|
||||
pm.nencodings = ARRAY_SIZE(test_encodings);
|
||||
@@ -10863,7 +11082,7 @@ int main(int argc, char **argv)
|
||||
pm.test_gamma_transform = 1;
|
||||
pm.test_gamma_sbit = 1;
|
||||
pm.test_gamma_scale16 = 1;
|
||||
pm.test_gamma_background = 1;
|
||||
pm.test_gamma_background = 1; /* composition */
|
||||
pm.test_gamma_alpha_mode = 1;
|
||||
}
|
||||
|
||||
@@ -10912,6 +11131,24 @@ int main(int argc, char **argv)
|
||||
else if (strcmp(*argv, "--noexpand16") == 0)
|
||||
pm.test_gamma_expand16 = 0;
|
||||
|
||||
else if (strcmp(*argv, "--low-depth-gray") == 0)
|
||||
pm.test_lbg = pm.test_lbg_gamma_threshold =
|
||||
pm.test_lbg_gamma_transform = pm.test_lbg_gamma_sbit =
|
||||
pm.test_lbg_gamma_composition = 1;
|
||||
|
||||
else if (strcmp(*argv, "--nolow-depth-gray") == 0)
|
||||
pm.test_lbg = pm.test_lbg_gamma_threshold =
|
||||
pm.test_lbg_gamma_transform = pm.test_lbg_gamma_sbit =
|
||||
pm.test_lbg_gamma_composition = 0;
|
||||
|
||||
# ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
else if (strcmp(*argv, "--tRNS") == 0)
|
||||
pm.test_tRNS = 1;
|
||||
# endif
|
||||
|
||||
else if (strcmp(*argv, "--notRNS") == 0)
|
||||
pm.test_tRNS = 0;
|
||||
|
||||
else if (strcmp(*argv, "--more-gammas") == 0)
|
||||
pm.ngamma_tests = 3U;
|
||||
|
||||
@@ -11102,7 +11339,7 @@ int main(int argc, char **argv)
|
||||
Try
|
||||
{
|
||||
/* Make useful base images */
|
||||
make_transform_images(&pm.this);
|
||||
make_transform_images(&pm);
|
||||
|
||||
/* Perform the standard and gamma tests. */
|
||||
if (pm.test_standard)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.17rc04 - March 16, 2015
|
||||
libpng version 1.6.18beta01 - April 1, 2015
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2015 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.6.17rc04 - March 16, 2015
|
||||
libpng versions 0.97, January 1998, through 1.6.18beta01 - April 1, 2015
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
|
||||
@@ -5279,13 +5279,13 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
XVI. Y2K Compliance in libpng
|
||||
|
||||
March 16, 2015
|
||||
April 1, 2015
|
||||
|
||||
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.6.17rc04 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.18beta01 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
|
||||
|
||||
24
libpng.3
24
libpng.3
@@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "March 16, 2015"
|
||||
.TH LIBPNG 3 "April 1, 2015"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.17rc04
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.18beta01
|
||||
.SH SYNOPSIS
|
||||
\fB
|
||||
#include <png.h>\fP
|
||||
@@ -504,7 +504,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.6.17rc04 - March 16, 2015
|
||||
libpng version 1.6.18beta01 - April 1, 2015
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
@@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.17rc04 - March 16, 2015
|
||||
libpng versions 0.97, January 1998, through 1.6.18beta01 - April 1, 2015
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
|
||||
@@ -5783,13 +5783,13 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
.SH XVI. Y2K Compliance in libpng
|
||||
|
||||
March 16, 2015
|
||||
April 1, 2015
|
||||
|
||||
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.6.17rc04 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.18beta01 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
|
||||
@@ -6042,7 +6042,9 @@ the first widely used release:
|
||||
1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||
1.6.16 16 10616 16.so.16.16[.0]
|
||||
1.6.17beta01-06 16 10617 16.so.16.17[.0]
|
||||
1.6.17rc01-04 16 10617 16.so.16.17[.0]
|
||||
1.6.17rc01-06 16 10617 16.so.16.17[.0]
|
||||
1.6.17 16 10617 16.so.16.17[.0]
|
||||
1.6.18beta01 16 10618 16.so.16.18[.0]
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@@ -6099,7 +6101,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.6.17rc04 - March 16, 2015:
|
||||
Libpng version 1.6.18beta01 - April 1, 2015:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
|
||||
@@ -6122,8 +6124,8 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.17rc04, March 16, 2015, are
|
||||
Copyright (c) 2004,2006-2014 Glenn Randers-Pehrson, and are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.18beta01, April 1, 2015, are
|
||||
Copyright (c) 2004,2006-2015 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
|
||||
|
||||
@@ -6221,7 +6223,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
March 16, 2015
|
||||
April 1, 2015
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "March 16, 2015"
|
||||
.TH LIBPNGPF 3 "April 1, 2015"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.17rc04
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.18beta01
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include \fI"pngpriv.h"
|
||||
|
||||
2
png.5
2
png.5
@@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "March 16, 2015"
|
||||
.TH PNG 5 "April 1, 2015"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
||||
12
png.c
12
png.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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_6_17rc04 Your_png_h_is_not_version_1_6_17rc04;
|
||||
typedef png_libpng_version_1_6_18beta01 Your_png_h_is_not_version_1_6_18beta01;
|
||||
|
||||
/* 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
|
||||
@@ -766,13 +766,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.17rc04 - March 16, 2015" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.18beta01 - April 1, 2015" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2015 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.6.17rc04 - March 16, 2015\
|
||||
return "libpng version 1.6.18beta01 - April 1, 2015\
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@@ -3034,7 +3034,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
/* Check for an exponent, if we don't need one we are
|
||||
* done and just need to terminate the string. At
|
||||
* this point exp_b10==(-1) is effectively if flag - it got
|
||||
* to '-1' because of the decrement after outputing
|
||||
* to '-1' because of the decrement after outputting
|
||||
* the decimal point above (the exponent required is
|
||||
* *not* -1!)
|
||||
*/
|
||||
@@ -3042,7 +3042,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
{
|
||||
/* The following only happens if we didn't output the
|
||||
* leading zeros above for negative exponent, so this
|
||||
* doest add to the digit requirement. Note that the
|
||||
* doesn't add to the digit requirement. Note that the
|
||||
* two zeros here can only be output if the two leading
|
||||
* zeros were *not* output, so this doesn't increase
|
||||
* the output count.
|
||||
|
||||
30
png.h
30
png.h
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.17rc04, March 16, 2015
|
||||
* libpng version 1.6.18beta01, April 1, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -12,7 +12,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.6.17rc04, March 16, 2015: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.6.18beta01, April 1, 2015: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@@ -214,7 +214,9 @@
|
||||
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||
* 1.6.17beta01-06 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17rc01-04 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17rc01-06 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17 16 10617 16.so.16.17[.0]
|
||||
* 1.6.18beta01 16 10618 16.so.16.18[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@@ -246,7 +248,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.17rc04, March 16, 2015, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.18beta01, April 1, 2015, are
|
||||
* Copyright (c) 2004, 2006-2015 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:
|
||||
@@ -358,13 +360,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 16, 2015
|
||||
* April 1, 2015
|
||||
*
|
||||
* 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.6.17rc04 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.18beta01 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
|
||||
@@ -426,9 +428,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.17rc04"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.18beta01"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.17rc04 - March 16, 2015\n"
|
||||
" libpng version 1.6.18beta01 - April 1, 2015\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@@ -436,13 +438,13 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 17
|
||||
#define PNG_LIBPNG_VER_RELEASE 18
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
*/
|
||||
|
||||
#define PNG_LIBPNG_VER_BUILD 04
|
||||
#define PNG_LIBPNG_VER_BUILD 01
|
||||
|
||||
/* Release Status */
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
@@ -459,7 +461,7 @@
|
||||
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
|
||||
PNG_LIBPNG_BUILD_PRIVATE */
|
||||
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_RC
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
@@ -467,7 +469,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10617 /* 1.6.17 */
|
||||
#define PNG_LIBPNG_VER 10618 /* 1.6.18 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@@ -572,7 +574,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_6_17rc04;
|
||||
typedef char* png_libpng_version_1_6_18beta01;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@@ -1595,6 +1597,7 @@ PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
|
||||
*/
|
||||
PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
||||
int filters));
|
||||
#endif /* WRITE */
|
||||
|
||||
/* Flags for png_set_filter() to say which filters to use. The flags
|
||||
* are chosen so that they don't conflict with real filter types
|
||||
@@ -1620,6 +1623,7 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
||||
#define PNG_FILTER_VALUE_PAETH 4
|
||||
#define PNG_FILTER_VALUE_LAST 5
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
|
||||
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
|
||||
* defines, either the default (minimum-sum-of-absolute-differences), or
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.17rc04, (PENDING RELEASE)
|
||||
* libpng version 1.6.18beta01, (PENDING RELEASE)
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
||||
4
pngget.c
4
pngget.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -1123,7 +1123,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_byte PNGAPI
|
||||
png_get_rgb_to_gray_status (png_const_structrp png_ptr)
|
||||
{
|
||||
return (png_byte)((png_ptr ? png_ptr->rgb_to_gray_status : 0) & 0xff);
|
||||
return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -168,7 +168,7 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
|
||||
png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
|
||||
num_to_check);
|
||||
png_ptr->sig_bytes = (png_byte)((png_ptr->sig_bytes + num_to_check) & 0xff);
|
||||
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
||||
|
||||
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -1823,6 +1823,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
y = (y + 128) >> 8;
|
||||
y *= 255;
|
||||
y = PNG_sRGB_FROM_LINEAR((y + 64) >> 7);
|
||||
alpha = PNG_DIV257(alpha);
|
||||
encoding = P_sRGB;
|
||||
}
|
||||
|
||||
@@ -2052,7 +2053,7 @@ make_rgb_colormap(png_image_read_control *display)
|
||||
|
||||
/* Return a palette index to the above palette given three 8-bit sRGB values. */
|
||||
#define PNG_RGB_INDEX(r,g,b) \
|
||||
((png_byte)(0xff & (6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b))))
|
||||
((png_byte)(6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b)))
|
||||
|
||||
static int
|
||||
png_image_read_colormap(png_voidp argument)
|
||||
@@ -3025,8 +3026,7 @@ png_image_read_and_map(png_voidp argument)
|
||||
*outrow = gray;
|
||||
|
||||
else
|
||||
*outrow =
|
||||
(png_byte)(0xff & (PNG_CMAP_TRANS_BACKGROUND+1));
|
||||
*outrow = (png_byte)(PNG_CMAP_TRANS_BACKGROUND+1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
2
pngrio.c
2
pngrio.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
||||
216
pngrtran.c
216
pngrtran.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -143,7 +143,7 @@ png_set_background_fixed(png_structrp png_ptr,
|
||||
|
||||
png_ptr->background = *background_color;
|
||||
png_ptr->background_gamma = background_gamma;
|
||||
png_ptr->background_gamma_type = (png_byte)(0xff & background_gamma_code);
|
||||
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
|
||||
if (need_expand != 0)
|
||||
png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
|
||||
else
|
||||
@@ -1176,8 +1176,8 @@ png_init_palette_transformations(png_structrp png_ptr)
|
||||
int i, istop = png_ptr->num_trans;
|
||||
|
||||
for (i=0; i<istop; i++)
|
||||
png_ptr->trans_alpha[i] = (png_byte)(0xff & (255 -
|
||||
png_ptr->trans_alpha[i]));
|
||||
png_ptr->trans_alpha[i] = (png_byte)(255 -
|
||||
png_ptr->trans_alpha[i]);
|
||||
}
|
||||
}
|
||||
#endif /* READ_INVERT_ALPHA */
|
||||
@@ -2023,14 +2023,14 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
|
||||
info_ptr->color_type = (png_byte)(0xff & (info_ptr->color_type |
|
||||
PNG_COLOR_MASK_COLOR));
|
||||
info_ptr->color_type = (png_byte)(info_ptr->color_type |
|
||||
PNG_COLOR_MASK_COLOR);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
|
||||
info_ptr->color_type = (png_byte)(0xff & (info_ptr->color_type &
|
||||
~PNG_COLOR_MASK_COLOR));
|
||||
info_ptr->color_type = (png_byte)(info_ptr->color_type &
|
||||
~PNG_COLOR_MASK_COLOR);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
@@ -2072,8 +2072,8 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
||||
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0)
|
||||
{
|
||||
info_ptr->color_type = (png_byte)(0xff & (info_ptr->color_type &
|
||||
~PNG_COLOR_MASK_ALPHA));
|
||||
info_ptr->color_type = (png_byte)(info_ptr->color_type &
|
||||
~PNG_COLOR_MASK_ALPHA);
|
||||
info_ptr->num_trans = 0;
|
||||
}
|
||||
#endif
|
||||
@@ -2106,8 +2106,8 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
}
|
||||
#endif
|
||||
|
||||
info_ptr->pixel_depth = (png_byte)(0xff & (info_ptr->channels *
|
||||
info_ptr->bit_depth));
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
|
||||
info_ptr->bit_depth);
|
||||
|
||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
|
||||
|
||||
@@ -2218,7 +2218,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
break;
|
||||
}
|
||||
row_info->bit_depth = 8;
|
||||
row_info->pixel_depth = (png_byte)(0xff & (8 * row_info->channels));
|
||||
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
|
||||
row_info->rowbytes = row_width * row_info->channels;
|
||||
}
|
||||
}
|
||||
@@ -2356,8 +2356,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
|
||||
value >>= shift[channel];
|
||||
if (++channel >= channels)
|
||||
channel = 0;
|
||||
*bp++ = (png_byte)(0xff & (value >> 8));
|
||||
*bp++ = (png_byte)(0xff & value);
|
||||
*bp++ = (png_byte)(value >> 8);
|
||||
*bp++ = (png_byte)value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2420,7 +2420,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
|
||||
row_info->bit_depth = 8;
|
||||
row_info->pixel_depth = (png_byte)(0xff & (8 * row_info->channels));
|
||||
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
|
||||
row_info->rowbytes = row_info->width * row_info->channels;
|
||||
}
|
||||
}
|
||||
@@ -2448,7 +2448,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
|
||||
row_info->bit_depth = 8;
|
||||
row_info->pixel_depth = (png_byte)(0xff & (8 * row_info->channels));
|
||||
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
|
||||
row_info->rowbytes = row_info->width * row_info->channels;
|
||||
}
|
||||
}
|
||||
@@ -2570,7 +2570,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = (png_byte)(0xff & (255 - *(--sp)));
|
||||
*(--dp) = (png_byte)(255 - *(--sp));
|
||||
|
||||
/* This does nothing:
|
||||
*(--dp) = *(--sp);
|
||||
@@ -2593,8 +2593,8 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = (png_byte)(0xff & (255 - *(--sp)));
|
||||
*(--dp) = (png_byte)(0xff & (255 - *(--sp)));
|
||||
*(--dp) = (png_byte)(255 - *(--sp));
|
||||
*(--dp) = (png_byte)(255 - *(--sp));
|
||||
|
||||
/* This does nothing:
|
||||
*(--dp) = *(--sp);
|
||||
@@ -2622,7 +2622,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = (png_byte)(0xff & (255 - *(--sp)));
|
||||
*(--dp) = (png_byte)(255 - *(--sp));
|
||||
*(--dp) = *(--sp);
|
||||
}
|
||||
}
|
||||
@@ -2637,8 +2637,8 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = (png_byte)(0xff & (255 - *(--sp)));
|
||||
*(--dp) = (png_byte)(0xff & (255 - *(--sp)));
|
||||
*(--dp) = (png_byte)(255 - *(--sp));
|
||||
*(--dp) = (png_byte)(255 - *(--sp));
|
||||
/*
|
||||
*(--dp) = *(--sp);
|
||||
*(--dp) = *(--sp);
|
||||
@@ -2662,9 +2662,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
png_uint_32 row_width = row_info->width;
|
||||
|
||||
#ifdef PNG_READ_16BIT_SUPPORTED
|
||||
png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
|
||||
png_byte hi_filler = (png_byte)(filler>>8);
|
||||
#endif
|
||||
png_byte lo_filler = (png_byte)(filler & 0xff);
|
||||
png_byte lo_filler = (png_byte)filler;
|
||||
|
||||
png_debug(1, "in png_do_read_filler");
|
||||
|
||||
@@ -2918,10 +2918,10 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
}
|
||||
}
|
||||
row_info->channels = (png_byte)(0xff & (row_info->channels + 2));
|
||||
row_info->channels = (png_byte)(row_info->channels + 2);
|
||||
row_info->color_type |= PNG_COLOR_MASK_COLOR;
|
||||
row_info->pixel_depth = (png_byte)(0xff & (row_info->channels *
|
||||
row_info->bit_depth));
|
||||
row_info->pixel_depth = (png_byte)(row_info->channels *
|
||||
row_info->bit_depth);
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
||||
}
|
||||
}
|
||||
@@ -3063,8 +3063,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
/* NOTE: this is the historical approach which simply
|
||||
* truncates the results.
|
||||
*/
|
||||
*(dp++) =
|
||||
(png_byte)(0xff & ((rc*red + gc*green + bc*blue)>>15));
|
||||
*(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3106,16 +3105,16 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
|
||||
else
|
||||
{
|
||||
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff)
|
||||
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red & 0xff)
|
||||
>> png_ptr->gamma_shift][red>>8];
|
||||
png_uint_16 green_1 =
|
||||
png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||
png_ptr->gamma_16_to_1[(green & 0xff) >>
|
||||
png_ptr->gamma_shift][green>>8];
|
||||
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff)
|
||||
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue & 0xff)
|
||||
>> png_ptr->gamma_shift][blue>>8];
|
||||
png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1
|
||||
+ bc*blue_1 + 16384)>>15);
|
||||
w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
|
||||
w = png_ptr->gamma_16_from_1[(gray16 & 0xff) >>
|
||||
png_ptr->gamma_shift][gray16 >> 8];
|
||||
rgb_error |= 1;
|
||||
}
|
||||
@@ -3167,11 +3166,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
}
|
||||
|
||||
row_info->channels = (png_byte)(0xff & (row_info->channels - 2));
|
||||
row_info->color_type = (png_byte)(0xff & (row_info->color_type &
|
||||
~PNG_COLOR_MASK_COLOR));
|
||||
row_info->pixel_depth = (png_byte)(0xff & (row_info->channels *
|
||||
row_info->bit_depth));
|
||||
row_info->channels = (png_byte)(row_info->channels - 2);
|
||||
row_info->color_type = (png_byte)(row_info->color_type &
|
||||
~PNG_COLOR_MASK_COLOR);
|
||||
row_info->pixel_depth = (png_byte)(row_info->channels *
|
||||
row_info->bit_depth);
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
||||
}
|
||||
return rgb_error;
|
||||
@@ -3413,10 +3412,10 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
if (v == png_ptr->trans_color.gray)
|
||||
{
|
||||
/* Background is already in screen gamma */
|
||||
*sp = (png_byte)(0xff &
|
||||
(png_ptr->background.gray >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff &
|
||||
png_ptr->background.gray);
|
||||
*sp = (png_byte)((png_ptr->background.gray >> 8)
|
||||
& 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.gray
|
||||
& 0xff);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3439,10 +3438,10 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
|
||||
if (v == png_ptr->trans_color.gray)
|
||||
{
|
||||
*sp = (png_byte)(0xff &
|
||||
(png_ptr->background.gray >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff &
|
||||
png_ptr->background.gray);
|
||||
*sp = (png_byte)((png_ptr->background.gray >> 8)
|
||||
& 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.gray
|
||||
& 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3520,18 +3519,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
b == png_ptr->trans_color.blue)
|
||||
{
|
||||
/* Background is already in screen gamma */
|
||||
*sp = (png_byte)(0xff &
|
||||
(png_ptr->background.red >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff &
|
||||
png_ptr->background.red);
|
||||
*(sp + 2) = (png_byte)(0xff &
|
||||
(png_ptr->background.green >> 8));
|
||||
*(sp + 3) = (png_byte)(0xff &
|
||||
png_ptr->background.green);
|
||||
*(sp + 4) = (png_byte)(0xff &
|
||||
(png_ptr->background.blue >> 8));
|
||||
*(sp + 5) = (png_byte)(0xff &
|
||||
png_ptr->background.blue);
|
||||
*sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
|
||||
*(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
|
||||
& 0xff);
|
||||
*(sp + 3) = (png_byte)(png_ptr->background.green
|
||||
& 0xff);
|
||||
*(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
|
||||
& 0xff);
|
||||
*(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3569,15 +3565,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
g == png_ptr->trans_color.green &&
|
||||
b == png_ptr->trans_color.blue)
|
||||
{
|
||||
*sp = (png_byte)(0xff & (png_ptr->background.red >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff & png_ptr->background.red);
|
||||
*(sp + 2) = (png_byte)(0xff &
|
||||
(png_ptr->background.green >> 8));
|
||||
*(sp + 3) = (png_byte)(0xff &
|
||||
png_ptr->background.green);
|
||||
*(sp + 4) = (png_byte)(0xff &
|
||||
(png_ptr->background.blue >> 8));
|
||||
*(sp + 5) = (png_byte)(0xff & png_ptr->background.blue);
|
||||
*sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
|
||||
*(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
|
||||
& 0xff);
|
||||
*(sp + 3) = (png_byte)(png_ptr->background.green
|
||||
& 0xff);
|
||||
*(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
|
||||
& 0xff);
|
||||
*(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3659,9 +3655,9 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
else if (a == 0)
|
||||
{
|
||||
/* Background is already in screen gamma */
|
||||
*sp = (png_byte)(0xff &
|
||||
(png_ptr->background.gray >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff & png_ptr->background.gray);
|
||||
*sp = (png_byte)((png_ptr->background.gray >> 8)
|
||||
& 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3673,7 +3669,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
if (optimize != 0)
|
||||
w = v;
|
||||
else
|
||||
w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
|
||||
w = gamma_16_from_1[(v & 0xff) >>
|
||||
gamma_shift][v >> 8];
|
||||
*sp = (png_byte)((w >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(w & 0xff);
|
||||
}
|
||||
@@ -3690,9 +3687,9 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
|
||||
if (a == 0)
|
||||
{
|
||||
*sp = (png_byte)(0xff &
|
||||
(png_ptr->background.gray >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff & png_ptr->background.gray);
|
||||
*sp = (png_byte)((png_ptr->background.gray >> 8)
|
||||
& 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
|
||||
}
|
||||
|
||||
else if (a < 0xffff)
|
||||
@@ -3819,15 +3816,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
else if (a == 0)
|
||||
{
|
||||
/* Background is already in screen gamma */
|
||||
*sp = (png_byte)(0xff & (png_ptr->background.red >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff & png_ptr->background.red );
|
||||
*(sp + 2) = (png_byte)(0xff &
|
||||
(png_ptr->background.green >> 8));
|
||||
*(sp + 3) = (png_byte)(0xff &
|
||||
png_ptr->background.green);
|
||||
*(sp + 4) = (png_byte)(0xff &
|
||||
(png_ptr->background.blue >> 8));
|
||||
*(sp + 5) = (png_byte)(0xff & png_ptr->background.blue);
|
||||
*sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
|
||||
*(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
|
||||
& 0xff);
|
||||
*(sp + 3) = (png_byte)(png_ptr->background.green
|
||||
& 0xff);
|
||||
*(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
|
||||
& 0xff);
|
||||
*(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3837,15 +3834,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
|
||||
png_composite_16(w, v, a, png_ptr->background_1.red);
|
||||
if (optimize == 0)
|
||||
w = gamma_16_from_1[((w & 0xff) >>
|
||||
gamma_shift)][w >> 8];
|
||||
w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
|
||||
8];
|
||||
*sp = (png_byte)((w >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(w & 0xff);
|
||||
|
||||
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
|
||||
png_composite_16(w, v, a, png_ptr->background_1.green);
|
||||
if (optimize == 0)
|
||||
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
|
||||
w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
|
||||
8];
|
||||
|
||||
*(sp + 2) = (png_byte)((w >> 8) & 0xff);
|
||||
@@ -3854,7 +3851,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
|
||||
png_composite_16(w, v, a, png_ptr->background_1.blue);
|
||||
if (optimize == 0)
|
||||
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
|
||||
w = gamma_16_from_1[((w & 0xff) >> gamma_shift)][w >>
|
||||
8];
|
||||
|
||||
*(sp + 4) = (png_byte)((w >> 8) & 0xff);
|
||||
@@ -3874,16 +3871,15 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
|
||||
if (a == 0)
|
||||
{
|
||||
*sp = (png_byte)(0xff & (png_ptr->background.red >> 8));
|
||||
*(sp + 1) = (png_byte)(0xff & png_ptr->background.red);
|
||||
*(sp + 2) = (png_byte)(0xff &
|
||||
(png_ptr->background.green >> 8));
|
||||
*(sp + 3) = (png_byte)(0xff &
|
||||
png_ptr->background.green);
|
||||
*(sp + 4) = (png_byte)(0xff &
|
||||
(png_ptr->background.blue >> 8));
|
||||
*(sp + 5) = (png_byte)(0xff &
|
||||
png_ptr->background.blue & 0xff);
|
||||
*sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
|
||||
*(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
|
||||
*(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
|
||||
& 0xff);
|
||||
*(sp + 3) = (png_byte)(png_ptr->background.green
|
||||
& 0xff);
|
||||
*(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
|
||||
& 0xff);
|
||||
*(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
|
||||
}
|
||||
|
||||
else if (a < 0xffff)
|
||||
@@ -4070,12 +4066,11 @@ png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
int c = *sp & 0x0c;
|
||||
int d = *sp & 0x03;
|
||||
|
||||
*sp = (png_byte)(0xff &
|
||||
(((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)|
|
||||
*sp = (png_byte)(
|
||||
((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)|
|
||||
((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
|
||||
((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
|
||||
((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) & 0xff))
|
||||
);
|
||||
((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) ));
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
@@ -4406,8 +4401,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
value = (*sp >> shift) & 0x03;
|
||||
*dp = (png_byte)(0xff & (value | (value << 2) |
|
||||
(value << 4) | (value << 6)));
|
||||
*dp = (png_byte)(value | (value << 2) | (value << 4) |
|
||||
(value << 6));
|
||||
if (shift == 6)
|
||||
{
|
||||
shift = 0;
|
||||
@@ -4431,7 +4426,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
value = (*sp >> shift) & 0x0f;
|
||||
*dp = (png_byte)(0xff & (value | (value << 4)));
|
||||
*dp = (png_byte)(value | (value << 4));
|
||||
if (shift == 4)
|
||||
{
|
||||
shift = 0;
|
||||
@@ -4502,8 +4497,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
|
||||
row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||
row_info->channels = 2;
|
||||
row_info->pixel_depth =
|
||||
(png_byte)(0xff & (row_info->bit_depth << 1));
|
||||
row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
|
||||
row_width);
|
||||
}
|
||||
@@ -4570,7 +4564,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
row_info->channels = 4;
|
||||
row_info->pixel_depth = (png_byte)(0xff & (row_info->bit_depth << 2));
|
||||
row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
||||
}
|
||||
}
|
||||
@@ -4603,7 +4597,7 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
|
||||
|
||||
row_info->rowbytes *= 2;
|
||||
row_info->bit_depth = 16;
|
||||
row_info->pixel_depth = (png_byte)(0xff & (row_info->channels * 16));
|
||||
row_info->pixel_depth = (png_byte)(row_info->channels * 16);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4991,8 +4985,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
if (png_ptr->user_transform_channels != 0)
|
||||
row_info->channels = png_ptr->user_transform_channels;
|
||||
#endif
|
||||
row_info->pixel_depth = (png_byte)(0xff & (row_info->bit_depth *
|
||||
row_info->channels));
|
||||
row_info->pixel_depth = (png_byte)(row_info->bit_depth *
|
||||
row_info->channels);
|
||||
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
|
||||
}
|
||||
|
||||
50
pngrutil.c
50
pngrutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.18 [(PENDING RELEASE)]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -575,7 +575,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
*/
|
||||
png_alloc_size_t limit = PNG_SIZE_MAX;
|
||||
|
||||
# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
@@ -822,13 +822,13 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
/* Set internal variables */
|
||||
png_ptr->width = width;
|
||||
png_ptr->height = height;
|
||||
png_ptr->bit_depth = (png_byte)(bit_depth & 0xff);
|
||||
png_ptr->interlaced = (png_byte)(interlace_type & 0xff);
|
||||
png_ptr->color_type = (png_byte)(color_type & 0xff);
|
||||
png_ptr->bit_depth = (png_byte)bit_depth;
|
||||
png_ptr->interlaced = (png_byte)interlace_type;
|
||||
png_ptr->color_type = (png_byte)color_type;
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
png_ptr->filter_type = (png_byte)(filter_type & 0xff);
|
||||
png_ptr->filter_type = (png_byte)filter_type;
|
||||
#endif
|
||||
png_ptr->compression_type = (png_byte)(compression_type & 0xff);
|
||||
png_ptr->compression_type = (png_byte)compression_type;
|
||||
|
||||
/* Find number of channels */
|
||||
switch (png_ptr->color_type)
|
||||
@@ -853,8 +853,7 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
}
|
||||
|
||||
/* Set up other useful info */
|
||||
png_ptr->pixel_depth =
|
||||
(png_byte)(0xff & (png_ptr->bit_depth * png_ptr->channels));
|
||||
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels);
|
||||
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
|
||||
png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
|
||||
png_debug1(3, "channels = %d", png_ptr->channels);
|
||||
@@ -2716,7 +2715,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
|
||||
# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
@@ -2732,8 +2731,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
|
||||
/* The following is safe because of the PNG_SIZE_MAX init above */
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
|
||||
/* 'mode' is a flag array, only the bottom four bits matter here */
|
||||
png_ptr->unknown_chunk.location =
|
||||
(png_byte)(0xff & png_ptr->mode/*SAFE*/);
|
||||
png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/;
|
||||
|
||||
if (length == 0)
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
@@ -3230,7 +3228,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
if (m != 0) /* something to copy */
|
||||
{
|
||||
if (m != 0xff)
|
||||
*dp = (png_byte)(((*dp & ~m) | (*sp & m)) & 0xff);
|
||||
*dp = (png_byte)((*dp & ~m) | (*sp & m));
|
||||
else
|
||||
*dp = *sp;
|
||||
}
|
||||
@@ -3482,8 +3480,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
|
||||
/* Restore the overwritten bits from the last byte if necessary. */
|
||||
if (end_ptr != NULL)
|
||||
*end_ptr =
|
||||
(png_byte)(0xff & ((end_byte & end_mask) | (*end_ptr & ~end_mask)));
|
||||
*end_ptr = (png_byte)((end_byte & end_mask) | (*end_ptr & ~end_mask));
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
@@ -3777,14 +3774,16 @@ png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
|
||||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
*rp = (png_byte)(((int)(*rp) + ((int)(*pp++) / 2 )) & 0xff);
|
||||
*rp = (png_byte)(((int)(*rp) +
|
||||
((int)(*pp++) / 2 )) & 0xff);
|
||||
|
||||
rp++;
|
||||
}
|
||||
|
||||
for (i = 0; i < istop; i++)
|
||||
{
|
||||
*rp = (png_byte)(((int)(*rp) + (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);
|
||||
*rp = (png_byte)(((int)(*rp) +
|
||||
(int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);
|
||||
|
||||
rp++;
|
||||
}
|
||||
@@ -3800,7 +3799,7 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
|
||||
/* First pixel/byte */
|
||||
c = *prev_row++;
|
||||
a = *row + c;
|
||||
*row++ = (png_byte)(a & 0xff);
|
||||
*row++ = (png_byte)a;
|
||||
|
||||
/* Remainder */
|
||||
while (row < rp_end)
|
||||
@@ -3834,7 +3833,7 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
|
||||
*/
|
||||
c = b;
|
||||
a += *row;
|
||||
*row++ = (png_byte)(a & 0xff);
|
||||
*row++ = (png_byte)a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3851,7 +3850,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
while (row < rp_end)
|
||||
{
|
||||
int a = *row + *prev_row++;
|
||||
*row++ = (png_byte)(a & 0xff);
|
||||
*row++ = (png_byte)a;
|
||||
}
|
||||
|
||||
/* Remainder */
|
||||
@@ -3882,7 +3881,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
if (pc < pa) a = c;
|
||||
|
||||
a += *row;
|
||||
*row++ = (png_byte)(a & 0xff);
|
||||
*row++ = (png_byte)a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4375,7 +4374,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
/* This value is stored in png_struct and double checked in the row read
|
||||
* code.
|
||||
*/
|
||||
png_ptr->maximum_pixel_depth = (png_byte)(max_pixel_depth & 0xff);
|
||||
png_ptr->maximum_pixel_depth = (png_byte)max_pixel_depth;
|
||||
png_ptr->transformed_pixel_depth = 0; /* calculated on demand */
|
||||
|
||||
/* Align the width on the next larger 8 pixels. Mainly used
|
||||
@@ -4447,11 +4446,8 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_debug1(3, "height = %u,", png_ptr->height);
|
||||
png_debug1(3, "iwidth = %u,", png_ptr->iwidth);
|
||||
png_debug1(3, "num_rows = %u,", png_ptr->num_rows);
|
||||
png_debug1(3, "row_bytes = %lu,", (unsigned long)row_bytes);
|
||||
png_debug1(3, "png_ptr->rowbytes = %lu,", (unsigned long)png_ptr->rowbytes);
|
||||
png_debug1(3, "png_ptr->info_rowbytes = %lu,",
|
||||
(unsigned long)png_ptr->info_rowbytes);
|
||||
png_debug1(3, "PNG_ROWBYTES = %lu",
|
||||
png_debug1(3, "rowbytes = %lu,", (unsigned long)png_ptr->rowbytes);
|
||||
png_debug1(3, "irowbytes = %lu",
|
||||
(unsigned long)PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
|
||||
|
||||
/* The sequential reader needs a buffer for IDAT, but the progressive reader
|
||||
|
||||
2
pngset.c
2
pngset.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -2028,4 +2028,4 @@ main(void)
|
||||
#endif
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_17rc04 Your_png_h_is_not_version_1_6_17rc04;
|
||||
typedef png_libpng_version_1_6_18beta01 Your_png_h_is_not_version_1_6_18beta01;
|
||||
|
||||
15
pngtrans.c
15
pngtrans.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -273,7 +273,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < istop; i++)
|
||||
{
|
||||
*rp = (png_byte)((~(*rp)) & 0xff);
|
||||
*rp = (png_byte)(~(*rp));
|
||||
rp++;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < istop; i += 2)
|
||||
{
|
||||
*rp = (png_byte)((~(*rp)) & 0xff);
|
||||
*rp = (png_byte)(~(*rp));
|
||||
rp += 2;
|
||||
}
|
||||
}
|
||||
@@ -302,8 +302,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0; i < istop; i += 4)
|
||||
{
|
||||
*rp = (png_byte)((~(*rp)) & 0xff);
|
||||
*(rp + 1) = (png_byte)((~(*(rp + 1))) & 0xff);
|
||||
*rp = (png_byte)(~(*rp));
|
||||
*(rp + 1) = (png_byte)(~(*(rp + 1)));
|
||||
rp += 4;
|
||||
}
|
||||
}
|
||||
@@ -803,9 +803,8 @@ png_set_user_transform_info(png_structrp png_ptr, png_voidp
|
||||
#endif
|
||||
|
||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||
png_ptr->user_transform_depth = (png_byte)(user_transform_depth & 0xff);
|
||||
png_ptr->user_transform_channels =
|
||||
(png_byte)(user_transform_channels & 0xff);
|
||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
65
pngwrite.c
65
pngwrite.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -219,7 +219,7 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
|
||||
int j;
|
||||
for (j = 0; j<(int)info_ptr->num_trans; j++)
|
||||
info_ptr->trans_alpha[j] =
|
||||
(png_byte)((255 - info_ptr->trans_alpha[j]) & 0xff);
|
||||
(png_byte)(255 - info_ptr->trans_alpha[j]);
|
||||
}
|
||||
#endif
|
||||
png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
|
||||
@@ -457,11 +457,11 @@ png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime)
|
||||
png_debug(1, "in png_convert_from_struct_tm");
|
||||
|
||||
ptime->year = (png_uint_16)(1900 + ttime->tm_year);
|
||||
ptime->month = (png_byte)((ttime->tm_mon + 1) & 0xff);
|
||||
ptime->day = (png_byte)(ttime->tm_mday & 0xff);
|
||||
ptime->hour = (png_byte)(ttime->tm_hour & 0xff);
|
||||
ptime->minute = (png_byte)(ttime->tm_min & 0xff);
|
||||
ptime->second = (png_byte)(ttime->tm_sec & 0xff);
|
||||
ptime->month = (png_byte)(ttime->tm_mon + 1);
|
||||
ptime->day = (png_byte)ttime->tm_mday;
|
||||
ptime->hour = (png_byte)ttime->tm_hour;
|
||||
ptime->minute = (png_byte)ttime->tm_min;
|
||||
ptime->second = (png_byte)ttime->tm_sec;
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
@@ -638,8 +638,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
||||
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
||||
*(rp) = (png_byte)(*rp - *(rp + 1));
|
||||
*(rp + 2) = (png_byte)(*(rp + 2) - *(rp + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,10 +665,10 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||
*(rp ) = (png_byte)(red >> 8);
|
||||
*(rp + 1) = (png_byte)red;
|
||||
*(rp + 4) = (png_byte)(blue >> 8);
|
||||
*(rp + 5) = (png_byte)blue;
|
||||
}
|
||||
}
|
||||
#endif /* WRITE_16BIT */
|
||||
@@ -811,8 +811,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
|
||||
row_info.width = png_ptr->usr_width;
|
||||
row_info.channels = png_ptr->usr_channels;
|
||||
row_info.bit_depth = png_ptr->usr_bit_depth;
|
||||
row_info.pixel_depth =
|
||||
(png_byte)(0xff & (row_info.bit_depth * row_info.channels));
|
||||
row_info.pixel_depth = (png_byte)(row_info.bit_depth * row_info.channels);
|
||||
row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
|
||||
|
||||
png_debug1(3, "row_info->color_type = %d", row_info.color_type);
|
||||
@@ -1038,7 +1037,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
png_ptr->do_filter = PNG_FILTER_PAETH; break;
|
||||
|
||||
default:
|
||||
png_ptr->do_filter = (png_byte)(filters & 0xff); break;
|
||||
png_ptr->do_filter = (png_byte)filters; break;
|
||||
#else
|
||||
default:
|
||||
png_app_error(png_ptr, "Unknown row filter for method 0");
|
||||
@@ -1071,8 +1070,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
if (png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Can't add Up filter after starting");
|
||||
png_ptr->do_filter =
|
||||
(png_byte)((png_ptr->do_filter & ~PNG_FILTER_UP) & 0xff);
|
||||
png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
|
||||
~PNG_FILTER_UP);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1089,8 +1088,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
if (png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Can't add Average filter after starting");
|
||||
png_ptr->do_filter =
|
||||
(png_byte)((png_ptr->do_filter & ~PNG_FILTER_AVG) & 0xff);
|
||||
png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
|
||||
~PNG_FILTER_AVG);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1107,7 +1106,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
if (png_ptr->prev_row == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Can't add Paeth filter after starting");
|
||||
png_ptr->do_filter &= (png_byte)((~PNG_FILTER_PAETH) & 0xff);
|
||||
png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1211,7 +1210,7 @@ png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
|
||||
}
|
||||
|
||||
/* Safe to set this now */
|
||||
png_ptr->num_prev_filters = (png_byte)(num_weights & 0xff);
|
||||
png_ptr->num_prev_filters = (png_byte)num_weights;
|
||||
}
|
||||
|
||||
/* If, in the future, there are other filter methods, this would
|
||||
@@ -1891,7 +1890,7 @@ png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
|
||||
component *= 255;
|
||||
|
||||
/* Convert the component to sRGB. */
|
||||
return (png_byte)(PNG_sRGB_FROM_LINEAR(component) & 0xff);
|
||||
return (png_byte)PNG_sRGB_FROM_LINEAR(component);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1940,7 +1939,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
while (out_ptr < row_end)
|
||||
{
|
||||
png_uint_16 alpha = in_ptr[aindex];
|
||||
png_byte alphabyte = (png_byte)(PNG_DIV257(alpha) & 0xff);
|
||||
png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
|
||||
png_uint_32 reciprocal = 0;
|
||||
int c;
|
||||
|
||||
@@ -1983,7 +1982,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
png_uint_32 component = *in_ptr++;
|
||||
|
||||
component *= 255;
|
||||
*out_ptr++ = (png_byte)(PNG_sRGB_FROM_LINEAR(component) & 0xff);
|
||||
*out_ptr++ = (png_byte)PNG_sRGB_FROM_LINEAR(component);
|
||||
}
|
||||
|
||||
png_write_row(png_ptr, output_row);
|
||||
@@ -2042,23 +2041,23 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
{
|
||||
if (channels >= 3) /* RGB */
|
||||
{
|
||||
palette[i].blue = (png_byte)(0xff & PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[(2 ^ bgr)]));
|
||||
palette[i].green = (png_byte)(0xff & PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[1]));
|
||||
palette[i].red = (png_byte)(0xff & PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[bgr]));
|
||||
palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[(2 ^ bgr)]);
|
||||
palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[1]);
|
||||
palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
|
||||
entry[bgr]);
|
||||
}
|
||||
|
||||
else /* Gray */
|
||||
palette[i].blue = palette[i].red = palette[i].green =
|
||||
(png_byte)(PNG_sRGB_FROM_LINEAR((255 * *entry)) & 0xff);
|
||||
(png_byte)PNG_sRGB_FROM_LINEAR(255 * *entry);
|
||||
}
|
||||
|
||||
else /* alpha */
|
||||
{
|
||||
png_uint_16 alpha = entry[afirst ? 0 : channels-1];
|
||||
png_byte alphabyte = (png_byte)(PNG_DIV257(alpha) & 0xff);
|
||||
png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
|
||||
png_uint_32 reciprocal = 0;
|
||||
|
||||
/* Calculate a reciprocal, as in the png_write_image_8bit code above
|
||||
|
||||
31
pngwtran.c
31
pngwtran.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -56,14 +56,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
else
|
||||
{
|
||||
mask = 0x80;
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
dp++;
|
||||
v = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask != 0x80)
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 6;
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
dp++;
|
||||
v = 0;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
}
|
||||
|
||||
if (shift != 6)
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 4;
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
dp++;
|
||||
v = 0;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
}
|
||||
|
||||
if (shift != 4)
|
||||
*dp = (png_byte)(v & 0xff);
|
||||
*dp = (png_byte)v;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -150,9 +150,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
break;
|
||||
}
|
||||
|
||||
row_info->bit_depth = (png_byte)(bit_depth & 0xff);
|
||||
row_info->pixel_depth =
|
||||
(png_byte)((bit_depth * row_info->channels) & 0xff);
|
||||
row_info->bit_depth = (png_byte)bit_depth;
|
||||
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
|
||||
row_info->width);
|
||||
}
|
||||
@@ -423,7 +422,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = *(sp++);
|
||||
*/
|
||||
sp+=3; dp = sp;
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,8 +445,8 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = *(sp++);
|
||||
*/
|
||||
sp+=6; dp = sp;
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* WRITE_16BIT */
|
||||
@@ -465,7 +464,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||
{
|
||||
*(dp++) = *(sp++);
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,8 +483,8 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*(dp++) = *(sp++);
|
||||
*/
|
||||
sp+=2; dp = sp;
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)((255 - *(sp++)) & 0xff);
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* WRITE_16BIT */
|
||||
|
||||
112
pngwutil.c
112
pngwutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
@@ -23,10 +23,10 @@
|
||||
void PNGAPI
|
||||
png_save_uint_32(png_bytep buf, png_uint_32 i)
|
||||
{
|
||||
buf[0] = (png_byte)((i >> 24) & 0xff);
|
||||
buf[1] = (png_byte)((i >> 16) & 0xff);
|
||||
buf[2] = (png_byte)((i >> 8) & 0xff);
|
||||
buf[3] = (png_byte)(i & 0xff);
|
||||
buf[0] = (png_byte)(i >> 24);
|
||||
buf[1] = (png_byte)(i >> 16);
|
||||
buf[2] = (png_byte)(i >> 8);
|
||||
buf[3] = (png_byte)(i );
|
||||
}
|
||||
|
||||
/* Place a 16-bit number into a buffer in PNG byte order.
|
||||
@@ -36,8 +36,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
|
||||
void PNGAPI
|
||||
png_save_uint_16(png_bytep buf, unsigned int i)
|
||||
{
|
||||
buf[0] = (png_byte)((i >> 8) & 0xff);
|
||||
buf[1] = (png_byte)(i & 0xff);
|
||||
buf[0] = (png_byte)(i >> 8);
|
||||
buf[1] = (png_byte)(i );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -278,10 +278,10 @@ optimize_cmf(png_bytep data, png_alloc_size_t data_size)
|
||||
|
||||
z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
|
||||
|
||||
data[0] = (png_byte)(z_cmf & 0xff);
|
||||
data[0] = (png_byte)z_cmf;
|
||||
tmp = data[1] & 0xe0;
|
||||
tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
|
||||
data[1] = (png_byte)(tmp & 0xff);
|
||||
data[1] = (png_byte)tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -695,7 +695,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||
|
||||
while (*key && key_len < 79)
|
||||
{
|
||||
png_byte ch = (png_byte)(0xff & *key++);
|
||||
png_byte ch = (png_byte)*key++;
|
||||
|
||||
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
||||
*new_key++ = ch, ++key_len, space = 0;
|
||||
@@ -872,17 +872,17 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
#endif
|
||||
|
||||
/* Save the relevant information */
|
||||
png_ptr->bit_depth = (png_byte)(bit_depth & 0xff);
|
||||
png_ptr->color_type = (png_byte)(color_type & 0xff);
|
||||
png_ptr->interlaced = (png_byte)(interlace_type & 0xff);
|
||||
png_ptr->bit_depth = (png_byte)bit_depth;
|
||||
png_ptr->color_type = (png_byte)color_type;
|
||||
png_ptr->interlaced = (png_byte)interlace_type;
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
png_ptr->filter_type = (png_byte)(filter_type & 0xff);
|
||||
png_ptr->filter_type = (png_byte)filter_type;
|
||||
#endif
|
||||
png_ptr->compression_type = (png_byte)(compression_type & 0xff);
|
||||
png_ptr->compression_type = (png_byte)compression_type;
|
||||
png_ptr->width = width;
|
||||
png_ptr->height = height;
|
||||
|
||||
png_ptr->pixel_depth = (png_byte)((bit_depth * png_ptr->channels) & 0xff);
|
||||
png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels);
|
||||
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
|
||||
/* Set the usr info, so any transformations can modify it */
|
||||
png_ptr->usr_width = png_ptr->width;
|
||||
@@ -892,11 +892,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
/* Pack the header information into the buffer */
|
||||
png_save_uint_32(buf, width);
|
||||
png_save_uint_32(buf + 4, height);
|
||||
buf[8] = (png_byte)(bit_depth & 0xff);
|
||||
buf[9] = (png_byte)(color_type & 0xff);
|
||||
buf[10] = (png_byte)(compression_type & 0xff);
|
||||
buf[11] = (png_byte)(filter_type & 0xff);
|
||||
buf[12] = (png_byte)(interlace_type & 0xff);
|
||||
buf[8] = (png_byte)bit_depth;
|
||||
buf[9] = (png_byte)color_type;
|
||||
buf[10] = (png_byte)compression_type;
|
||||
buf[11] = (png_byte)filter_type;
|
||||
buf[12] = (png_byte)interlace_type;
|
||||
|
||||
/* Write the chunk */
|
||||
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
||||
@@ -1181,7 +1181,7 @@ png_write_sRGB(png_structrp png_ptr, int srgb_intent)
|
||||
png_warning(png_ptr,
|
||||
"Invalid sRGB rendering intent specified");
|
||||
|
||||
buf[0]=(png_byte)(srgb_intent & 0xff);
|
||||
buf[0]=(png_byte)srgb_intent;
|
||||
png_write_complete_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
|
||||
}
|
||||
#endif
|
||||
@@ -1285,10 +1285,10 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
|
||||
{
|
||||
if (spalette->depth == 8)
|
||||
{
|
||||
entrybuf[0] = (png_byte)(ep->red & 0xff);
|
||||
entrybuf[1] = (png_byte)(ep->green & 0xff);
|
||||
entrybuf[2] = (png_byte)(ep->blue & 0xff);
|
||||
entrybuf[3] = (png_byte)(ep->alpha & 0xff);
|
||||
entrybuf[0] = (png_byte)ep->red;
|
||||
entrybuf[1] = (png_byte)ep->green;
|
||||
entrybuf[2] = (png_byte)ep->blue;
|
||||
entrybuf[3] = (png_byte)ep->alpha;
|
||||
png_save_uint_16(entrybuf + 4, ep->frequency);
|
||||
}
|
||||
|
||||
@@ -1309,10 +1309,10 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
|
||||
{
|
||||
if (spalette->depth == 8)
|
||||
{
|
||||
entrybuf[0] = (png_byte)(ep[i].red & 0xff);
|
||||
entrybuf[1] = (png_byte)(ep[i].green & 0xff);
|
||||
entrybuf[2] = (png_byte)(ep[i].blue & 0xff);
|
||||
entrybuf[3] = (png_byte)(ep[i].alpha & 0xff);
|
||||
entrybuf[0] = (png_byte)ep[i].red;
|
||||
entrybuf[1] = (png_byte)ep[i].green;
|
||||
entrybuf[2] = (png_byte)ep[i].blue;
|
||||
entrybuf[3] = (png_byte)ep[i].alpha;
|
||||
png_save_uint_16(entrybuf + 4, ep[i].frequency);
|
||||
}
|
||||
|
||||
@@ -1348,8 +1348,8 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
|
||||
{
|
||||
png_byte maxbits;
|
||||
|
||||
maxbits = (png_byte)((color_type==PNG_COLOR_TYPE_PALETTE ? 8 :
|
||||
png_ptr->usr_bit_depth) & 0xff);
|
||||
maxbits = (png_byte)(color_type==PNG_COLOR_TYPE_PALETTE ? 8 :
|
||||
png_ptr->usr_bit_depth);
|
||||
|
||||
if (sbit->red == 0 || sbit->red > maxbits ||
|
||||
sbit->green == 0 || sbit->green > maxbits ||
|
||||
@@ -1786,7 +1786,7 @@ png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
|
||||
|
||||
png_save_int_32(buf, x_offset);
|
||||
png_save_int_32(buf + 4, y_offset);
|
||||
buf[8] = (png_byte)(unit_type & 0xff);
|
||||
buf[8] = (png_byte)unit_type;
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
|
||||
}
|
||||
@@ -1841,8 +1841,8 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
png_write_chunk_data(png_ptr, new_purpose, purpose_len);
|
||||
png_save_int_32(buf, X0);
|
||||
png_save_int_32(buf + 4, X1);
|
||||
buf[8] = (png_byte)(type & 0xff);
|
||||
buf[9] = (png_byte)(nparams & 0xff);
|
||||
buf[8] = (png_byte)type;
|
||||
buf[9] = (png_byte)nparams;
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)10);
|
||||
png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
|
||||
|
||||
@@ -1877,7 +1877,7 @@ png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width,
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = (png_byte)(unit & 0xff);
|
||||
buf[0] = (png_byte)unit;
|
||||
memcpy(buf + 1, width, wlen + 1); /* Append the '\0' here */
|
||||
memcpy(buf + wlen + 2, height, hlen); /* Do NOT append the '\0' here */
|
||||
|
||||
@@ -1902,7 +1902,7 @@ png_write_pHYs(png_structrp png_ptr, png_uint_32 x_pixels_per_unit,
|
||||
|
||||
png_save_uint_32(buf, x_pixels_per_unit);
|
||||
png_save_uint_32(buf + 4, y_pixels_per_unit);
|
||||
buf[8] = (png_byte)(unit_type & 0xff);
|
||||
buf[8] = (png_byte)unit_type;
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
|
||||
}
|
||||
@@ -1968,7 +1968,7 @@ png_write_start_row(png_structrp png_ptr)
|
||||
|
||||
/* 1.5.6: added to allow checking in the row write code. */
|
||||
png_ptr->transformed_pixel_depth = png_ptr->pixel_depth;
|
||||
png_ptr->maximum_pixel_depth = (png_byte)(usr_pixel_depth & 0xff);
|
||||
png_ptr->maximum_pixel_depth = (png_byte)usr_pixel_depth;
|
||||
|
||||
/* Set up row buffer */
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, buf_size);
|
||||
@@ -2180,7 +2180,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 7;
|
||||
*dp++ = (png_byte)(d & 0xff);
|
||||
*dp++ = (png_byte)d;
|
||||
d = 0;
|
||||
}
|
||||
|
||||
@@ -2189,7 +2189,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
|
||||
}
|
||||
if (shift != 7)
|
||||
*dp = (png_byte)(d & 0xff);
|
||||
*dp = (png_byte)d;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2218,7 +2218,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 6;
|
||||
*dp++ = (png_byte)(d & 0xff);
|
||||
*dp++ = (png_byte)d;
|
||||
d = 0;
|
||||
}
|
||||
|
||||
@@ -2226,7 +2226,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
shift -= 2;
|
||||
}
|
||||
if (shift != 6)
|
||||
*dp = (png_byte)(d & 0xff);
|
||||
*dp = (png_byte)d;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2254,7 +2254,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
if (shift == 0)
|
||||
{
|
||||
shift = 4;
|
||||
*dp++ = (png_byte)(d & 0xff);
|
||||
*dp++ = (png_byte)d;
|
||||
d = 0;
|
||||
}
|
||||
|
||||
@@ -2262,7 +2262,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
shift -= 4;
|
||||
}
|
||||
if (shift != 4)
|
||||
*dp = (png_byte)(d & 0xff);
|
||||
*dp = (png_byte)d;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2453,7 +2453,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (lp = row_buf + 1; i < row_bytes;
|
||||
i++, rp++, lp++, dp++)
|
||||
{
|
||||
*dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
||||
*dp = (png_byte)((int)*rp - (int)*lp);
|
||||
}
|
||||
|
||||
best_row = png_ptr->sub_row;
|
||||
@@ -2515,7 +2515,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (lp = row_buf + 1; i < row_bytes;
|
||||
i++, rp++, lp++, dp++)
|
||||
{
|
||||
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
||||
v = *dp = (png_byte)((int)*rp - (int)*lp);
|
||||
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
|
||||
@@ -2574,7 +2574,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
pp = prev_row + 1; i < row_bytes;
|
||||
i++, rp++, pp++, dp++)
|
||||
{
|
||||
*dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||
*dp = (png_byte)((int)*rp - (int)*pp);
|
||||
}
|
||||
|
||||
best_row = png_ptr->up_row;
|
||||
@@ -2625,7 +2625,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
||||
pp = prev_row + 1; i < row_bytes; i++)
|
||||
{
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
||||
v = *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
|
||||
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
|
||||
@@ -2683,13 +2683,13 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
*dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
||||
*dp++ = (png_byte)((int)*rp++ - ((int)*pp++ / 2));
|
||||
}
|
||||
|
||||
for (lp = row_buf + 1; i < row_bytes; i++)
|
||||
{
|
||||
*dp++ =
|
||||
(png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
|
||||
(png_byte)((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2));
|
||||
}
|
||||
best_row = png_ptr->avg_row;
|
||||
}
|
||||
@@ -2738,7 +2738,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
||||
v = *dp++ = (png_byte)((int)*rp++ - ((int)*pp++ / 2));
|
||||
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
}
|
||||
@@ -2746,7 +2746,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (lp = row_buf + 1; i < row_bytes; i++)
|
||||
{
|
||||
v = *dp++ =
|
||||
(png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
|
||||
(png_byte)(((int)*rp++ - ((int)*pp++ + (int)*lp++) / 2));
|
||||
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
|
||||
@@ -2804,7 +2804,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
*dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
||||
*dp++ = (png_byte)((int)*rp++ - (int)*pp++);
|
||||
}
|
||||
|
||||
for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
|
||||
@@ -2830,7 +2830,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
|
||||
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||
|
||||
*dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
||||
*dp++ = (png_byte)((int)*rp++ - p);
|
||||
}
|
||||
best_row = png_ptr->paeth_row;
|
||||
}
|
||||
@@ -2879,7 +2879,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
||||
v = *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
|
||||
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
}
|
||||
@@ -2921,7 +2921,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
p = c;
|
||||
#endif /* SLOW_PAETH */
|
||||
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
||||
v = *dp++ = (png_byte)((int)*rp++ - p);
|
||||
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.6.17rc04 - March 16, 2015
|
||||
libpng version 1.6.18beta01 - April 1, 2015
|
||||
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source
|
||||
*
|
||||
* libpng version 1.6.17rc04 - March 16, 2015
|
||||
* libpng version 1.6.18beta01 - April 1, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
Makefiles for libpng version 1.6.17rc04 - March 16, 2015
|
||||
Makefiles for libpng version 1.6.18beta01 - April 1, 2015
|
||||
|
||||
pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng16.so.16.1.6.17rc04)
|
||||
(gcc, creates libpng16.so.16.1.6.18beta01)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
@@ -33,12 +33,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 libpng16.so.16.1.6.17rc04)
|
||||
creates libpng16.so.16.1.6.18beta01)
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||
creates libpng16.so.16.1.6.17rc04)
|
||||
creates libpng16.so.16.1.6.18beta01)
|
||||
makefile.so9 => Solaris 9 makefile (gcc,
|
||||
creates libpng16.so.16.1.6.17rc04)
|
||||
creates libpng16.so.16.1.6.18beta01)
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
|
||||
@@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
|
||||
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
||||
PNG_DFN ""
|
||||
PNG_DFN "EXPORTS"
|
||||
PNG_DFN ";Version 1.6.17rc04"
|
||||
PNG_DFN ";Version 1.6.18beta01"
|
||||
|
||||
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
# Modeled after libxml-config.
|
||||
|
||||
version=1.6.17rc04
|
||||
version=1.6.18beta01
|
||||
prefix=""
|
||||
libdir=""
|
||||
libs=""
|
||||
|
||||
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
|
||||
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: 1.6.17rc04
|
||||
Version: 1.6.18beta01
|
||||
Libs: -L${libdir} -lpng16
|
||||
Cflags: -I${includedir}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
VERMAJ = 1
|
||||
VERMIN = 6
|
||||
VERMIC = 17
|
||||
VERMIC = 18
|
||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||
NAME = libpng
|
||||
PACKAGE = $(NAME)-$(VER)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 17
|
||||
RELEASE = 18
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).so
|
||||
|
||||
@@ -18,7 +18,7 @@ exec_prefix=$(prefix)
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 17
|
||||
RELEASE = 18
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).dll
|
||||
|
||||
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
|
||||
|
||||
LIB= png16
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.6.17rc04
|
||||
SHLIB_MINOR= 1.6.18beta01
|
||||
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
|
||||
|
||||
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
||||
|
||||
LIB= png
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.17rc04
|
||||
SHLIB_MINOR= 1.6.18beta01
|
||||
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
|
||||
|
||||
@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.17rc04
|
||||
SHLIB_MINOR= 1.6.18beta01
|
||||
|
||||
LIB= png
|
||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* libpng 1.6.17rc04 STANDARD API DEFINITION */
|
||||
/* libpng 1.6.18beta01 STANDARD API DEFINITION */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng version 1.6.17rc04 - March 16, 2015 */
|
||||
/* Libpng version 1.6.18beta01 - April 1, 2015 */
|
||||
|
||||
/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
|
||||
|
||||
@@ -101,8 +101,6 @@
|
||||
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
#define PNG_SETJMP_SUPPORTED
|
||||
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
#define PNG_SET_OPTION_SUPPORTED
|
||||
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
|
||||
@@ -49,6 +49,7 @@ pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $
|
||||
$(MOVE) pnglibconf.tmp $@
|
||||
|
||||
clean-pnglibconf:
|
||||
$(DELETE) pnglibconf.h pnglibconf.c pnglibconf.out
|
||||
$(DELETE) pnglibconf.h pnglibconf.c pnglibconf.out pnglibconf.pre \
|
||||
pnglibconf.dfn
|
||||
|
||||
clean: clean-pnglibconf
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;Version 1.6.17rc04
|
||||
;Version 1.6.18beta01
|
||||
;--------------------------------------------------------------
|
||||
; LIBPNG symbol list as a Win32 DEF file
|
||||
; Contains all the symbols that can be exported from libpng
|
||||
|
||||
Reference in New Issue
Block a user