Imported from libpng-1.0.10beta1.tar

This commit is contained in:
Glenn Randers-Pehrson 2001-03-14 07:08:39 -06:00
parent d4e8109a48
commit 1909560348
52 changed files with 1171 additions and 694 deletions

View File

@ -1,58 +1,21 @@
Libpng 1.0.9 - January 31, 2001
Libpng 1.0.10beta1 - March 14, 2001
This is a public release of libpng, intended for use in production codes.
Changes since the last public release (1.0.8):
Changes since the last public release (1.0.9):
Fixed typo in scripts/makefile.hpux
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
Changed "cdrom.com" in documentation to "libpng.org"
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
Changed type of "params" from voidp to png_voidp in png_read|write_png().
Added MNG_EXTENSIONS_SUPPORTED macro and support for some proposed MNG
features, for testing purposes.
Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h.
Revised the 3 instances of WRITEFILE in pngtest.c.
Updated png.rc in dll/msvc project
Revised makefile.dec to define and use LIBPATH and INCPATH
Increased size of global png_libpng_ver[] array from 12 to 18 chars.
Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const.
Removed duplicate png_crc_finish() from png_handle_bKGD() function.
Added a warning when application calls png_read_update_info() multiple times.
Revised makefile.cygwin
Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
Relocated "msvc" and "wince" project subdirectories into "projects"
subdirectory and added projects/borland project subdirectory.
Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
Add error message in png_set_compression_buffer_size() when malloc fails.
Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project.
Removed the png_flush() in pngwrite.c that crashes some applications
that don't set png_output_flush_fn.
Added makefile.macosx and makefile.aix to scripts directory.
Change png_chunk_warning to png_warning in png_check_keyword().
Increased the first part of msg buffer from 16 to 18 in png_chunk_error().
Added support for filter method 64 (for PNG datastreams embedded in MNG)
Revised png_set_filter() to accept filter method 64 when appropriate.
Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to
help prevent applications from using MNG features in PNG datastreams.
Revised libpng.3/libpng.txt. Changed "filter type" to "filter method".
Fixed error handling of unknown compression type in png_decompress_chunk().
In pngconf.h, define __cdecl when _MSC_VER is defined.
Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places.
Revised memory management in png_set_hIST and png_handle_hIST in a backward
compatible manner. PLTE and tRNS were revised similarly.
Revised the iCCP chunk reader to ignore trailing garbage.
Moved pngasmrd.h into pngconf.h.
Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
Added png_set_invalid to wince and msvc project module definition files.
Fixed bug with progressive reading of narrow interlaced images in pngpread.c
Do not typedef png_FILE_io in pngconf.h when PNG_NO_STDIO is defined.
Updated makefile.sgi to make shared library.
Added check of cygwin's ALL_STATIC in pngconf.h
Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos.
Revised makefile.dec
Reformatted libpng.3 to eliminate bad line breaks.
Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c
Added prototype for png_mmx_support() near the top of pnggccrd.c
Moved some error checking from png_handle_IHDR to png_set_IHDR.
Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros.
Revised png_mmx_support() function in pnggccrd.c
Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c
Fixed memory leak in contrib/visupng/PngFile.c
Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version)
Added warnings when retrieving or setting gamma=0.
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

13
CHANGES
View File

@ -893,6 +893,19 @@ version 1.0.9rc2 [January 22, 2001]
version 1.0.9 [January 31, 2001]
Added check of cygwin's ALL_STATIC in pngconf.h
Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos.
version 1.0.10beta1 [March 14, 2001]
Revised makefile.dec, makefile.sgi, and makefile.sggcc; added makefile.hpgcc.
Reformatted libpng.3 to eliminate bad line breaks.
Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c
Added prototype for png_mmx_support() near the top of pnggccrd.c
Moved some error checking from png_handle_IHDR to png_set_IHDR.
Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros.
Revised png_mmx_support() function in pnggccrd.c
Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c
Fixed memory leak in contrib/visupng/PngFile.c
Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version)
Added warnings when retrieving or setting gamma=0.
Increased the first part of msg buffer from 16 to 18 in png_chunk_warning().
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

13
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.9 - January 31, 2001
Installing libpng version 1.0.10beta1 - March 14, 2001
Before installing libpng, you must first install zlib. zlib
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.
You can rename the directories that you downloaded (they
might be called "libpng-1.0.9" or "lpng109" and "zlib-1.1.3"
might be called "libpng-1.0.10beta1" or "lpng109" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -59,8 +59,8 @@ The files that are presently available in the scripts directory
include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9,
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.10beta1)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.10beta1,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -69,15 +69,16 @@ include
makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.dec => DEC Alpha UNIX makefile
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.macosx => MACOS X Makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.10beta1)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.9)
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.10beta1)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -1,4 +1,4 @@
Known bugs in libpng-1.0.9
Known bugs in libpng-1.0.10
None.
None as of March 14, 2001.

14
LICENSE
View File

@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.0.7, July 1, 2000, through 1.0.9, January 31, 2001, are
Copyright (c) 2000 Glenn Randers-Pehrson
libpng versions 1.0.7, July 1, 2000, through 1.0.10beta1, March 14, 2001, are
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
and are distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
@ -73,11 +73,11 @@ to the following restrictions:
1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source.
2. Altered versions must be plainly marked as such and
must not be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
3. This Copyright notice may not be removed or altered from
any source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to
@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
January 31, 2001
March 14, 2001

11
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.9 - January 31, 2001 (shared library 2.1)
README for libpng 1.0.10beta1 - March 14, 2001 (shared library 2.1)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@ -182,9 +182,9 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.9)
(gcc, creates libpng.so.2.1.0.10beta1)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.9, uses assembler code
libpng.so.2.1.0.10beta1, uses assembler code
tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@ -193,16 +193,17 @@ Files in this distribution:
makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.dec => DEC Alpha UNIX makefile
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.macosx => MACOS X Makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.10beta1)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.9)
(gcc, creates libpng.so.2.1.0.10beta1)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
January 31, 2001
March 14, 2001
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.9 are Y2K compliant. It is my belief that earlier
upward through 1.0.10beta1 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer

2
configure vendored
View File

@ -1,5 +1,5 @@
echo "
There is no \"configure\" script for Libpng-1.0.9. Instead, please
There is no \"configure\" script for Libpng-1.0.10beta1. Instead, please
copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details.
"

View File

