Imported from libpng-1.0.1a.tar
This commit is contained in:
parent
f9f2fe0ce7
commit
896239be20
26
ANNOUNCE
Normal file
26
ANNOUNCE
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
Libpng 1.0.1a April 21, 1998
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Changes since the last release:
|
||||||
|
|
||||||
|
Optimized Paeth calculations by replacing abs() function calls with intrinsics
|
||||||
|
plus other loop optimizations. Improves avg decoding speed by about 20 percent.
|
||||||
|
Commented out i386istic "align" compiler flags in makefile.lnx.
|
||||||
|
Reduced the default warning level in some makefiles, to make them consistent.
|
||||||
|
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
|
||||||
|
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
|
||||||
|
Added grayscale and 16-bit capability to png_do_read_filler().
|
||||||
|
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
|
||||||
|
too large when writing an image with bit_depth < 8 (Bob Dellaca).
|
||||||
|
Corrected some bugs in the experimental weighted filtering heuristics.
|
||||||
|
Moved a misplaced pngrutil code block that truncates tRNS if it has more
|
||||||
|
than num_palette entries -- test was done before num_palette was defined.
|
||||||
|
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to
|
||||||
|
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
|
||||||
|
|
||||||
|
Glenn R-P
|
17
CHANGES
17
CHANGES
@ -283,6 +283,21 @@ version 1.0.0b [March 13, 1998]
|
|||||||
Minor changes to makefile.s2x
|
Minor changes to makefile.s2x
|
||||||
Removed #ifdef/#endif around a png_free() in pngread.c
|
Removed #ifdef/#endif around a png_free() in pngread.c
|
||||||
version 1.0.1 [March 14, 1998]
|
version 1.0.1 [March 14, 1998]
|
||||||
Changes makefile.s2x to reduce security risk of using a relative pathname
|
Changed makefile.s2x to reduce security risk of using a relative pathname
|
||||||
Fixed some typos in the documentation (Greg).
|
Fixed some typos in the documentation (Greg).
|
||||||
Fixed a problem with value of "channels" returned by png_read_update_info()
|
Fixed a problem with value of "channels" returned by png_read_update_info()
|
||||||
|
version 1.0.1a [April 21, 1998]
|
||||||
|
Optimized Paeth calculations by replacing abs() function calls with intrinsics
|
||||||
|
plus other loop optimizations. Improves avg decoding speed by about 20%.
|
||||||
|
Commented out i386istic "align" compiler flags in makefile.lnx.
|
||||||
|
Reduced the default warning level in some makefiles, to make them consistent.
|
||||||
|
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
|
||||||
|
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
|
||||||
|
Added grayscale and 16-bit capability to png_do_read_filler().
|
||||||
|
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
|
||||||
|
too large when writing an image with bit_depth < 8 (Bob Dellaca).
|
||||||
|
Corrected some bugs in the experimental weighted filtering heuristics.
|
||||||
|
Moved a misplaced pngrutil code block that truncates tRNS if it has more
|
||||||
|
than num_palette entries -- test was done before num_palette was defined.
|
||||||
|
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
|
||||||
|
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen)
|
||||||
|
4
INSTALL
4
INSTALL
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.0.1 March 15, 1998
|
Installing libpng version %VER% %DATE%
|
||||||
|
|
||||||
Before installing libpng, you must first install zlib. zlib
|
Before installing libpng, you must first install zlib. zlib
|
||||||
can usually be found wherever you got libpng. zlib can be
|
can usually be found wherever you got libpng. zlib can be
|
||||||
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
|
|||||||
version of zlib that's installed.
|
version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.0.1 or "lpng100" and "zlib-1.1.1"
|
might be called "libpng-%VER% or "lpng100" and "zlib-1.1.1"
|
||||||
or "zlib111") so that you have directories called "zlib" and "libpng".
|
or "zlib111") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
113
KNOWNBUG
Normal file
113
KNOWNBUG
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
Known bugs and suggested enhancements in libpng-1.0.1
|
||||||
|
|
||||||
|
1. March 13, 1998 -- BUG -- pngtrans.c:
|
||||||
|
|
||||||
|
row_info->channels should be updated --
|
||||||
|
row_info->color_type should be updated --
|
||||||
|
|
||||||
|
STATUS: I think this is all fixed in libpng-1.0.1a but needs
|
||||||
|
to be tested.
|
||||||
|
|
||||||
|
2. March 14, 1998 -- ENHANCEMENT -- Glenn
|
||||||
|
|
||||||
|
We should add the G>GA, G>GX, G>AG, and G>XG transformations
|
||||||
|
in png_do_read_filler()
|
||||||
|
|
||||||
|
STATUS: Implemented in libpng-1.0.1a
|
||||||
|
|
||||||
|
3. March 14, 1998 -- BUG? -- Greg Roelofs
|
||||||
|
|
||||||
|
pngrtran.c: if-test for channels/FILLER may be incorrect
|
||||||
|
|
||||||
|
STATUS: Under investigation
|
||||||
|
|
||||||
|
4. March 15, 1998 -- BUG -- Kevin Bracey
|
||||||
|
|
||||||
|
pngwtran.c:
|
||||||
|
line 306: loop should count to row_info->width, not to
|
||||||
|
row_info->width*row_info->channnels
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.1a
|
||||||
|
|
||||||
|
5. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
|
||||||
|
|
||||||
|
Loops need to be optimized everywhere
|
||||||
|
|
||||||
|
a. Make them count down instead of up -- Kevin Bracey
|
||||||
|
|
||||||
|
Optimizing compilers don't need this, and making
|
||||||
|
the change would be error prone -- Tom Lane, Glenn R-P
|
||||||
|
|
||||||
|
Question whether i-- or --i is better.
|
||||||
|
|
||||||
|
STATUS: Under investigation.
|
||||||
|
|
||||||
|
b. Remove products and structure members from loop tests -- Glenn R-P
|
||||||
|
|
||||||
|
Can be accomplished without messing with loop guts. This
|
||||||
|
was shown to be effective on optimized SGI compiler:
|
||||||
|
|
||||||
|
replace
|
||||||
|
png_uint_32 i;
|
||||||
|
for(i=0; i < s->a*s->b; i++)
|
||||||
|
with
|
||||||
|
png_uint_32 i, count;
|
||||||
|
istop = s->a*s->b;
|
||||||
|
for(i=0; i<istop; i++)
|
||||||
|
|
||||||
|
STATUS: Mostly done in libpng-1.0.1a, done for all important loops.
|
||||||
|
|
||||||
|
c. Replace abs() with intrinsic ternary operations in Paeth
|
||||||
|
filtering -- Glenn R-P
|
||||||
|
|
||||||
|
STATUS: Done in libpng-1.0.1a
|
||||||
|
(can be restored to original behavior with #define PNG_USE_ABS)
|
||||||
|
|
||||||
|
d. In pngwutil.c, make separate simple loops to use when filter
|
||||||
|
heuristic sums aren't needed. -- Glenn R-P
|
||||||
|
|
||||||
|
STATUS: Done in libpng-1.0.1a
|
||||||
|
|
||||||
|
6. April 6, 1998 -- BUG -- bug in pngset.c (rowbytes too large) -- Bob Dellaca
|
||||||
|
|
||||||
|
pngset.c has a bug, introduced in version 0.99c, that sets rowbytes
|
||||||
|
too large when writing an image with bit_depth < 8
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.1a
|
||||||
|
|
||||||
|
7. April 10, 1998 -- BUG -- pngwutil weighted filtering bugs -- Glenn R-P
|
||||||
|
|
||||||
|
pngwutil.c has some bugs in the experimental weighted filter
|
||||||
|
algorithm (PNG_FILTER_XXX should be PNG_FILTER_VALUE_XXX in
|
||||||
|
several places)
|
||||||
|
|
||||||
|
STATUS: Andreas concurs. Fixed in libpng-1.0.1a
|
||||||
|
|
||||||
|
8. April 10, 1998 -- ENHANCEMENT -- run-time selection of malloc function
|
||||||
|
-- Bob Dellaca
|
||||||
|
|
||||||
|
pngmem.c currently provides a compile-time option to replace
|
||||||
|
png_malloc() and png_free(). It's been requested that these
|
||||||
|
be made possible at run time, via calls to new png_set_malloc_fn()
|
||||||
|
and png_set_free_fn() functions.
|
||||||
|
|
||||||
|
STATUS: Will do in libpng-1.0.1b
|
||||||
|
|
||||||
|
9. April 11, 1998 -- BUG -- incorrect truncation of tRNS data in
|
||||||
|
illegal PNG file where tRNS precedes PLTE -- Larry Reeve
|
||||||
|
|
||||||
|
There is a misplaced pngrutil code block that truncates tRNS if it has
|
||||||
|
more than num_palette entries -- test was done before num_palette was
|
||||||
|
defined. Although the PNG file is illegal, it shouldn't crash apps.
|
||||||
|
There is a simple fix; just moving the test to the point after
|
||||||
|
num_palette has been defined.
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.1a
|
||||||
|
|
||||||
|
10. April 16, 1998 -- BUG -- incorrect operation of png_convert_to_rfc1123
|
||||||
|
with 31st day of the month -- Steve Eddins
|
||||||
|
|
||||||
|
The "ptime->date % 31" is wrong, should be "ptime->date % 32".
|
||||||
|
|
||||||
|
STATUS: Fixed in libpng-1.0.1a
|
2
README
2
README
@ -1,4 +1,4 @@
|
|||||||
README for libpng 1.0.1 (shared library 2.1)
|
README for libpng %VER% (shared library 2.1)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
1
TODO
1
TODO
@ -2,7 +2,6 @@ TODO - list of things to do for libpng
|
|||||||
|
|
||||||
fix problem with C++ and EXTERN "C"
|
fix problem with C++ and EXTERN "C"
|
||||||
add "grayscale->palette" transformation and "palette->grayscale" detection
|
add "grayscale->palette" transformation and "palette->grayscale" detection
|
||||||
add "grayscale" -> "grayscale+alpha" and "grayscale+FILLER" transformations
|
|
||||||
improved dithering
|
improved dithering
|
||||||
multi-lingual error and warning message support
|
multi-lingual error and warning message support
|
||||||
sPLT chunk handling
|
sPLT chunk handling
|
||||||
|
12
ansi2knr.c
12
ansi2knr.c
@ -1,7 +1,9 @@
|
|||||||
/* ansi2knr.c */
|
/* ansi2knr.c */
|
||||||
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
|
|
||||||
|
|
||||||
/*
|
/* Convert ANSI C function definitions to K&R ("traditional C") syntax
|
||||||
|
Copyright (C) 1989 Aladdin Enterprises. All rights reserved.
|
||||||
|
Copyright (C) 1988 Richard M. Stallman
|
||||||
|
|
||||||
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
WARRANTY. No author or distributor accepts responsibility to anyone for the
|
||||||
consequences of using it or for whether it serves any particular purpose or
|
consequences of using it or for whether it serves any particular purpose or
|
||||||
@ -12,12 +14,12 @@ Everyone is granted permission to copy, modify and redistribute ansi2knr,
|
|||||||
but only under the conditions described in the GPL. A copy of this license
|
but only under the conditions described in the GPL. A copy of this license
|
||||||
is supposed to have been given to you along with ansi2knr so you can know
|
is supposed to have been given to you along with ansi2knr so you can know
|
||||||
your rights and responsibilities. It should be in a file named COPYLEFT.
|
your rights and responsibilities. It should be in a file named COPYLEFT.
|
||||||
[In the IJG distribution, the GPL appears below, not in a separate file.]
|
[In the LIBPNG distribution, the GPL appears below, not in a separate file.]
|
||||||
Among other things, the copyright notice and this notice must be preserved
|
Among other things, the copyright notice and this notice must be preserved
|
||||||
on all copies.
|
on all copies.
|
||||||
|
|
||||||
We explicitly state here what we believe is already implied by the GPL: if
|
We explicitly state here what we believe is already implied by the GPL: if
|
||||||
the ansi2knr program is distributed as a separate set of sources and a
|
the ansi2knr program is distributed as a separate source file and a
|
||||||
separate executable file which are aggregated on a storage medium together
|
separate executable file which are aggregated on a storage medium together
|
||||||
with another program, this in itself does not bring the other program under
|
with another program, this in itself does not bring the other program under
|
||||||
the GPL, nor does the mere fact that such a program or the procedures for
|
the GPL, nor does the mere fact that such a program or the procedures for
|
||||||
@ -27,7 +29,7 @@ program under the GPL.
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
---------- Here is the GNU GPL file COPYLEFT, referred to above ----------
|
---------- Here is the GNU GPL file COPYLEFT, referred to above ----------
|
||||||
----- These terms do NOT apply to the JPEG software itself; see README ------
|
----- These terms do NOT apply to the LIBPNG software itself; see README ------
|
||||||
|
|
||||||
GHOSTSCRIPT GENERAL PUBLIC LICENSE
|
GHOSTSCRIPT GENERAL PUBLIC LICENSE
|
||||||
(Clarified 11 Feb 1988)
|
(Clarified 11 Feb 1988)
|
||||||
|
34
libpng.3
34
libpng.3
@ -1,4 +1,4 @@
|
|||||||
.TH LIBPNG 3 "March 15, 1998"
|
.TH LIBPNG 3 "April 21, 1998"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library
|
libpng \- Portable Network Graphics (PNG) Reference Library
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -396,7 +396,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.1 March 15, 1998
|
libpng version 1.0.1a April 21, 1998
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alumni.rpi.edu>
|
<randeg@alumni.rpi.edu>
|
||||||
Copyright (c) 1998, Glenn Randers-Pehrson
|
Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
@ -872,11 +872,14 @@ unless the library has been told to transform it into another format.
|
|||||||
For example, 4 bit/pixel paletted or grayscale data will be returned
|
For example, 4 bit/pixel paletted or grayscale data will be returned
|
||||||
2 pixels/byte with the leftmost pixel in the high-order bits of the
|
2 pixels/byte with the leftmost pixel in the high-order bits of the
|
||||||
byte, unless png_set_packing() is called. 8-bit RGB data will be stored
|
byte, unless png_set_packing() is called. 8-bit RGB data will be stored
|
||||||
in RGBRGBRGB format unless png_set_filler() is called to insert filler
|
in RGB RGB RGB format unless png_set_filler() is called to insert filler
|
||||||
bytes, either before or after each RGB triplet. 16-bit RGB data will
|
bytes, either before or after each RGB triplet. 16-bit RGB data will
|
||||||
be returned RRGGBBRRGGBB, with the most significant byte of the color
|
be returned RRGGBB RRGGBB, with the most significant byte of the color
|
||||||
value first, unless png_set_strip_16() is called to transform it to
|
value first, unless png_set_strip_16() is called to transform it to
|
||||||
regular RGBRGB triplets.
|
regular RGB RGB triplets, or png_set_filler() is called to insert
|
||||||
|
filler bytes, either before or after each RRGGBB triplet. Similarly,
|
||||||
|
8-bit or 16-bit grayscale data can be modified with png_set_filler()
|
||||||
|
or png_set_strip_16().
|
||||||
|
|
||||||
The following code transforms grayscale images of less than 8 to 8 bits,
|
The following code transforms grayscale images of less than 8 to 8 bits,
|
||||||
changes paletted images to RGB, and adds a full alpha channel if there is
|
changes paletted images to RGB, and adds a full alpha channel if there is
|
||||||
@ -952,7 +955,7 @@ into 4 bytes for windowing systems that need them in this format:
|
|||||||
PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr,
|
PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr,
|
||||||
filler, PNG_FILLER_BEFORE);
|
filler, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
where "filler" is the number to fill with, and the location is
|
where "filler" is the 8 or 16-bit number to fill with, and the location is
|
||||||
either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether
|
either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether
|
||||||
you want the filler before the RGB or after. This transformation
|
you want the filler before the RGB or after. This transformation
|
||||||
does not affect images that already have full alpha channels.
|
does not affect images that already have full alpha channels.
|
||||||
@ -1412,6 +1415,8 @@ png_infop info_ptr;
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.SH IV. Writing
|
.SH IV. Writing
|
||||||
|
|
||||||
Much of this is very similar to reading. However, everything of
|
Much of this is very similar to reading. However, everything of
|
||||||
@ -1504,9 +1509,9 @@ not calling this function at all, as it has been tuned to deliver a good
|
|||||||
speed/compression ratio. The second parameter to png_set_filter() is
|
speed/compression ratio. The second parameter to png_set_filter() is
|
||||||
the filter method, for which the only valid value is '0' (as of the
|
the filter method, for which the only valid value is '0' (as of the
|
||||||
October 1996 PNG specification, version 1.0). The third parameter is a
|
October 1996 PNG specification, version 1.0). The third parameter is a
|
||||||
flag that indicates
|
flag that indicates which filter type(s) are to be tested for each
|
||||||
which filter type(s) are to be tested for each scanline. See the
|
scanline. See the Compression Library for details on the specific filter
|
||||||
Compression Library for details on the specific filter types.
|
types.
|
||||||
|
|
||||||
|
|
||||||
/* turn on or off filtering, and/or choose
|
/* turn on or off filtering, and/or choose
|
||||||
@ -1780,8 +1785,9 @@ checks to see if it has data that it can do something with, you should
|
|||||||
make sure to only enable a transformation if it will be valid for the
|
make sure to only enable a transformation if it will be valid for the
|
||||||
data. For example, don't swap red and blue on grayscale data.
|
data. For example, don't swap red and blue on grayscale data.
|
||||||
|
|
||||||
PNG files store RGB pixels packed into 3 bytes. This code tells
|
PNG files store RGB pixels packed into 3 or 6 bytes. This code tells
|
||||||
the library to expect input data with 4 bytes per pixel
|
the library to expand the input data to 4 or 8 bytes per pixel
|
||||||
|
(or expand 1 or 2-byte grayscale data to 2 or 4 bytes per pixel).
|
||||||
|
|
||||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
@ -1899,11 +1905,11 @@ times, or any of that other stuff necessary with png_write_rows().
|
|||||||
|
|
||||||
where row_pointers is:
|
where row_pointers is:
|
||||||
|
|
||||||
png_bytef *row_pointers[height];
|
png_byte *row_pointers[height];
|
||||||
|
|
||||||
You can point to void or char or whatever you use for pixels.
|
You can point to void or char or whatever you use for pixels.
|
||||||
|
|
||||||
If you can't want to write the whole image at once, you can
|
If you don't want to write the whole image at once, you can
|
||||||
use png_write_rows() instead. If the file is not interlaced,
|
use png_write_rows() instead. If the file is not interlaced,
|
||||||
this is simple:
|
this is simple:
|
||||||
|
|
||||||
@ -2366,7 +2372,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.0.1 March 15, 1998:
|
Libpng version 1.0.1a April 21, 1998:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
|
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
|
||||||
|
|
||||||
|
31
libpng.txt
31
libpng.txt
@ -1,6 +1,6 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.1 March 15, 1998
|
libpng version 1.0.1a April 21, 1998
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alumni.rpi.edu>
|
<randeg@alumni.rpi.edu>
|
||||||
Copyright (c) 1998, Glenn Randers-Pehrson
|
Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
@ -22,7 +22,7 @@ libpng.txt - A description on how to use and modify libpng
|
|||||||
Copyright (c) 1995 Frank J. T. Wojcik
|
Copyright (c) 1995 Frank J. T. Wojcik
|
||||||
December 18, 1995 && January 20, 1996
|
December 18, 1995 && January 20, 1996
|
||||||
|
|
||||||
Introduction
|
I. Introduction
|
||||||
|
|
||||||
This file describes how to use and modify the PNG reference library
|
This file describes how to use and modify the PNG reference library
|
||||||
(known as libpng) for your own use. There are five sections to this
|
(known as libpng) for your own use. There are five sections to this
|
||||||
@ -476,11 +476,14 @@ unless the library has been told to transform it into another format.
|
|||||||
For example, 4 bit/pixel paletted or grayscale data will be returned
|
For example, 4 bit/pixel paletted or grayscale data will be returned
|
||||||
2 pixels/byte with the leftmost pixel in the high-order bits of the
|
2 pixels/byte with the leftmost pixel in the high-order bits of the
|
||||||
byte, unless png_set_packing() is called. 8-bit RGB data will be stored
|
byte, unless png_set_packing() is called. 8-bit RGB data will be stored
|
||||||
in RGBRGBRGB format unless png_set_filler() is called to insert filler
|
in RGB RGB RGB format unless png_set_filler() is called to insert filler
|
||||||
bytes, either before or after each RGB triplet. 16-bit RGB data will
|
bytes, either before or after each RGB triplet. 16-bit RGB data will
|
||||||
be returned RRGGBBRRGGBB, with the most significant byte of the color
|
be returned RRGGBB RRGGBB, with the most significant byte of the color
|
||||||
value first, unless png_set_strip_16() is called to transform it to
|
value first, unless png_set_strip_16() is called to transform it to
|
||||||
regular RGBRGB triplets.
|
regular RGB RGB triplets, or png_set_filler() is called to insert
|
||||||
|
filler bytes, either before or after each RRGGBB triplet. Similarly,
|
||||||
|
8-bit or 16-bit grayscale data can be modified with png_set_filler()
|
||||||
|
or png_set_strip_16().
|
||||||
|
|
||||||
The following code transforms grayscale images of less than 8 to 8 bits,
|
The following code transforms grayscale images of less than 8 to 8 bits,
|
||||||
changes paletted images to RGB, and adds a full alpha channel if there is
|
changes paletted images to RGB, and adds a full alpha channel if there is
|
||||||
@ -556,7 +559,7 @@ into 4 bytes for windowing systems that need them in this format:
|
|||||||
PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr,
|
PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr,
|
||||||
filler, PNG_FILLER_BEFORE);
|
filler, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
where "filler" is the number to fill with, and the location is
|
where "filler" is the 8 or 16-bit number to fill with, and the location is
|
||||||
either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether
|
either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether
|
||||||
you want the filler before the RGB or after. This transformation
|
you want the filler before the RGB or after. This transformation
|
||||||
does not affect images that already have full alpha channels.
|
does not affect images that already have full alpha channels.
|
||||||
@ -1110,9 +1113,9 @@ not calling this function at all, as it has been tuned to deliver a good
|
|||||||
speed/compression ratio. The second parameter to png_set_filter() is
|
speed/compression ratio. The second parameter to png_set_filter() is
|
||||||
the filter method, for which the only valid value is '0' (as of the
|
the filter method, for which the only valid value is '0' (as of the
|
||||||
October 1996 PNG specification, version 1.0). The third parameter is a
|
October 1996 PNG specification, version 1.0). The third parameter is a
|
||||||
flag that indicates
|
flag that indicates which filter type(s) are to be tested for each
|
||||||
which filter type(s) are to be tested for each scanline. See the
|
scanline. See the Compression Library for details on the specific filter
|
||||||
Compression Library for details on the specific filter types.
|
types.
|
||||||
|
|
||||||
|
|
||||||
/* turn on or off filtering, and/or choose
|
/* turn on or off filtering, and/or choose
|
||||||
@ -1386,8 +1389,9 @@ checks to see if it has data that it can do something with, you should
|
|||||||
make sure to only enable a transformation if it will be valid for the
|
make sure to only enable a transformation if it will be valid for the
|
||||||
data. For example, don't swap red and blue on grayscale data.
|
data. For example, don't swap red and blue on grayscale data.
|
||||||
|
|
||||||
PNG files store RGB pixels packed into 3 bytes. This code tells
|
PNG files store RGB pixels packed into 3 or 6 bytes. This code tells
|
||||||
the library to expect input data with 4 bytes per pixel
|
the library to expand the input data to 4 or 8 bytes per pixel
|
||||||
|
(or expand 1 or 2-byte grayscale data to 2 or 4 bytes per pixel).
|
||||||
|
|
||||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
@ -1505,11 +1509,11 @@ times, or any of that other stuff necessary with png_write_rows().
|
|||||||
|
|
||||||
where row_pointers is:
|
where row_pointers is:
|
||||||
|
|
||||||
png_bytef *row_pointers[height];
|
png_byte *row_pointers[height];
|
||||||
|
|
||||||
You can point to void or char or whatever you use for pixels.
|
You can point to void or char or whatever you use for pixels.
|
||||||
|
|
||||||
If you can't want to write the whole image at once, you can
|
If you don't want to write the whole image at once, you can
|
||||||
use png_write_rows() instead. If the file is not interlaced,
|
use png_write_rows() instead. If the file is not interlaced,
|
||||||
this is simple:
|
this is simple:
|
||||||
|
|
||||||
@ -1886,4 +1890,3 @@ to set the error callbacks AFTER png_read_init(), or to change them with
|
|||||||
png_set_error_fn(), which is essentially the same function, but with a
|
png_set_error_fn(), which is essentially the same function, but with a
|
||||||
new name to force compilation errors with applications that try to use
|
new name to force compilation errors with applications that try to use
|
||||||
the old method.
|
the old method.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.TH LIBPNGPF 3 "March 15, 1998"
|
.TH LIBPNGPF 3 "April 21, 1998"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library
|
libpng \- Portable Network Graphics (PNG) Reference Library
|
||||||
(private functions)
|
(private functions)
|
||||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "March 15, 1998"
|
.TH PNG 5 "April 21, 1998"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
6
png.c
6
png.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -16,7 +16,7 @@
|
|||||||
/* Version information for C files. This had better match the version
|
/* Version information for C files. This had better match the version
|
||||||
* string defined in png.h.
|
* string defined in png.h.
|
||||||
*/
|
*/
|
||||||
char png_libpng_ver[12] = "1.0.1";
|
char png_libpng_ver[12] = "1.0.1a";
|
||||||
|
|
||||||
/* Place to hold the signature string for a PNG file. */
|
/* Place to hold the signature string for a PNG file. */
|
||||||
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
18
png.h
18
png.h
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
|
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998 Glenn Randers-Pehrson
|
* Copyright (c) 1998 Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
*
|
*
|
||||||
@ -31,6 +31,7 @@
|
|||||||
* 1.00 1.00 100 2.1.0 [int should be 10000]
|
* 1.00 1.00 100 2.1.0 [int should be 10000]
|
||||||
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
|
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
|
||||||
* 1.0.1 1.0.1 10001 2.1.0
|
* 1.0.1 1.0.1 10001 2.1.0
|
||||||
|
* 1.0.1a 1.0.1a 10002 2.1.0
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library minor
|
* Henceforth the source version will match the shared-library minor
|
||||||
* and patch numbers; the shared-library major version number will be
|
* and patch numbers; the shared-library major version number will be
|
||||||
@ -39,9 +40,8 @@
|
|||||||
* is available for applications, is an unsigned integer of the form
|
* is available for applications, is an unsigned integer of the form
|
||||||
* xyyzz corresponding to the source version x.y.z (leading zeros in y and z).
|
* xyyzz corresponding to the source version x.y.z (leading zeros in y and z).
|
||||||
*
|
*
|
||||||
*
|
* See libpng.txt or libpng.3 for more information. The PNG specification is
|
||||||
* See libpng.txt for more information. The PNG specification is available
|
* available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
|
||||||
* as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
|
|
||||||
* and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
|
* and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
|
||||||
*
|
*
|
||||||
* Contributing Authors:
|
* Contributing Authors:
|
||||||
@ -118,14 +118,14 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.0.1"
|
#define PNG_LIBPNG_VER_STRING "1.0.1a"
|
||||||
|
|
||||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||||
* We must not include leading zeros.
|
* We must not include leading zeros.
|
||||||
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* 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=bugfix */
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=bugfix */
|
||||||
#define PNG_LIBPNG_VER 10001 /* 1.0.1 */
|
#define PNG_LIBPNG_VER 10002 /* 1.0.2 */
|
||||||
|
|
||||||
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
||||||
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
||||||
@ -589,7 +589,7 @@ struct png_struct_def
|
|||||||
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
||||||
|
|
||||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
png_byte filler; /* filler byte for 24->32-bit pixel expansion */
|
png_uint_16 filler; /* filler bytes for pixel expansion */
|
||||||
#endif /* PNG_READ_FILLER_SUPPORTED */
|
#endif /* PNG_READ_FILLER_SUPPORTED */
|
||||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
#if defined(PNG_READ_bKGD_SUPPORTED)
|
||||||
png_byte background_gamma_type;
|
png_byte background_gamma_type;
|
||||||
@ -1590,7 +1590,7 @@ PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
|
|||||||
#endif /* PNG_READ_pCAL_SUPPORTED */
|
#endif /* PNG_READ_pCAL_SUPPORTED */
|
||||||
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
|
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
|
||||||
PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
|
PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
|
||||||
#endif /* PNG_BIG_ENDIAN_GET_SUPPORTED */
|
#endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */
|
||||||
|
|
||||||
/* Initialize png_ptr struct for reading, and allocate any other memory.
|
/* Initialize png_ptr struct for reading, and allocate any other memory.
|
||||||
* (old interface - NOT DLL EXPORTED).
|
* (old interface - NOT DLL EXPORTED).
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Any machine specific code is near the front of this file, so if you
|
/* Any machine specific code is near the front of this file, so if you
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all error handling. Users which
|
* This file provides a location for all error handling. Users which
|
||||||
* need special error handling are expected to write replacement functions
|
* need special error handling are expected to write replacement functions
|
||||||
|
4
pngget.c
4
pngget.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
|
6
pngmem.c
6
pngmem.c
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all memory allocation. Users which
|
* This file provides a location for all memory allocation. Users who
|
||||||
* need special memory handling are expected to modify the code in this file
|
* need special memory handling are expected to modify the code in this file
|
||||||
* to meet their needs. See the instructions at each function.
|
* to meet their needs. See the instructions at each function.
|
||||||
*/
|
*/
|
||||||
|
10
pngpread.c
10
pngpread.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -446,13 +446,13 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||||
{
|
{
|
||||||
png_size_t i;
|
png_size_t i,istop;
|
||||||
png_bytep sp;
|
png_bytep sp;
|
||||||
png_bytep dp;
|
png_bytep dp;
|
||||||
|
|
||||||
|
istop = png_ptr->save_buffer_size;
|
||||||
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
|
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
|
||||||
i < png_ptr->save_buffer_size;
|
i < istop; i++, sp++, dp++)
|
||||||
i++, sp++, dp++)
|
|
||||||
{
|
{
|
||||||
*dp = *sp;
|
*dp = *sp;
|
||||||
}
|
}
|
||||||
|
28
pngread.c
28
pngread.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This file contains routines that an application calls directly to
|
* This file contains routines that an application calls directly to
|
||||||
* read a PNG file or stream.
|
* read a PNG file or stream.
|
||||||
@ -125,7 +125,7 @@ png_read_init(png_structp png_ptr)
|
|||||||
/* Read the information before the actual image data. This has been
|
/* Read the information before the actual image data. This has been
|
||||||
* changed in v0.90 to allow reading a file that already has the magic
|
* changed in v0.90 to allow reading a file that already has the magic
|
||||||
* bytes read from the stream. You can tell libpng how many bytes have
|
* bytes read from the stream. You can tell libpng how many bytes have
|
||||||
* been read from the beginning of the stream (up to the maxumum of 8)
|
* been read from the beginning of the stream (up to the maximum of 8)
|
||||||
* via png_set_sig_bytes(), and we will only check the remaining bytes
|
* via png_set_sig_bytes(), and we will only check the remaining bytes
|
||||||
* here. The application can then have access to the signature bytes we
|
* here. The application can then have access to the signature bytes we
|
||||||
* read if it is determined that this isn't a valid PNG file.
|
* read if it is determined that this isn't a valid PNG file.
|
||||||
@ -522,7 +522,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
|||||||
void
|
void
|
||||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||||
{
|
{
|
||||||
png_uint_32 i;
|
png_uint_32 i,image_height;
|
||||||
int pass, j;
|
int pass, j;
|
||||||
png_bytepp rp;
|
png_bytepp rp;
|
||||||
|
|
||||||
@ -530,12 +530,13 @@ png_read_image(png_structp png_ptr, png_bytepp image)
|
|||||||
/* save jump buffer and error functions */
|
/* save jump buffer and error functions */
|
||||||
pass = png_set_interlace_handling(png_ptr);
|
pass = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
png_ptr->num_rows = png_ptr->height; /* Make sure this is set correctly */
|
image_height=png_ptr->height;
|
||||||
|
png_ptr->num_rows = image_height; /* Make sure this is set correctly */
|
||||||
|
|
||||||
for (j = 0; j < pass; j++)
|
for (j = 0; j < pass; j++)
|
||||||
{
|
{
|
||||||
rp = image;
|
rp = image;
|
||||||
for (i = 0; i < png_ptr->height; i++)
|
for (i = 0; i < image_height; i++)
|
||||||
{
|
{
|
||||||
png_read_row(png_ptr, *rp, NULL);
|
png_read_row(png_ptr, *rp, NULL);
|
||||||
rp++;
|
rp++;
|
||||||
@ -728,8 +729,9 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
if (png_ptr->gamma_16_table != NULL)
|
if (png_ptr->gamma_16_table != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i,istop;
|
||||||
for (i = 0; i < (1 << (8 - png_ptr->gamma_shift)); i++)
|
istop = (1 << (8 - png_ptr->gamma_shift));
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->gamma_16_table[i]);
|
png_free(png_ptr, png_ptr->gamma_16_table[i]);
|
||||||
}
|
}
|
||||||
@ -739,8 +741,9 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
png_free(png_ptr, png_ptr->gamma_16_table);
|
png_free(png_ptr, png_ptr->gamma_16_table);
|
||||||
if (png_ptr->gamma_16_from_1 != NULL)
|
if (png_ptr->gamma_16_from_1 != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i,istop;
|
||||||
for (i = 0; i < (1 << (8 - png_ptr->gamma_shift)); i++)
|
istop = (1 << (8 - png_ptr->gamma_shift));
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
|
png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
|
||||||
}
|
}
|
||||||
@ -748,8 +751,9 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
png_free(png_ptr, png_ptr->gamma_16_from_1);
|
png_free(png_ptr, png_ptr->gamma_16_from_1);
|
||||||
if (png_ptr->gamma_16_to_1 != NULL)
|
if (png_ptr->gamma_16_to_1 != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i,istop;
|
||||||
for (i = 0; i < (1 << (8 - png_ptr->gamma_shift)); i++)
|
istop = (1 << (8 - png_ptr->gamma_shift));
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
|
png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
|
||||||
}
|
}
|
||||||
|
4
pngrio.c
4
pngrio.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all input. Users which need
|
* This file provides a location for all input. Users which need
|
||||||
* special handling are expected to write a function which has the same
|
* special handling are expected to write a function which has the same
|
||||||
|
533
pngrtran.c
533
pngrtran.c
File diff suppressed because it is too large
Load Diff
261
pngrutil.c
261
pngrutil.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This file contains routines which are only called from within
|
* This file contains routines which are only called from within
|
||||||
* libpng itself during the course of reading an image.
|
* libpng itself during the course of reading an image.
|
||||||
@ -76,9 +76,10 @@ png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
|
|||||||
int
|
int
|
||||||
png_crc_finish(png_structp png_ptr, png_uint_32 skip)
|
png_crc_finish(png_structp png_ptr, png_uint_32 skip)
|
||||||
{
|
{
|
||||||
png_uint_32 i;
|
png_uint_32 i,istop;
|
||||||
|
|
||||||
for (i = skip; i > (png_uint_32)png_ptr->zbuf_size; i -= png_ptr->zbuf_size)
|
istop = (png_uint_32)png_ptr->zbuf_size;
|
||||||
|
for (i = skip; i > istop; i -= istop)
|
||||||
{
|
{
|
||||||
png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
|
png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
|
||||||
}
|
}
|
||||||
@ -258,20 +259,6 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_ptr->mode |= PNG_HAVE_PLTE;
|
png_ptr->mode |= PNG_HAVE_PLTE;
|
||||||
|
|
||||||
#if defined (PNG_READ_tRNS_SUPPORTED)
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
|
||||||
{
|
|
||||||
if (info_ptr != NULL && info_ptr->valid & PNG_INFO_tRNS)
|
|
||||||
{
|
|
||||||
if (png_ptr->num_trans > png_ptr->num_palette)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "Truncating incorrect tRNS chunk length");
|
|
||||||
png_ptr->num_trans = png_ptr->num_palette;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
|
#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
|
||||||
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
@ -349,6 +336,21 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_ptr->palette = palette;
|
png_ptr->palette = palette;
|
||||||
png_ptr->num_palette = (png_uint_16)num;
|
png_ptr->num_palette = (png_uint_16)num;
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, num);
|
png_set_PLTE(png_ptr, info_ptr, palette, num);
|
||||||
|
|
||||||
|
#if defined (PNG_READ_tRNS_SUPPORTED)
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
|
{
|
||||||
|
if (info_ptr != NULL && info_ptr->valid & PNG_INFO_tRNS)
|
||||||
|
{
|
||||||
|
if (png_ptr->num_trans > png_ptr->num_palette)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Truncating incorrect tRNS chunk length");
|
||||||
|
png_ptr->num_trans = png_ptr->num_palette;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -758,6 +760,12 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Zero length tRNS chunk");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
png_ptr->trans = (png_bytep)png_malloc(png_ptr, length);
|
png_ptr->trans = (png_bytep)png_malloc(png_ptr, length);
|
||||||
png_ptr->flags |= PNG_FLAG_FREE_TRANS;
|
png_ptr->flags |= PNG_FLAG_FREE_TRANS;
|
||||||
@ -1075,7 +1083,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
purpose[slength] = 0x00; /* null terminate the last string */
|
purpose[slength] = 0x00; /* null terminate the last string */
|
||||||
|
|
||||||
png_debug(3, "Finding end of pCAL purpose string\n");
|
png_debug(3, "Finding end of pCAL purpose string\n");
|
||||||
for (buf = purpose; *buf != '\0'; buf++)
|
for (buf = purpose; *buf; buf++)
|
||||||
/* empty loop */ ;
|
/* empty loop */ ;
|
||||||
|
|
||||||
endptr = purpose + slength;
|
endptr = purpose + slength;
|
||||||
@ -1113,7 +1121,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
|
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (buf = units; *buf != 0x00; buf++)
|
for (buf = units; *buf; buf++)
|
||||||
/* Empty loop to move past the units string. */ ;
|
/* Empty loop to move past the units string. */ ;
|
||||||
|
|
||||||
png_debug(3, "Allocating pCAL parameters array\n");
|
png_debug(3, "Allocating pCAL parameters array\n");
|
||||||
@ -1497,7 +1505,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
int s_inc, s_start, s_end;
|
int s_inc, s_start, s_end;
|
||||||
int m;
|
int m;
|
||||||
int shift;
|
int shift;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
sp = png_ptr->row_buf + 1;
|
sp = png_ptr->row_buf + 1;
|
||||||
dp = row;
|
dp = row;
|
||||||
@ -1519,7 +1527,8 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
|
|
||||||
shift = s_start;
|
shift = s_start;
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->width; i++)
|
istop = png_ptr->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (m & mask)
|
if (m & mask)
|
||||||
{
|
{
|
||||||
@ -1553,7 +1562,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
int s_start, s_end, s_inc;
|
int s_start, s_end, s_inc;
|
||||||
int m;
|
int m;
|
||||||
int shift;
|
int shift;
|
||||||
png_uint_32 i;
|
png_uint_32 i,istop;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
sp = png_ptr->row_buf + 1;
|
sp = png_ptr->row_buf + 1;
|
||||||
@ -1576,7 +1585,8 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
|
|
||||||
shift = s_start;
|
shift = s_start;
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->width; i++)
|
istop = png_ptr->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (m & mask)
|
if (m & mask)
|
||||||
{
|
{
|
||||||
@ -1607,7 +1617,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
int s_start, s_end, s_inc;
|
int s_start, s_end, s_inc;
|
||||||
int m;
|
int m;
|
||||||
int shift;
|
int shift;
|
||||||
png_uint_32 i;
|
png_uint_32 i,istop;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
sp = png_ptr->row_buf + 1;
|
sp = png_ptr->row_buf + 1;
|
||||||
@ -1629,7 +1639,8 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
}
|
}
|
||||||
shift = s_start;
|
shift = s_start;
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->width; i++)
|
istop = png_ptr->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (m & mask)
|
if (m & mask)
|
||||||
{
|
{
|
||||||
@ -1658,7 +1669,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
png_bytep sp;
|
png_bytep sp;
|
||||||
png_bytep dp;
|
png_bytep dp;
|
||||||
png_size_t pixel_bytes;
|
png_size_t pixel_bytes;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
png_byte m;
|
png_byte m;
|
||||||
|
|
||||||
pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
|
pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
|
||||||
@ -1666,7 +1677,8 @@ png_combine_row(png_structp png_ptr, png_bytep row,
|
|||||||
sp = png_ptr->row_buf + 1;
|
sp = png_ptr->row_buf + 1;
|
||||||
dp = row;
|
dp = row;
|
||||||
m = 0x80;
|
m = 0x80;
|
||||||
for (i = 0; i < png_ptr->width; i++)
|
istop = png_ptr->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (m & mask)
|
if (m & mask)
|
||||||
{
|
{
|
||||||
@ -1708,7 +1720,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
int s_start, s_end, s_inc;
|
int s_start, s_end, s_inc;
|
||||||
png_byte v;
|
png_byte v;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int j;
|
int j, jstop;
|
||||||
|
|
||||||
sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
||||||
dp = row + (png_size_t)((final_width - 1) >> 3);
|
dp = row + (png_size_t)((final_width - 1) >> 3);
|
||||||
@ -1731,10 +1743,11 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
s_inc = 1;
|
s_inc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jstop = png_pass_inc[pass];
|
||||||
for (i = row_info->width; i; i--)
|
for (i = row_info->width; i; i--)
|
||||||
{
|
{
|
||||||
v = (png_byte)((*sp >> sshift) & 0x1);
|
v = (png_byte)((*sp >> sshift) & 0x1);
|
||||||
for (j = 0; j < png_pass_inc[pass]; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
*dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);
|
*dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);
|
||||||
*dp |= (png_byte)(v << dshift);
|
*dp |= (png_byte)(v << dshift);
|
||||||
@ -1762,6 +1775,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
int sshift, dshift;
|
int sshift, dshift;
|
||||||
int s_start, s_end, s_inc;
|
int s_start, s_end, s_inc;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
int jstop;
|
||||||
|
|
||||||
sp = row + (png_uint_32)((row_info->width - 1) >> 2);
|
sp = row + (png_uint_32)((row_info->width - 1) >> 2);
|
||||||
dp = row + (png_uint_32)((final_width - 1) >> 2);
|
dp = row + (png_uint_32)((final_width - 1) >> 2);
|
||||||
@ -1784,13 +1798,14 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
s_inc = 2;
|
s_inc = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jstop = png_pass_inc[pass];
|
||||||
for (i = row_info->width; i; i--)
|
for (i = row_info->width; i; i--)
|
||||||
{
|
{
|
||||||
png_byte v;
|
png_byte v;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
v = (png_byte)((*sp >> sshift) & 0x3);
|
v = (png_byte)((*sp >> sshift) & 0x3);
|
||||||
for (j = 0; j < png_pass_inc[pass]; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
*dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);
|
*dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);
|
||||||
*dp |= (png_byte)(v << dshift);
|
*dp |= (png_byte)(v << dshift);
|
||||||
@ -1818,6 +1833,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
int sshift, dshift;
|
int sshift, dshift;
|
||||||
int s_start, s_end, s_inc;
|
int s_start, s_end, s_inc;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
int jstop;
|
||||||
|
|
||||||
sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
||||||
dp = row + (png_size_t)((final_width - 1) >> 1);
|
dp = row + (png_size_t)((final_width - 1) >> 1);
|
||||||
@ -1840,13 +1856,14 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
s_inc = 4;
|
s_inc = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jstop = png_pass_inc[pass];
|
||||||
for (i = row_info->width; i; i--)
|
for (i = row_info->width; i; i--)
|
||||||
{
|
{
|
||||||
png_byte v;
|
png_byte v;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
v = (png_byte)((*sp >> sshift) & 0xf);
|
v = (png_byte)((*sp >> sshift) & 0xf);
|
||||||
for (j = 0; j < png_pass_inc[pass]; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
*dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);
|
*dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);
|
||||||
*dp |= (png_byte)(v << dshift);
|
*dp |= (png_byte)(v << dshift);
|
||||||
@ -1872,19 +1889,21 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
int jstop;
|
||||||
png_size_t pixel_bytes;
|
png_size_t pixel_bytes;
|
||||||
|
|
||||||
pixel_bytes = (row_info->pixel_depth >> 3);
|
pixel_bytes = (row_info->pixel_depth >> 3);
|
||||||
|
|
||||||
sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes;
|
sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes;
|
||||||
dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
||||||
|
jstop = png_pass_inc[pass];
|
||||||
for (i = row_info->width; i; i--)
|
for (i = row_info->width; i; i--)
|
||||||
{
|
{
|
||||||
png_byte v[8];
|
png_byte v[8];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
png_memcpy(v, sp, pixel_bytes);
|
png_memcpy(v, sp, pixel_bytes);
|
||||||
for (j = 0; j < png_pass_inc[pass]; j++)
|
for (j = 0; j < jstop; j++)
|
||||||
{
|
{
|
||||||
png_memcpy(dp, v, pixel_bytes);
|
png_memcpy(dp, v, pixel_bytes);
|
||||||
dp -= pixel_bytes;
|
dp -= pixel_bytes;
|
||||||
@ -1901,6 +1920,165 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PNG_READ_SLOW_FILTERING
|
||||||
|
void
|
||||||
|
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
||||||
|
png_bytep prev_row, int filter)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_read_filter_row\n");
|
||||||
|
png_debug2(2,"row = %d, filter = %d\n", png_ptr->row_number, filter);
|
||||||
|
|
||||||
|
|
||||||
|
switch (filter)
|
||||||
|
{
|
||||||
|
case PNG_FILTER_VALUE_NONE:
|
||||||
|
break;
|
||||||
|
case PNG_FILTER_VALUE_SUB:
|
||||||
|
{
|
||||||
|
png_uint_32 i, istop;
|
||||||
|
int bpp;
|
||||||
|
png_bytep rp;
|
||||||
|
png_bytep lp;
|
||||||
|
|
||||||
|
bpp = (row_info->pixel_depth + 7) / 8;
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (i = (png_uint_32)bpp, rp = row + bpp, lp = row;
|
||||||
|
i < istop; i++, rp++, lp++)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(((int)(*rp) + (int)(*lp)) & 0xff);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PNG_FILTER_VALUE_UP:
|
||||||
|
{
|
||||||
|
png_uint_32 i, istop;
|
||||||
|
png_bytep rp;
|
||||||
|
png_bytep pp;
|
||||||
|
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (i = 0, rp = row, pp = prev_row; i < istop; i++, rp++, pp++)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(((int)(*rp) + (int)(*pp)) & 0xff);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PNG_FILTER_VALUE_AVG:
|
||||||
|
{
|
||||||
|
png_uint_32 i, istop;
|
||||||
|
int bpp;
|
||||||
|
png_bytep rp;
|
||||||
|
png_bytep pp;
|
||||||
|
png_bytep lp;
|
||||||
|
|
||||||
|
bpp = (row_info->pixel_depth + 7) / 8;
|
||||||
|
istop = (png_uint_32)bpp;
|
||||||
|
for (i = 0, rp = row, pp = prev_row; i < istop; i++, rp++, pp++)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(((int)(*rp) +
|
||||||
|
((int)(*pp) / 2)) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (lp = row; i < istop; i++, rp++,
|
||||||
|
lp++, pp++)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(((int)(*rp) +
|
||||||
|
(int)(*pp + *lp) / 2) & 0xff);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PNG_FILTER_VALUE_PAETH:
|
||||||
|
{
|
||||||
|
int bpp;
|
||||||
|
png_uint_32 i, istop;
|
||||||
|
png_bytep rp;
|
||||||
|
png_bytep pp;
|
||||||
|
png_bytep lp;
|
||||||
|
png_bytep cp;
|
||||||
|
|
||||||
|
bpp = (row_info->pixel_depth + 7) / 8;
|
||||||
|
#ifndef PNG_SLOW_PAETH
|
||||||
|
istop=bpp;
|
||||||
|
for (i = 0, rp = row, pp = prev_row; i < istop;
|
||||||
|
i++, rp++, pp++)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(((int)(*rp) + (int)(*pp)) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
istop=row_info->rowbytes;
|
||||||
|
for (lp = row, cp = prev_row; i < istop; /* use leftover i,rp,pp */
|
||||||
|
i++, rp++, pp++, lp++, cp++)
|
||||||
|
{
|
||||||
|
int a, b, c, pa, pb, pc, p;
|
||||||
|
|
||||||
|
a = *lp;
|
||||||
|
b = *pp;
|
||||||
|
c = *cp;
|
||||||
|
|
||||||
|
p = a + b - c;
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
pa = abs(p - a);
|
||||||
|
pb = abs(p - b);
|
||||||
|
pc = abs(p - c);
|
||||||
|
#else
|
||||||
|
pa = p > a ? p - a : a - p;
|
||||||
|
pb = p > b ? p - b : b - p;
|
||||||
|
pc = p > c ? p - c : c - p;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (pa <= pb && pa <= pc)
|
||||||
|
p = a;
|
||||||
|
else if (pb <= pc)
|
||||||
|
p = b;
|
||||||
|
else
|
||||||
|
p = c;
|
||||||
|
*/
|
||||||
|
|
||||||
|
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||||
|
|
||||||
|
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
|
||||||
|
}
|
||||||
|
#else /* PNG_SLOW_PAETH */
|
||||||
|
for (i = 0, rp = row, pp = prev_row,
|
||||||
|
lp = row - bpp, cp = prev_row - bpp,
|
||||||
|
istop = row_info->rowbytes; i < istop; i++, rp++, pp++, lp++, cp++)
|
||||||
|
{
|
||||||
|
int a, b, c, pa, pb, pc, p;
|
||||||
|
|
||||||
|
b = *pp;
|
||||||
|
if (i >= (png_uint_32)bpp)
|
||||||
|
{
|
||||||
|
c = *cp;
|
||||||
|
a = *lp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
a = c = 0;
|
||||||
|
}
|
||||||
|
p = a + b - c;
|
||||||
|
pa = abs(p - a);
|
||||||
|
pb = abs(p - b);
|
||||||
|
pc = abs(p - c);
|
||||||
|
|
||||||
|
if (pa <= pb && pa <= pc)
|
||||||
|
p = a;
|
||||||
|
else if (pb <= pc)
|
||||||
|
p = b;
|
||||||
|
else
|
||||||
|
p = c;
|
||||||
|
|
||||||
|
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
|
||||||
|
}
|
||||||
|
#endif /* PNG_SLOW_PAETH */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
png_error(png_ptr, "Bad adaptive filter type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else /* PNG_READ_SLOW_FILTERING */
|
||||||
void
|
void
|
||||||
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
||||||
png_bytep prev_row, int filter)
|
png_bytep prev_row, int filter)
|
||||||
@ -2010,6 +2188,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_READ_SLOW_FILTERING */
|
||||||
|
|
||||||
void
|
void
|
||||||
png_read_finish_row(png_structp png_ptr)
|
png_read_finish_row(png_structp png_ptr)
|
||||||
@ -2186,9 +2365,21 @@ png_read_start_row(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_FILLER_SUPPORTED)
|
#if defined(PNG_READ_FILLER_SUPPORTED)
|
||||||
if (png_ptr->transformations & (PNG_FILLER))
|
if (png_ptr->transformations & (PNG_FILLER))
|
||||||
{
|
{
|
||||||
if (max_pixel_depth < 32)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
|
{
|
||||||
|
if (max_pixel_depth <= 8)
|
||||||
|
max_pixel_depth = 16;
|
||||||
|
else
|
||||||
max_pixel_depth = 32;
|
max_pixel_depth = 32;
|
||||||
}
|
}
|
||||||
|
else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
{
|
||||||
|
if (max_pixel_depth <= 32)
|
||||||
|
max_pixel_depth = 32;
|
||||||
|
else
|
||||||
|
max_pixel_depth = 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
|
||||||
@ -2216,7 +2407,7 @@ png_read_start_row(png_structp png_ptr)
|
|||||||
for interlacing */
|
for interlacing */
|
||||||
rowbytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
|
rowbytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
|
||||||
/* calculate the maximum bytes needed, adding a byte and a pixel
|
/* calculate the maximum bytes needed, adding a byte and a pixel
|
||||||
for safety sake */
|
for safety's sake */
|
||||||
rowbytes = ((rowbytes * (png_uint_32)max_pixel_depth + 7) >> 3) +
|
rowbytes = ((rowbytes * (png_uint_32)max_pixel_depth + 7) >> 3) +
|
||||||
1 + ((max_pixel_depth + 7) >> 3);
|
1 + ((max_pixel_depth + 7) >> 3);
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
|
7
pngset.c
7
pngset.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* The functions here are used during reads to store data from the file
|
* The functions here are used during reads to store data from the file
|
||||||
* into the info struct, and during writes to store application data
|
* into the info struct, and during writes to store application data
|
||||||
@ -108,13 +108,14 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
rowbytes_per_pixel = (info_ptr->pixel_depth + 7) >> 3;
|
rowbytes_per_pixel = (info_ptr->pixel_depth + 7) >> 3;
|
||||||
info_ptr->rowbytes = info_ptr->width * rowbytes_per_pixel;
|
|
||||||
if (( width > (png_uint_32)2147483647L/rowbytes_per_pixel))
|
if (( width > (png_uint_32)2147483647L/rowbytes_per_pixel))
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Width too large to process image data; rowbytes will overflow.");
|
"Width too large to process image data; rowbytes will overflow.");
|
||||||
info_ptr->rowbytes = (png_size_t)0;
|
info_ptr->rowbytes = (png_size_t)0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
info_ptr->rowbytes = (info_ptr->width * info_ptr->pixel_depth + 7) >> 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
||||||
|
54
pngtest.c
54
pngtest.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This program reads in a PNG image, writes it out again, and then
|
* This program reads in a PNG image, writes it out again, and then
|
||||||
* compares the two files. If the files are identical, this shows that
|
* compares the two files. If the files are identical, this shows that
|
||||||
@ -81,12 +81,12 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
|
|||||||
|
|
||||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
/* example of using user transform callback (we don't transform anything,
|
/* example of using user transform callback (we don't transform anything,
|
||||||
but merely count the black pixels) */
|
but merely count the zero samples) */
|
||||||
|
|
||||||
static png_uint_32 black_pixels;
|
static png_uint_32 zero_samples;
|
||||||
|
|
||||||
void
|
void
|
||||||
count_black_pixels(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
||||||
{
|
{
|
||||||
png_bytep dp = data;
|
png_bytep dp = data;
|
||||||
if(png_ptr == NULL)return;
|
if(png_ptr == NULL)return;
|
||||||
@ -100,60 +100,66 @@ count_black_pixels(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
|||||||
* png_byte pixel_depth bits per pixel (depth*channels)
|
* png_byte pixel_depth bits per pixel (depth*channels)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* counts the number of black pixels (or zero pixels if color_type is 3 */
|
/* counts the number of zero samples (or zero pixels if color_type is 3 */
|
||||||
|
|
||||||
if(row_info->color_type == 0 || row_info->color_type == 3)
|
if(row_info->color_type == 0 || row_info->color_type == 3)
|
||||||
{
|
{
|
||||||
int pos=0;
|
int pos=0;
|
||||||
png_uint_32 n;
|
png_uint_32 n, nstop;
|
||||||
for (n=0; n<row_info->width; n++)
|
for (n=0, nstop=row_info->width; n<nstop; n++)
|
||||||
{
|
{
|
||||||
if(row_info->bit_depth == 1)
|
if(row_info->bit_depth == 1)
|
||||||
if(((*dp << pos++ )& 0x80) == 0) black_pixels++;
|
{
|
||||||
|
if(((*dp << pos++ )& 0x80) == 0) zero_samples++;
|
||||||
if(pos == 8)
|
if(pos == 8)
|
||||||
{
|
{
|
||||||
pos=0;
|
pos = 0;
|
||||||
dp++;
|
dp++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(row_info->bit_depth == 2)
|
if(row_info->bit_depth == 2)
|
||||||
if(((*dp << (pos+=2))& 0xc0) == 0) black_pixels++;
|
{
|
||||||
|
if(((*dp << (pos+=2))& 0xc0) == 0) zero_samples++;
|
||||||
if(pos == 8)
|
if(pos == 8)
|
||||||
{
|
{
|
||||||
pos=0;
|
pos = 0;
|
||||||
dp++;
|
dp++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(row_info->bit_depth == 4)
|
if(row_info->bit_depth == 4)
|
||||||
if(((*dp << (pos+=4))& 0xf0) == 0) black_pixels++;
|
{
|
||||||
|
if(((*dp << (pos+=4))& 0xf0) == 0) zero_samples++;
|
||||||
if(pos == 8)
|
if(pos == 8)
|
||||||
{
|
{
|
||||||
pos=0;
|
pos = 0;
|
||||||
dp++;
|
dp++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(row_info->bit_depth == 8)
|
if(row_info->bit_depth == 8)
|
||||||
if(*dp++ == 0) black_pixels++;
|
if(*dp++ == 0) zero_samples++;
|
||||||
if(row_info->bit_depth == 16)
|
if(row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if((*dp | *(dp+1)) == 0) black_pixels++;
|
if((*dp | *(dp+1)) == 0) zero_samples++;
|
||||||
dp+=2;
|
dp+=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* other color types */
|
else /* other color types */
|
||||||
{
|
{
|
||||||
png_uint_32 n;
|
png_uint_32 n, nstop;
|
||||||
int channel;
|
int channel;
|
||||||
int color_channels = row_info->channels;
|
int color_channels = row_info->channels;
|
||||||
if(row_info->color_type > 3)color_channels--;
|
if(row_info->color_type > 3)color_channels--;
|
||||||
|
|
||||||
for (n=0; n<row_info->width; n++)
|
for (n=0, nstop=row_info->width; n<nstop; n++)
|
||||||
{
|
{
|
||||||
for (channel = 0; channel < color_channels; channel++)
|
for (channel = 0; channel < color_channels; channel++)
|
||||||
{
|
{
|
||||||
if(row_info->bit_depth == 8)
|
if(row_info->bit_depth == 8)
|
||||||
if(*dp++ == 0) black_pixels++;
|
if(*dp++ == 0) zero_samples++;
|
||||||
if(row_info->bit_depth == 16)
|
if(row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if((*dp | *(dp+1)) == 0) black_pixels++;
|
if((*dp | *(dp+1)) == 0) zero_samples++;
|
||||||
dp+=2;
|
dp+=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,8 +569,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
# if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
black_pixels=0;
|
zero_samples=0;
|
||||||
png_set_write_user_transform_fn(write_ptr, count_black_pixels);
|
png_set_write_user_transform_fn(write_ptr, count_zero_samples);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
png_debug(0, "Reading info struct\n");
|
png_debug(0, "Reading info struct\n");
|
||||||
@ -948,7 +954,7 @@ main(int argc, char *argv[])
|
|||||||
kerror = test_one_file(argv[i], outname);
|
kerror = test_one_file(argv[i], outname);
|
||||||
if (kerror == 0)
|
if (kerror == 0)
|
||||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
fprintf(STDERR, " PASS (%lu black pixels)\n",black_pixels);
|
fprintf(STDERR, " PASS (%lu zero samples)\n",zero_samples);
|
||||||
#else
|
#else
|
||||||
fprintf(STDERR, " PASS\n");
|
fprintf(STDERR, " PASS\n");
|
||||||
#endif
|
#endif
|
||||||
@ -994,7 +1000,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if(verbose == 1 || i == 2)
|
if(verbose == 1 || i == 2)
|
||||||
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
fprintf(STDERR, " PASS (%lu black pixels)\n",black_pixels);
|
fprintf(STDERR, " PASS (%lu zero samples)\n",zero_samples);
|
||||||
#else
|
#else
|
||||||
fprintf(STDERR, " PASS\n");
|
fprintf(STDERR, " PASS\n");
|
||||||
#endif
|
#endif
|
||||||
|
105
pngtrans.c
105
pngtrans.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -100,12 +100,6 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
||||||
else
|
else
|
||||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
/* This should probably go in the "do_filler" routine */
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB && png_ptr->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_ptr->usr_channels = 4;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -172,14 +166,13 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||||||
row_info->bit_depth == 16)
|
row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte t;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row;
|
for (i = 0, rp = row;
|
||||||
i < row_info->width * row_info->channels;
|
i < row_info->width * row_info->channels;
|
||||||
i++, rp += 2)
|
i++, rp += 2)
|
||||||
{
|
{
|
||||||
t = *rp;
|
png_byte t = *rp;
|
||||||
*rp = *(rp + 1);
|
*rp = *(rp + 1);
|
||||||
*(rp + 1) = t;
|
*(rp + 1) = t;
|
||||||
}
|
}
|
||||||
@ -338,6 +331,11 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
*/
|
*/
|
||||||
|
png_bytep sp=row;
|
||||||
|
png_bytep dp=row;
|
||||||
|
png_uint_32 width=row_info->width;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
if (row_info->channels == 4)
|
if (row_info->channels == 4)
|
||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
@ -345,10 +343,8 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from RGBX or RGBA to RGB */
|
/* This converts from RGBX or RGBA to RGB */
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
dp+=3; sp+=4;
|
||||||
png_uint_32 i;
|
for (i = 1; i < width; i++)
|
||||||
|
|
||||||
for (i = 1, sp = row + 4, dp = row + 3; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@ -359,10 +355,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from XRGB or ARGB to RGB */
|
/* This converts from XRGB or ARGB to RGB */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
for (i = 0; i < width; i++)
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, sp = row, dp = row; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
sp++;
|
sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@ -371,17 +364,15 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 24;
|
row_info->pixel_depth = 24;
|
||||||
row_info->rowbytes = row_info->width * 3;
|
row_info->rowbytes = width * 3;
|
||||||
}
|
}
|
||||||
else /* if (row_info->bit_depth == 16) */
|
else /* if (row_info->bit_depth == 16) */
|
||||||
{
|
{
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
||||||
for (i = 1, sp = row + 8, dp = row + 6; i < row_info->width; i++)
|
sp += 8; dp += 6;
|
||||||
|
for (i = 1; i < width; i++)
|
||||||
{
|
{
|
||||||
/* This could be (although memcpy is probably slower):
|
/* This could be (although memcpy is probably slower):
|
||||||
png_memcpy(dp, sp, 6);
|
png_memcpy(dp, sp, 6);
|
||||||
@ -399,17 +390,15 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
||||||
for (i = 0, sp = row + 2, dp = row; i < row_info->width; i++)
|
for (i = 0; i < width; i++)
|
||||||
{
|
{
|
||||||
/* This could be (although memcpy is probably slower):
|
/* This could be (although memcpy is probably slower):
|
||||||
png_memcpy(dp, sp, 6);
|
png_memcpy(dp, sp, 6);
|
||||||
sp += 8;
|
sp += 8;
|
||||||
dp += 6;
|
dp += 6;
|
||||||
*/
|
*/
|
||||||
|
sp+=2;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@ -419,9 +408,10 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 48;
|
row_info->pixel_depth = 48;
|
||||||
row_info->rowbytes = row_info->width * 6;
|
row_info->rowbytes = width * 6;
|
||||||
}
|
}
|
||||||
row_info->channels = 3;
|
row_info->channels = 3;
|
||||||
|
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
||||||
@ -434,10 +424,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from GX or GA to G */
|
/* This converts from GX or GA to G */
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
for (i = 0; i < width; i++)
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 1, sp = row + 2, dp = row + 1; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
sp++;
|
sp++;
|
||||||
@ -446,27 +433,22 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from XG or AG to G */
|
/* This converts from XG or AG to G */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
for (i = 0; i < width; i++)
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, sp = row, dp = row; i < row_info->width; i++)
|
|
||||||
{
|
{
|
||||||
sp++;
|
sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 8;
|
row_info->pixel_depth = 8;
|
||||||
row_info->rowbytes = row_info->width;
|
row_info->rowbytes = width;
|
||||||
}
|
}
|
||||||
else /* if (row_info->bit_depth == 16) */
|
else /* if (row_info->bit_depth == 16) */
|
||||||
{
|
{
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from GGXX or GGAA to GG */
|
/* This converts from GGXX or GGAA to GG */
|
||||||
for (i = 1, sp = row + 4, dp = row + 2; i < row_info->width; i++)
|
sp += 4; dp += 2;
|
||||||
|
for (i = 1; i < width; i++)
|
||||||
{
|
{
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@ -475,11 +457,8 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
/* This converts from XXGG or AAGG to GG */
|
/* This converts from XXGG or AAGG to GG */
|
||||||
for (i = 0, sp = row, dp = row; i < row_info->width; i++)
|
for (i = 0; i < width; i++)
|
||||||
{
|
{
|
||||||
sp += 2;
|
sp += 2;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@ -487,9 +466,10 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
row_info->pixel_depth = 16;
|
row_info->pixel_depth = 16;
|
||||||
row_info->rowbytes = row_info->width * 2;
|
row_info->rowbytes = width * 2;
|
||||||
}
|
}
|
||||||
row_info->channels = 1;
|
row_info->channels = 1;
|
||||||
|
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,17 +487,17 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
#endif
|
#endif
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
{
|
{
|
||||||
|
png_uint_32 width = row_info->width;
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 3)
|
for (i = 0, rp = row; i < width; i++, rp += 3)
|
||||||
{
|
{
|
||||||
save = *rp;
|
png_byte save = *rp;
|
||||||
*rp = *(rp + 2);
|
*rp = *(rp + 2);
|
||||||
*(rp + 2) = save;
|
*(rp + 2) = save;
|
||||||
}
|
}
|
||||||
@ -525,12 +505,11 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 4)
|
for (i = 0, rp = row; i < width; i++, rp += 4)
|
||||||
{
|
{
|
||||||
save = *rp;
|
png_byte save = *rp;
|
||||||
*rp = *(rp + 2);
|
*rp = *(rp + 2);
|
||||||
*(rp + 2) = save;
|
*(rp + 2) = save;
|
||||||
}
|
}
|
||||||
@ -541,33 +520,31 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 6)
|
for (i = 0, rp = row; i < width; i++, rp += 6)
|
||||||
{
|
{
|
||||||
save[0] = *rp;
|
png_byte save = *rp;
|
||||||
save[1] = *(rp + 1);
|
|
||||||
*rp = *(rp + 4);
|
*rp = *(rp + 4);
|
||||||
|
*(rp + 4) = save;
|
||||||
|
save = *(rp + 1);
|
||||||
*(rp + 1) = *(rp + 5);
|
*(rp + 1) = *(rp + 5);
|
||||||
*(rp + 4) = save[0];
|
*(rp + 5) = save;
|
||||||
*(rp + 5) = save[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_info->width; i++, rp += 8)
|
for (i = 0, rp = row; i < width; i++, rp += 8)
|
||||||
{
|
{
|
||||||
save[0] = *rp;
|
png_byte save = *rp;
|
||||||
save[1] = *(rp + 1);
|
|
||||||
*rp = *(rp + 4);
|
*rp = *(rp + 4);
|
||||||
|
*(rp + 4) = save;
|
||||||
|
save = *(rp + 1);
|
||||||
*(rp + 1) = *(rp + 5);
|
*(rp + 1) = *(rp + 5);
|
||||||
*(rp + 4) = save[0];
|
*(rp + 5) = save;
|
||||||
*(rp + 5) = save[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
pngwio.c
4
pngwio.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*
|
*
|
||||||
* This file provides a location for all output. Users which need
|
* This file provides a location for all output. Users which need
|
||||||
* special handling are expected to write functions which have the same
|
* special handling are expected to write functions which have the same
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get internal access to png.h */
|
/* get internal access to png.h */
|
||||||
@ -239,7 +239,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
{
|
{
|
||||||
char near_time_buf[29];
|
char near_time_buf[29];
|
||||||
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 31, short_months[ptime->month - 1],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||||
@ -247,7 +247,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 31, short_months[ptime->month - 1],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
#endif
|
#endif
|
||||||
|
81
pngwtran.c
81
pngwtran.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -96,13 +96,15 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
int mask, v;
|
int mask, v;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
sp = row;
|
sp = row;
|
||||||
dp = row;
|
dp = row;
|
||||||
mask = 0x80;
|
mask = 0x80;
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < row_info->width; i++)
|
|
||||||
|
istop = row_info->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (*sp != 0)
|
if (*sp != 0)
|
||||||
v |= mask;
|
v |= mask;
|
||||||
@ -125,13 +127,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
int shift, v;
|
int shift, v;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
sp = row;
|
sp = row;
|
||||||
dp = row;
|
dp = row;
|
||||||
shift = 6;
|
shift = 6;
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_byte value;
|
png_byte value;
|
||||||
|
|
||||||
@ -156,13 +159,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
int shift, v;
|
int shift, v;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
sp = row;
|
sp = row;
|
||||||
dp = row;
|
dp = row;
|
||||||
shift = 4;
|
shift = 4;
|
||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_byte value;
|
png_byte value;
|
||||||
|
|
||||||
@ -246,7 +250,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
if (row_info->bit_depth < 8)
|
if (row_info->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
png_byte mask;
|
png_byte mask;
|
||||||
|
|
||||||
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
||||||
@ -256,7 +260,8 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
else
|
else
|
||||||
mask = 0xff;
|
mask = 0xff;
|
||||||
|
|
||||||
for (bp = row, i = 0; i < row_info->rowbytes; i++, bp++)
|
istop = row_info->rowbytes;
|
||||||
|
for (bp = row, i = 0; i < istop; i++, bp++)
|
||||||
{
|
{
|
||||||
png_uint_16 v;
|
png_uint_16 v;
|
||||||
int j;
|
int j;
|
||||||
@ -275,9 +280,10 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
else if (row_info->bit_depth == 8)
|
else if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
for (bp = row, i = 0; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (bp = row, i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_uint_32 c;
|
png_uint_32 c;
|
||||||
|
|
||||||
@ -301,9 +307,10 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
for (bp = row, i = 0; i < row_info->width * row_info->channels; i++)
|
istop = row_info->width;
|
||||||
|
for (bp = row, i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_uint_32 c;
|
png_uint_32 c;
|
||||||
|
|
||||||
@ -345,12 +352,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save;
|
png_uint_32 i, istop;
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
save = *(sp++);
|
png_byte save = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -361,11 +368,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save[2];
|
png_uint_32 i, istop;
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
|
png_byte save[2];
|
||||||
save[0] = *(sp++);
|
save[0] = *(sp++);
|
||||||
save[1] = *(sp++);
|
save[1] = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -385,12 +393,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
save = *(sp++);
|
png_byte save = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = save;
|
*(dp++) = save;
|
||||||
}
|
}
|
||||||
@ -399,11 +407,12 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_byte save[2];
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
|
png_byte save[2];
|
||||||
save[0] = *(sp++);
|
save[0] = *(sp++);
|
||||||
save[1] = *(sp++);
|
save[1] = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -432,9 +441,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -446,9 +456,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
@ -467,9 +478,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = 255 - *(sp++);
|
*(dp++) = 255 - *(sp++);
|
||||||
@ -479,9 +491,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_info->width; i++)
|
istop = row_info->width;
|
||||||
|
for (i = 0, sp = dp = row; i < istop; i++)
|
||||||
{
|
{
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
*(dp++) = *(sp++);
|
*(dp++) = *(sp++);
|
||||||
|
216
pngwutil.c
216
pngwutil.c
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.1
|
* libpng 1.0.1a
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||||
* Copyright (c) 1998, Glenn Randers-Pehrson
|
* Copyright (c) 1998, Glenn Randers-Pehrson
|
||||||
* March 15, 1998
|
* April 21, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@ -1241,7 +1241,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
if (pass < 6)
|
if (pass < 6)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* each pixel depth is handled seperately */
|
/* each pixel depth is handled separately */
|
||||||
switch (row_info->pixel_depth)
|
switch (row_info->pixel_depth)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@ -1251,12 +1251,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
int shift;
|
int shift;
|
||||||
int d;
|
int d;
|
||||||
int value;
|
int value;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
dp = row;
|
dp = row;
|
||||||
d = 0;
|
d = 0;
|
||||||
shift = 7;
|
shift = 7;
|
||||||
for (i = png_pass_start[pass]; i < row_info->width;
|
istop = row_info->width;
|
||||||
|
for (i = png_pass_start[pass]; i < istop;
|
||||||
i += png_pass_inc[pass])
|
i += png_pass_inc[pass])
|
||||||
{
|
{
|
||||||
sp = row + (png_size_t)(i >> 3);
|
sp = row + (png_size_t)(i >> 3);
|
||||||
@ -1284,12 +1285,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
int shift;
|
int shift;
|
||||||
int d;
|
int d;
|
||||||
int value;
|
int value;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
dp = row;
|
dp = row;
|
||||||
shift = 6;
|
shift = 6;
|
||||||
d = 0;
|
d = 0;
|
||||||
for (i = png_pass_start[pass]; i < row_info->width;
|
istop = row_info->width;
|
||||||
|
for (i = png_pass_start[pass]; i < istop;
|
||||||
i += png_pass_inc[pass])
|
i += png_pass_inc[pass])
|
||||||
{
|
{
|
||||||
sp = row + (png_size_t)(i >> 2);
|
sp = row + (png_size_t)(i >> 2);
|
||||||
@ -1316,12 +1318,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
int shift;
|
int shift;
|
||||||
int d;
|
int d;
|
||||||
int value;
|
int value;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
dp = row;
|
dp = row;
|
||||||
shift = 4;
|
shift = 4;
|
||||||
d = 0;
|
d = 0;
|
||||||
for (i = png_pass_start[pass]; i < row_info->width;
|
istop = row_info->width;
|
||||||
|
for (i = png_pass_start[pass]; i < istop;
|
||||||
i += png_pass_inc[pass])
|
i += png_pass_inc[pass])
|
||||||
{
|
{
|
||||||
sp = row + (png_size_t)(i >> 1);
|
sp = row + (png_size_t)(i >> 1);
|
||||||
@ -1345,7 +1348,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
{
|
{
|
||||||
png_bytep sp;
|
png_bytep sp;
|
||||||
png_bytep dp;
|
png_bytep dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
png_size_t pixel_bytes;
|
png_size_t pixel_bytes;
|
||||||
|
|
||||||
/* start at the beginning */
|
/* start at the beginning */
|
||||||
@ -1354,7 +1357,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||||||
pixel_bytes = (row_info->pixel_depth >> 3);
|
pixel_bytes = (row_info->pixel_depth >> 3);
|
||||||
/* loop through the row, only looking at the pixels that
|
/* loop through the row, only looking at the pixels that
|
||||||
matter */
|
matter */
|
||||||
for (i = png_pass_start[pass]; i < row_info->width;
|
istop = row_info->width;
|
||||||
|
for (i = png_pass_start[pass]; i < istop;
|
||||||
i += png_pass_inc[pass])
|
i += png_pass_inc[pass])
|
||||||
{
|
{
|
||||||
/* find out where the original pixel is */
|
/* find out where the original pixel is */
|
||||||
@ -1392,6 +1396,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
{
|
{
|
||||||
png_bytep prev_row, best_row, row_buf;
|
png_bytep prev_row, best_row, row_buf;
|
||||||
png_uint_32 mins, bpp;
|
png_uint_32 mins, bpp;
|
||||||
|
png_byte filter_to_do = png_ptr->do_filter;
|
||||||
|
|
||||||
png_debug(1, "in png_write_find_filter\n");
|
png_debug(1, "in png_write_find_filter\n");
|
||||||
/* find out how many bytes offset each pixel is */
|
/* find out how many bytes offset each pixel is */
|
||||||
@ -1405,7 +1410,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
* smallest value when summing the absolute values of the distances
|
* smallest value when summing the absolute values of the distances
|
||||||
* from zero using anything >= 128 as negative numbers. This is known
|
* from zero using anything >= 128 as negative numbers. This is known
|
||||||
* as the "minimum sum of absolute differences" heuristic. Other
|
* as the "minimum sum of absolute differences" heuristic. Other
|
||||||
* heuristics are the "weighted minumum sum of absolute differences"
|
* heuristics are the "weighted minimum sum of absolute differences"
|
||||||
* (experimental and can in theory improve compression), and the "zlib
|
* (experimental and can in theory improve compression), and the "zlib
|
||||||
* predictive" method (not implemented in libpng 0.95), which does test
|
* predictive" method (not implemented in libpng 0.95), which does test
|
||||||
* compressions of lines using different filter methods, and then chooses
|
* compressions of lines using different filter methods, and then chooses
|
||||||
@ -1413,18 +1418,20 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
* computationally expensive).
|
* computationally expensive).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* We don't need to test the 'no filter' case if this is the only filter
|
/* We don't need to test the 'no filter' case if this is the only filter
|
||||||
* that has been chosen, as it doesn't actually do anything to the data.
|
* that has been chosen, as it doesn't actually do anything to the data.
|
||||||
*/
|
*/
|
||||||
if (png_ptr->do_filter & PNG_FILTER_NONE &&
|
if (filter_to_do & PNG_FILTER_NONE &&
|
||||||
png_ptr->do_filter != PNG_FILTER_NONE)
|
filter_to_do != PNG_FILTER_NONE)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_uint_32 sum = 0;
|
png_uint_32 sum = 0;
|
||||||
png_uint_32 i;
|
png_uint_32 i,istop;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
for (i = 0, rp = row_buf + 1; i < row_info->rowbytes; i++, rp++)
|
istop = row_info->rowbytes;
|
||||||
|
for (i = 0, rp = row_buf + 1; i < istop; i++, rp++)
|
||||||
{
|
{
|
||||||
v = *rp;
|
v = *rp;
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
@ -1438,9 +1445,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
|
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
|
||||||
|
|
||||||
/* Reduce the sum if we match any of the previous rows */
|
/* Reduce the sum if we match any of the previous rows */
|
||||||
for (i = 0; i < (png_uint_32)png_ptr->num_prev_filters; i++)
|
istop = (png_uint_32)png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_NONE)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_NONE)
|
||||||
{
|
{
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
||||||
PNG_WEIGHT_SHIFT;
|
PNG_WEIGHT_SHIFT;
|
||||||
@ -1468,15 +1476,34 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* sub filter */
|
/* sub filter */
|
||||||
if (png_ptr->do_filter & PNG_FILTER_SUB)
|
if (filter_to_do == PNG_FILTER_SUB)
|
||||||
|
/* it's the only filter so no testing is needed */
|
||||||
|
{
|
||||||
|
png_bytep rp, lp, dp;
|
||||||
|
png_uint_32 i,istop;
|
||||||
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
|
||||||
|
i++, rp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = *rp;
|
||||||
|
}
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (lp = row_buf + 1; i < istop;
|
||||||
|
i++, rp++, lp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
||||||
|
}
|
||||||
|
best_row = png_ptr->sub_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (filter_to_do & PNG_FILTER_SUB)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, lp;
|
png_bytep rp, dp, lp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
/* We temporarily increase the "minumum sum" by the factor we
|
/* We temporarily increase the "minimum sum" by the factor we
|
||||||
* would reduce the sum of this filter, so that we can do the
|
* would reduce the sum of this filter, so that we can do the
|
||||||
* early exit comparison without scaling the sum each time.
|
* early exit comparison without scaling the sum each time.
|
||||||
*/
|
*/
|
||||||
@ -1486,7 +1513,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
lmlo = lmins & PNG_LOMASK;
|
lmlo = lmins & PNG_LOMASK;
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < (png_uint_32)png_ptr->num_prev_filters; i++)
|
istop = (png_uint_32)png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_SUB)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_SUB)
|
||||||
{
|
{
|
||||||
@ -1534,7 +1562,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
sumlo = sum & PNG_LOMASK;
|
sumlo = sum & PNG_LOMASK;
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < (png_uint_32)png_ptr->num_prev_filters; i++)
|
istop = (png_uint_32)png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_SUB)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_SUB)
|
||||||
{
|
{
|
||||||
@ -1565,13 +1594,29 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* up filter */
|
/* up filter */
|
||||||
if (png_ptr->do_filter & PNG_FILTER_UP)
|
if (filter_to_do == PNG_FILTER_UP)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, pp;
|
||||||
|
png_uint_32 i, istop;
|
||||||
|
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
||||||
|
pp = prev_row + 1; i < istop;
|
||||||
|
i++, rp++, pp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||||
|
}
|
||||||
|
best_row = png_ptr->up_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (filter_to_do & PNG_FILTER_UP)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp;
|
png_bytep rp, dp, pp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||||
{
|
{
|
||||||
@ -1579,7 +1624,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
lmlo = lmins & PNG_LOMASK;
|
lmlo = lmins & PNG_LOMASK;
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < (png_uint_32)png_ptr->num_prev_filters; i++)
|
istop = (png_uint_32)png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_UP)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_UP)
|
||||||
{
|
{
|
||||||
@ -1602,8 +1648,9 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
istop = row_info->rowbytes;
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
||||||
pp = prev_row + 1; i < row_info->rowbytes;
|
pp = prev_row + 1; i < istop;
|
||||||
i++, rp++, pp++, dp++)
|
i++, rp++, pp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||||
@ -1621,9 +1668,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
sumlo = sum & PNG_LOMASK;
|
sumlo = sum & PNG_LOMASK;
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < (png_uint_32)png_ptr->num_prev_filters; i++)
|
istop = (png_uint_32)png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_UP)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_UP)
|
||||||
{
|
{
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
||||||
PNG_WEIGHT_SHIFT;
|
PNG_WEIGHT_SHIFT;
|
||||||
@ -1652,11 +1700,28 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* avg filter */
|
/* avg filter */
|
||||||
if (png_ptr->do_filter & PNG_FILTER_AVG)
|
if (filter_to_do == PNG_FILTER_AVG)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, pp, lp;
|
||||||
|
png_uint_32 i,istop;
|
||||||
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||||
|
pp = prev_row + 1; i < bpp; i++, rp++, pp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - ((int)*pp / 2)) & 0xff);
|
||||||
|
}
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (lp = row_buf + 1; i < istop; i++, rp++, pp++, lp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - (((int)*pp + (int)*lp) / 2)) & 0xff);
|
||||||
|
}
|
||||||
|
best_row = png_ptr->avg_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (filter_to_do & PNG_FILTER_AVG)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp, lp;
|
png_bytep rp, dp, pp, lp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
png_uint_32 i;
|
png_uint_32 i,istop;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
@ -1666,7 +1731,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
lmlo = lmins & PNG_LOMASK;
|
lmlo = lmins & PNG_LOMASK;
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < (png_uint_32)png_ptr->num_prev_filters; i++)
|
istop = (png_uint_32)png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_AVG)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_AVG)
|
||||||
{
|
{
|
||||||
@ -1696,8 +1762,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
}
|
}
|
||||||
for (lp = row_buf + 1; i < row_info->rowbytes;
|
istop = row_info->rowbytes;
|
||||||
i++, rp++, pp++, lp++, dp++)
|
for (lp = row_buf + 1; i < istop; i++, rp++, pp++, lp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = (png_byte)(((int)*rp - (((int)*pp + (int)*lp) / 2)) & 0xff);
|
v = *dp = (png_byte)(((int)*rp - (((int)*pp + (int)*lp) / 2)) & 0xff);
|
||||||
|
|
||||||
@ -1714,9 +1780,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
sumlo = sum & PNG_LOMASK;
|
sumlo = sum & PNG_LOMASK;
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->num_prev_filters; i++)
|
istop = png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_NONE)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_NONE)
|
||||||
{
|
{
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
||||||
PNG_WEIGHT_SHIFT;
|
PNG_WEIGHT_SHIFT;
|
||||||
@ -1745,11 +1812,50 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Paeth filter */
|
/* Paeth filter */
|
||||||
if (png_ptr->do_filter & PNG_FILTER_PAETH)
|
if (filter_to_do == PNG_FILTER_PAETH)
|
||||||
|
{
|
||||||
|
png_bytep rp, dp, pp, cp, lp;
|
||||||
|
png_uint_32 i, istop;
|
||||||
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||||
|
pp = prev_row + 1; i < bpp; i++, rp++, pp++, dp++)
|
||||||
|
{
|
||||||
|
*dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (lp = row_buf + 1, cp = prev_row + 1; i < istop;
|
||||||
|
i++, rp++, pp++, lp++, dp++, cp++)
|
||||||
|
{
|
||||||
|
int a, b, c, pa, pb, pc, p;
|
||||||
|
|
||||||
|
b = *pp;
|
||||||
|
c = *cp;
|
||||||
|
a = *lp;
|
||||||
|
|
||||||
|
p = a + b - c;
|
||||||
|
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
|
pa = abs(p - a);
|
||||||
|
pb = abs(p - b);
|
||||||
|
pc = abs(p - c);
|
||||||
|
#else
|
||||||
|
pa = p > a ? p - a : a - p;
|
||||||
|
pb = p > b ? p - b : b - p;
|
||||||
|
pc = p > c ? p - c : c - p;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||||
|
|
||||||
|
*dp = (png_byte)(((int)*rp - p) & 0xff);
|
||||||
|
}
|
||||||
|
best_row = png_ptr->paeth_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (filter_to_do & PNG_FILTER_PAETH)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp, cp, lp;
|
png_bytep rp, dp, pp, cp, lp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
png_uint_32 i;
|
png_uint_32 i, istop;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
@ -1759,7 +1865,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
lmlo = lmins & PNG_LOMASK;
|
lmlo = lmins & PNG_LOMASK;
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->num_prev_filters; i++)
|
istop = png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_PAETH)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_PAETH)
|
||||||
{
|
{
|
||||||
@ -1783,13 +1890,15 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||||
pp = prev_row + 1; (unsigned)i < bpp; i++, rp++, pp++, dp++)
|
pp = prev_row + 1; i < bpp; i++, rp++, pp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
}
|
}
|
||||||
for (lp = row_buf + 1, cp = prev_row + 1; i < row_info->rowbytes;
|
|
||||||
|
istop = row_info->rowbytes;
|
||||||
|
for (lp = row_buf + 1, cp = prev_row + 1; i < istop;
|
||||||
i++, rp++, pp++, lp++, dp++, cp++)
|
i++, rp++, pp++, lp++, dp++, cp++)
|
||||||
{
|
{
|
||||||
int a, b, c, pa, pb, pc, p;
|
int a, b, c, pa, pb, pc, p;
|
||||||
@ -1799,16 +1908,30 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
a = *lp;
|
a = *lp;
|
||||||
|
|
||||||
p = a + b - c;
|
p = a + b - c;
|
||||||
|
|
||||||
|
#ifndef PNG_SLOW_PAETH
|
||||||
|
#ifdef PNG_USE_ABS
|
||||||
pa = abs(p - a);
|
pa = abs(p - a);
|
||||||
pb = abs(p - b);
|
pb = abs(p - b);
|
||||||
pc = abs(p - c);
|
pc = abs(p - c);
|
||||||
|
#else
|
||||||
|
pa = p > a ? p - a : a - p;
|
||||||
|
pb = p > b ? p - b : b - p;
|
||||||
|
pc = p > c ? p - c : c - p;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||||
|
#else /* PNG_SLOW_PAETH */
|
||||||
|
pa = abs(p - a);
|
||||||
|
pb = abs(p - b);
|
||||||
|
pc = abs(p - c);
|
||||||
if (pa <= pb && pa <= pc)
|
if (pa <= pb && pa <= pc)
|
||||||
p = a;
|
p = a;
|
||||||
else if (pb <= pc)
|
else if (pb <= pc)
|
||||||
p = b;
|
p = b;
|
||||||
else
|
else
|
||||||
p = c;
|
p = c;
|
||||||
|
#endif /* PNG_SLOW_PAETH */
|
||||||
|
|
||||||
v = *dp = (png_byte)(((int)*rp - p) & 0xff);
|
v = *dp = (png_byte)(((int)*rp - p) & 0xff);
|
||||||
|
|
||||||
@ -1825,9 +1948,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
sumlo = sum & PNG_LOMASK;
|
sumlo = sum & PNG_LOMASK;
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->num_prev_filters; i++)
|
istop = png_ptr->num_prev_filters;
|
||||||
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
if (png_ptr->prev_filters[i] == PNG_FILTER_PAETH)
|
if (png_ptr->prev_filters[i] == PNG_FILTER_VALUE_PAETH)
|
||||||
{
|
{
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
sumlo = (sumlo * png_ptr->filter_weights[i]) >>
|
||||||
PNG_WEIGHT_SHIFT;
|
PNG_WEIGHT_SHIFT;
|
||||||
@ -1855,15 +1979,17 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do the actual writing of the filtered row data from the chosen filter. */
|
/* Do the actual writing of the filtered row data from the chosen filter. */
|
||||||
|
|
||||||
png_write_filtered_row(png_ptr, best_row);
|
png_write_filtered_row(png_ptr, best_row);
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
/* Save the type of filter we picked this time for future calculations */
|
/* Save the type of filter we picked this time for future calculations */
|
||||||
if (png_ptr->num_prev_filters > 0)
|
if (png_ptr->num_prev_filters > 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i, istop;
|
||||||
|
|
||||||
for (i = 1; i < (int)png_ptr->num_prev_filters; i++)
|
istop = (int)png_ptr->num_prev_filters;
|
||||||
|
for (i = 1; i < istop; i++)
|
||||||
{
|
{
|
||||||
png_ptr->prev_filters[i] = png_ptr->prev_filters[i - 1];
|
png_ptr->prev_filters[i] = png_ptr->prev_filters[i - 1];
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,16 @@ CC=gcc
|
|||||||
ZLIBLIB=../zlib
|
ZLIBLIB=../zlib
|
||||||
ZLIBINC=../zlib
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
|
ALIGN=
|
||||||
|
# For I-386:
|
||||||
|
#ALIGN=-malign-loops=2 -malign-functions=2
|
||||||
|
|
||||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -malign-loops=2 \
|
|
||||||
-malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5
|
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
|
||||||
|
$(ALIGN) #$(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
@ -24,7 +29,7 @@ RANLIB=ranlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0
|
PNGMIN = 1.0.1a
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
# where make install puts libpng.a, libpng.so*, and png.h
|
||||||
|
@ -20,7 +20,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|||||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
CFLAGS=-I$(ZLIBINC) -Wall -O3 \
|
CFLAGS=-I$(ZLIBINC) -Wall -O3 \
|
||||||
#$(WARNMORE) -g -DPNG_DEBUG=5
|
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
#RANLIB=ranlib
|
#RANLIB=ranlib
|
||||||
@ -29,7 +29,7 @@ RANLIB=echo
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0
|
PNGMIN = 1.0.1a
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
# where make install puts libpng.a, libpng.so*, and png.h
|
||||||
|
@ -10,7 +10,8 @@ ZLIBINC=../zlib
|
|||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -O -fullwarn # -g -DPNG_DEBUG=1
|
WARNMORE=-fullwarn
|
||||||
|
CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
RANLIB=echo
|
RANLIB=echo
|
||||||
|
@ -9,7 +9,7 @@ ZLIBLIB=../zlib
|
|||||||
ZLIBINC=../zlib
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
|
@ -13,7 +13,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \
|
|||||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes
|
-Wstrict-prototypes -Wmissing-prototypes
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_DEBUG=4
|
CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Makefile for libpng
|
# Makefile for libpng
|
||||||
# Watcom 10a and later 32-bit protected mode flat memory model
|
# Watcom 10.0a and later 32-bit protected mode flat memory model
|
||||||
|
|
||||||
# Adapted by Pawel Mrochen, based on makefile.msc
|
# Adapted by Pawel Mrochen, based on makefile.msc
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
# To use, do "wmake -f makefile.wat"
|
# To use, do "wmake -f makefile.wat"
|
||||||
|
|
||||||
# ------------- Watcom 10a and later -------------
|
# ------------- Watcom 10.0a and later -------------
|
||||||
MODEL=-mf
|
MODEL=-mf
|
||||||
CFLAGS= $(MODEL) -fpi87 -fp5 -5r -oaeilmnrt -s -zp4 -i=..\zlib
|
CFLAGS= $(MODEL) -5r -fp5 -fpi87 -oneatx -zp8 -i=..\zlib
|
||||||
CC=wcc386
|
CC=wcc386
|
||||||
LD=wcl386
|
LD=wcl386
|
||||||
LIB=wlib -b -c
|
LIB=wlib -b -c
|
||||||
@ -75,9 +75,9 @@ pngwutil$(O): png.h pngconf.h
|
|||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
|
||||||
$(LIB) -n libpng.lib +$(OBJS1)
|
$(LIB) -n libpng.lib $(OBJS1)
|
||||||
$(LIB) libpng.lib +$(OBJS2)
|
$(LIB) libpng.lib $(OBJS2)
|
||||||
$(LIB) libpng.lib +$(OBJS3)
|
$(LIB) libpng.lib $(OBJS3)
|
||||||
|
|
||||||
pngtest.exe: pngtest.obj libpng.lib
|
pngtest.exe: pngtest.obj libpng.lib
|
||||||
$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib
|
$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib
|
||||||
|
Reference in New Issue
Block a user