@ -370,14 +370,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
// clean up after the write, and free any memory allocated
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
// yepp, done
}
Catch (msg)
{
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
if(ppbRowPointers)
free (ppbRowPointers);

361
libpng.3
View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "January 31, 2001"
.TH LIBPNG 3 "March 14, 2001"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.10beta1
.SH SYNOPSIS
\fI\fB
@ -747,7 +747,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.9 - January 31, 2001
libpng version 1.0.10beta1 - March 14, 2001
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -1004,10 +1004,11 @@ input stream. You must supply the function
png_byte name[5];
png_byte *data;
png_size_t size;
/* Note that libpng has already taken care of the
CRC handling */
/* Note that libpng has already taken care of
the CRC handling */
/* put your code here. Return one of the following: */
/* put your code here. Return one of the
following: */
return (-n); /* chunk had an error */
return (0); /* did not recognize */
@ -1078,16 +1079,23 @@ the entire image into memory, and (b) the input transformations
you want to do are limited to the following set:
PNG_TRANSFORM_IDENTITY No transformation
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to 8 bits
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to
8 bits
PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit samples to bytes
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit
samples to bytes
PNG_TRANSFORM_PACKSWAP Change order of packed
pixels to LSB first
PNG_TRANSFORM_EXPAND Perform set_expand()
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
PNG_TRANSFORM_SHIFT Normalize pixels to the
sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
(This excludes setting a background color, doing gamma transformation,
@ -1115,9 +1123,11 @@ where row_pointers is an array of pointers to the pixel data for each row:
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
row_pointers = png_malloc(png_ptr,
height*sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
row_pointers[i]=png_malloc(png_ptr,
width*pixel_size);
png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define
@ -1185,8 +1195,8 @@ in until png_read_end() has read the chunk data following the image.
interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7)
Any or all of interlace_type, compression_type, of
filter_method can be NULL if you are
not interested in their values.
filter_method can be NULL if you are
not interested in their values.
channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the
@ -1249,14 +1259,15 @@ into the info_ptr is returned for any complex types.
implies specific values of gAMA and
cHRM.
png_get_iCCP(png_ptr, info_ptr, &name, &compression_type,
&profile, &proflen);
png_get_iCCP(png_ptr, info_ptr, &name,
&compression_type, &profile, &proflen);
name - The profile name.
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
for PNG 1.0. You may give NULL to this argument
to ignore it.
profile - International Color Consortium color profile
data. May contain NULs.
compression - The compression type; always
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
You may give NULL to this argument to
ignore it.
profile - International Color Consortium color
profile data. May contain NULs.
proflen - length of profile data in bytes.
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
@ -1312,21 +1323,24 @@ into the info_ptr is returned for any complex types.
string for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8
(empty string for unknown).
num_text - number of comments (same as num_comments;
you can put NULL here to avoid the duplication)
Note while png_set_text() will accept text, language, and
translated keywords that can be NULL pointers, the structure
returned by png_get_text will always contain regular
zero-terminated C strings. They might be empty strings but
they will never be NULL pointers.
num_text - number of comments (same as
num_comments; you can put NULL here
to avoid the duplication)
Note while png_set_text() will accept text, language,
and translated keywords that can be NULL pointers, the
structure returned by png_get_text will always contain
regular zero-terminated C strings. They might be
empty strings but they will never be NULL pointers.
num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr);
num_spalettes = png_get_sPLT(png_ptr, info_ptr,
&palette_ptr);
palette_ptr - array of palette structures holding
contents of one or more sPLT chunks read.
contents of one or more sPLT chunks
read.
num_spalettes - number of sPLT chunks read.
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
&unit_type);
&unit_type);
offset_x - positive offset from the left edge
of the screen
offset_y - positive offset from the top edge
@ -1334,7 +1348,7 @@ into the info_ptr is returned for any complex types.
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
&unit_type);
&unit_type);
res_x - pixels/unit physical resolution in
x direction
res_y - pixels/unit physical resolution in
@ -1342,47 +1356,50 @@ into the info_ptr is returned for any complex types.
unit_type - PNG_RESOLUTION_UNKNOWN,
PNG_RESOLUTION_METER
png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height)
png_get_sCAL(png_ptr, info_ptr, &unit, &width,
&height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are doubles)
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height)
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width,
&height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
&unknowns)
unknowns - array of png_unknown_chunk structures holding
unknown chunks
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
info_ptr, &unknowns)
unknowns - array of png_unknown_chunk
structures holding unknown chunks
unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk's data
unknowns[i].location - position of chunk in file
The value of "i" corresponds to the order in which the chunks were read
from the PNG file or inserted with the png_set_unknown_chunks() function.
The value of "i" corresponds to the order in which the
chunks were read from the PNG file or inserted with the
png_set_unknown_chunks() function.
The data from the pHYs chunk can be retrieved in several convenient
forms:
res_x = png_get_x_pixels_per_meter(png_ptr,
info_ptr)
info_ptr)
res_y = png_get_y_pixels_per_meter(png_ptr,
info_ptr)
info_ptr)
res_x_and_y = png_get_pixels_per_meter(png_ptr,
info_ptr)
info_ptr)
res_x = png_get_x_pixels_per_inch(png_ptr,
info_ptr)
info_ptr)
res_y = png_get_y_pixels_per_inch(png_ptr,
info_ptr)
info_ptr)
res_x_and_y = png_get_pixels_per_inch(png_ptr,
info_ptr)
info_ptr)
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
info_ptr)
info_ptr)
(Each of these returns 0 [signifying "unknown"] if
the data is not present or if res_x is 0;
@ -1397,8 +1414,8 @@ forms:
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
(Each of these returns 0 [signifying "unknown" if both
x and y are 0] if the data is not present or if the chunk
is present but the unit is the pixel)
x and y are 0] if the data is not present or if the
chunk is present but the unit is the pixel)
For more information, see the png_info definition in png.h and the
PNG specification for chunk contents. Be careful with trusting
@ -1932,7 +1949,7 @@ When you are done, you can free all memory allocated by libpng like this:
It is also possible to individually free the info_ptr members that
point to libpng-allocated storage with the following function:
png_free_data(png_ptr, info_ptr, mask, n)
png_free_data(png_ptr, info_ptr, mask, seq)
mask - identifies data to be freed, a mask
containing the logical OR of one or
more of
@ -1942,16 +1959,17 @@ point to libpng-allocated storage with the following function:
PNG_FREE_SCAL, PNG_FREE_SPLT,
PNG_FREE_TEXT, PNG_FREE_UNKN,
or simply PNG_FREE_ALL
n - sequence number of item to be freed
seq - sequence number of item to be freed
(-1 for all items)
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not
cases do nothing. The "seq" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "seq" is not
-1, and multiple items are allowed for the data type identified in
the mask, such as text or sPLT, only the n'th item is freed.
the mask, such as text or sPLT, only the n'th item in the structure
is freed, where n is "seq".
The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data,
@ -2124,9 +2142,10 @@ png_infop info_ptr;
/* This function is called when each row of image
data is complete */
void
row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass)
png_uint_32 row_num, int pass)
{
/* If the image is interlaced, and you turned
on the interlace handler, this function will
@ -2270,7 +2289,8 @@ called after each row has been written, which you can use to control
a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void write_row_callback(png_ptr, png_uint_32 row, int pass);
void write_row_callback(png_ptr, png_uint_32 row,
int pass);
{
/* put your code here */
}
@ -2298,8 +2318,9 @@ types.
/* turn on or off filtering, and/or choose
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
or the logical OR of one or more PNG_FILTER_NAME masks. */
specific filters. You can use either a single
PNG_FILTER_VALUE_NAME or the logical OR of one
or more PNG_FILTER_NAME masks. */
png_set_filter(png_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
@ -2435,11 +2456,12 @@ Some of the more important parts of the png_info are:
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
profile, proflen);
name - The profile name.
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
for PNG 1.0. You may give NULL to this argument
to ignore it.
profile - International Color Consortium color profile
data. May contain NULs.
compression - The compression type; always
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
You may give NULL to this argument to
ignore it.
profile - International Color Consortium color
profile data. May contain NULs.
proflen - length of profile data in bytes.
png_set_sBIT(png_ptr, info_ptr, sig_bit);
@ -2493,11 +2515,13 @@ Some of the more important parts of the png_info are:
or empty for unknown).
num_text - number of comments
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
palette_ptr - array of png_sPLT_struct structures to be
added to the list of palettes in the info
structure.
num_spalettes - number of palette structures to be added.
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
num_spalettes);
palette_ptr - array of png_sPLT_struct structures
to be added to the list of palettes
in the info structure.
num_spalettes - number of palette structures to be
added.
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
unit_type);
@ -2528,9 +2552,10 @@ Some of the more important parts of the png_info are:
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
unknowns - array of png_unknown_chunk structures holding
unknown chunks
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
num_unknowns)
unknowns - array of png_unknown_chunk
structures holding unknown chunks
unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk's data
@ -2539,14 +2564,15 @@ Some of the more important parts of the png_info are:
PNG_HAVE_IHDR: before PLTE
PNG_HAVE_PLTE: before IDAT
PNG_AFTER_IDAT: after IDAT
The "location" member is set automatically according to
what part of the output file has already been written.
You can change its value after calling png_set_unknown_chunks()
as demonstrated in pngtest.c. Within each of the "locations",
the chunks are sequenced according to their position in the
structure (that is, the value of "i", which is the order in which
the chunk was either read from the input file or defined with
png_set_unknown_chunks).
The "location" member is set automatically according to
what part of the output file has already been written.
You can change its value after calling png_set_unknown_chunks()
as demonstrated in pngtest.c. Within each of the "locations",
the chunks are sequenced according to their position in the
structure (that is, the value of "i", which is the order in which
the chunk was either read from the input file or defined with
png_set_unknown_chunks).
A quick word about text and num_text. text is an array of png_text
structures. num_text is the number of valid structures in the array.
@ -2647,12 +2673,17 @@ transformations are permitted, enabled by the following masks.
PNG_TRANSFORM_IDENTITY No transformation
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
PNG_TRANSFORM_PACKSWAP Change order of packed
pixels to LSB first
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
PNG_TRANSFORM_SHIFT Normalize pixels to the
sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
@ -2916,7 +2947,7 @@ When you are done, you can free all memory used by libpng like this:
It is also possible to individually free the info_ptr members that
point to libpng-allocated storage with the following function:
png_free_data(png_ptr, info_ptr, mask, n)
png_free_data(png_ptr, info_ptr, mask, seq)
mask - identifies data to be freed, a mask
containing the logical OR of one or
more of
@ -2926,16 +2957,17 @@ point to libpng-allocated storage with the following function:
PNG_FREE_SCAL, PNG_FREE_SPLT,
PNG_FREE_TEXT, PNG_FREE_UNKN,
or simply PNG_FREE_ALL
n - sequence number of item to be freed
seq - sequence number of item to be freed
(-1 for all items)
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not
cases do nothing. The "seq" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "seq" is not
-1, and multiple items are allowed for the data type identified in
the mask, such as text or sPLT, only the n'th item is freed.
the mask, such as text or sPLT, only the n'th item in the structure
is freed, where n is "seq".
If you allocated data such as a palette that you passed
in to libpng with png_set_*, you must not free it until just before the call to
@ -3016,8 +3048,8 @@ memory allocation on a platform will change between applications, these
functions must be modified in the library at compile time. If you prefer
to use a different method of allocating and freeing data, you can use
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn)
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
This function also provides a void pointer that can be retrieved via
@ -3025,7 +3057,8 @@ This function also provides a void pointer that can be retrieved via
Your replacement memory functions must have prototypes as follows:
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
png_voidp malloc_fn(png_structp png_ptr,
png_uint_32 size);
void free_fn(png_structp png_ptr, png_voidp ptr);
Input/Output in libpng is done through png_read() and png_write(),
@ -3237,10 +3270,12 @@ structures appropriately for all of the filter types.
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
The second parameter can also be PNG_INTRAPIXEL_DIFFERENCING
if you are writing a PNG to be embedded in a MNG
datastream. This parameter must be the same as the
value of filter_method used in png_set_IHDR().
The second parameter can also be
PNG_INTRAPIXEL_DIFFERENCING if you are
writing a PNG to be embedded in a MNG
datastream. This parameter must be the
same as the value of filter_method used
in png_set_IHDR().
It is also possible to influence how libpng chooses from among the
available filters. This is done in two ways - by telling it how
@ -3429,13 +3464,13 @@ application:
.SH VIII. Y2K Compliance in libpng
January 31, 2001
March 14, 2001
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.9 are Y2K compliant. It is my belief that earlier
upward through 1.0.10beta1 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@ -3453,7 +3488,8 @@ There are seven time-related functions:
png_convert_to_rfc_1123() in png.c
(formerly png_convert_to_rfc_1152() in error)
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
png_convert_from_struct_tm() in pngwrite.c, called
in pngwrite.c
png_convert_from_time_t() in pngwrite.c
png_get_tIME() in pngget.c
png_handle_tIME() in pngrutil.c, called in pngread.c
@ -3492,43 +3528,63 @@ on the library has not always been consistent and straightforward.
The following table summarizes matters since version 0.89c, which was
the first widely used release:
source png.h png.h shared-lib
version string int version
------- ------ ----- ----------
0.89c ("1.0 beta 3") 0.89 89 1.0.89
0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90]
0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95]
0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96]
0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97]
0.97c 0.97 97 2.0.97
0.98 0.98 98 2.0.98
0.99 0.99 98 2.0.99
0.99a-m 0.99 99 2.0.99
1.00 1.00 100 2.1.0 [100 should be 10000]
1.0.0 1.0.0 100 2.1.0 [100 should be 10000]
1.0.1 1.0.1 10001 2.1.0
1.0.1a-e 1.0.1a-e 10002 2.1.0.1a-e
1.0.2 1.0.2 10002 2.1.0.2
1.0.2a-b 1.0.2a-b 10003 2.1.0.2a-b
1.0.3 1.0.3 10003 2.1.0.3
1.0.3a-d 1.0.3a-d 10004 2.1.0.3a-d
1.0.4 1.0.4 10004 2.1.0.4
1.0.4a-f 1.0.4a-f 10005 2.1.0.4a-f
1.0.5 (+ 2 patches) 1.0.5 10005 2.1.0.5
1.0.5a-d 1.0.5a-d 10006 2.1.0.5a-d
1.0.5e-r 1.0.5e-r 10100 2.1.0.5e-r (not compatible)
1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (compatible)
1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6
1.0.6d 1.0.6d 10007 2.1.0.6d
1.0.7 1.0.7 10007 2.1.0.7 (still compatible)
source png.h png.h shared-lib
version string int version
------- ------ ----- ----------
0.89c ("beta 3") 0.89 89 1.0.89
0.90 ("beta 4") 0.90 90 0.90
0.95 ("beta 5") 0.95 95 0.95
0.96 ("beta 6") 0.96 96 0.96
0.97b ("beta 7") 1.00.97 97 1.0.1
0.97c 0.97 97 2.0.97
0.98 0.98 98 2.0.98
0.99 0.99 98 2.0.99
0.99a-m 0.99 99 2.0.99
1.00 1.00 100 2.1.0
1.0.0 1.0.0 100 2.1.0
1.0.0 (from here on, the 100 2.1.0
1.0.1 png.h string is 10001 2.1.0
1.0.1a-e identical to the 10002 from here on, the
1.0.2 source version) 10002 shared library is 2.V
1.0.2a-b 10003 where V is the source
1.0.1 10001 code version except as
1.0.1a-e 10002 2.1.0.1a-e noted.
1.0.2 10002 2.1.0.2
1.0.2a-b 10003 2.1.0.2a-b
1.0.3 10003 2.1.0.3
1.0.3a-d 10004 2.1.0.3a-d
1.0.4 10004 2.1.0.4
1.0.4a-f 10005 2.1.0.4a-f
1.0.5 (+ 2 patches) 10005 2.1.0.5
1.0.5a-d 10006 2.1.0.5a-d
1.0.5e-r 10100 2.1.0.5e-r
1.0.5s-v 10006 2.1.0.5s-v
1.0.6 (+ 3 patches) 10006 2.1.0.6
1.0.6d-g 10007 2.1.0.6d-g
1.0.6h 10007 10.6h
1.0.6i 10007 10.6i
1.0.6j 10007 2.1.0.6j
1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14
1.0.7beta15-18 1 10007 2.1.0.7beta15-18
1.0.7rc1-2 1 10007 2.1.0.7rc1-2
1.0.7 1 10007 2.1.0.7
1.0.8beta1-4 1 10008 2.1.0.8beta1-4
1.0.8rc1 1 10008 2.1.0.8rc1
1.0.8 1 10008 2.1.0.8
1.0.9beta1-6 1 10009 2.1.0.9beta1-6
1.0.9rc1 1 10009 2.1.0.9rc1
1.0.9beta7-10 1 10009 2.1.0.9beta7-10
1.0.9rc2 1 10009 2.1.0.9rc2
1.0.9 1 10009 2.1.0.9
1.0.10rc1 1 10010 2.1.0.10rc1
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
used for changes in backward compatibility, as it is intended. The
PNG_PNGLIB_VER macro, which is not used within libpng but 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). Beta versions
are given the previous public release number plus a letter or two.
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
used for changes in backward compatibility, as it is intended. The
PNG_PNGLIB_VER macro, which is not used within libpng but 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). Beta versions
are given the previous public release number plus a letter or two.
.SH "SEE ALSO"
libpngpf(3), png(5)
@ -3576,7 +3632,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.9 - January 31, 2001:
Libpng version 1.0.10beta1 - March 14, 2001:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@ -3593,8 +3649,8 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.0.7, July 1, 2000, through 1.0.9, January 31, 2001, are
Copyright (c) 2000 Glenn Randers-Pehrson, and are
libpng versions 1.0.7, July 1, 2000, through 1.0.10beta1, March 14, 2001, are
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
@ -3604,12 +3660,13 @@ with the following individuals added to the list of Contributing Authors
and with the following additions to the disclaimer:
There is no warranty against interference with your enjoyment of the
library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is with
the user.
There is no warranty against interference with your
enjoyment of the library or against infringement.
There is no warranty that our efforts or the library
will fulfill any of your particular purposes or needs.
This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and
effort is with the user.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
@ -3658,11 +3715,11 @@ to the following restrictions:
1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source.
2. Altered versions must be plainly marked as such and
must not be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
3. This Copyright notice may not be removed or altered from
any source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to
@ -3684,7 +3741,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
January 31, 2001
March 14, 2001
.\" end of man page

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.9 - January 31, 2001
libpng version 1.0.10beta1 - March 14, 2001
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@ -257,10 +257,11 @@ input stream. You must supply the function
png_byte name[5];
png_byte *data;
png_size_t size;
/* Note that libpng has already taken care of the
CRC handling */
/* Note that libpng has already taken care of
the CRC handling */
/* put your code here. Return one of the following: */
/* put your code here. Return one of the
following: */
return (-n); /* chunk had an error */
return (0); /* did not recognize */
@ -331,16 +332,23 @@ the entire image into memory, and (b) the input transformations
you want to do are limited to the following set:
PNG_TRANSFORM_IDENTITY No transformation
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to 8 bits
PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to
8 bits
PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit samples to bytes
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit
samples to bytes
PNG_TRANSFORM_PACKSWAP Change order of packed
pixels to LSB first
PNG_TRANSFORM_EXPAND Perform set_expand()
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
PNG_TRANSFORM_SHIFT Normalize pixels to the
sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
(This excludes setting a background color, doing gamma transformation,
@ -368,9 +376,11 @@ where row_pointers is an array of pointers to the pixel data for each row:
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
row_pointers = png_malloc(png_ptr,
height*sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
row_pointers[i]=png_malloc(png_ptr,
width*pixel_size);
png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define
@ -438,8 +448,8 @@ in until png_read_end() has read the chunk data following the image.
interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7)
Any or all of interlace_type, compression_type, of
filter_method can be NULL if you are
not interested in their values.
filter_method can be NULL if you are
not interested in their values.
channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the
@ -502,14 +512,15 @@ into the info_ptr is returned for any complex types.
implies specific values of gAMA and
cHRM.
png_get_iCCP(png_ptr, info_ptr, &name, &compression_type,
&profile, &proflen);
png_get_iCCP(png_ptr, info_ptr, &name,
&compression_type, &profile, &proflen);
name - The profile name.
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
for PNG 1.0. You may give NULL to this argument
to ignore it.
profile - International Color Consortium color profile
data. May contain NULs.
compression - The compression type; always
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
You may give NULL to this argument to
ignore it.
profile - International Color Consortium color
profile data. May contain NULs.
proflen - length of profile data in bytes.
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
@ -565,21 +576,24 @@ into the info_ptr is returned for any complex types.
string for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8
(empty string for unknown).
num_text - number of comments (same as num_comments;
you can put NULL here to avoid the duplication)
Note while png_set_text() will accept text, language, and
translated keywords that can be NULL pointers, the structure
returned by png_get_text will always contain regular
zero-terminated C strings. They might be empty strings but
they will never be NULL pointers.
num_text - number of comments (same as
num_comments; you can put NULL here
to avoid the duplication)
Note while png_set_text() will accept text, language,
and translated keywords that can be NULL pointers, the
structure returned by png_get_text will always contain
regular zero-terminated C strings. They might be
empty strings but they will never be NULL pointers.
num_spalettes = png_get_sPLT(png_ptr, info_ptr, &palette_ptr);
num_spalettes = png_get_sPLT(png_ptr, info_ptr,
&palette_ptr);
palette_ptr - array of palette structures holding
contents of one or more sPLT chunks read.
contents of one or more sPLT chunks
read.
num_spalettes - number of sPLT chunks read.
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
&unit_type);
&unit_type);
offset_x - positive offset from the left edge
of the screen
offset_y - positive offset from the top edge
@ -587,7 +601,7 @@ into the info_ptr is returned for any complex types.
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
&unit_type);
&unit_type);
res_x - pixels/unit physical resolution in
x direction
res_y - pixels/unit physical resolution in
@ -595,47 +609,50 @@ into the info_ptr is returned for any complex types.
unit_type - PNG_RESOLUTION_UNKNOWN,
PNG_RESOLUTION_METER
png_get_sCAL(png_ptr, info_ptr, &unit, &width, &height)
png_get_sCAL(png_ptr, info_ptr, &unit, &width,
&height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are doubles)
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, &height)
png_get_sCAL_s(png_ptr, info_ptr, &unit, &width,
&height)
unit - physical scale units (an integer)
width - width of a pixel in physical scale units
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
&unknowns)
unknowns - array of png_unknown_chunk structures holding
unknown chunks
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
info_ptr, &unknowns)
unknowns - array of png_unknown_chunk
structures holding unknown chunks
unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk's data
unknowns[i].location - position of chunk in file
The value of "i" corresponds to the order in which the chunks were read
from the PNG file or inserted with the png_set_unknown_chunks() function.
The value of "i" corresponds to the order in which the
chunks were read from the PNG file or inserted with the
png_set_unknown_chunks() function.
The data from the pHYs chunk can be retrieved in several convenient
forms:
res_x = png_get_x_pixels_per_meter(png_ptr,
info_ptr)
info_ptr)
res_y = png_get_y_pixels_per_meter(png_ptr,
info_ptr)
info_ptr)
res_x_and_y = png_get_pixels_per_meter(png_ptr,
info_ptr)
info_ptr)
res_x = png_get_x_pixels_per_inch(png_ptr,
info_ptr)
info_ptr)
res_y = png_get_y_pixels_per_inch(png_ptr,
info_ptr)
info_ptr)
res_x_and_y = png_get_pixels_per_inch(png_ptr,
info_ptr)
info_ptr)
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
info_ptr)
info_ptr)
(Each of these returns 0 [signifying "unknown"] if
the data is not present or if res_x is 0;
@ -650,8 +667,8 @@ forms:
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
(Each of these returns 0 [signifying "unknown" if both
x and y are 0] if the data is not present or if the chunk
is present but the unit is the pixel)
x and y are 0] if the data is not present or if the
chunk is present but the unit is the pixel)
For more information, see the png_info definition in png.h and the
PNG specification for chunk contents. Be careful with trusting
@ -1185,7 +1202,7 @@ When you are done, you can free all memory allocated by libpng like this:
It is also possible to individually free the info_ptr members that
point to libpng-allocated storage with the following function:
png_free_data(png_ptr, info_ptr, mask, n)
png_free_data(png_ptr, info_ptr, mask, seq)
mask - identifies data to be freed, a mask
containing the logical OR of one or
more of
@ -1195,16 +1212,17 @@ point to libpng-allocated storage with the following function:
PNG_FREE_SCAL, PNG_FREE_SPLT,
PNG_FREE_TEXT, PNG_FREE_UNKN,
or simply PNG_FREE_ALL
n - sequence number of item to be freed
seq - sequence number of item to be freed
(-1 for all items)
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not
cases do nothing. The "seq" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "seq" is not
-1, and multiple items are allowed for the data type identified in
the mask, such as text or sPLT, only the n'th item is freed.
the mask, such as text or sPLT, only the n'th item in the structure
is freed, where n is "seq".
The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data,
@ -1377,9 +1395,10 @@ png_infop info_ptr;
/* This function is called when each row of image
data is complete */
void
row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass)
png_uint_32 row_num, int pass)
{
/* If the image is interlaced, and you turned
on the interlace handler, this function will
@ -1523,7 +1542,8 @@ called after each row has been written, which you can use to control
a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void write_row_callback(png_ptr, png_uint_32 row, int pass);
void write_row_callback(png_ptr, png_uint_32 row,
int pass);
{
/* put your code here */
}
@ -1551,8 +1571,9 @@ types.
/* turn on or off filtering, and/or choose
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
or the logical OR of one or more PNG_FILTER_NAME masks. */
specific filters. You can use either a single
PNG_FILTER_VALUE_NAME or the logical OR of one
or more PNG_FILTER_NAME masks. */
png_set_filter(png_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
@ -1688,11 +1709,12 @@ Some of the more important parts of the png_info are:
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
profile, proflen);
name - The profile name.
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
for PNG 1.0. You may give NULL to this argument
to ignore it.
profile - International Color Consortium color profile
data. May contain NULs.
compression - The compression type; always
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
You may give NULL to this argument to
ignore it.
profile - International Color Consortium color
profile data. May contain NULs.
proflen - length of profile data in bytes.
png_set_sBIT(png_ptr, info_ptr, sig_bit);
@ -1746,11 +1768,13 @@ Some of the more important parts of the png_info are:
or empty for unknown).
num_text - number of comments
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
palette_ptr - array of png_sPLT_struct structures to be
added to the list of palettes in the info
structure.
num_spalettes - number of palette structures to be added.
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
num_spalettes);
palette_ptr - array of png_sPLT_struct structures
to be added to the list of palettes
in the info structure.
num_spalettes - number of palette structures to be
added.
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
unit_type);
@ -1781,9 +1805,10 @@ Some of the more important parts of the png_info are:
height - height of a pixel in physical scale units
(width and height are strings like "2.54")
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
unknowns - array of png_unknown_chunk structures holding
unknown chunks
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
num_unknowns)
unknowns - array of png_unknown_chunk
structures holding unknown chunks
unknowns[i].name - name of unknown chunk
unknowns[i].data - data of unknown chunk
unknowns[i].size - size of unknown chunk's data
@ -1792,14 +1817,15 @@ Some of the more important parts of the png_info are:
PNG_HAVE_IHDR: before PLTE
PNG_HAVE_PLTE: before IDAT
PNG_AFTER_IDAT: after IDAT
The "location" member is set automatically according to
what part of the output file has already been written.
You can change its value after calling png_set_unknown_chunks()
as demonstrated in pngtest.c. Within each of the "locations",
the chunks are sequenced according to their position in the
structure (that is, the value of "i", which is the order in which
the chunk was either read from the input file or defined with
png_set_unknown_chunks).
The "location" member is set automatically according to
what part of the output file has already been written.
You can change its value after calling png_set_unknown_chunks()
as demonstrated in pngtest.c. Within each of the "locations",
the chunks are sequenced according to their position in the
structure (that is, the value of "i", which is the order in which
the chunk was either read from the input file or defined with
png_set_unknown_chunks).
A quick word about text and num_text. text is an array of png_text
structures. num_text is the number of valid structures in the array.
@ -1900,12 +1926,17 @@ transformations are permitted, enabled by the following masks.
PNG_TRANSFORM_IDENTITY No transformation
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
PNG_TRANSFORM_PACKSWAP Change order of packed
pixels to LSB first
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
PNG_TRANSFORM_SHIFT Normalize pixels to the
sBIT depth
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
to BGRA
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA
to AG
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
@ -2169,7 +2200,7 @@ When you are done, you can free all memory used by libpng like this:
It is also possible to individually free the info_ptr members that
point to libpng-allocated storage with the following function:
png_free_data(png_ptr, info_ptr, mask, n)
png_free_data(png_ptr, info_ptr, mask, seq)
mask - identifies data to be freed, a mask
containing the logical OR of one or
more of
@ -2179,16 +2210,17 @@ point to libpng-allocated storage with the following function:
PNG_FREE_SCAL, PNG_FREE_SPLT,
PNG_FREE_TEXT, PNG_FREE_UNKN,
or simply PNG_FREE_ALL
n - sequence number of item to be freed
seq - sequence number of item to be freed
(-1 for all items)
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not
cases do nothing. The "seq" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "seq" is not
-1, and multiple items are allowed for the data type identified in
the mask, such as text or sPLT, only the n'th item is freed.
the mask, such as text or sPLT, only the n'th item in the structure
is freed, where n is "seq".
If you allocated data such as a palette that you passed
in to libpng with png_set_*, you must not free it until just before the call to
@ -2269,8 +2301,8 @@ memory allocation on a platform will change between applications, these
functions must be modified in the library at compile time. If you prefer
to use a different method of allocating and freeing data, you can use
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn)
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
This function also provides a void pointer that can be retrieved via
@ -2278,7 +2310,8 @@ This function also provides a void pointer that can be retrieved via
Your replacement memory functions must have prototypes as follows:
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
png_voidp malloc_fn(png_structp png_ptr,
png_uint_32 size);
void free_fn(png_structp png_ptr, png_voidp ptr);
Input/Output in libpng is done through png_read() and png_write(),
@ -2490,10 +2523,12 @@ structures appropriately for all of the filter types.
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
The second parameter can also be PNG_INTRAPIXEL_DIFFERENCING
if you are writing a PNG to be embedded in a MNG
datastream. This parameter must be the same as the
value of filter_method used in png_set_IHDR().
The second parameter can also be
PNG_INTRAPIXEL_DIFFERENCING if you are
writing a PNG to be embedded in a MNG
datastream. This parameter must be the
same as the value of filter_method used
in png_set_IHDR().
It is also possible to influence how libpng chooses from among the
available filters. This is done in two ways - by telling it how
@ -2682,13 +2717,13 @@ application:
VIII. Y2K Compliance in libpng
January 31, 2001
March 14, 2001
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.9 are Y2K compliant. It is my belief that earlier
upward through 1.0.10beta1 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@ -2706,7 +2741,8 @@ There are seven time-related functions:
png_convert_to_rfc_1123() in png.c
(formerly png_convert_to_rfc_1152() in error)
png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
png_convert_from_struct_tm() in pngwrite.c, called
in pngwrite.c
png_convert_from_time_t() in pngwrite.c
png_get_tIME() in pngget.c
png_handle_tIME() in pngrutil.c, called in pngread.c

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "January 31, 2001"
.TH LIBPNGPF 3 "March 14, 2001"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.10beta1
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "January 31, 2001"
.TH PNG 5 "March 14, 2001"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

14
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* libpng version 1.0.9 - January 31, 2001
* libpng version 1.0.10beta1 - March 14, 2001
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -13,14 +13,14 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_9 Your_png_h_is_not_version_1_0_9;
typedef version_1_0_10beta1 Your_png_h_is_not_version_1_0_10beta1;
/* Version information for C files. This had better match the version
* string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
const char png_libpng_ver[18] = "1.0.9";
const char png_libpng_ver[18] = "1.0.10beta1";
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
@ -626,7 +626,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ((png_charp) "\n libpng version 1.0.9 - January 31, 2001\n\
return ((png_charp) "\n libpng version 1.0.10beta1 - March 14, 2001\n\
Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
@ -644,8 +644,8 @@ png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return((png_charp) "1.0.9");
return((png_charp) "1.0.9");
return((png_charp) "1.0.10beta1");
return((png_charp) "1.0.10beta1");
}
png_charp PNGAPI
@ -695,7 +695,7 @@ png_uint_32 PNGAPI
png_access_version_number(void)
{
/* Version of *.c files used when building libpng */
return((png_uint_32) 10009L);
return((png_uint_32) 10010L);
}

105
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.0.9 - January 31, 2001
* libpng version 1.0.10beta1 - March 14, 2001
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -9,7 +9,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.9 - January 31, 2001: Glenn
* libpng versions 0.97, January 1998, through 1.0.10beta1 - March 14, 2001: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -64,6 +64,7 @@
* 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
* 1.0.9rc2 1 10009 2.1.0.9rc2
* 1.0.9 1 10009 2.1.0.9
* 1.0.10beta1 1 10010 2.1.0.10beta1
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -93,7 +94,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* libpng versions 1.0.7, July 1, 2000, through 1.0.9, January 31, 2001, are
* libpng versions 1.0.7, July 1, 2000, through 1.0.10beta1, March 14, 2001, are
* Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors
@ -158,11 +159,11 @@
*
* 1. The origin of this source code must not be misrepresented.
*
* 2. Altered versions must be plainly marked as such and must not
* be misrepresented as being the original source.
* 2. Altered versions must be plainly marked as such and
* must not be misrepresented as being the original source.
*
* 3. This Copyright notice may not be removed or altered from any
* source or altered source distribution.
* 3. This Copyright notice may not be removed or altered from
* any source or altered source distribution.
*
* The Contributing Authors and Group 42, Inc. specifically permit, without
* fee, and encourage the use of this source code as a component to
@ -198,13 +199,13 @@
* Y2K compliance in libpng:
* =========================
*
* January 31, 2001
* March 14, 2001
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.9 are Y2K compliant. It is my belief that earlier
* upward through 1.0.10beta1 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@ -260,7 +261,7 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.9"
#define PNG_LIBPNG_VER_STRING "1.0.10beta1"
#define PNG_LIBPNG_VER_SONUM 2
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
@ -268,11 +269,11 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 0
#define PNG_LIBPNG_VER_RELEASE 9
#define PNG_LIBPNG_VER_RELEASE 10
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
#define PNG_LIBPNG_VER_BUILD 0
#define PNG_LIBPNG_VER_BUILD 1
#define PNG_LIBPNG_BUILD_ALPHA 1
#define PNG_LIBPNG_BUILD_BETA 2
@ -280,14 +281,14 @@
#define PNG_LIBPNG_BUILD_STABLE 4
#define PNG_LIBPNG_BUILD_TYPEMASK 7
#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with STABLE only */
#define PNG_LIBPNG_BUILD_TYPE 4
#define PNG_LIBPNG_BUILD_TYPE 2
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
* 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.1 it's xxyyzz, where x=major, y=minor, z=release */
#define PNG_LIBPNG_VER 10009 /* 1.0.9 */
#define PNG_LIBPNG_VER 10010 /* 1.0.10 */
#ifndef PNG_VERSION_INFO_ONLY
@ -902,10 +903,10 @@ typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
png_row_infop, png_bytep));
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_USER_CHUNKS_SUPPORTED)
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
#endif
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#endif
@ -1025,7 +1026,7 @@ struct png_struct_def
#endif
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
#if defined(PNG_bKGD_SUPPORTED)
png_byte background_gamma_type;
# ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma;
@ -1033,8 +1034,8 @@ struct png_struct_def
png_color_16 background; /* background color in screen gamma space */
# if defined(PNG_READ_GAMMA_SUPPORTED)
png_color_16 background_1; /* background normalized to gamma 1.0 */
# endif /* PNG_READ_GAMMA && PNG_READ_bKGD_SUPPORTED */
#endif /* PNG_READ_bKGD_SUPPORTED */
# endif /* PNG_READ_GAMMA && PNG_bKGD_SUPPORTED */
#endif /* PNG_bKGD_SUPPORTED */
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
png_flush_ptr output_flush_fn;/* Function for flushing output */
@ -1059,7 +1060,7 @@ struct png_struct_def
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_sBIT_SUPPORTED)
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
@ -1067,7 +1068,7 @@ struct png_struct_def
png_color_8 shift; /* shift for significant bit tranformation */
#endif
#if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans; /* transparency values for paletted files */
png_color_16 trans_values; /* transparency values for non-paletted files */
@ -1092,12 +1093,12 @@ struct png_struct_def
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
# if defined(PNG_READ_TEXT_SUPPORTED)
# if defined(PNG_TEXT_SUPPORTED)
png_size_t current_text_size; /* current size of text input data */
png_size_t current_text_left; /* how much text left to read in input */
png_charp current_text; /* current text chunk buffer */
png_charp current_text_ptr; /* current location in current_text */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_READ_TEXT_SUPPORTED */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
@ -1115,7 +1116,7 @@ struct png_struct_def
png_bytep dither_index; /* index translation for palette files */
#endif
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_READ_hIST_SUPPORTED)
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
png_uint_16p hist; /* histogram */
#endif
@ -1145,7 +1146,7 @@ struct png_struct_def
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
@ -1175,13 +1176,15 @@ struct png_struct_def
png_byte filter_type;
png_uint_32 row_buf_size;
};
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.9
and png.h are both at * version 1.0.10beta1
*/
typedef png_structp version_1_0_9;
typedef png_structp version_1_0_10beta1;
typedef png_struct FAR * FAR * png_structpp;
@ -1695,7 +1698,7 @@ extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
PNGARG((png_structp png_ptr));
#endif
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
#ifdef PNG_USER_CHUNKS_SUPPORTED
extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
@ -1888,7 +1891,7 @@ png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
png_infop info_ptr));
#if defined(PNG_READ_bKGD_SUPPORTED)
#if defined(PNG_bKGD_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p *background));
#endif
@ -1898,7 +1901,7 @@ extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p background));
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *white_x, double *white_y, double *red_x,
@ -1929,7 +1932,7 @@ extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
#endif
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *file_gamma));
@ -1947,7 +1950,7 @@ extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point int_file_gamma));
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#if defined(PNG_hIST_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p *hist));
#endif
@ -1967,7 +1970,7 @@ extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
int color_type, int interlace_method, int compression_method,
int filter_method));
#if defined(PNG_READ_oFFs_SUPPORTED)
#if defined(PNG_oFFs_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
int *unit_type));
@ -1979,7 +1982,7 @@ extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
int unit_type));
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#if defined(PNG_pCAL_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
int *type, int *nparams, png_charp *units, png_charpp *params));
@ -1991,7 +1994,7 @@ extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
int type, int nparams, png_charp units, png_charpp params));
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#if defined(PNG_pHYs_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif
@ -2007,7 +2010,7 @@ extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_colorp palette, int num_palette));
#if defined(PNG_READ_sBIT_SUPPORTED)
#if defined(PNG_sBIT_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p *sig_bit));
#endif
@ -2017,7 +2020,7 @@ extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p sig_bit));
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#if defined(PNG_sRGB_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *intent));
#endif
@ -2029,7 +2032,7 @@ extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#if defined(PNG_iCCP_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen));
@ -2043,7 +2046,7 @@ extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
/* Note to maintainer: profile should be png_bytep */
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#if defined(PNG_sPLT_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tpp entries));
#endif
@ -2053,7 +2056,7 @@ extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries));
#endif
#if defined(PNG_READ_TEXT_SUPPORTED)
#if defined(PNG_TEXT_SUPPORTED)
/* png_get_text also returns the number of text chunks in *num_text */
extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp *text_ptr, int *num_text));
@ -2072,7 +2075,7 @@ extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#if defined(PNG_tIME_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep *mod_time));
#endif
@ -2082,7 +2085,7 @@ extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep mod_time));
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#if defined(PNG_tRNS_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep *trans, int *num_trans,
png_color_16p *trans_values));
@ -2097,7 +2100,7 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#if defined(PNG_tRNS_SUPPORTED)
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *unit, double *width, double *height));
@ -2107,7 +2110,7 @@ extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
#endif
#endif
#endif /* PNG_READ_sCAL_SUPPORTED */
#endif /* PNG_sCAL_SUPPORTED */
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
@ -2118,7 +2121,7 @@ extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
#endif
#endif /* PNG_READ_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* provide a list of chunks and how they are to be handled, if the built-in
@ -2229,7 +2232,7 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.9 - January 31, 2001 (header)\n"
" libpng version 1.0.10beta1 - March 14, 2001 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on
@ -2443,13 +2446,13 @@ PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
* values, which is almost certainly true.
*/
#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
# if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_oFFs_SUPPORTED)
# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
# endif
# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
#else
# if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_oFFs_SUPPORTED)
# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
# endif
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
@ -2513,8 +2516,8 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
png_size_t length));
/* Decompress data in a chunk that uses compression */
#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \
defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED)
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_length, png_size_t *data_length));
@ -2709,7 +2712,7 @@ PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* expand an interlaced row */
/* OLD interface:
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass, png_uint_32 transformations));
*/

View File

@ -1,6 +1,6 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 2001 Glenn Randers-Pehrson
*

View File

@ -1,6 +1,6 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -33,8 +33,32 @@
# define PNG_ZBUF_SIZE 8192
#endif
/* Enable if you want a write-only libpng */
#ifndef PNG_NO_READ_SUPPORTED
# define PNG_READ_SUPPORTED
#endif
/* Enable if you want a read-only libpng */
#ifndef PNG_NO_WRITE_SUPPORTED
# define PNG_WRITE_SUPPORTED
#endif
/* Enable if you need to support PNGs that are embedded in MNG
datastreams */
/*
#ifndef PNG_NO_MNG_FEATURES
# ifndef PNG_MNG_FEATURES_SUPPORTED
# define PNG_MNG_FEATURES_SUPPORTED
# endif
#endif
*/
#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
# define PNG_FLOATING_POINT_SUPPORTED
# ifndef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FLOATING_POINT_SUPPORTED
# endif
#endif
/* If you are running on a machine where you cannot allocate more
@ -367,7 +391,7 @@
* iTXt is supported. It is turned off by default, to support old apps
* that malloc the png_text structure instead of calling png_set_text()
* and letting libpng malloc it. It will be turned on by default in
* libpng-2.0.0.
* libpng-1.3.0.
*/
#ifndef PNG_iTXt_SUPPORTED
@ -418,14 +442,12 @@
# define PNG_FREE_ME_SUPPORTED
#endif
#if defined(PNG_READ_SUPPORTED)
#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS)
!defined(PNG_NO_READ_TRANSFORMS)
# define PNG_READ_TRANSFORMS_SUPPORTED
#endif
#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS)
# define PNG_WRITE_TRANSFORMS_SUPPORTED
#endif
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
# ifndef PNG_NO_READ_EXPAND
@ -498,19 +520,21 @@
# endif
#endif
/* Enable if you need to support PNGs that are embedded in MNG
datastreams */
/*
#ifndef PNG_NO_MNG_FEATURES
# define PNG_MNG_FEATURES_SUPPORTED
#endif
*/
/* Deprecated, will be removed from version 2.0.0 */
/* Deprecated, will be removed from version 2.0.0.
Use PNG_MNG_FEATURES_SUPPORTED instead. */
#ifndef PNG_NO_READ_EMPTY_PLTE
# define PNG_READ_EMPTY_PLTE_SUPPORTED
#endif
#endif /* PNG_READ_SUPPORTED */
#if defined(PNG_WRITE_SUPPORTED)
# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS)
# define PNG_WRITE_TRANSFORMS_SUPPORTED
#endif
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
# ifndef PNG_NO_WRITE_SHIFT
# define PNG_WRITE_SHIFT_SUPPORTED
@ -569,6 +593,8 @@
# define PNG_WRITE_EMPTY_PLTE_SUPPORTED
#endif
#endif /* PNG_WRITE_SUPPORTED */
#ifndef PNG_NO_STDIO
# define PNG_TIME_RFC1123_SUPPORTED
#endif
@ -595,10 +621,14 @@
/* PNG_ASSEMBLER_CODE will be enabled by default in version 1.2.0
even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
#ifndef PNG_NO_ASSEMBLER_CODE
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
# if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD)
# define PNG_ASSEMBLER_CODE_SUPPORTED
# define PNG_MMX_CODE_SUPPORTED
# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
# define PNG_ASSEMBLER_CODE_SUPPORTED
# endif
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
# define PNG_MMX_CODE_SUPPORTED
# endif
# endif
#endif
@ -606,7 +636,11 @@
/* very little testing */
/*
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
#ifdef PNG_READ_SUPPORTED
# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
# endif
#endif
#ifndef PNG_NO_USER_MEM
# define PNG_USER_MEM_SUPPORTED
#endif
@ -618,7 +652,11 @@
/* This is only for PowerPC big-endian and 680x0 systems */
/* some testing */
/*
#define PNG_READ_BIG_ENDIAN_SUPPORTED
#ifdef PNG_READ_SUPPORTED
# ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
# define PNG_READ_BIG_ENDIAN_SUPPORTED
# endif
#endif
*/
/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
@ -638,11 +676,14 @@
* a bit smaller.
*/
#if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
#if defined(PNG_READ_SUPPORTED) && \
!defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_ANCILLARY_CHUNKS)
# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#endif
#if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
#if defined(PNG_WRITE_SUPPORTED) && \
!defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#endif
@ -1221,8 +1262,9 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_ZBUF_SIZE 65536
#endif
#ifdef PNG_READ_SUPPORTED
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_INTERNAL)
#if defined(PNG_INTERNAL)
/* These are the default thresholds before the MMX code kicks in; if either
* rowbytes or bitdepth is below the threshold, plain C code is used. These
@ -1258,7 +1300,8 @@ typedef z_stream FAR * png_zstreamp;
#endif
/* - see pnggccrd.c for info about what is currently enabled */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
#endif /* PNG_INTERNAL */
#endif /* PNG_READ_SUPPORTED */
#endif /* PNGCONF_H */

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -107,7 +107,7 @@ png_chunk_error(png_structp png_ptr, png_const_charp message)
void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp message)
{
char msg[16+64];
char msg[18+64];
png_format_buffer(png_ptr, msg, message);
png_warning(png_ptr, msg);
}

View File

@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code.
*
* libpng 1.0.9 - January 31, 2001
* libpng version 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
@ -95,11 +95,11 @@
* variables, not the other way around. Hence _const4, _mask8_0, etc.
*
* 19991024:
* - fixed mmxsupport()/png_do_interlace() first-row bug
* - fixed mmxsupport()/png_do_read_interlace() first-row bug
* This one was severely weird: even though mmxsupport() doesn't touch
* ebx (where "row" pointer was stored), it nevertheless managed to zero
* the register (even in static/non-fPIC code--see below), which in turn
* caused png_do_interlace() to return prematurely on the first row of
* caused png_do_read_interlace() to return prematurely on the first row of
* interlaced images (i.e., without expanding the interlaced pixels).
* Inspection of the generated assembly code didn't turn up any clues,
* although it did point at a minor optimization (i.e., get rid of
@ -212,6 +212,9 @@
* within MMX version of png_read_filter_row()) so no longer necessary to
* compile it into pngrutil.o
*
* 20010310:
* - fixed buffer-overrun bug in png_combine_row() C code (non-MMX)
*
* STILL TO DO:
* - test png_do_read_interlace() 64-bit case (pixel_bytes == 8)
* - write MMX code for 48-bit case (pixel_bytes == 6)
@ -226,12 +229,18 @@
* - add support for runtime enable/disable/query of various MMX routines
*/
//#define PNG_DEBUG 2 // GRR
/*
#ifndef PNG_DEBUG
# define PNG_DEBUG 0
#endif
*/
#define PNG_INTERNAL
#include "png.h"
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD)
#if defined(PNG_USE_PNGGCCRD)
int PNGAPI png_mmx_support(void);
#ifdef PNG_USE_LOCAL_ARRAYS
static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
@ -239,8 +248,9 @@ static const int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
#endif
// djgpp, Win32, and Cygwin add their own underscores to global variables,
// so define them without:
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
/* djgpp, Win32, and Cygwin add their own underscores to global variables,
* so define them without: */
#if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__)
# define _mmx_supported mmx_supported
# define _unmask unmask
@ -277,7 +287,6 @@ static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
# define _pctemp pctemp
#endif
static int _mmx_supported = 2;
/* These constants are used in the inlined MMX assembly code.
Ignore gcc's "At top level: defined but not used" warnings. */
@ -324,18 +333,24 @@ static int _dif;
static int _patemp; // temp variables for Paeth routine
static int _pbtemp;
static int _pctemp;
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
static int _mmx_supported = 2;
//===========================================================================//
// //
// P N G _ C O M B I N E _ R O W //
// //
//===========================================================================//
/*===========================================================================*/
/* */
/* P N G _ C O M B I N E _ R O W */
/* */
/*===========================================================================*/
#if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW)
#define BPP2 2
#define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */
#define BPP4 4
#define BPP6 6 /* (defined only to help avoid cut-and-paste errors) */
#define BPP8 8
/* Combines the row recently read in with the previous row.
This routine takes care of alpha and transparency if requested.
This routine also handles the two methods of progressive display
@ -353,7 +368,7 @@ static int _pctemp;
void /* PRIVATE */
png_combine_row(png_structp png_ptr, png_bytep row, int mask)
{
png_debug(1,"in png_combine_row_asm\n");
png_debug(1, "in png_combine_row (pnggccrd.c)\n");
if (_mmx_supported == 2) {
png_mmx_support();
@ -361,15 +376,15 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
if (mask == 0xff)
{
png_debug(2,"mask == 0xff: doing single png_memcpy()\n");
png_memcpy(row, png_ptr->row_buf + 1,
(png_size_t)((png_ptr->width * png_ptr->row_info.pixel_depth + 7) >> 3));
}
/* GRR: png_combine_row() never called with mask == 0 */
else
else /* (png_combine_row() is never called with mask == 0) */
{
switch (png_ptr->row_info.pixel_depth)
{
case 1: // png_ptr->row_info.pixel_depth
case 1: /* png_ptr->row_info.pixel_depth */
{
png_bytep sp;
png_bytep dp;
@ -426,7 +441,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
break;
}
case 2: // png_ptr->row_info.pixel_depth
case 2: /* png_ptr->row_info.pixel_depth */
{
png_bytep sp;
png_bytep dp;
@ -481,7 +496,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
break;
}
case 4: // png_ptr->row_info.pixel_depth
case 4: /* png_ptr->row_info.pixel_depth */
{
png_bytep sp;
png_bytep dp;
@ -535,11 +550,12 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
break;
}
case 8: // png_ptr->row_info.pixel_depth
case 8: /* png_ptr->row_info.pixel_depth */
{
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported )
{
png_uint_32 len;
@ -553,7 +569,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
diff = (int) (png_ptr->width & 7); // amount lost
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
@ -627,15 +643,18 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
);
}
else /* mmx _not supported - Use modified C routine */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
register png_uint_32 i;
png_uint_32 initial_val = png_pass_start[png_ptr->pass];
// png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
register int stride = png_pass_inc[png_ptr->pass];
// png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
register int rep_bytes = png_pass_width[png_ptr->pass];
// png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
register png_uint_32 final_val = png_ptr->width;
/* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
int diff = (int) (png_ptr->width & 7); /* amount lost */
register png_uint_32 final_val = len; /* GRR bugfix */
srcptr = png_ptr->row_buf + 1 + initial_val;
dstptr = row + initial_val;
@ -646,16 +665,30 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr += stride;
dstptr += stride;
}
} /* end of else */
if (diff) /* number of leftover pixels: 3 for pngtest */
{
final_val+=diff /* *BPP1 */ ;
for (; i < final_val; i += stride)
{
if (rep_bytes > (int)(final_val-i))
rep_bytes = (int)(final_val-i);
png_memcpy(dstptr, srcptr, rep_bytes);
srcptr += stride;
dstptr += stride;
}
}
} /* end of else (_mmx_supported) */
break;
} // end 8 bpp
} /* end 8 bpp */
case 16: // png_ptr->row_info.pixel_depth
case 16: /* png_ptr->row_info.pixel_depth */
{
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported )
{
png_uint_32 len;
@ -669,7 +702,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
diff = (int) (png_ptr->width & 7); // amount lost //
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
@ -759,15 +792,18 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
);
}
else /* mmx _not supported - Use modified C routine */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
register png_uint_32 i;
png_uint_32 initial_val = 2 * png_pass_start[png_ptr->pass];
// png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
register int stride = 2 * png_pass_inc[png_ptr->pass];
// png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
register int rep_bytes = 2 * png_pass_width[png_ptr->pass];
// png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
register png_uint_32 final_val = 2 * png_ptr->width;
png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass];
/* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
register int stride = BPP2 * png_pass_inc[png_ptr->pass];
/* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
register int rep_bytes = BPP2 * png_pass_width[png_ptr->pass];
/* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
int diff = (int) (png_ptr->width & 7); /* amount lost */
register png_uint_32 final_val = BPP2 * len; /* GRR bugfix */
srcptr = png_ptr->row_buf + 1 + initial_val;
dstptr = row + initial_val;
@ -778,16 +814,29 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr += stride;
dstptr += stride;
}
} /* end of else */
if (diff) /* number of leftover pixels: 3 for pngtest */
{
final_val+=diff*BPP2;
for (; i < final_val; i += stride)
{
if (rep_bytes > (int)(final_val-i))
rep_bytes = (int)(final_val-i);
png_memcpy(dstptr, srcptr, rep_bytes);
srcptr += stride;
dstptr += stride;
}
}
} /* end of else (_mmx_supported) */
break;
} // end 16 bpp
} /* end 16 bpp */
case 24: // png_ptr->row_info.pixel_depth
case 24: /* png_ptr->row_info.pixel_depth */
{
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported )
{
png_uint_32 len;
@ -801,7 +850,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
diff = (int) (png_ptr->width & 7); // amount lost //
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
@ -906,15 +955,18 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
);
}
else /* mmx _not supported - Use modified C routine */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
register png_uint_32 i;
png_uint_32 initial_val = 3 * png_pass_start[png_ptr->pass];
// png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
register int stride = 3 * png_pass_inc[png_ptr->pass];
// png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
register int rep_bytes = 3 * png_pass_width[png_ptr->pass];
// png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
register png_uint_32 final_val = 3 * png_ptr->width;
png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass];
/* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
register int stride = BPP3 * png_pass_inc[png_ptr->pass];
/* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
register int rep_bytes = BPP3 * png_pass_width[png_ptr->pass];
/* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
int diff = (int) (png_ptr->width & 7); /* amount lost */
register png_uint_32 final_val = BPP3 * len; /* GRR bugfix */
srcptr = png_ptr->row_buf + 1 + initial_val;
dstptr = row + initial_val;
@ -925,16 +977,29 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr += stride;
dstptr += stride;
}
} /* end of else */
if (diff) /* number of leftover pixels: 3 for pngtest */
{
final_val+=diff*BPP3;
for (; i < final_val; i += stride)
{
if (rep_bytes > (int)(final_val-i))
rep_bytes = (int)(final_val-i);
png_memcpy(dstptr, srcptr, rep_bytes);
srcptr += stride;
dstptr += stride;
}
}
} /* end of else (_mmx_supported) */
break;
} // end 24 bpp
} /* end 24 bpp */
case 32: // png_ptr->row_info.pixel_depth
case 32: /* png_ptr->row_info.pixel_depth */
{
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported )
{
png_uint_32 len;
@ -948,7 +1013,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
diff = (int) (png_ptr->width & 7); // amount lost //
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
@ -1060,15 +1125,18 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
);
}
else /* mmx _not supported - Use modified C routine */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
register png_uint_32 i;
png_uint_32 initial_val = 4 * png_pass_start[png_ptr->pass];
// png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
register int stride = 4 * png_pass_inc[png_ptr->pass];
// png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
register int rep_bytes = 4 * png_pass_width[png_ptr->pass];
// png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
register png_uint_32 final_val = 4 * png_ptr->width;
png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass];
/* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
register int stride = BPP4 * png_pass_inc[png_ptr->pass];
/* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
register int rep_bytes = BPP4 * png_pass_width[png_ptr->pass];
/* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
int diff = (int) (png_ptr->width & 7); /* amount lost */
register png_uint_32 final_val = BPP4 * len; /* GRR bugfix */
srcptr = png_ptr->row_buf + 1 + initial_val;
dstptr = row + initial_val;
@ -1079,16 +1147,29 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr += stride;
dstptr += stride;
}
} /* end of else */
if (diff) /* number of leftover pixels: 3 for pngtest */
{
final_val+=diff*BPP4;
for (; i < final_val; i += stride)
{
if (rep_bytes > (int)(final_val-i))
rep_bytes = (int)(final_val-i);
png_memcpy(dstptr, srcptr, rep_bytes);
srcptr += stride;
dstptr += stride;
}
}
} /* end of else (_mmx_supported) */
break;
} // end 32 bpp
} /* end 32 bpp */
case 48: // png_ptr->row_info.pixel_depth
case 48: /* png_ptr->row_info.pixel_depth */
{
png_bytep srcptr;
png_bytep dstptr;
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported )
{
png_uint_32 len;
@ -1102,7 +1183,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = png_ptr->width &~7; // reduce to multiple of 8
diff = png_ptr->width & 7; // amount lost
diff = (int) (png_ptr->width & 7); // amount lost //
__asm__ __volatile__ (
"movd _unmask, %%mm7 \n\t" // load bit pattern
@ -1231,15 +1312,18 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
);
}
else /* mmx _not supported - Use modified C routine */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
register png_uint_32 i;
png_uint_32 initial_val = 6 * png_pass_start[png_ptr->pass];
// png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
register int stride = 6 * png_pass_inc[png_ptr->pass];
// png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
register int rep_bytes = 6 * png_pass_width[png_ptr->pass];
// png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
register png_uint_32 final_val = 6 * png_ptr->width;
png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass];
/* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
register int stride = BPP6 * png_pass_inc[png_ptr->pass];
/* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
register int rep_bytes = BPP6 * png_pass_width[png_ptr->pass];
/* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
int diff = (int) (png_ptr->width & 7); /* amount lost */
register png_uint_32 final_val = BPP6 * len; /* GRR bugfix */
srcptr = png_ptr->row_buf + 1 + initial_val;
dstptr = row + initial_val;
@ -1250,23 +1334,37 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr += stride;
dstptr += stride;
}
} /* end of else */
if (diff) /* number of leftover pixels: 3 for pngtest */
{
final_val+=diff*BPP6;
for (; i < final_val; i += stride)
{
if (rep_bytes > (int)(final_val-i))
rep_bytes = (int)(final_val-i);
png_memcpy(dstptr, srcptr, rep_bytes);
srcptr += stride;
dstptr += stride;
}
}
} /* end of else (_mmx_supported) */
break;
} // end 48 bpp
} /* end 48 bpp */
case 64: // png_ptr->row_info.pixel_depth
case 64: /* png_ptr->row_info.pixel_depth */
{
png_bytep srcptr;
png_bytep dstptr;
register png_uint_32 i;
png_uint_32 initial_val = 8 * png_pass_start[png_ptr->pass];
// png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
register int stride = 8 * png_pass_inc[png_ptr->pass];
// png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
register int rep_bytes = 8 * png_pass_width[png_ptr->pass];
// png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
register png_uint_32 final_val = 8 * png_ptr->width;
png_uint_32 initial_val = BPP8 * png_pass_start[png_ptr->pass];
/* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */
register int stride = BPP8 * png_pass_inc[png_ptr->pass];
/* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */
register int rep_bytes = BPP8 * png_pass_width[png_ptr->pass];
/* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */
png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */
int diff = (int) (png_ptr->width & 7); /* amount lost */
register png_uint_32 final_val = BPP8 * len; /* GRR bugfix */
srcptr = png_ptr->row_buf + 1 + initial_val;
dstptr = row + initial_val;
@ -1277,12 +1375,25 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
srcptr += stride;
dstptr += stride;
}
break;
} // end 64 bpp
if (diff) /* number of leftover pixels: 3 for pngtest */
{
final_val+=diff*BPP8;
for (; i < final_val; i += stride)
{
if (rep_bytes > (int)(final_val-i))
rep_bytes = (int)(final_val-i);
png_memcpy(dstptr, srcptr, rep_bytes);
srcptr += stride;
dstptr += stride;
}
}
default: // png_ptr->row_info.pixel_depth != 1,2,4,8,16,24,32,48,64
break;
} /* end 64 bpp */
default: /* png_ptr->row_info.pixel_depth != 1,2,4,8,16,24,32,48,64 */
{
// this should never happen
/* this should never happen */
fprintf(stderr,
"libpng internal error: png_ptr->row_info.pixel_depth = %d\n",
png_ptr->row_info.pixel_depth);
@ -1300,11 +1411,11 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
//===========================================================================//
// //
// P N G _ D O _ R E A D _ I N T E R L A C E //
// //
//===========================================================================//
/*===========================================================================*/
/* */
/* P N G _ D O _ R E A D _ I N T E R L A C E */
/* */
/*===========================================================================*/
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#if defined(PNG_HAVE_ASSEMBLER_READ_INTERLACE)
@ -1319,9 +1430,11 @@ png_do_read_interlace(png_structp png_ptr)
png_row_infop row_info = &(png_ptr->row_info);
png_bytep row = png_ptr->row_buf + 1;
int pass = png_ptr->pass;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
png_uint_32 transformations = png_ptr->transformations;
#endif
png_debug(1,"in png_do_read_interlace\n");
png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n");
if (_mmx_supported == 2) {
png_mmx_support();
@ -1505,29 +1618,32 @@ png_do_read_interlace(png_structp png_ptr)
break;
}
//====================================================================
/*====================================================================*/
default: // 8-bit or larger (this is where the routine is modified)
default: /* 8-bit or larger (this is where the routine is modified) */
{
#if 0
// static unsigned long long _const4 = 0x0000000000FFFFFFLL; no good
// static unsigned long long const4 = 0x0000000000FFFFFFLL; no good
// unsigned long long _const4 = 0x0000000000FFFFFFLL; no good
// unsigned long long const4 = 0x0000000000FFFFFFLL; no good
#endif
png_bytep sptr, dp;
png_uint_32 i;
png_size_t pixel_bytes;
int width = row_info->width;
int width = (int)row_info->width;
pixel_bytes = (row_info->pixel_depth >> 3);
// point sptr at the last pixel in the pre-expanded row:
/* point sptr at the last pixel in the pre-expanded row: */
sptr = row + (width - 1) * pixel_bytes;
// point dp at the last pixel position in the expanded row:
/* point dp at the last pixel position in the expanded row: */
dp = row + (final_width - 1) * pixel_bytes;
// New code by Nirav Chhatrapati - Intel Corporation
/* New code by Nirav Chhatrapati - Intel Corporation */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported )
{
//--------------------------------------------------------------
@ -1779,7 +1895,9 @@ png_do_read_interlace(png_structp png_ptr)
*/
for (j = 0; j < png_pass_inc[pass]; j++)
{
*dp-- = *sptr;
}
--sptr;
}
}
@ -1832,7 +1950,9 @@ png_do_read_interlace(png_structp png_ptr)
int j;
for (j = 0; j < png_pass_inc[pass]; j++)
{
*dp-- = *sptr;
}
--sptr;
}
}
@ -1884,7 +2004,9 @@ png_do_read_interlace(png_structp png_ptr)
int j;
for (j = 0; j < png_pass_inc[pass]; j++)
{
*dp-- = *sptr;
}
--sptr;
}
}
@ -2413,6 +2535,7 @@ png_do_read_interlace(png_structp png_ptr)
/* GRR 19991007: does it? or should pixel_bytes in each
* block be replaced with immediate value (e.g., 1)? */
/* GRR 19991017: replaced with constants in each case */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
if (pixel_bytes == 1)
{
@ -2420,7 +2543,9 @@ png_do_read_interlace(png_structp png_ptr)
{
int j;
for (j = 0; j < png_pass_inc[pass]; j++)
{
*dp-- = *sptr;
}
--sptr;
}
}
@ -2463,6 +2588,14 @@ png_do_read_interlace(png_structp png_ptr)
png_memcpy(v, sptr, 4);
for (j = 0; j < png_pass_inc[pass]; j++)
{
#ifdef PNG_DEBUG
if (dp < row || dp+3 > row+png_ptr->row_buf_size)
{
printf("dp out of bounds: row=%d, dp=%d, rp=%d\n",row, dp,
row+png_ptr->row_buf_size);
printf("row_buf=%d\n",png_ptr->row_buf_size);
}
#endif
png_memcpy(dp, v, 4);
dp -= 4;
}
@ -2499,7 +2632,7 @@ png_do_read_interlace(png_structp png_ptr)
sptr -= 8;
}
}
else // GRR: should never be reached
else /* GRR: should never be reached */
{
for (i = width; i; i--)
{
@ -2533,6 +2666,8 @@ png_do_read_interlace(png_structp png_ptr)
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
// These variables are utilized in the functions below. They are declared
// globally here to ensure alignment on 8-byte boundaries.
@ -2545,7 +2680,6 @@ union uAll {
//===========================================================================//
// //
// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ A V G //
@ -4739,14 +4873,16 @@ png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
} // end of png_read_filter_row_mmx_up()
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
//===========================================================================//
// //
// P N G _ R E A D _ F I L T E R _ R O W //
// //
//===========================================================================//
/*===========================================================================*/
/* */
/* P N G _ R E A D _ F I L T E R _ R O W */
/* */
/*===========================================================================*/
#if defined(PNG_HAVE_ASSEMBLER_READ_FILTER_ROW)
@ -4760,6 +4896,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
char filnm[10];
#endif
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
/* GRR: these are superseded by png_ptr->asm_flags: */
#define UseMMX_sub 1 // GRR: converted 20000730
#define UseMMX_up 1 // GRR: converted 20000729
@ -4769,9 +4906,10 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
if (_mmx_supported == 2) {
png_mmx_support();
}
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
#ifdef PNG_DEBUG
png_debug(1, "in png_read_filter_row\n");
png_debug(1, "in png_read_filter_row (pnggccrd.c)\n");
switch (filter)
{
case 0: sprintf(filnm, "none");
@ -4800,13 +4938,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_SUB:
if (
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported &&
(row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
(row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
{
png_read_filter_row_mmx_sub(row_info, row);
}
else
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
@ -4823,13 +4963,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_UP:
if (
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported &&
(row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
(row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
{
png_read_filter_row_mmx_up(row_info, row, prev_row);
}
else
else
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
@ -4845,13 +4987,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_AVG:
if (
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported &&
(row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
(row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
{
png_read_filter_row_mmx_avg(row_info, row, prev_row);
}
else
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
png_uint_32 i;
png_bytep rp = row;
@ -4877,13 +5021,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
break;
case PNG_FILTER_VALUE_PAETH:
if (
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if ( _mmx_supported &&
(row_info->pixel_depth >= PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT) &&
(row_info->rowbytes >= PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT))
{
png_read_filter_row_mmx_paeth(row_info, row, prev_row);
}
else
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
{
png_uint_32 i;
png_bytep rp = row;
@ -4947,30 +5093,27 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
#endif /* PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
/*===========================================================================*/
/* */
/* P N G _ M M X _ S U P P O R T */
/* */
/*===========================================================================*/
//===========================================================================//
// //
// P N G _ M M X _ S U P P O R T //
// //
//===========================================================================//
// GRR NOTES: (1) the following code assumes 386 or better (pushfl/popfl)
// (2) all instructions compile with gcc 2.7.2.3 and later
// (3) the function is moved down here to prevent gcc from
// inlining it in multiple places and then barfing be-
// cause the ".NOT_SUPPORTED" label is multiply defined
// [is there a way to signal that a *single* function should
// not be inlined? is there a way to modify the label for
// each inlined instance, e.g., by appending _1, _2, etc.?
// maybe if don't use leading "." in label name? (nope...sigh)]
// GRR TO DO: make sure PNGAPI doesn't do/require anything screwy here
// [looks OK for everybody except possibly Cygwin (__cdecl)]
/* GRR NOTES: (1) the following code assumes 386 or better (pushfl/popfl)
* (2) all instructions compile with gcc 2.7.2.3 and later
* (3) the function is moved down here to prevent gcc from
* inlining it in multiple places and then barfing be-
* cause the ".NOT_SUPPORTED" label is multiply defined
* [is there a way to signal that a *single* function should
* not be inlined? is there a way to modify the label for
* each inlined instance, e.g., by appending _1, _2, etc.?
* maybe if don't use leading "." in label name? (nope...sigh)]
*/
int PNGAPI
png_mmx_support(void)
{
#if defined(PNG_MMX_CODE_SUPPORTED)
__asm__ __volatile__ (
"pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
"pushl %%ecx \n\t" // so does ecx...
@ -5008,15 +5151,15 @@ png_mmx_support(void)
"movl %%eax, _mmx_supported \n\t" // save in global static variable, too
"popl %%edx \n\t" // restore edx
"popl %%ecx \n\t" // restore ecx
"popl %%ebx \n\t" // restore ebx ("row" in png_do_interlace)
"popl %%ebx \n\t" // restore ebx
"ret \n\t" // DONE: have MMX support
".NOT_SUPPORTED: \n\t" // target label for jump instructions
"movl $0, %%eax \n\t" // set return value to 0
"movl %%eax, _mmx_supported \n\t" // save in global static variable, too
// "movl %%eax, _mmx_supported \n\t" // save in global static variable, too
"popl %%edx \n\t" // restore edx
"popl %%ecx \n\t" // restore ecx
"popl %%ebx \n\t" // restore ebx ("row" in png_do_interlace)
"popl %%ebx \n\t" // restore ebx
// "ret \n\t" // DONE: no MMX support
// (fall through to standard C "ret")
@ -5029,8 +5172,10 @@ png_mmx_support(void)
// , "memory" // if write to a variable gcc thought was in a reg
// , "cc" // "condition codes" (flag bits)
);
#endif /* PNG_MMX_CODE_SUPPORTED */
// return %%eax;
_mmx_supported = 0;
return 0;
}
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGGCCRD */
#endif /* PNG_USE_PNGGCCRD */

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -297,7 +297,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
*.00003937);
}
#if defined(PNG_READ_pHYs_SUPPORTED)
#if defined(PNG_pHYs_SUPPORTED)
png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@ -330,7 +330,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
}
return (retval);
}
#endif /* PNG_READ_pHYs_SUPPORTED */
#endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
/* png_get_channels really belongs in here, too, but it's been around longer */
@ -355,7 +355,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
return (NULL);
}
#if defined(PNG_READ_bKGD_SUPPORTED)
#if defined(PNG_bKGD_SUPPORTED)
png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background)
@ -371,7 +371,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
@ -435,7 +435,7 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
@ -467,7 +467,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#if defined(PNG_sRGB_SUPPORTED)
png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{
@ -482,7 +482,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
}
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#if defined(PNG_iCCP_SUPPORTED)
png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type,
@ -504,7 +504,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#if defined(PNG_sPLT_SUPPORTED)
png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes)
@ -515,7 +515,7 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#if defined(PNG_hIST_SUPPORTED)
png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{
@ -576,7 +576,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
return (0);
}
#if defined(PNG_READ_oFFs_SUPPORTED)
#if defined(PNG_oFFs_SUPPORTED)
png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
@ -594,7 +594,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#if defined(PNG_pCAL_SUPPORTED)
png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
@ -618,7 +618,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
@ -654,7 +654,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#if defined(PNG_pHYs_SUPPORTED)
png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@ -701,7 +701,7 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
return (0);
}
#if defined(PNG_READ_sBIT_SUPPORTED)
#if defined(PNG_sBIT_SUPPORTED)
png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{
@ -716,7 +716,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
}
#endif
#if defined(PNG_READ_TEXT_SUPPORTED)
#if defined(PNG_TEXT_SUPPORTED)
png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text)
@ -738,7 +738,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
}
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#if defined(PNG_tIME_SUPPORTED)
png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{
@ -753,7 +753,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
}
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#if defined(PNG_tRNS_SUPPORTED)
png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
@ -792,7 +792,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns)
@ -811,7 +811,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
}
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_USER_CHUNKS_SUPPORTED)
png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr)
{

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -715,7 +715,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
* not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it.
*
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.10beta1
*/
void PNGAPI
@ -764,7 +764,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead.
*
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.10beta1
*/
void PNGAPI
png_read_image(png_structp png_ptr, png_bytepp image)

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -332,59 +332,6 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
filter_type = buf[11];
interlace_type = buf[12];
/* check for width and height valid values */
if (width == 0 || width > PNG_MAX_UINT || height == 0 ||
height > PNG_MAX_UINT)
png_error(png_ptr, "Invalid image size in IHDR");
/* check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
bit_depth != 8 && bit_depth != 16)
png_error(png_ptr, "Invalid bit depth in IHDR");
if (color_type < 0 || color_type == 1 ||
color_type == 5 || color_type > 6)
png_error(png_ptr, "Invalid color type in IHDR");
if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) ||
((color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8))
png_error(png_ptr, "Invalid color type/bit depth combination in IHDR");
if (interlace_type >= PNG_INTERLACE_LAST)
png_error(png_ptr, "Unknown interlace method in IHDR");
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
png_error(png_ptr, "Unknown compression method in IHDR");
#if defined(PNG_MNG_FEATURES_SUPPORTED)
/* Accept filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not read a PNG signature (this filter_method is only
* used in PNG datastreams that are embedded in MNG datastreams) and
* 3. The application called png_permit_mng_features with a mask that
* included PNG_FLAG_MNG_FILTER_64 and
* 4. The filter_method is 64 and
* 5. The color_type is RGB or RGBA
*/
if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&png_ptr->mng_features_permitted)
png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n");
if(filter_type != PNG_FILTER_TYPE_BASE)
{
if(!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
(color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)))
png_error(png_ptr, "Unknown filter method in IHDR");
if(png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)
png_warning(png_ptr, "Invalid filter method in IHDR");
}
#else
if(filter_type != PNG_FILTER_TYPE_BASE)
png_error(png_ptr, "Unknown filter method in IHDR");
#endif
/* set internal variables */
png_ptr->width = width;
@ -628,7 +575,11 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
igamma = (png_fixed_point)png_get_uint_32(buf);
/* check for zero gamma */
if (igamma == 0)
return;
{
png_warning(png_ptr,
"Ignoring gAMA chunk with gamma=0");
return;
}
#if defined(PNG_READ_sRGB_SUPPORTED)
if (info_ptr->valid & PNG_INFO_sRGB)
@ -2371,6 +2322,10 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
#ifdef PNG_READ_INTERLACING_SUPPORTED
#ifndef PNG_HAVE_ASSEMBLER_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */
/* OLD pre-1.0.9 interface:
void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
png_uint_32 transformations)
*/
void /* PRIVATE */
png_do_read_interlace(png_structp png_ptr)
{
@ -3008,6 +2963,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_error(png_ptr, "This image requires a row greater than 64KB");
#endif
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
png_ptr->row_buf_size = row_bytes;
#ifdef PNG_MAX_MALLOC_64K
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -109,9 +109,10 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
info_ptr->int_gamma = (int)(file_gamma*100000.+.5);
#endif
info_ptr->valid |= PNG_INFO_gAMA;
if(file_gamma == 0.0)
png_warning(png_ptr, "Setting gamma=0");
}
#endif
#endif
void PNGAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
int_gamma)
@ -127,7 +128,10 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
info_ptr->int_gamma = int_gamma;
#endif
info_ptr->valid |= PNG_INFO_gAMA;
if(int_gamma == 0)
png_warning(png_ptr, "Setting gamma=0");
}
#endif
#if defined(PNG_hIST_SUPPORTED)
void PNGAPI
@ -172,6 +176,61 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
/* check for width and height valid values */
if (width == 0 || height == 0)
png_error(png_ptr, "Image width or height is zero in IHDR");
if (width > PNG_MAX_UINT || height > PNG_MAX_UINT)
png_error(png_ptr, "Invalid image size in IHDR");
/* check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
bit_depth != 8 && bit_depth != 16)
png_error(png_ptr, "Invalid bit depth in IHDR");
if (color_type < 0 || color_type == 1 ||
color_type == 5 || color_type > 6)
png_error(png_ptr, "Invalid color type in IHDR");
if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) ||
((color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8))
png_error(png_ptr, "Invalid color type/bit depth combination in IHDR");
if (interlace_type >= PNG_INTERLACE_LAST)
png_error(png_ptr, "Unknown interlace method in IHDR");
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
png_error(png_ptr, "Unknown compression method in IHDR");
#if defined(PNG_MNG_FEATURES_SUPPORTED)
/* Accept filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not read a PNG signature (this filter_method is only
* used in PNG datastreams that are embedded in MNG datastreams) and
* 3. The application called png_permit_mng_features with a mask that
* included PNG_FLAG_MNG_FILTER_64 and
* 4. The filter_method is 64 and
* 5. The color_type is RGB or RGBA
*/
if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&png_ptr->mng_features_permitted)
png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n");
if(filter_type != PNG_FILTER_TYPE_BASE)
{
if(!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
(color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)))
png_error(png_ptr, "Unknown filter method in IHDR");
if(png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)
png_warning(png_ptr, "Invalid filter method in IHDR");
}
#else
if(filter_type != PNG_FILTER_TYPE_BASE)
png_error(png_ptr, "Unknown filter method in IHDR");
#endif
info_ptr->width = width;
info_ptr->height = height;
info_ptr->bit_depth = (png_byte)bit_depth;
@ -738,7 +797,7 @@ png_set_sPLT(png_structp png_ptr,
}
#endif /* PNG_sPLT_SUPPORTED */
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
void PNGAPI
png_set_unknown_chunks(png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
@ -883,7 +942,6 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
info_ptr->row_pointers = row_pointers;
if(row_pointers)
info_ptr->valid |= PNG_INFO_IDAT;
}
#endif

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -51,16 +51,20 @@
#endif
#if defined(PNG_NO_STDIO)
#if defined(_WIN32_WCE)
typedef HANDLE png_FILE_p;
#else
typedef FILE * png_FILE_p;
#endif
# if defined(_WIN32_WCE)
typedef HANDLE png_FILE_p;
# else
typedef FILE * png_FILE_p;
# endif
#endif
/* Makes pngtest verbose so we can find problems (needs to be before png.h) */
#ifndef PNG_DEBUG
#define PNG_DEBUG 0
# define PNG_DEBUG 0
#endif
#if !PNG_DEBUG
# define SINGLE_ROWBUF_ALLOC /* makes buffer overruns easier to nail */
#endif
/* Turn on CPU timing
@ -279,7 +283,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (check != length)
{
png_error(png_ptr, "Read Error");
png_error(png_ptr, "Read Error!");
}
}
#else
@ -564,8 +568,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{
static png_FILE_p fpin;
static png_FILE_p fpout; /* "static" prevents setjmp corruption */
png_structp read_ptr, write_ptr;
png_infop read_info_ptr, write_info_ptr, end_info_ptr, write_end_info_ptr;
png_structp read_ptr;
png_infop read_info_ptr, end_info_ptr;
#ifdef PNG_WRITE_SUPPORTED
png_structp write_ptr;
png_infop write_info_ptr;
png_infop write_end_info_ptr;
#else
png_structp write_ptr = NULL;
png_infop write_info_ptr = NULL;
png_infop write_end_info_ptr = NULL;
#endif
png_bytep row_buf;
png_uint_32 y;
png_uint_32 width, height;
@ -620,6 +633,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
#ifdef PNG_WRITE_SUPPORTED
#ifdef PNG_USER_MEM_SUPPORTED
write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
(png_error_ptr)NULL, (png_error_ptr)NULL, (png_voidp)NULL,
@ -631,13 +645,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#if defined(PNG_NO_STDIO)
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
#endif
png_debug(0, "Allocating read_info, write_info and end_info structures\n");
read_info_ptr = png_create_info_struct(read_ptr);
write_info_ptr = png_create_info_struct(write_ptr);
end_info_ptr = png_create_info_struct(read_ptr);
#ifdef PNG_WRITE_SUPPORTED
write_info_ptr = png_create_info_struct(write_ptr);
write_end_info_ptr = png_create_info_struct(write_ptr);
#ifdef PNG_USER_MEM_SUPPORTED
#endif
#ifdef PNG_SETJMP_SUPPORTED
@ -650,8 +665,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif
FCLOSE(fpin);
FCLOSE(fpout);
return (1);
@ -660,6 +677,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_memcpy(png_jmpbuf(read_ptr),jmpbuf,sizeof(jmp_buf));
#endif
#ifdef PNG_WRITE_SUPPORTED
png_debug(0, "Setting jmpbuf for write struct\n");
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
@ -670,7 +688,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname);
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED
png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif
FCLOSE(fpin);
FCLOSE(fpout);
return (1);
@ -678,29 +698,38 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(write_ptr),jmpbuf,sizeof(jmp_buf));
#endif
#endif
#endif
png_debug(0, "Initializing input and output streams\n");
#if !defined(PNG_NO_STDIO)
png_init_io(read_ptr, fpin);
# ifdef PNG_WRITE_SUPPORTED
png_init_io(write_ptr, fpout);
# endif
#else
png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data);
#ifdef PNG_WRITE_SUPPORTED
png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data,
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
pngtest_flush);
#else
#endif
NULL);
#endif
#endif
if(status_dots_requested == 1)
{
#ifdef PNG_WRITE_SUPPORTED
png_set_write_status_fn(write_ptr, write_row_callback);
#endif
png_set_read_status_fn(read_ptr, read_row_callback);
}
else
{
#ifdef PNG_WRITE_SUPPORTED
png_set_write_status_fn(write_ptr, NULL);
#endif
png_set_read_status_fn(read_ptr, NULL);
}
@ -984,32 +1013,41 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
#endif
#ifdef PNG_WRITE_SUPPORTED
png_debug(0, "\nWriting info struct\n");
/* If we wanted, we could write info in two steps:
png_write_info_before_PLTE(write_ptr, write_info_ptr);
*/
png_write_info(write_ptr, write_info_ptr);
#endif
png_debug(0, "\nAllocating row buffer \n");
#ifdef SINGLE_ROWBUF_ALLOC
png_debug(0, "\nAllocating row buffer...");
row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr));
png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf);
if (row_buf == NULL)
{
fprintf(STDERR, "No memory to allocate row buffer\n");
png_destroy_read_struct(&read_ptr, &read_info_ptr, (png_infopp)NULL);
#ifdef PNG_WRITE_SUPPORTED
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif
FCLOSE(fpin);
FCLOSE(fpout);
return (1);
}
#endif /* SINGLE_ROWBUF_ALLOC */
png_debug(0, "Writing row data\n");
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED)
num_pass = png_set_interlace_handling(read_ptr);
# ifdef PNG_WRITE_SUPPORTED
png_set_interlace_handling(write_ptr);
# endif
#else
num_pass=1;
#endif
@ -1024,7 +1062,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_debug1(0, "Writing row data for pass %d\n",pass);
for (y = 0; y < height; y++)
{
#ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass,y);
row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr));
png_debug2(0, "0x%08lx (%ld bytes)\n", (unsigned long)row_buf,
png_get_rowbytes(read_ptr, read_info_ptr));
#endif /* !SINGLE_ROWBUF_ALLOC */
png_read_rows(read_ptr, (png_bytepp)&row_buf, (png_bytepp)NULL, 1);
#ifdef PNG_WRITE_SUPPORTED
#ifdef PNGTEST_TIMING
t_stop = (float)clock();
t_decode += (t_stop - t_start);
@ -1036,6 +1083,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
t_encode += (t_stop - t_start);
t_start = t_stop;
#endif
#endif /* PNG_WRITE_SUPPORTED */
#ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n\n", pass, y);
png_free(read_ptr, row_buf);
#endif /* !SINGLE_ROWBUF_ALLOC */
}
}
@ -1098,7 +1151,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#ifdef PNG_WRITE_SUPPORTED
png_write_end(write_ptr, write_end_info_ptr);
#endif
#ifdef PNG_EASY_ACCESS_SUPPORTED
if(verbose)
@ -1112,11 +1167,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
png_debug(0, "Destroying data structs\n");
#ifdef SINGLE_ROWBUF_ALLOC
png_debug(1, "destroying row_buf for read_ptr\n");
png_free(read_ptr, row_buf);
row_buf=NULL;
#endif /* SINGLE_ROWBUF_ALLOC */
png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr\n");
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED
png_debug(1, "destroying write_end_info_ptr\n");
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
png_debug(1, "destroying write_ptr, write_info_ptr\n");
png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif
png_debug(0, "Destruction complete.\n");
FCLOSE(fpin);
FCLOSE(fpout);
@ -1458,4 +1522,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_9 your_png_h_is_not_version_1_0_9;
typedef version_1_0_10beta1 your_png_h_is_not_version_1_0_10beta1;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -2,7 +2,7 @@
*
* For Intel x86 CPU and Microsoft Visual C++ compiler
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
@ -382,6 +382,8 @@ end8:
incr1 = (disp)*pixel_bytes;
for (i = initial_val; i < final_val; i += incr1)
{
if (pixel_bytes > (png_size_t)(final_val-i))
pixel_bytes = (png_size_t)(final_val-i);
png_memcpy(dstptr, srcptr, pixel_bytes);
srcptr += incr1;
dstptr += incr1;
@ -493,6 +495,8 @@ end16:
incr1 = (disp)*pixel_bytes;
for (i = initial_val; i < final_val; i += incr1)
{
if (pixel_bytes > (png_size_t)(final_val-i))
pixel_bytes = (png_size_t)(final_val-i);
png_memcpy(dstptr, srcptr, pixel_bytes);
srcptr += incr1;
dstptr += incr1;
@ -623,6 +627,8 @@ end24:
incr1 = (disp)*pixel_bytes;
for (i = initial_val; i < final_val; i += incr1)
{
if (pixel_bytes > (png_size_t)(final_val-i))
pixel_bytes = (png_size_t)(final_val-i);
png_memcpy(dstptr, srcptr, pixel_bytes);
srcptr += incr1;
dstptr += incr1;
@ -762,6 +768,8 @@ end32:
incr1 = (disp)*pixel_bytes;
for (i = initial_val; i < final_val; i += incr1)
{
if (pixel_bytes > (png_size_t)(final_val-i))
pixel_bytes = (png_size_t)(final_val-i);
png_memcpy(dstptr, srcptr, pixel_bytes);
srcptr += incr1;
dstptr += incr1;
@ -919,6 +927,8 @@ end48:
incr1 = (disp)*pixel_bytes;
for (i = initial_val; i < final_val; i += incr1)
{
if (pixel_bytes > (png_size_t)(final_val-i))
pixel_bytes = (png_size_t)(final_val-i);
png_memcpy(dstptr, srcptr, pixel_bytes);
srcptr += incr1;
dstptr += incr1;
@ -947,6 +957,8 @@ end48:
incr1 = (disp)*pixel_bytes;
for (i = initial_val; i < final_val; i += incr1)
{
if (pixel_bytes > (png_size_t)(final_val-i))
pixel_bytes = (png_size_t)(final_val-i);
png_memcpy(dp, sptr, pixel_bytes);
sptr += incr1;
dp += incr1;

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -17,6 +17,7 @@
#define PNG_INTERNAL
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
/* Write the data to whatever output you are using. The default routine
writes to a file pointer. Note that this routine sometimes gets called
@ -224,3 +225,4 @@ void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
}
# endif
# endif
#endif /* PNG_WRITE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -11,6 +11,7 @@
/* get internal access to png.h */
#define PNG_INTERNAL
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
/* Writes all the PNG information. This is the suggested way to use the
* library. If you have a new chunk to add, make a function to write it,
@ -1363,3 +1364,4 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* quiet compiler warnings */ return;
}
#endif
#endif /* PNG_WRITE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -10,6 +10,7 @@
#define PNG_INTERNAL
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
/* Transform the data according to the user's wishes. The order of
* transformations is significant.
@ -559,3 +560,4 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
}
}
#endif /* PNG_MNG_FEATURES_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* libpng 1.0.9 - January 31, 2001
* libpng 1.0.10beta1 - March 14, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -10,6 +10,7 @@
#define PNG_INTERNAL
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
/* Place a 32-bit number into a buffer in PNG byte order. We work
* with unsigned numbers for convenience, although one supported
@ -534,7 +535,8 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_debug(1, "in png_write_PLTE\n");
if ((
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
defined (PNG_WRITE_EMPTY_PLTE_SUPPORTED)
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
#endif
num_pal == 0) || num_pal > 256)
@ -1017,7 +1019,8 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
defined (PNG_WRITE_EMPTY_PLTE_SUPPORTED)
(png_ptr->num_palette ||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
#endif
@ -2631,3 +2634,4 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
}
#endif
}
#endif /* PNG_WRITE_SUPPORTED */

View File

@ -1,5 +1,5 @@
Microsoft Developer Studio Build File, Format Version 6.00 for
libpng 1.0.9 (January 31, 2001) and zlib
libpng 1.0.10beta1 (March 14, 2001) and zlib
Copyright (C) 2000 Simon-Pierre Cadieux
For conditions of distribution and use, see copyright notice in png.h

View File

@ -6,7 +6,7 @@ LIBRARY
DESCRIPTION "PNG image compression library for Windows"
EXPORTS
;Version 1.0.9
;Version 1.0.10beta1
png_build_grayscale_palette @1
png_check_sig @2
png_chunk_error @3

View File

@ -8,9 +8,9 @@ libpng for WindowsCE Rel.1.0
Introduction
============
This is libpng 1.0.9 ported to WindowsCE 2.0 and 2.11.
libpng 1.0.9 is a PNG reference library.
See README, a document of original libpng 1.0.9.
This is libpng 1.0.10beta1 ported to WindowsCE 2.0 and 2.11.
libpng 1.0.10beta1 is a PNG reference library.
See README, a document of original libpng 1.0.10beta1.
zlib for WindowsCE
==================
@ -23,7 +23,7 @@ This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
See README and LICENSE, documents of original libpng 1.0.9, for conditions
See README and LICENSE, documents of original libpng 1.0.10beta1, for conditions
of use and distribution.
Files

View File

@ -24,7 +24,7 @@ libpng
になったいかなる被害についても、作者、配布者、その他利用者以外の人物、
団体に責任をとる義務はないものとします。
その他、このソフトウェアの利用条件については、原版である libpng 1.0.9
その他、このソフトウェアの利用条件については、原版である libpng 1.0.10beta1
準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。
収録内容

View File

@ -5,7 +5,7 @@
LIBRARY lpngce
EXPORTS
;Version 1.0.9
;Version 1.0.10beta1
png_build_grayscale_palette @1
png_check_sig @2
png_chunk_error @3

View File

@ -18,7 +18,7 @@ RM = rm -f
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local

View File

@ -13,7 +13,7 @@ ZLIBINC=/usr/local/include
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
ALIGN=

View File

@ -39,9 +39,9 @@ CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
# have to change it.
PNGMAJ = 2
#PNGDLL = $%DLLNUM% # msvc
PNGDLL = 2 # cygwin 1.0.9
PNGMIN = 1.0.9
PNGMIN_BASE = 1.0.9
PNGDLL = 2 # cygwin 1.0.10beta1
PNGMIN = 1.0.10beta1
PNGMIN_BASE = 1.0.10
PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(PNGDLL).dll

View File

@ -17,7 +17,7 @@ ZLIBINC=../zlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
CC=cc
@ -64,7 +64,7 @@ install: libpng.a libpng.so.$(PNGVER)
chmod 644 $(LIBPATH)/libpng.a
chmod 644 $(LIBPATH)/libpng.so.$(PNGVER)
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
(cd $(LIBPATH)); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
(cd $(LIBPATH); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
ln -f -s libpng.so.$(PNGMAJ) libpng.so)
clean:

View File

@ -51,7 +51,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

112
scripts/makefile.hpgcc Normal file
View File

@ -0,0 +1,112 @@
# makefile for libpng on HP-UX using GCC
# Copyright (C) 2001, Laurent faillie
# Copyright (C) 1998, 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h
CC=gcc
# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
prefix=/usr/local
# Where the zlib library and include files are located
ZLIBLIB=/opt/zlib/lib
ZLIBINC=/opt/zlib/include
ALIGN=
# for i386:
#ALIGN=-malign-loops=2 -malign-functions=2
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
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. -L$(ZLIBLIB) -lpng -lz -lm
RANLIB=ranlib
#RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o
OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.pic.o:
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
all: libpng.a libpng.sl pngtest
libpng.a: $(OBJS)
ar rc $@ $(OBJS)
$(RANLIB) $@
libpng.sl: libpng.sl.$(PNGMAJ)
ln -f -s libpng.sl.$(PNGMAJ) libpng.sl
libpng.sl.$(PNGMAJ): libpng.sl.$(PNGVER)
ln -f -s libpng.sl.$(PNGVER) libpng.sl.$(PNGMAJ)
libpng.sl.$(PNGVER): $(OBJSDLL)
$(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \
+h libpng.sl.$(PNGMAJ) -o libpng.sl.$(PNGVER) $(OBJSDLL) -lz
pngtest: pngtest.o libpng.sl
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
test: pngtest
./pngtest
install: libpng.a libpng.sl.$(PNGVER)
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
cp png.h pngconf.h $(INCPATH)
chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
cp libpng.a libpng.sl.$(PNGVER) $(LIBPATH)
chmod 755 $(LIBPATH)/libpng.sl.$(PNGVER)
-@/bin/rm -f $(LIBPATH)/libpng.sl.$(PNGMAJ) $(LIBPATH)/libpng.sl
(cd $(LIBPATH); ln -sf libpng.sl.$(PNGVER) libpng.sl.$(PNGMAJ); \
ln -sf libpng.sl.$(PNGMAJ) libpng.sl)
clean:
/bin/rm -f *.o libpng.a libpng.sl* pngtest pngout.png
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
chmod a-w *.[ch35] $(DOCS) scripts/*
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h
pngerror.o pngerror.pic.o: png.h pngconf.h
pngrio.o pngrio.pic.o: png.h pngconf.h
pngwio.o pngwio.pic.o: png.h pngconf.h
pngmem.o pngmem.pic.o: png.h pngconf.h
pngset.o pngset.pic.o: png.h pngconf.h
pngget.o pngget.pic.o: png.h pngconf.h
pngread.o pngread.pic.o: png.h pngconf.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h
pngpread.o pngpread.pic.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@ -10,6 +10,7 @@ ZLIBINC=/opt/zlib/include
CC=cc
CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
# Caution: be sure you have built zlib with the same CFLAGS.
CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
@ -18,7 +19,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a and png.h

View File

@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -25,7 +25,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=gcc -shared
VER=1.0.9
LIBS=libpng.so.1.0.9
VER=1.0.10beta1
LIBS=libpng.so.1.0.10beta1
SHAREDLIB=libpng.so
libdir=$(prefix)/lib32
@ -59,12 +59,12 @@ install: libpng.a
cp libpng.a $(prefix)/lib
chmod 644 $(prefix)/lib/libpng.a
cp $(SHAREDLIB).$(VER) $(libdir); chmod 755 $(SHAREDLIB).$(VER)
cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
(cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
(ldconfig || true) >/dev/null 2>&1; \
fi
fi)
clean:
rm -f *.o libpng.a pngtest pngout.png

View File

@ -20,11 +20,12 @@ CC=cc
WARNMORE=-fullwarn
# You can add the -n32 option; then zlib must also be compiled with -n32
# Note: -KPIC is the default anyhow
CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -KPIC # -g -DPNG_DEBUG=5
#CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5
CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=cc -shared
VER=1.0.9
VER=1.0.10beta1
SONUM=2
SHAREDLIB=libpng.so
libdir=$(prefix)
@ -33,7 +34,7 @@ libdir=$(prefix)
RANLIB=echo
#RANLIB=ranlib
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o
@ -68,15 +69,15 @@ install: libpng.a
chmod 644 $(prefix)/lib/libpng.a
install-shared: $(SHAREDLIB).$(SONUM).$(VER)
cp $(SHAREDLIB).$(SONUM).$(VER) $(libdir);
cp $(SHAREDLIB).$(SONUM).$(VER) $(libdir)
chmod 755 $(SHAREDLIB).$(SONUM).$(VER)
cd $(libdir);
rm -f $(SHAREDLIB) $(SHAREDLIB).$(SONUM);
ln -s $(SHAREDLIB).$(SONUM).$(VER) $(SHAREDLIB).$(SONUM);
ln -s $(SHAREDLIB).$(SONUM) $(SHAREDLIB);
(cd $(libdir)
rm -f $(SHAREDLIB) $(SHAREDLIB).$(SONUM)
ln -s $(SHAREDLIB).$(SONUM).$(VER) $(SHAREDLIB).$(SONUM)
ln -s $(SHAREDLIB).$(SONUM) $(SHAREDLIB))
clean:
rm -f *.o libpng.a pngtest pngout.png $(SHAREDLIB).*
rm -f *.o libpng.a pngtest pngout.png $(SHAREDLIB).*
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
@ -100,4 +101,5 @@ pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h
pnggccrd.o: png.h pngconf.h

View File

@ -31,7 +31,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.9
PNGMIN = 1.0.10beta1
PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include

View File

@ -5,8 +5,8 @@ unit pngdef;
interface
const
PNG_LIBPNG_VER_STRING = '1.0.9';
PNG_LIBPNG_VER = 10009;
PNG_LIBPNG_VER_STRING = '1.0.10beta1';
PNG_LIBPNG_VER = 10010;
type
png_uint_32 = Cardinal;