mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
20 Commits
v1.0.9beta
...
v1.0.13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80b4f15ae3 | ||
|
|
e68f5a361b | ||
|
|
328353990f | ||
|
|
82ae383331 | ||
|
|
e1eff58f87 | ||
|
|
f64a06f5ec | ||
|
|
87c6bc984a | ||
|
|
13cfbac075 | ||
|
|
e164447858 | ||
|
|
1909560348 | ||
|
|
d4e8109a48 | ||
|
|
be9de0f428 | ||
|
|
cdf140beec | ||
|
|
231e687411 | ||
|
|
76e5fd642e | ||
|
|
f05f8033b8 | ||
|
|
408b421265 | ||
|
|
2ad31ae31f | ||
|
|
f6b4f45c7e | ||
|
|
d56aca7104 |
66
ANNOUNCE
66
ANNOUNCE
@@ -1,33 +1,49 @@
|
|||||||
|
|
||||||
Libpng 1.0.9beta2 - November 19, 2000
|
Libpng 1.0.13 - April 15, 2002
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
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.2.1):
|
||||||
|
|
||||||
Fixed typo in scripts/makefile.hpux
|
Fixed a bug with reading the length of iCCP profiles (Larry Reeves).
|
||||||
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
Revised makefile.linux, makefile.gcmmx, and others to generate
|
||||||
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
libpng.a, libpngNN.so, libpng.so.NN, and libpngNN/png.h
|
||||||
Changed "cdrom.com" in documentation to "libpng.org"
|
Revised makefile.darwin to remove "-undefined suppress" option.
|
||||||
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
Added checks for gamma and chromaticity values over 21474.83, which exceed
|
||||||
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
the limit for PNG unsigned 32-bit integers when encoded.
|
||||||
Added MNG_EXTENSIONS_SUPPORTED macro and support for some proposed MNG
|
Revised calls to png_create_read_struct() and png_create_write_struct()
|
||||||
features, for testing purposes.
|
for simpler debugging.
|
||||||
Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h.
|
Revised png_zalloc() so zlib handles errors (uses PNG_FLAG_MALLOC_NULL_MEM_OK)
|
||||||
Revised the 3 instances of WRITEFILE in pngtest.c.
|
Check chunk_length and idat_size for invalid (over PNG_MAX_UINT) lengths.
|
||||||
Updated png.rc in dll/msvc project
|
Check for invalid image dimensions in png_get_IHDR.
|
||||||
Revised makefile.dec to define and use LIBPATH and INCPATH
|
Added install-shared and install-static targets to all makefiles that make
|
||||||
Increased size of global png_libpng_ver[] array from 12 to 18 chars.
|
shared libraries.
|
||||||
Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const.
|
Always do gamma compensation when image is partially transparent.
|
||||||
Removed duplicate png_crc_finish() from png_handle_bKGD() function.
|
Modified shared-library makefiles to install pkgconfig/libpngNN.pc.
|
||||||
Added a warning when application calls png_read_update_info() multiple times.
|
Export (with PNGAPI) png_zalloc, png_zfree, and png_handle_as_unknown
|
||||||
Revised makefile.cygwin
|
Removed unused png_write_destroy_info prototype from png.h
|
||||||
Fixed bugs in iCCP support in pngrutil.c and pngwutil.c.
|
Eliminated incorrect use of width_mmx from pnggccrd.c in pixel_bytes == 8 case
|
||||||
Replaced png_set_empty_plte_permitted() with png_permit_mng_features().
|
Stopped a double free of palette, hist, and trans when not using free_me.
|
||||||
Relocated "msvc" and "wince" project subdirectories into "projects"
|
Added makefile.32sunu for Sun Ultra 32 and makefile.64sunu for Sun Ultra 64.
|
||||||
subdirectory and added projects/borland project subdirectory.
|
Compute background.gray and background_1.gray even when color_type is RGB
|
||||||
Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
|
in case image gets reduced to gray later (Jason Summers).
|
||||||
Add error message in png_set_compression_buffer_size() when malloc fails.
|
Added PNG_1_0_X macro which can be used to build a 1.0.x-compatible library.
|
||||||
|
Added missing PNGAPI to several function definitions.
|
||||||
|
Check for invalid bit_depth or color_type in png_get_IHDR(), and
|
||||||
|
check for missing PLTE or IHDR in png_push_read_chunk() (Matthias Clasen).
|
||||||
|
Revised iTXt support to accept NULL for lang and lang_key.
|
||||||
|
Compute gamma for color components of background even when color_type is gray.
|
||||||
|
Revised makefiles to put png.h and pngconf.h only in $prefix/include/libpngNN
|
||||||
|
Revised makefiles to make symlink to libpng.so.NN in addition to libpngNN.so
|
||||||
|
Prevent png_zalloc() from trying to memset memory that it failed to acquire.
|
||||||
|
Add typecasts of PNG_MAX_UINT in pngset_cHRM_fixed() (Matt Holgate).
|
||||||
|
Ensure that the right function (user or default) is used to free the
|
||||||
|
png_struct after an error in png_create_read_struct_2().
|
||||||
|
Save the ebx register in pnggccrd.c (Sami Farin)
|
||||||
|
Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner).
|
||||||
|
Updated makefiles to put headers in include/libpng and remove old include/*.h.
|
||||||
|
Revised description of png_set_filter() in libpng.3/libpng.txt.
|
||||||
|
Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
Send comments/corrections/commendations to
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||||
|
|||||||
234
CHANGES
234
CHANGES
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
CHANGES - changes for libpng
|
CHANGES - changes for libpng
|
||||||
|
|
||||||
version 0.2
|
version 0.2
|
||||||
@@ -379,7 +380,7 @@ version 1.0.2a [December 30, 1998]
|
|||||||
Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
|
Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and makefile.sco.
|
||||||
Removed lines after Dynamic Dependencies" in makefile.aco .
|
Removed lines after Dynamic Dependencies" in makefile.aco .
|
||||||
Revised makefile.dec to make a shared library (Jeremie Petit).
|
Revised makefile.dec to make a shared library (Jeremie Petit).
|
||||||
Removed trailing blanks from all files.
|
Removed trailing blanks from all files.
|
||||||
version 1.0.2a [January 6, 1999]
|
version 1.0.2a [January 6, 1999]
|
||||||
Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
|
Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h
|
||||||
Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
|
Added "if" tests to silence complaints about unused png_ptr in png.h and png.c
|
||||||
@@ -718,7 +719,7 @@ version 1.0.6i [May 2, 2000]
|
|||||||
the high-level interface, and unknown chunks support (all new in 1.0.6).
|
the high-level interface, and unknown chunks support (all new in 1.0.6).
|
||||||
This was necessary because of old applications that allocate the structs
|
This was necessary because of old applications that allocate the structs
|
||||||
directly as authors were instructed to do in libpng-0.88 and earlier,
|
directly as authors were instructed to do in libpng-0.88 and earlier,
|
||||||
instead of using png_create_*().
|
instead of using png_create_*().
|
||||||
Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
|
Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
|
||||||
can be used to detect codes that directly allocate the structs, and
|
can be used to detect codes that directly allocate the structs, and
|
||||||
code to check these modes in png_read_init() and png_write_init() and
|
code to check these modes in png_read_init() and png_write_init() and
|
||||||
@@ -732,10 +733,11 @@ version 1.0.6j [May 3, 2000]
|
|||||||
version 1.0.7beta11 [May 7, 2000]
|
version 1.0.7beta11 [May 7, 2000]
|
||||||
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||||
which are no longer used.
|
which are no longer used.
|
||||||
Eliminated the three new members of png_text when PNG_NO_iTXt_SUPPORTED
|
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
||||||
or PNG_LEGACY_SUPPORTED is defined.
|
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED
|
||||||
Made PNG_NO_ITXT_SUPPORTED the default setting, to avoid memory overrun
|
is defined.
|
||||||
when old applications fill the info_ptr->text structure directly.
|
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
||||||
|
overrun when old applications fill the info_ptr->text structure directly.
|
||||||
Added PNGAPI macro, and added it to the definitions of all exported functions.
|
Added PNGAPI macro, and added it to the definitions of all exported functions.
|
||||||
Relocated version macro definitions ahead of the includes of zlib.h and
|
Relocated version macro definitions ahead of the includes of zlib.h and
|
||||||
pngconf.h in png.h.
|
pngconf.h in png.h.
|
||||||
@@ -798,7 +800,6 @@ version 1.0.7rc2 [June 28, 2000]
|
|||||||
Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
|
Fixed "DJBPP" typo in pnggccrd.c introduced in beta18.
|
||||||
version 1.0.7 [July 1, 2000]
|
version 1.0.7 [July 1, 2000]
|
||||||
Revised the definition of "trans_values" in libpng.3/libpng.txt
|
Revised the definition of "trans_values" in libpng.3/libpng.txt
|
||||||
version 1.0.9beta2 [November 19, 2000]
|
|
||||||
version 1.0.8beta1 [July 8, 2000]
|
version 1.0.8beta1 [July 8, 2000]
|
||||||
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
|
Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks.
|
||||||
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
|
Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and
|
||||||
@@ -848,6 +849,225 @@ version 1.0.9beta2 [November 19, 2000]
|
|||||||
Added borland project files to "projects" subdirectory.
|
Added borland project files to "projects" subdirectory.
|
||||||
Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate.
|
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.
|
Add error message in png_set_compression_buffer_size() when malloc fails.
|
||||||
|
version 1.0.9beta3 [November 23, 2000]
|
||||||
|
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.
|
||||||
|
version 1.0.9beta4 [December 1, 2000]
|
||||||
|
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().
|
||||||
|
version 1.0.9beta5 [December 15, 2000]
|
||||||
|
Added support for filter method 64 (for PNG datastreams embedded in MNG).
|
||||||
|
version 1.0.9beta6 [December 18, 2000]
|
||||||
|
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.
|
||||||
|
Added png_permit_mng_features() function.
|
||||||
|
Revised libpng.3/libpng.txt. Changed "filter type" to "filter method".
|
||||||
|
version 1.0.9rc1 [December 23, 2000]
|
||||||
|
Revised test for PNG_HAVE_PNG_SIGNATURE in pngrutil.c
|
||||||
|
Fixed error handling of unknown compression type in png_decompress_chunk().
|
||||||
|
In pngconf.h, define __cdecl when _MSC_VER is defined.
|
||||||
|
version 1.0.9beta7 [December 28, 2000]
|
||||||
|
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.
|
||||||
|
version 1.0.9beta8 [January 12, 2001]
|
||||||
|
Moved pngasmrd.h into pngconf.h.
|
||||||
|
Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop.
|
||||||
|
version 1.0.9beta9 [January 15, 2001]
|
||||||
|
Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to
|
||||||
|
wince and msvc project module definition files.
|
||||||
|
Minor revision of makefile.cygwin.
|
||||||
|
Fixed bug with progressive reading of narrow interlaced images in pngpread.c
|
||||||
|
version 1.0.9beta10 [January 16, 2001]
|
||||||
|
Do not typedef png_FILE_p in pngconf.h when PNG_NO_STDIO is defined.
|
||||||
|
Fixed "png_mmx_supported" typo in project definition files.
|
||||||
|
version 1.0.9beta11 [January 19, 2001]
|
||||||
|
Updated makefile.sgi to make shared library.
|
||||||
|
Removed png_mmx_support() function and disabled PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
by default, for the benefit of DLL forward compatibility. These will
|
||||||
|
be re-enabled in version 1.2.0.
|
||||||
|
version 1.0.9rc2 [January 22, 2001]
|
||||||
|
Revised cygwin support.
|
||||||
|
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().
|
||||||
|
version 1.0.10rc1 [March 23, 2001]
|
||||||
|
Changed all instances of memcpy, strcpy, and strlen to png_memcpy, png_strcpy,
|
||||||
|
and png_strlen.
|
||||||
|
Revised png_mmx_supported() function in pnggccrd.c to return proper value.
|
||||||
|
Fixed bug in progressive reading (pngpread.c) with small images (height < 8).
|
||||||
|
version 1.0.10 [March 30, 2001]
|
||||||
|
Deleted extraneous space (introduced in 1.0.9) from line 42 of makefile.cygwin
|
||||||
|
Added beos project files (Chris Herborth)
|
||||||
|
version 1.0.11beta1 [April 3, 2001]
|
||||||
|
Added type casts on several png_malloc() calls (Dimitri Papadapoulos).
|
||||||
|
Removed a no-longer needed AIX work-around from pngconf.h
|
||||||
|
Changed several "//" single-line comments to C-style in pnggccrd.c
|
||||||
|
version 1.0.11beta2 [April 11, 2001]
|
||||||
|
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
|
||||||
|
Updated scripts/pngos2.def
|
||||||
|
version 1.0.11beta3 [April 14, 2001]
|
||||||
|
Added checking the results of many instances of png_malloc() for NULL
|
||||||
|
version 1.0.11beta4 [April 20, 2001]
|
||||||
|
Undid the changes from version 1.0.11beta3. Added a check for NULL return
|
||||||
|
from user's malloc_fn().
|
||||||
|
Removed some useless type casts of the NULL pointer.
|
||||||
|
Added makefile.netbsd
|
||||||
|
version 1.0.11 [April 27, 2001]
|
||||||
|
Revised makefile.netbsd
|
||||||
|
version 1.0.12beta1 [May 14, 2001]
|
||||||
|
Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot)
|
||||||
|
Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h
|
||||||
|
Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings.
|
||||||
|
Eliminated the png_error about apps using png_read|write_init(). Instead,
|
||||||
|
libpng will reallocate the png_struct and info_struct if they are too small.
|
||||||
|
This retains future binary compatibility for old applications written for
|
||||||
|
libpng-0.88 and earlier.
|
||||||
|
version 1.2.0beta1 [May 6, 2001]
|
||||||
|
Bumped DLLNUM to 2.
|
||||||
|
Re-enabled PNG_MNG_FEATURES_SUPPORTED and enabled PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
by default.
|
||||||
|
Added runtime selection of MMX features.
|
||||||
|
Added png_set_strip_error_numbers function and related macros.
|
||||||
|
version 1.2.0beta2 [May 7, 2001]
|
||||||
|
Finished merging 1.2.0beta1 with version 1.0.11
|
||||||
|
Added a check for attempts to read or write PLTE in grayscale PNG datastreams.
|
||||||
|
version 1.2.0beta3 [May 17, 2001]
|
||||||
|
Enabled user memory function by default.
|
||||||
|
Modified png_create_struct so it passes user mem_ptr to user memory allocator.
|
||||||
|
Increased png_mng_features flag from png_byte to png_uint_32.
|
||||||
|
Bumped shared-library (so-number) and dll-number to 3.
|
||||||
|
version 1.2.0beta4 [June 23, 2001]
|
||||||
|
Check for missing profile length field in iCCP chunk and free chunk_data
|
||||||
|
in case of truncated iCCP chunk.
|
||||||
|
Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc
|
||||||
|
Bumped dll-number from 2 to 3 in makefile.cygwin
|
||||||
|
Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly
|
||||||
|
if user attempts to run it on an 8-bit display.
|
||||||
|
Updated contrib/gregbook
|
||||||
|
Use png_malloc instead of png_zalloc to allocate palette in pngset.c
|
||||||
|
Updated makefile.ibmc
|
||||||
|
Added some typecasts to eliminate gcc 3.0 warnings. Changed prototypes
|
||||||
|
of png_write_oFFS width and height from png_uint_32 to png_int_32.
|
||||||
|
Updated example.c
|
||||||
|
Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c
|
||||||
|
version 1.2.0beta5 [August 8, 2001]
|
||||||
|
Revised contrib/gregbook
|
||||||
|
Revised makefile.gcmmx
|
||||||
|
Revised pnggccrd.c to conditionally compile some thread-unsafe code only
|
||||||
|
when PNG_THREAD_UNSAFE_OK is defined.
|
||||||
|
Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with
|
||||||
|
value exceeding 2^bit_depth-1
|
||||||
|
Revised makefile.sgi and makefile.sggcc
|
||||||
|
Replaced calls to fprintf(stderr,...) with png_warning() in pnggccrd.c
|
||||||
|
Removed restriction that do_invert_mono only operate on 1-bit opaque files
|
||||||
|
version 1.2.0 [September 1, 2001]
|
||||||
|
Changed a png_warning() to png_debug() in pnggccrd.c
|
||||||
|
Fixed contrib/gregbook/rpng-x.c, rpng2-x.c to avoid crash with XFreeGC().
|
||||||
|
version 1.2.1beta1 [October 19, 2001]
|
||||||
|
Revised makefile.std in contrib/pngminus
|
||||||
|
Include background_1 in png_struct regardless of gamma support.
|
||||||
|
Revised makefile.netbsd and makefile.macosx, added makefile.darwin.
|
||||||
|
Revised example.c to provide more details about using row_callback().
|
||||||
|
version 1.2.1beta2 [October 25, 2001]
|
||||||
|
Added type cast to each NULL appearing in a function call, except for
|
||||||
|
WINCE functions.
|
||||||
|
Added makefile.so9.
|
||||||
|
version 1.2.1beta3 [October 27, 2001]
|
||||||
|
Removed type casts from all NULLs.
|
||||||
|
Simplified png_create_struct_2().
|
||||||
|
version 1.2.1beta4 [November 7, 2001]
|
||||||
|
Revised png_create_info_struct() and png_creat_struct_2().
|
||||||
|
Added error message if png_write_info() was omitted.
|
||||||
|
Type cast NULLs appearing in function calls when _NO_PROTO or
|
||||||
|
PNG_TYPECAST_NULL is defined.
|
||||||
|
version 1.2.1rc1 [November 24, 2001]
|
||||||
|
Type cast NULLs appearing in function calls except when PNG_NO_TYPECAST_NULL
|
||||||
|
is defined.
|
||||||
|
Changed typecast of "size" argument to png_size_t in pngmem.c calls to
|
||||||
|
the user malloc_fn, to agree with the prototype in png.h
|
||||||
|
Added a pop/push operation to pnggccrd.c, to preserve Eflag (Maxim Sobolev)
|
||||||
|
Updated makefile.sgi to recognize LIBPATH and INCPATH.
|
||||||
|
Updated various makefiles so "make clean" does not remove previous major
|
||||||
|
version of the shared library.
|
||||||
|
version 1.2.1rc2 [December 4, 2001]
|
||||||
|
Added a pop/push operation to pngvcrd.c, to preserve Eflag.
|
||||||
|
Always allocate 256-entry internal palette, hist, and trans arrays, to
|
||||||
|
avoid out-of-bounds memory reference caused by invalid PNG datastreams.
|
||||||
|
Added a check for prefix_length > data_length in iCCP chunk handler.
|
||||||
|
version 1.2.1 [December 7, 2001]
|
||||||
|
None.
|
||||||
|
version 1.2.2beta1 [February 22, 2002]
|
||||||
|
Fixed a bug with reading the length of iCCP profiles (Larry Reeves).
|
||||||
|
Revised makefile.linux, makefile.gcmmx, and makefile.sgi to generate
|
||||||
|
libpng.a, libpng12.so (not libpng.so.3), and libpng12/png.h
|
||||||
|
Revised makefile.darwin to remove "-undefined suppress" option.
|
||||||
|
Added checks for gamma and chromaticity values over 21474.83, which exceed
|
||||||
|
the limit for PNG unsigned 32-bit integers when encoded.
|
||||||
|
Revised calls to png_create_read_struct() and png_create_write_struct()
|
||||||
|
for simpler debugging.
|
||||||
|
Revised png_zalloc() so zlib handles errors (uses PNG_FLAG_MALLOC_NULL_MEM_OK)
|
||||||
|
version 1.2.2beta2 [February 23, 2002]
|
||||||
|
Check chunk_length and idat_size for invalid (over PNG_MAX_UINT) lengths.
|
||||||
|
Check for invalid image dimensions in png_get_IHDR.
|
||||||
|
Added missing "fi;" in the install target of the SGI makefiles.
|
||||||
|
Added install-static to all makefiles that make shared libraries.
|
||||||
|
Always do gamma compensation when image is partially transparent.
|
||||||
|
version 1.2.2beta3 [March 7, 2002]
|
||||||
|
Compute background.gray and background_1.gray even when color_type is RGB
|
||||||
|
in case image gets reduced to gray later.
|
||||||
|
Modified shared-library makefiles to install pkgconfig/libpngNN.pc.
|
||||||
|
Export (with PNGAPI) png_zalloc, png_zfree, and png_handle_as_unknown
|
||||||
|
Removed unused png_write_destroy_info prototype from png.h
|
||||||
|
Eliminated incorrect use of width_mmx from pnggccrd.c in pixel_bytes == 8 case
|
||||||
|
Added install-shared target to all makefiles that make shared libraries.
|
||||||
|
Stopped a double free of palette, hist, and trans when not using free_me.
|
||||||
|
Added makefile.32sunu for Sun Ultra 32 and makefile.64sunu for Sun Ultra 64.
|
||||||
|
version 1.2.2beta4 [March 8, 2002]
|
||||||
|
Compute background.gray and background_1.gray even when color_type is RGB
|
||||||
|
in case image gets reduced to gray later (Jason Summers).
|
||||||
|
Relocated a misplaced /bin/rm in the "install-shared" makefile targets
|
||||||
|
Added PNG_1_0_X macro which can be used to build a 1.0.x-compatible library.
|
||||||
|
version 1.2.2beta5 [March 26, 2002]
|
||||||
|
Added missing PNGAPI to several function definitions.
|
||||||
|
Check for invalid bit_depth or color_type in png_get_IHDR(), and
|
||||||
|
check for missing PLTE or IHDR in png_push_read_chunk() (Matthias Clasen).
|
||||||
|
Revised iTXt support to accept NULL for lang and lang_key.
|
||||||
|
Compute gamma for color components of background even when color_type is gray.
|
||||||
|
Changed "()" to "{}" in scripts/libpng.pc.in.
|
||||||
|
Revised makefiles to put png.h and pngconf.h only in $prefix/include/libpngNN
|
||||||
|
Revised makefiles to make symlink to libpng.so.NN in addition to libpngNN.so
|
||||||
|
version 1.2.2beta6 [March 31, 2002]
|
||||||
|
version 1.0.13beta1 [March 31, 2002]
|
||||||
|
Prevent png_zalloc() from trying to memset memory that it failed to acquire.
|
||||||
|
Add typecasts of PNG_MAX_UINT in pngset_cHRM_fixed() (Matt Holgate).
|
||||||
|
Ensure that the right function (user or default) is used to free the
|
||||||
|
png_struct after an error in png_create_read_struct_2().
|
||||||
|
version 1.2.2rc1 [April 7, 2002]
|
||||||
|
version 1.0.13rc1 [April 7, 2002]
|
||||||
|
Save the ebx register in pnggccrd.c (Sami Farin)
|
||||||
|
Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner).
|
||||||
|
Updated makefiles to put headers in include/libpng and remove old include/*.h.
|
||||||
|
version 1.0.13 [April 15, 2002]
|
||||||
|
Revised description of png_set_filter() in libpng.3/libpng.txt.
|
||||||
|
Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
Send comments/corrections/commendations to
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||||
|
|||||||
36
INSTALL
36
INSTALL
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.0.9beta2 - November 19, 2000
|
Installing libpng version 1.0.13 - April 15, 2002
|
||||||
|
|
||||||
Before installing libpng, you must first install zlib. zlib
|
Before installing libpng, you must first install zlib. zlib
|
||||||
can usually be found wherever you got libpng. zlib can be
|
can usually be found wherever you got libpng. zlib can be
|
||||||
@@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
|
|||||||
version of zlib that's installed.
|
version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.0.9beta2" or "lpng109" and "zlib-1.1.3"
|
might be called "libpng-1.0.13" or "lpng109" and "zlib-1.1.3"
|
||||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
@@ -28,9 +28,11 @@ Your directory structure should look like this:
|
|||||||
pngsuite
|
pngsuite
|
||||||
visupng
|
visupng
|
||||||
projects
|
projects
|
||||||
|
beos
|
||||||
borland
|
borland
|
||||||
msvc
|
msvc
|
||||||
wince
|
netware.txt
|
||||||
|
wince.txt
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
pngtest.png
|
pngtest.png
|
||||||
@@ -47,35 +49,47 @@ distribution of libpng. It is available in both tar.gz (UNIX style line
|
|||||||
endings) and zip (DOS style line endings) formats.
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
If you are building libpng with MSVC, you can enter the libpng\msvc directory
|
If you are building libpng with MSVC, you can enter the libpng\msvc directory
|
||||||
and follow the instructions in msvc\README.txt. You can build libpng for
|
and follow the instructions in msvc\README.txt.
|
||||||
WindowsCE by entering the libpng\wince directory and following the
|
|
||||||
instructions in the README* files.
|
You can build libpng for WindowsCE by entering the downloading and installing
|
||||||
|
the libpng\wince directory as instructed in the projects\wince.txt file, and
|
||||||
|
then following the instructions in the README* files. Similarly, you can
|
||||||
|
build libpng for Netware as instructed in projects\netware.txt.
|
||||||
|
|
||||||
Else enter the zlib directory and follow the instructions in zlib/README,
|
Else enter the zlib directory and follow the instructions in zlib/README,
|
||||||
then come back here and choose the appropriate makefile.sys in the scripts
|
then come back here and choose the appropriate makefile.sys in the scripts
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
The files that are presently available in the scripts directory
|
The files that are presently available in the scripts directory
|
||||||
include
|
include
|
||||||
|
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9beta2)
|
makefile.linux => Linux/ELF makefile (gcc, creates libpng10.so.0.1.0.13)
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.9beta2,
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng10.so.0.1.0.13,
|
||||||
uses assembler code tuned for Intel MMX platform)
|
uses assembler code tuned for Intel MMX platform)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
ftp://ftp.cs.wisc.edu/ghost)
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX makefile
|
||||||
makefile.cygwin => Cygwin/gcc makefile
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
makefile.intel => Intel C/C++ version 4.0 and later
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
||||||
|
makefile.macosx => MACOS X Makefile
|
||||||
|
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
|
||||||
|
makefile.openbsd => OpenBSD makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9beta2)
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng10.so.0.1.0.13)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.9beta2)
|
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng10.so.0.1.0.13)
|
||||||
|
makefile.so9 => Solaris 9 makefile (gcc, creates libpng10.so.0.1.0.13)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.mips => MIPS makefile
|
makefile.mips => MIPS makefile
|
||||||
makefile.acorn => Acorn makefile
|
makefile.acorn => Acorn makefile
|
||||||
|
|||||||
66
KNOWNBUG
66
KNOWNBUG
@@ -1,65 +1,9 @@
|
|||||||
|
|
||||||
Known bugs and suggested enhancements in libpng-1.0.8
|
Known bugs in libpng version 1.0.13
|
||||||
|
|
||||||
0: November 3, 2000 -- BUG -- incorrect iCCP chunk is written
|
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
|
||||||
|
reading interlaced PNG files, when assembler code is enabled.
|
||||||
|
|
||||||
The compression_type byte in the iCCP chunk written by libpng is
|
STATUS: Under investigation. The change to pnggccrd.c in libpng-1.2.1
|
||||||
usually incorrect.
|
fixed a problem under FreeBSD but not the problem with NetBSD.
|
||||||
|
|
||||||
Status: Fixed in libpng-1.0.9beta1
|
|
||||||
|
|
||||||
1. October 12, 2000 -- BUG -- pngtest fails
|
|
||||||
|
|
||||||
The three WRITEFILE calls in pngtest.c are incorrect. They must be
|
|
||||||
changed to read
|
|
||||||
|
|
||||||
WRITEFILE((png_FILE_p)png_ptr->io_ptr, data, length, check);
|
|
||||||
WRITEFILE(io_ptr, near_data, length, check);
|
|
||||||
WRITEFILE(io_ptr, buf, written, err);
|
|
||||||
|
|
||||||
2. August 28, 2000 -- BUG -- pnggccrd.c
|
|
||||||
|
|
||||||
The interlacing() function has still not been fully converted and
|
|
||||||
will not compile under gcc-2.95.2; it is currently ifdef'ed out.
|
|
||||||
|
|
||||||
STATUS: Fixed in libpng-1.0.9. There were also bugs in pngvcrd.c
|
|
||||||
which have been fixed. The replacement files are available at the
|
|
||||||
PNG web site (http://www.libpng.org/pub/png).
|
|
||||||
|
|
||||||
3. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
|
|
||||||
|
|
||||||
Loops need to be optimized everywhere
|
|
||||||
|
|
||||||
Make them count down instead of up -- Kevin Bracey
|
|
||||||
|
|
||||||
Optimizing compilers don't need this, and making
|
|
||||||
the change would be error prone -- Tom Lane, Glenn R-P
|
|
||||||
|
|
||||||
Question whether i-- or --i is better.
|
|
||||||
|
|
||||||
STATUS: Under investigation, postponed until after
|
|
||||||
libpng-2.0.0. About 160 loops will be turned around
|
|
||||||
in libpng-2.0.x betaxx, for testing.
|
|
||||||
|
|
||||||
4. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
|
|
||||||
|
|
||||||
libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
|
|
||||||
merging with background, and then back to the image's gamma. The
|
|
||||||
bit_depth of the intermediate (gamma=1.0) representation is probably
|
|
||||||
not sufficient. In the typical gamma=1/2.2 situation, the linear
|
|
||||||
pixels need about 4 more bits than the gamma-encoded ones, to avoid
|
|
||||||
loss of precision. A similar situation exists with the rgb_to_gray
|
|
||||||
operation.
|
|
||||||
|
|
||||||
STATUS: under development.
|
|
||||||
|
|
||||||
5. September 1999 -- ENHANCEMENT --
|
|
||||||
|
|
||||||
It should be possible to use libpng without floating-point arithmetic.
|
|
||||||
|
|
||||||
STATUS: Under investigation, implementation postponed until after
|
|
||||||
libpng-2.0.0.
|
|
||||||
|
|
||||||
Much of this was completed in libpng-1.0.6, but gamma compensation
|
|
||||||
is not yet done in fixed-point arithmetic.
|
|
||||||
|
|
||||||
|
|||||||
6
LICENSE
6
LICENSE
@@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
|||||||
If you modify libpng you may insert additional notices immediately following
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.0.9beta2, November 19, 2000, are
|
libpng versions 1.0.7, July 1, 2000, through 1.0.13, April 15, 2002, are
|
||||||
Copyright (c) 2000 Glenn Randers-Pehrson
|
Copyright (c) 2000-2002 Glenn Randers-Pehrson
|
||||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
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
|
with the following individuals added to the list of Contributing Authors
|
||||||
|
|
||||||
@@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
randeg@alum.rpi.edu
|
randeg@alum.rpi.edu
|
||||||
November 19, 2000
|
April 15, 2002
|
||||||
|
|||||||
29
README
29
README
@@ -1,4 +1,4 @@
|
|||||||
README for libpng 1.0.9beta2 - November 19, 2000 (shared library 2.1)
|
README for libpng 1.0.13 - April 15, 2002 (shared library 2.1)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
@@ -172,35 +172,50 @@ Files in this distribution:
|
|||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for building DLL
|
projects => Contains project files and workspaces for building DLL
|
||||||
|
beos => Contains a Beos workspace for building libpng
|
||||||
borland => Contains a Borland workspace for building libpng
|
borland => Contains a Borland workspace for building libpng
|
||||||
and zlib
|
and zlib
|
||||||
msvc => Contains a Microsoft Visual C++ (MSVC) workspace
|
msvc => Contains a Microsoft Visual C++ (MSVC) workspace
|
||||||
for building libpng and zlib
|
for building libpng and zlib
|
||||||
wince => Contains a Microsoft Visual C++ (Windows CD Toolkit)
|
netware.txt => Contains instructions for downloading a set of
|
||||||
workspace for building libpng and zlib on WindowsCE
|
project files for building libpng and zlib on
|
||||||
|
Netware.
|
||||||
|
wince.txt => Contains instructions for downloading a Microsoft
|
||||||
|
Visual C++ (Windows CD Toolkit) workspace for
|
||||||
|
building libpng and zlib on WindowsCE
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng.so.2.1.0.9beta2)
|
(gcc, creates libpng10.so.0.1.0.13)
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||||
libpng.so.2.1.0.9beta2, uses assembler code
|
libpng10.so.0.1.0.13, uses assembler code
|
||||||
tuned for Intel MMX platform)
|
tuned for Intel MMX platform)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
ftp://ftp.cs.wisc.edu/ghost)
|
ftp://ftp.cs.wisc.edu/ghost)
|
||||||
|
makefile.aix => AIX makefile
|
||||||
makefile.cygwin => Cygwin/gcc makefile
|
makefile.cygwin => Cygwin/gcc makefile
|
||||||
|
makefile.darwin => Darwin makefile
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
||||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
|
||||||
makefile.intel => Intel C/C++ version 4.0 and later
|
makefile.intel => Intel C/C++ version 4.0 and later
|
||||||
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||||
|
makefile.macosx => MACOS X Makefile
|
||||||
|
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
|
||||||
|
makefile.openbsd => OpenBSD makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.9beta2)
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng10.so.0.1.0.13)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile
|
makefile.solaris => Solaris 2.X makefile
|
||||||
(gcc, creates libpng.so.2.1.0.9beta2)
|
(gcc, creates libpng10.so.0.1.0.13)
|
||||||
|
makefile.so9 => Solaris 9 makefile
|
||||||
|
(gcc, creates libpng10.so.0.1.0.13)
|
||||||
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.mips => MIPS makefile
|
makefile.mips => MIPS makefile
|
||||||
makefile.acorn => Acorn makefile
|
makefile.acorn => Acorn makefile
|
||||||
|
|||||||
5
TODO
5
TODO
@@ -17,3 +17,8 @@ Better filter selection
|
|||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
Histogram creation.
|
Histogram creation.
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
|
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
||||||
|
Build gamma tables using fixed point (and do away with floating point entirely).
|
||||||
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
|
background and doing rgb-to-gray transformation.
|
||||||
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
|
|||||||
4
Y2KINFO
4
Y2KINFO
@@ -1,13 +1,13 @@
|
|||||||
Y2K compliance in libpng:
|
Y2K compliance in libpng:
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
November 19, 2000
|
April 15, 2002
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.0.9beta2 are Y2K compliant. It is my belief that earlier
|
upward through 1.0.13 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer
|
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
|
|||||||
2
configure
vendored
2
configure
vendored
@@ -1,5 +1,5 @@
|
|||||||
echo "
|
echo "
|
||||||
There is no \"configure\" script for Libpng-1.0.9beta2. Instead, please
|
There is no \"configure\" script for Libpng-1.0.13. Instead, please
|
||||||
copy the appropriate makefile for your system from the \"scripts\"
|
copy the appropriate makefile for your system from the \"scripts\"
|
||||||
directory. Read the INSTALL file for more details.
|
directory. Read the INSTALL file for more details.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
|
|||||||
102
contrib/gregbook/Makefile.sgi
Normal file
102
contrib/gregbook/Makefile.sgi
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
|
||||||
|
# Greg Roelofs
|
||||||
|
# Last modified: 7 March 2002
|
||||||
|
#
|
||||||
|
# The programs built by this makefile are described in the book,
|
||||||
|
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||||
|
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
||||||
|
# and family, too. (Not that this is a blatant plug or anything.)
|
||||||
|
#
|
||||||
|
# Invoke this makefile from a shell prompt in the usual way; for example:
|
||||||
|
#
|
||||||
|
# make -f Makefile.sgi
|
||||||
|
#
|
||||||
|
# This makefile assumes libpng and zlib have already been built or downloaded
|
||||||
|
# and are both installed in /usr/local/{include,lib} (as indicated by the
|
||||||
|
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
|
||||||
|
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
|
||||||
|
#
|
||||||
|
# This makefile builds dynamically linked executables (against libpng and zlib,
|
||||||
|
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
|
||||||
|
# ZLIB lines.
|
||||||
|
|
||||||
|
|
||||||
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
|
PNGINC = -I/usr/local/include/libpng10
|
||||||
|
PNGLIB = -L/usr/local/lib -lpng10 # dynamically linked against libpng
|
||||||
|
#PNGLIB = /usr/local/lib/libpng10.a # statically linked against libpng
|
||||||
|
# or:
|
||||||
|
#PNGINC = -I../..
|
||||||
|
#PNGLIB = -L../.. -lpng
|
||||||
|
#PNGLIB = ../../libpng.a
|
||||||
|
|
||||||
|
ZINC = -I/usr/local/include
|
||||||
|
ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
||||||
|
#ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
||||||
|
#ZINC = -I../zlib
|
||||||
|
#ZLIB = -L../zlib -lz
|
||||||
|
#ZLIB = ../../../zlib/libz.a
|
||||||
|
|
||||||
|
XINC = -I/usr/include/X11 # old-style, stock X distributions
|
||||||
|
XLIB = -L/usr/lib/X11 -lX11
|
||||||
|
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||||
|
#XLIB = -L/usr/openwin/lib -lX11
|
||||||
|
#XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
|
||||||
|
#XLIB = -L/usr/X11R6/lib -lX11
|
||||||
|
|
||||||
|
INCS = $(PNGINC) $(ZINC) $(XINC)
|
||||||
|
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
|
||||||
|
WLIBS = $(PNGLIB) $(ZLIB)
|
||||||
|
|
||||||
|
CC = cc
|
||||||
|
LD = cc
|
||||||
|
RM = rm -f
|
||||||
|
CFLAGS = -O -fullwarn $(INCS)
|
||||||
|
LDFLAGS =
|
||||||
|
O = .o
|
||||||
|
E =
|
||||||
|
|
||||||
|
RPNG = rpng-x
|
||||||
|
RPNG2 = rpng2-x
|
||||||
|
WPNG = wpng
|
||||||
|
|
||||||
|
ROBJS = $(RPNG)$(O) readpng$(O)
|
||||||
|
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
||||||
|
WOBJS = $(WPNG)$(O) writepng$(O)
|
||||||
|
|
||||||
|
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
||||||
|
|
||||||
|
|
||||||
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
|
.c$(O):
|
||||||
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies --------------------------------------------------------------
|
||||||
|
|
||||||
|
all: $(EXES)
|
||||||
|
|
||||||
|
$(RPNG)$(E): $(ROBJS)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
|
||||||
|
|
||||||
|
$(RPNG2)$(E): $(ROBJS2)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
|
||||||
|
|
||||||
|
$(WPNG)$(E): $(WOBJS)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
|
||||||
|
|
||||||
|
$(RPNG)$(O): $(RPNG).c readpng.h
|
||||||
|
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
||||||
|
$(WPNG)$(O): $(WPNG).c writepng.h
|
||||||
|
|
||||||
|
readpng$(O): readpng.c readpng.h
|
||||||
|
readpng2$(O): readpng2.c readpng2.h
|
||||||
|
writepng$(O): writepng.c writepng.h
|
||||||
|
|
||||||
|
|
||||||
|
# maintenance ---------------------------------------------------------------
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
|
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
|
||||||
# Greg Roelofs
|
# Greg Roelofs
|
||||||
# Last modified: 28 February 2000
|
# Last modified: 7 March 2002
|
||||||
#
|
#
|
||||||
# The programs built by this makefile are described in the book,
|
# The programs built by this makefile are described in the book,
|
||||||
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
||||||
@@ -23,24 +23,24 @@
|
|||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGINC = -I/usr/local/include
|
PNGINC = -I/usr/local/include/libpng10
|
||||||
#PNGLIB = -L/usr/local/lib -lpng # dynamically linked against libpng
|
#PNGLIB = -L/usr/local/lib -lpng10 # dynamically linked against libpng
|
||||||
PNGLIB = /usr/local/lib/libpng.a # statically linked against libpng
|
PNGLIB = /usr/local/lib/libpng10.a # statically linked against libpng
|
||||||
# or:
|
# or:
|
||||||
#PNGINC = -I../..
|
#PNGINC = -I../libpng
|
||||||
#PNGLIB = -L../.. -lpng
|
#PNGLIB = -L../libpng -lpng
|
||||||
#PNGLIB = ../../libpng.a
|
#PNGLIB = ../libpng/libpng.a
|
||||||
|
|
||||||
ZINC = -I/usr/local/include
|
ZINC = -I/usr/local/include
|
||||||
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
||||||
ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
||||||
#ZINC = -I../zlib
|
#ZINC = -I../zlib
|
||||||
#ZLIB = -L../zlib -lz
|
#ZLIB = -L../zlib -lz
|
||||||
#ZLIB = ../../../zlib/libz.a
|
#ZLIB = ../zlib/libz.a
|
||||||
|
|
||||||
#XINC = -I/usr/include/X11 # old-style, stock X distributions
|
#XINC = -I/usr/include # old-style, stock X distributions
|
||||||
#XLIB = -L/usr/lib/X11 -lX11
|
#XLIB = -L/usr/lib/X11 -lX11
|
||||||
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
||||||
#XLIB = -L/usr/openwin/lib -lX11
|
#XLIB = -L/usr/openwin/lib -lX11
|
||||||
XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
|
XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
|
||||||
XLIB = -L/usr/X11R6/lib -lX11
|
XLIB = -L/usr/X11R6/lib -lX11
|
||||||
|
|||||||
@@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGPATH = ../..
|
PNGPATH = ../libpng
|
||||||
PNGINC = -I$(PNGPATH)
|
PNGINC = -I$(PNGPATH)
|
||||||
#PNGLIB = $(PNGPATH)/pngdll.lib
|
#PNGLIB = $(PNGPATH)/pngdll.lib
|
||||||
PNGLIB = $(PNGPATH)/libpng.lib
|
PNGLIB = $(PNGPATH)/libpng.lib
|
||||||
|
|
||||||
ZPATH = ../../../zlib
|
ZPATH = ../zlib
|
||||||
ZINC = -I$(ZPATH)
|
ZINC = -I$(ZPATH)
|
||||||
#ZLIB = $(ZPATH)/zlibdll.lib
|
#ZLIB = $(ZPATH)/zlibdll.lib
|
||||||
ZLIB = $(ZPATH)/zlibstat.lib
|
ZLIB = $(ZPATH)/zlibstat.lib
|
||||||
|
|||||||
@@ -16,13 +16,12 @@ of PBMPLUS/NetPBM) and converts them to PNG.
|
|||||||
The source code for all three demo programs currently compiles under
|
The source code for all three demo programs currently compiles under
|
||||||
Unix, OpenVMS, and 32-bit Windows. (Special thanks to Martin Zinser,
|
Unix, OpenVMS, and 32-bit Windows. (Special thanks to Martin Zinser,
|
||||||
zinser@decus.de, for making the necessary changes for OpenVMS and for
|
zinser@decus.de, for making the necessary changes for OpenVMS and for
|
||||||
providing an appropriate build script.) Build instructions can be
|
providing an appropriate build script.) Build instructions can be found
|
||||||
found below.
|
below.
|
||||||
|
|
||||||
Files:
|
Files:
|
||||||
|
|
||||||
README this file
|
README this file
|
||||||
README.w32 additional Windows-specific information
|
|
||||||
LICENSE terms of distribution and reuse (BSD-like)
|
LICENSE terms of distribution and reuse (BSD-like)
|
||||||
|
|
||||||
Makefile.unx Unix makefile
|
Makefile.unx Unix makefile
|
||||||
@@ -45,26 +44,27 @@ Files:
|
|||||||
|
|
||||||
toucan.png transparent PNG for testing (by Stefan Schneider)
|
toucan.png transparent PNG for testing (by Stefan Schneider)
|
||||||
|
|
||||||
Note that the programs are designed to be functional, but their primary
|
Note that, although the programs are designed to be functional, their
|
||||||
purpose is to demonstrate how to use libpng to add PNG support to other
|
primary purpose is to illustrate how to use libpng to add PNG support to
|
||||||
programs. As such, their user interfaces are crude and definitely not
|
other programs. As such, their user interfaces are crude and definitely
|
||||||
intended for everyday use.
|
are not intended for everyday use.
|
||||||
|
|
||||||
Please see http://www.cdrom.com/pub/png/pngbook.html for further infor-
|
Please see http://www.libpng.org/pub/png/pngbook.html for further infor-
|
||||||
mation and links to the latest version of the source code, and Chapters
|
mation and links to the latest version of the source code, and Chapters
|
||||||
13-15 of the book for detailed discussion of the three programs.
|
13-15 of the book for detailed discussion of the three programs.
|
||||||
|
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
19 March 2000
|
newt@pobox.com
|
||||||
|
30 June 2001
|
||||||
|
|
||||||
|
|
||||||
BUILD INSTRUCTIONS
|
BUILD INSTRUCTIONS
|
||||||
|
|
||||||
- Prerequisites:
|
- Prerequisites (in order of compilation):
|
||||||
|
|
||||||
- zlib ftp://ftp.cdrom.com/pub/infozip/zlib/zlib.html
|
- zlib http://www.gzip.org/zlib/
|
||||||
- libpng http://www.cdrom.com/pub/png/pngcode.html
|
- libpng http://www.libpng.org/pub/png/libpng.html
|
||||||
- pngbook http://www.cdrom.com/pub/png/book/sources.html
|
- pngbook http://www.libpng.org/pub/png/book/sources.html
|
||||||
|
|
||||||
The pngbook demo programs are explicitly designed to demonstrate proper
|
The pngbook demo programs are explicitly designed to demonstrate proper
|
||||||
coding techniques for using the libpng reference library. As a result,
|
coding techniques for using the libpng reference library. As a result,
|
||||||
@@ -128,11 +128,13 @@ BUILD INSTRUCTIONS
|
|||||||
|
|
||||||
The result should be three executables: rpng-win.exe, rpng2-win.exe,
|
The result should be three executables: rpng-win.exe, rpng2-win.exe,
|
||||||
and wpng.exe. Copy them somewhere in your PATH or run them from the
|
and wpng.exe. Copy them somewhere in your PATH or run them from the
|
||||||
current folder. Unlike the Unix versions, the two windowed programs
|
current folder. Like the Unix versions, the two windowed programs
|
||||||
(rpng and rpng2) do not display a usage screen when invoked without
|
(rpng and rpng2) now display a usage screen in a console window when
|
||||||
command-line arguments; see README.w32 for brief help or the book for
|
invoked without command-line arguments; this is new behavior as of
|
||||||
details. Note that the programs use the Unix-style "-" character to
|
the June 2001 release. Note that the programs use the Unix-style "-"
|
||||||
specify options, instead of the more common DOS/Windows "/" character.
|
character to specify options, instead of the more common DOS/Windows
|
||||||
|
"/" character. (For example: "rpng2-win -bgpat 4 foo.png", not
|
||||||
|
"rpng2-win /bgpat 4 foo.png")
|
||||||
|
|
||||||
|
|
||||||
- OpenVMS:
|
- OpenVMS:
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
See the main README file for basic instructions on compiling and running
|
|
||||||
the programs. See http://www.cdrom.com/pub/png/pngbook.html for further
|
|
||||||
information and links to the source code, and Chapters 13-15 of the book
|
|
||||||
for detailed discussion of the three programs.
|
|
||||||
|
|
||||||
Since the two viewers, rpng and rpng2, are both designed to write infor-
|
|
||||||
mation to the console (i.e., a DOS-window command line) while displaying
|
|
||||||
the image in a graphical window--and since I haven't yet figured out how
|
|
||||||
to do that under Windows--here are the usage screens for the two programs:
|
|
||||||
|
|
||||||
|
|
||||||
rpng-win 1.02 of 19 March 2000: Simple PNG Viewer for Windows
|
|
||||||
Compiled with libpng 1.0.5; using libpng 1.0.5.
|
|
||||||
Compiled with zlib 1.1.3; using zlib 1.1.3.
|
|
||||||
|
|
||||||
Usage: rpng-win [-gamma exp] [-bgcolor bg] file.png
|
|
||||||
exp transfer-function exponent (``gamma'') of the display
|
|
||||||
system in floating-point format (e.g., ``2.2''); equal
|
|
||||||
to the product of the lookup-table exponent (varies)
|
|
||||||
and the CRT exponent (usually 2.2); must be positive
|
|
||||||
bg desired background color in 7-character hex RGB format
|
|
||||||
(e.g., ``#ff7f00'' for orange: same as HTML colors);
|
|
||||||
used with transparent images
|
|
||||||
|
|
||||||
Press Q, Esc or mouse button 1 after image is displayed to quit.
|
|
||||||
|
|
||||||
|
|
||||||
rpng2-win 1.04 of 19 March 2000: Progressive PNG Viewer for Windows
|
|
||||||
Compiled with libpng 1.0.5; using libpng 1.0.5.
|
|
||||||
Compiled with zlib 1.1.3; using zlib 1.1.3.
|
|
||||||
|
|
||||||
Usage: rpng2-win [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing] file.png
|
|
||||||
|
|
||||||
exp transfer-function exponent (``gamma'') of the display
|
|
||||||
system in floating-point format (e.g., ``2.2''); equal
|
|
||||||
to the product of the lookup-table exponent (varies)
|
|
||||||
and the CRT exponent (usually 2.2); must be positive
|
|
||||||
bg desired background color in 7-character hex RGB format
|
|
||||||
(e.g., ``#ff7f00'' for orange: same as HTML colors);
|
|
||||||
used with transparent images; overrides -bgpat
|
|
||||||
pat desired background pattern number (1-16); used with
|
|
||||||
transparent images; overrides -bgcolor
|
|
||||||
-timing enables delay for every block read, to simulate modem
|
|
||||||
download of image (~36 Kbps)
|
|
||||||
|
|
||||||
Press Q, Esc or mouse button 1 after image is displayed to quit.
|
|
||||||
|
|
||||||
|
|
||||||
The usage screen for the third (non-windowed) program, wpng, can be seen
|
|
||||||
simply by invoking it without any parameters (``wpng'').
|
|
||||||
|
|
||||||
Greg Roelofs
|
|
||||||
19 March 2000
|
|
||||||
@@ -9,21 +9,22 @@ $! Set locations where zlib and libpng sources live.
|
|||||||
$!
|
$!
|
||||||
$ zpath = ""
|
$ zpath = ""
|
||||||
$ pngpath = ""
|
$ pngpath = ""
|
||||||
$ if f$search("[-.zlib]zlib.h").nes."" then zpath = "[-.zlib]"
|
|
||||||
$ if f$search("[-.libpng]png.h").nes."" then pngpath = "[-.libpng]"
|
|
||||||
$!
|
$!
|
||||||
$ if f$search("[---.zlib]zlib.h").nes."" then zpath = "[---.zlib]"
|
$ if f$search("[---.zlib]zlib.h").nes."" then zpath = "[---.zlib]"
|
||||||
$ if f$search("[--]png.h").nes."" then pngpath = "[--]"
|
$ if f$search("[--]png.h").nes."" then pngpath = "[--]"
|
||||||
$!
|
$!
|
||||||
|
$ if f$search("[-.zlib]zlib.h").nes."" then zpath = "[-.zlib]"
|
||||||
|
$ if f$search("[-.libpng]png.h").nes."" then pngpath = "[-.libpng]"
|
||||||
|
$!
|
||||||
$ if zpath .eqs. ""
|
$ if zpath .eqs. ""
|
||||||
$ then
|
$ then
|
||||||
$ write sys$output "Zlib include not found. Exiting..."
|
$ write sys$output "zlib include not found. Exiting..."
|
||||||
$ exit 2
|
$ exit 2
|
||||||
$ endif
|
$ endif
|
||||||
$!
|
$!
|
||||||
$ if pngpath .eqs. ""
|
$ if pngpath .eqs. ""
|
||||||
$ then
|
$ then
|
||||||
$ write sys$output "Libpng include not found. Exiting..."
|
$ write sys$output "libpng include not found. Exiting..."
|
||||||
$ exit 2
|
$ exit 2
|
||||||
$ endif
|
$ endif
|
||||||
$!
|
$!
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
|
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));
|
||||||
|
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
/* set the individual row_pointers to point at the correct offsets */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -49,8 +49,78 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
|
|||||||
|
|
||||||
void readpng2_version_info(void)
|
void readpng2_version_info(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n",
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
|
||||||
PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
(defined(__i386__) || defined(_M_IX86)) && \
|
||||||
|
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||||
|
/*
|
||||||
|
* WARNING: This preprocessor approach means that the following code
|
||||||
|
* cannot be used with a libpng DLL older than 1.2.0--the
|
||||||
|
* compiled-in symbols for the new functions will not exist.
|
||||||
|
* (Could use dlopen() and dlsym() on Unix and corresponding
|
||||||
|
* calls for Windows, but not portable...)
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int mmxsupport = png_mmx_support();
|
||||||
|
if (mmxsupport < 0)
|
||||||
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
||||||
|
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||||
|
else {
|
||||||
|
int compilerID;
|
||||||
|
png_uint_32 mmx_mask = png_get_mmx_flagmask(
|
||||||
|
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
||||||
|
|
||||||
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
||||||
|
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
|
||||||
|
png_libpng_ver, compilerID == 1? "MSVC++" :
|
||||||
|
(compilerID == 2? "GNU C" : "unknown"));
|
||||||
|
fprintf(stderr, " Processor %s MMX instructions.\n",
|
||||||
|
mmxsupport? "supports" : "does not support");
|
||||||
|
if (mmxsupport > 0) {
|
||||||
|
int num_optims = 0;
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
" Potential MMX optimizations supported by libpng:\n");
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
|
||||||
|
++num_optims;
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
|
||||||
|
++num_optims;
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
|
||||||
|
++num_optims;
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
|
||||||
|
++num_optims;
|
||||||
|
if (num_optims)
|
||||||
|
fprintf(stderr,
|
||||||
|
" decoding %s row filters (reading)\n",
|
||||||
|
(num_optims == 4)? "all non-trivial" : "some");
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
|
||||||
|
fprintf(stderr, " combining rows (reading)\n");
|
||||||
|
++num_optims;
|
||||||
|
}
|
||||||
|
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
|
||||||
|
fprintf(stderr,
|
||||||
|
" expanding interlacing (reading)\n");
|
||||||
|
++num_optims;
|
||||||
|
}
|
||||||
|
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||||
|
if (mmx_mask) {
|
||||||
|
fprintf(stderr, " other (unknown)\n");
|
||||||
|
++num_optims;
|
||||||
|
}
|
||||||
|
if (num_optims == 0)
|
||||||
|
fprintf(stderr, " (none)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
||||||
|
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
||||||
ZLIB_VERSION, zlib_version);
|
ZLIB_VERSION, zlib_version);
|
||||||
}
|
}
|
||||||
@@ -111,6 +181,96 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* may as well enable or disable MMX routines here, if supported;
|
||||||
|
*
|
||||||
|
* to enable all: mask = png_get_mmx_flagmask (
|
||||||
|
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
||||||
|
* flags = png_get_asm_flags (png_ptr);
|
||||||
|
* flags |= mask;
|
||||||
|
* png_set_asm_flags (png_ptr, flags);
|
||||||
|
*
|
||||||
|
* to disable all: mask = png_get_mmx_flagmask (
|
||||||
|
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
||||||
|
* flags = png_get_asm_flags (png_ptr);
|
||||||
|
* flags &= ~mask;
|
||||||
|
* png_set_asm_flags (png_ptr, flags);
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86)) && \
|
||||||
|
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
||||||
|
/*
|
||||||
|
* WARNING: This preprocessor approach means that the following code
|
||||||
|
* cannot be used with a libpng DLL older than 1.2.0--the
|
||||||
|
* compiled-in symbols for the new functions will not exist.
|
||||||
|
* (Could use dlopen() and dlsym() on Unix and corresponding
|
||||||
|
* calls for Windows, but not portable...)
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
png_uint_32 mmx_disable_mask = 0;
|
||||||
|
png_uint_32 asm_flags, mmx_mask;
|
||||||
|
int compilerID;
|
||||||
|
|
||||||
|
if (mainprog_ptr->nommxfilters)
|
||||||
|
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
||||||
|
if (mainprog_ptr->nommxcombine)
|
||||||
|
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
|
||||||
|
if (mainprog_ptr->nommxinterlace)
|
||||||
|
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
|
||||||
|
asm_flags = png_get_asm_flags(png_ptr);
|
||||||
|
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
||||||
|
|
||||||
|
|
||||||
|
/* Now query libpng's asm settings, just for yuks. Note that this
|
||||||
|
* differs from the querying of its *potential* MMX capabilities
|
||||||
|
* in readpng2_version_info(); this is true runtime verification. */
|
||||||
|
|
||||||
|
asm_flags = png_get_asm_flags(png_ptr);
|
||||||
|
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
|
||||||
|
&compilerID);
|
||||||
|
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
|
||||||
|
fprintf(stderr,
|
||||||
|
" MMX support (%s version) is compiled into libpng\n",
|
||||||
|
compilerID == 1? "MSVC++" :
|
||||||
|
(compilerID == 2? "GNU C" : "unknown"));
|
||||||
|
else
|
||||||
|
fprintf(stderr, " MMX support is not compiled into libpng\n");
|
||||||
|
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
|
||||||
|
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
|
||||||
|
fprintf(stderr,
|
||||||
|
" MMX read support for expanding interlacing is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
|
||||||
|
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
|
||||||
|
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
|
||||||
|
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
|
||||||
|
if (asm_flags)
|
||||||
|
fprintf(stderr,
|
||||||
|
" additional MMX support is also enabled (0x%02lx)\n",
|
||||||
|
asm_flags);
|
||||||
|
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
fprintf(stderr, " MMX querying is disabled in libpng.\n");
|
||||||
|
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* make sure we save our pointers for use in readpng2_decode_data() */
|
/* make sure we save our pointers for use in readpng2_decode_data() */
|
||||||
|
|
||||||
mainprog_ptr->png_ptr = png_ptr;
|
mainprog_ptr->png_ptr = png_ptr;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -66,6 +66,11 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
int nommxfilters;
|
||||||
|
int nommxcombine;
|
||||||
|
int nommxinterlace;
|
||||||
|
#endif
|
||||||
int done;
|
int done;
|
||||||
uch bg_red;
|
uch bg_red;
|
||||||
uch bg_green;
|
uch bg_green;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
with a little tweaking (or maybe not).
|
with a little tweaking (or maybe not).
|
||||||
|
|
||||||
to do:
|
to do:
|
||||||
- stdout/stderr don't work! need message window (maybe scrollable?)
|
|
||||||
- handle quoted command-line args (especially filenames with spaces)
|
- handle quoted command-line args (especially filenames with spaces)
|
||||||
- have minimum window width: oh well
|
- have minimum window width: oh well
|
||||||
- use %.1023s to simplify truncation of title-bar string?
|
- use %.1023s to simplify truncation of title-bar string?
|
||||||
@@ -22,10 +21,11 @@
|
|||||||
match; switched to png_jmpbuf() macro
|
match; switched to png_jmpbuf() macro
|
||||||
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
|
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||||
command-line parsing bug
|
command-line parsing bug
|
||||||
|
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -52,13 +52,14 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng-win"
|
#define PROGNAME "rpng-win"
|
||||||
#define LONGNAME "Simple PNG Viewer for Windows"
|
#define LONGNAME "Simple PNG Viewer for Windows"
|
||||||
#define VERSION "1.02 of 19 March 2000"
|
#define VERSION "1.20 of 28 May 2001"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <conio.h> /* only for _getch() */
|
||||||
|
|
||||||
/* #define DEBUG : this enables the Trace() macros */
|
/* #define DEBUG : this enables the Trace() macros */
|
||||||
|
|
||||||
@@ -128,7 +129,17 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
filename = (char *)NULL;
|
filename = (char *)NULL;
|
||||||
|
|
||||||
|
|
||||||
/* First set the default value for our display-system exponent, i.e.,
|
/* First reenable console output, which normally goes to the bit bucket
|
||||||
|
* for windowed apps. Closing the console window will terminate the
|
||||||
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
|
* incantation. */
|
||||||
|
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONOUT$", "a", stderr);
|
||||||
|
freopen("CONOUT$", "a", stdout);
|
||||||
|
|
||||||
|
|
||||||
|
/* Next set the default value for our display-system exponent, i.e.,
|
||||||
* the product of the CRT exponent and the exponent corresponding to
|
* the product of the CRT exponent and the exponent corresponding to
|
||||||
* the frame-buffer's lookup table (LUT), if any. This is not an
|
* the frame-buffer's lookup table (LUT), if any. This is not an
|
||||||
* exhaustive list of LUT values (e.g., OpenStep has a lot of weird
|
* exhaustive list of LUT values (e.g., OpenStep has a lot of weird
|
||||||
@@ -272,20 +283,31 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
/* usage screen */
|
/* usage screen */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
int ch;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng_version_info();
|
readpng_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
"Usage: %s [-gamma exp] [-bgcolor bg] file.png\n"
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
"\t\t used with transparent images\n"
|
"\t\t used with transparent images\n"
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
"\n", PROGNAME, default_display_exponent);
|
"Press Q or Esc to quit this usage screen.\n"
|
||||||
|
"\n", PROGNAME, default_display_exponent);
|
||||||
|
do
|
||||||
|
ch = _getch();
|
||||||
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
|
fprintf(stderr,
|
||||||
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
|
PROGNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,12 @@
|
|||||||
- 1.10: added support for non-default visuals; fixed X pixel-conversion
|
- 1.10: added support for non-default visuals; fixed X pixel-conversion
|
||||||
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
|
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
|
||||||
command-line parsing bug
|
command-line parsing bug
|
||||||
|
- 1.12: fixed small X memory leak (thanks to Francois Petitjean)
|
||||||
|
- 1.13: fixed XFreeGC() crash bug
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -51,7 +53,7 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng-x"
|
#define PROGNAME "rpng-x"
|
||||||
#define LONGNAME "Simple PNG Viewer for X"
|
#define LONGNAME "Simple PNG Viewer for X"
|
||||||
#define VERSION "1.11 of 19 March 2000"
|
#define VERSION "1.13 of 16 August 2001"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -117,6 +119,7 @@ static Colormap colormap;
|
|||||||
static int have_nondefault_visual = FALSE;
|
static int have_nondefault_visual = FALSE;
|
||||||
static int have_colormap = FALSE;
|
static int have_colormap = FALSE;
|
||||||
static int have_window = FALSE;
|
static int have_window = FALSE;
|
||||||
|
static int have_gc = FALSE;
|
||||||
/*
|
/*
|
||||||
ulg numcolors=0, pixels[256];
|
ulg numcolors=0, pixels[256];
|
||||||
ush reds[256], greens[256], blues[256];
|
ush reds[256], greens[256], blues[256];
|
||||||
@@ -542,9 +545,20 @@ static int rpng_x_create_window(void)
|
|||||||
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
|
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
|
||||||
size_hints, wm_hints, NULL);
|
size_hints, wm_hints, NULL);
|
||||||
|
|
||||||
|
/* various properties and hints no longer needed; free memory */
|
||||||
|
if (pWindowName)
|
||||||
|
XFree(pWindowName->value);
|
||||||
|
if (pIconName)
|
||||||
|
XFree(pIconName->value);
|
||||||
|
if (size_hints)
|
||||||
|
XFree(size_hints);
|
||||||
|
if (wm_hints)
|
||||||
|
XFree(wm_hints);
|
||||||
|
|
||||||
XMapWindow(display, window);
|
XMapWindow(display, window);
|
||||||
|
|
||||||
gc = XCreateGC(display, window, 0, &gcvalues);
|
gc = XCreateGC(display, window, 0, &gcvalues);
|
||||||
|
have_gc = TRUE;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
Fill window with the specified background color.
|
Fill window with the specified background color.
|
||||||
@@ -814,7 +828,8 @@ static void rpng_x_cleanup(void)
|
|||||||
ximage = NULL;
|
ximage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XFreeGC(display, gc);
|
if (have_gc)
|
||||||
|
XFreeGC(display, gc);
|
||||||
|
|
||||||
if (have_window)
|
if (have_window)
|
||||||
XDestroyWindow(display, window);
|
XDestroyWindow(display, window);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
Meulen for the "diamond" and "radial waves" patterns, respectively.
|
||||||
|
|
||||||
to do:
|
to do:
|
||||||
- stdout/stderr don't work! need message window (maybe scrollable?)
|
|
||||||
- handle quoted command-line args (especially filenames with spaces)
|
- handle quoted command-line args (especially filenames with spaces)
|
||||||
- finish resizable checkerboard-gradient (sizes 4-128?)
|
- finish resizable checkerboard-gradient (sizes 4-128?)
|
||||||
- use %.1023s to simplify truncation of title-bar string?
|
- use %.1023s to simplify truncation of title-bar string?
|
||||||
@@ -25,10 +24,13 @@
|
|||||||
- 1.03: modified to allow abbreviated options
|
- 1.03: modified to allow abbreviated options
|
||||||
- 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
|
- 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
|
||||||
fixed command-line parsing bug
|
fixed command-line parsing bug
|
||||||
|
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||||
|
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options
|
||||||
|
- 1.21: made minor tweak to usage screen to fit within 25-line console
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-win"
|
#define PROGNAME "rpng2-win"
|
||||||
#define LONGNAME "Progressive PNG Viewer for Windows"
|
#define LONGNAME "Progressive PNG Viewer for Windows"
|
||||||
#define VERSION "1.04 of 19 March 2000"
|
#define VERSION "1.21 of 29 June 2001"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -64,6 +66,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <math.h> /* only for PvdM background code */
|
#include <math.h> /* only for PvdM background code */
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <conio.h> /* only for _getch() */
|
||||||
|
|
||||||
/* all for PvdM background code: */
|
/* all for PvdM background code: */
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
@@ -239,6 +242,16 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
||||||
|
|
||||||
|
|
||||||
|
/* Next reenable console output, which normally goes to the bit bucket
|
||||||
|
* for windowed apps. Closing the console window will terminate the
|
||||||
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
|
* incantation. */
|
||||||
|
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONOUT$", "a", stderr);
|
||||||
|
freopen("CONOUT$", "a", stdout);
|
||||||
|
|
||||||
|
|
||||||
/* Set the default value for our display-system exponent, i.e., the
|
/* Set the default value for our display-system exponent, i.e., the
|
||||||
* product of the CRT exponent and the exponent corresponding to
|
* product of the CRT exponent and the exponent corresponding to
|
||||||
* the frame-buffer's lookup table (LUT), if any. This is not an
|
* the frame-buffer's lookup table (LUT), if any. This is not an
|
||||||
@@ -354,6 +367,18 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
} else if (!strncmp(*argv, "-timing", 2)) {
|
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||||
timing = TRUE;
|
timing = TRUE;
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
} else if (!strcmp(*argv, "-nommx")) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
filename = *argv;
|
filename = *argv;
|
||||||
@@ -401,25 +426,49 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
/* usage screen */
|
/* usage screen */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
int ch;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]"
|
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
||||||
" file.png\n\n"
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
||||||
|
#endif
|
||||||
|
" %*s file.png\n\n"
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
"\t\t used with transparent images; overrides -bgpat\n"
|
"\t\t used with transparent images; overrides -bgpat option\n"
|
||||||
" pat \tdesired background pattern number (1-%d); used with\n"
|
" pat \tdesired background pattern number (1-%d); used with\n"
|
||||||
"\t\t transparent images; overrides -bgcolor\n"
|
"\t\t transparent images; overrides -bgcolor option\n"
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
"\t\t download of image (~36 Kbps)\n"
|
"\t\t download of image (~36 Kbps)\n"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
||||||
|
"\t\t combining rows, and expanding interlacing, respectively\n"
|
||||||
|
#endif
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
"\n", PROGNAME, default_display_exponent, num_bgpat);
|
"Press Q or Esc to quit this usage screen. ",
|
||||||
|
PROGNAME,
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
strlen(PROGNAME), " ",
|
||||||
|
#endif
|
||||||
|
strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||||
|
fflush(stderr);
|
||||||
|
do
|
||||||
|
ch = _getch();
|
||||||
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
|
fprintf(stderr,
|
||||||
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
|
PROGNAME);
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,13 @@
|
|||||||
- 1.10: added support for non-default visuals; fixed X pixel-conversion
|
- 1.10: added support for non-default visuals; fixed X pixel-conversion
|
||||||
- 1.11: added -usleep option for demos; fixed command-line parsing bug
|
- 1.11: added -usleep option for demos; fixed command-line parsing bug
|
||||||
- 1.12: added -pause option for demos and testing
|
- 1.12: added -pause option for demos and testing
|
||||||
|
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options
|
||||||
|
- 1.21: fixed small X memory leak (thanks to Francois Petitjean)
|
||||||
|
- 1.22: fixed XFreeGC() crash bug
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
|
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
|
||||||
|
|
||||||
This software is provided "as is," without warranty of any kind,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -55,7 +58,7 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-x"
|
#define PROGNAME "rpng2-x"
|
||||||
#define LONGNAME "Progressive PNG Viewer for X"
|
#define LONGNAME "Progressive PNG Viewer for X"
|
||||||
#define VERSION "1.12 of 19 March 2000"
|
#define VERSION "1.22 of 16 August 2001"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -226,6 +229,7 @@ static Colormap colormap;
|
|||||||
static int have_nondefault_visual = FALSE;
|
static int have_nondefault_visual = FALSE;
|
||||||
static int have_colormap = FALSE;
|
static int have_colormap = FALSE;
|
||||||
static int have_window = FALSE;
|
static int have_window = FALSE;
|
||||||
|
static int have_gc = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -359,6 +363,18 @@ int main(int argc, char **argv)
|
|||||||
pause_after_pass = TRUE;
|
pause_after_pass = TRUE;
|
||||||
} else if (!strncmp(*argv, "-timing", 2)) {
|
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||||
timing = TRUE;
|
timing = TRUE;
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
} else if (!strcmp(*argv, "-nommx")) {
|
||||||
|
rpng2_info.nommxfilters = TRUE;
|
||||||
|
rpng2_info.nommxcombine = TRUE;
|
||||||
|
rpng2_info.nommxinterlace = TRUE;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
filename = *argv;
|
filename = *argv;
|
||||||
@@ -414,10 +430,13 @@ int main(int argc, char **argv)
|
|||||||
/* usage screen */
|
/* usage screen */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
||||||
|
#endif
|
||||||
" %*s [-usleep dur | -timing] [-pause] file.png\n\n"
|
" %*s [-usleep dur | -timing] [-pause] file.png\n\n"
|
||||||
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
@@ -429,6 +448,10 @@ int main(int argc, char **argv)
|
|||||||
"\t\t used with transparent images; overrides -bgpat\n"
|
"\t\t used with transparent images; overrides -bgpat\n"
|
||||||
" pat \tdesired background pattern number (1-%d); used with\n"
|
" pat \tdesired background pattern number (1-%d); used with\n"
|
||||||
"\t\t transparent images; overrides -bgcolor\n"
|
"\t\t transparent images; overrides -bgcolor\n"
|
||||||
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
||||||
|
"\t\t combining rows, and expanding interlacing, respectively\n"
|
||||||
|
#endif
|
||||||
" dur \tduration in microseconds to wait after displaying each\n"
|
" dur \tduration in microseconds to wait after displaying each\n"
|
||||||
"\t\t row (for demo purposes)\n"
|
"\t\t row (for demo purposes)\n"
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
@@ -436,8 +459,11 @@ int main(int argc, char **argv)
|
|||||||
" -pause\tpauses after displaying each pass until key pressed\n"
|
" -pause\tpauses after displaying each pass until key pressed\n"
|
||||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||||
"is displayed) to quit.\n"
|
"is displayed) to quit.\n"
|
||||||
"\n", PROGNAME, strlen(PROGNAME), " ", default_display_exponent,
|
"\n", PROGNAME,
|
||||||
num_bgpat);
|
#if (defined(__i386__) || defined(_M_IX86))
|
||||||
|
strlen(PROGNAME), " ",
|
||||||
|
#endif
|
||||||
|
strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,8 +588,15 @@ static void rpng2_x_init(void)
|
|||||||
* pattern */
|
* pattern */
|
||||||
|
|
||||||
if (rpng2_x_create_window()) {
|
if (rpng2_x_create_window()) {
|
||||||
|
|
||||||
|
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
||||||
|
* above; libpng should longjmp() back to us when png_ptr goes away.
|
||||||
|
* If we/it segfault instead, seems like a libpng bug... */
|
||||||
|
|
||||||
|
/* we're here via libpng callback, so if window fails, clean and bail */
|
||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
return;
|
rpng2_x_cleanup();
|
||||||
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -715,9 +748,20 @@ static int rpng2_x_create_window(void)
|
|||||||
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
|
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
|
||||||
size_hints, wm_hints, NULL);
|
size_hints, wm_hints, NULL);
|
||||||
|
|
||||||
|
/* various properties and hints no longer needed; free memory */
|
||||||
|
if (pWindowName)
|
||||||
|
XFree(pWindowName->value);
|
||||||
|
if (pIconName)
|
||||||
|
XFree(pIconName->value);
|
||||||
|
if (size_hints)
|
||||||
|
XFree(size_hints);
|
||||||
|
if (wm_hints)
|
||||||
|
XFree(wm_hints);
|
||||||
|
|
||||||
XMapWindow(display, window);
|
XMapWindow(display, window);
|
||||||
|
|
||||||
gc = XCreateGC(display, window, 0, &gcvalues);
|
gc = XCreateGC(display, window, 0, &gcvalues);
|
||||||
|
have_gc = TRUE;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
Allocate memory for the X- and display-specific version of the image.
|
Allocate memory for the X- and display-specific version of the image.
|
||||||
@@ -1333,7 +1377,8 @@ static void rpng2_x_cleanup(void)
|
|||||||
ximage = NULL;
|
ximage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XFreeGC(display, gc);
|
if (have_gc)
|
||||||
|
XFreeGC(display, gc);
|
||||||
|
|
||||||
if (have_window)
|
if (have_window)
|
||||||
XDestroyWindow(display, window);
|
XDestroyWindow(display, window);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng1.lib /nologo /subsystem:console /machine:I386
|
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng10.lib /nologo /subsystem:console /machine:I386
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\dll
|
OutDir=.\dll
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -84,7 +84,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng10d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\dll_dbg
|
OutDir=.\dll_dbg
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -114,7 +114,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng1a.lib /nologo /subsystem:console /machine:I386
|
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng10a.lib /nologo /subsystem:console /machine:I386
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\dll_asm
|
OutDir=.\dll_asm
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -144,7 +144,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng1b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng10b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\dll_dbga
|
OutDir=.\dll_dbga
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||||
# Linux / Unix
|
# Linux / Unix
|
||||||
|
|
||||||
CC=cc -O
|
#CC=cc
|
||||||
LD=cc -O
|
CC=gcc
|
||||||
#CC=gcc -O
|
LD=$(CC)
|
||||||
#LD=gcc -O
|
|
||||||
LB=ar
|
|
||||||
RM=rm
|
|
||||||
CP=cp
|
|
||||||
|
|
||||||
PNGPATH = /usr/local
|
RM=rm -f
|
||||||
PNGINC = $(PNGPATH)/include
|
|
||||||
#PNGLIB = $(PNGPATH)/lib -lpng
|
|
||||||
PNGLIB = $(PNGPATH)/lib/libpng.a
|
|
||||||
|
|
||||||
ZPATH = /usr/local
|
#PNGPATH = /usr/local
|
||||||
ZINC = $(ZPATH)/include
|
#PNGINC = -I$(PNGPATH)/include/libpng10
|
||||||
#ZLIB = $(ZPATH)/lib -lz
|
#PNGLIB = -L$(PNGPATH)/lib -lpng10
|
||||||
ZLIB = $(ZPATH)/lib/libz.a
|
#PNGLIBS = $(PNGPATH)/lib/libpng10.a
|
||||||
|
PNGINC = -I../..
|
||||||
|
PNGLIB = -L../.. -lpng
|
||||||
|
PNGLIBS = ../../libpng.a
|
||||||
|
|
||||||
CCFLAGS=-I$(PNGINC) -I$(ZINC)
|
#ZPATH = /usr/local
|
||||||
LDFLAGS=-L$(PNGLIB) -L$(ZLIB)
|
#ZINC = -I$(ZPATH)/include
|
||||||
|
#ZLIB = -L$(ZPATH)/lib -lz
|
||||||
|
#ZLIBS = $(ZPATH)/lib/libz.a
|
||||||
|
ZINC = -I../../../zlib
|
||||||
|
ZLIB = -L../../../zlib -lz
|
||||||
|
ZLIBS = ../../../zlib/libz.a
|
||||||
|
|
||||||
|
CFLAGS=-O3 $(PNGINC) $(ZINC)
|
||||||
|
LDFLAGS=$(PNGLIB) $(ZLIB)
|
||||||
|
LDFLAGSS=$(PNGLIBS) $(ZLIBS)
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
L=.a
|
L=.a
|
||||||
@@ -28,25 +33,33 @@ E=
|
|||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
all: png2pnm$(E) pnm2png$(E)
|
#all: png2pnm$(E) pnm2png$(E)
|
||||||
|
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
|
||||||
|
|
||||||
png2pnm$(O): png2pnm$(C)
|
png2pnm$(O): png2pnm$(C)
|
||||||
$(CC) -c $(CCFLAGS) png2pnm$(C)
|
$(CC) -c $(CFLAGS) png2pnm$(C)
|
||||||
|
|
||||||
png2pnm$(E): png2pnm$(O)
|
png2pnm$(E): png2pnm$(O)
|
||||||
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lpng -lz -lm
|
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm
|
||||||
|
|
||||||
|
png2pnm-static$(E): png2pnm$(O)
|
||||||
|
$(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm
|
||||||
|
|
||||||
pnm2png$(O): pnm2png$(C)
|
pnm2png$(O): pnm2png$(C)
|
||||||
$(CC) -c $(CCFLAGS) pnm2png$(C)
|
$(CC) -c $(CFLAGS) pnm2png$(C)
|
||||||
|
|
||||||
pnm2png$(E): pnm2png$(O)
|
pnm2png$(E): pnm2png$(O)
|
||||||
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lpng -lz -lm
|
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm
|
||||||
|
|
||||||
|
pnm2png-static$(E): pnm2png$(O)
|
||||||
|
$(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) png2pnm$(O)
|
$(RM) png2pnm$(O)
|
||||||
$(RM) pnm2png$(O)
|
$(RM) pnm2png$(O)
|
||||||
$(RM) png2pnm$(E)
|
$(RM) png2pnm$(E)
|
||||||
$(RM) pnm2png$(E)
|
$(RM) pnm2png$(E)
|
||||||
|
$(RM) png2pnm-static$(E)
|
||||||
|
$(RM) pnm2png-static$(E)
|
||||||
|
|
||||||
# End of makefile for png2pnm / pnm2png
|
# End of makefile for png2pnm / pnm2png
|
||||||
|
|
||||||
|
|||||||
0
contrib/pngminus/png2pnm.sh
Executable file → Normal file
0
contrib/pngminus/png2pnm.sh
Executable file → Normal file
0
contrib/pngminus/pngminus.sh
Executable file → Normal file
0
contrib/pngminus/pngminus.sh
Executable file → Normal file
0
contrib/pngminus/pnm2png.sh
Executable file → Normal file
0
contrib/pngminus/pnm2png.sh
Executable file → Normal file
@@ -59,8 +59,8 @@ BSC32=bscmake.exe
|
|||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
|
# ADD BASE LINK32 libpng10.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
|
||||||
# ADD LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
|
# ADD LINK32 libpng10.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\dll
|
OutDir=.\dll
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
@@ -92,9 +92,9 @@ BSC32=bscmake.exe
|
|||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 libpng1.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
|
# ADD BASE LINK32 libpng10.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
|
||||||
# SUBTRACT BASE LINK32 /nodefaultlib
|
# SUBTRACT BASE LINK32 /nodefaultlib
|
||||||
# ADD LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
|
# ADD LINK32 libpng10d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
|
||||||
# SUBTRACT LINK32 /nodefaultlib
|
# SUBTRACT LINK32 /nodefaultlib
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\dll_dbg
|
OutDir=.\dll_dbg
|
||||||
@@ -128,7 +128,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 libpng1.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
|
# ADD BASE LINK32 libpng10.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
|
||||||
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\lib"
|
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\lib"
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
OutDir=.\lib
|
OutDir=.\lib
|
||||||
@@ -161,7 +161,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 libpng1d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
|
# ADD BASE LINK32 libpng10d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
|
||||||
# SUBTRACT BASE LINK32 /nodefaultlib
|
# SUBTRACT BASE LINK32 /nodefaultlib
|
||||||
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\lib_dbg"
|
# ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\lib_dbg"
|
||||||
# SUBTRACT LINK32 /nodefaultlib
|
# SUBTRACT LINK32 /nodefaultlib
|
||||||
|
|||||||
96
example.c
96
example.c
@@ -114,7 +114,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
/* Free all of the memory associated with the png_ptr and info_ptr */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem reading the file */
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
@@ -157,7 +157,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
* adjustment), then you can read the entire image (including
|
* adjustment), then you can read the entire image (including
|
||||||
* pixels) into the info structure with this call:
|
* pixels) into the info structure with this call:
|
||||||
*/
|
*/
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
||||||
#else
|
#else
|
||||||
/* OK, you're doing it the hard way, with the lower-level functions */
|
/* OK, you're doing it the hard way, with the lower-level functions */
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&interlace_type, NULL, NULL);
|
&interlace_type, int_p_NULL, int_p_NULL);
|
||||||
|
|
||||||
/**** Set up the data transformations you want. Note that these are all
|
/**** Set up the data transformations you want. Note that these are all
|
||||||
**** optional. Only call them if you want/need them. Many of the
|
**** optional. Only call them if you want/need them. Many of the
|
||||||
@@ -194,17 +194,17 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
/* Expand paletted colors into true RGB triplets */
|
/* Expand paletted colors into true RGB triplets */
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_expand(png_ptr);
|
png_set_palette_rgb(png_ptr);
|
||||||
|
|
||||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
png_set_expand(png_ptr);
|
png_set_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
/* Expand paletted or RGB images with transparency to full alpha channels
|
/* Expand paletted or RGB images with transparency to full alpha channels
|
||||||
* so the data will be available as RGBA quartets.
|
* so the data will be available as RGBA quartets.
|
||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
png_set_expand(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
/* Set the background color to draw transparent and alpha images over.
|
/* Set the background color to draw transparent and alpha images over.
|
||||||
* It is possible to set the red, green, and blue components directly
|
* It is possible to set the red, green, and blue components directly
|
||||||
@@ -267,7 +267,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
*/
|
*/
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
{
|
{
|
||||||
png_uint_32 num_palette;
|
int num_palette;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* This reduces the image to the application supplied palette */
|
/* This reduces the image to the application supplied palette */
|
||||||
@@ -277,7 +277,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||||
|
|
||||||
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, NULL, 0);
|
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0);
|
||||||
}
|
}
|
||||||
/* This reduces the image to the palette supplied in the file */
|
/* This reduces the image to the palette supplied in the file */
|
||||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
||||||
@@ -338,7 +338,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < height; row++)
|
||||||
{
|
{
|
||||||
row_pointers[row] = malloc(png_get_rowbytes(png_ptr, info_ptr));
|
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||||
|
info_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||||
@@ -353,18 +354,18 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
#ifdef single /* Read the image a single row at a time */
|
#ifdef single /* Read the image a single row at a time */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
|
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else no_single /* Read the image several rows at a time */
|
#else no_single /* Read the image several rows at a time */
|
||||||
for (y = 0; y < height; y += number_of_rows)
|
for (y = 0; y < height; y += number_of_rows)
|
||||||
{
|
{
|
||||||
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
||||||
png_read_rows(png_ptr, &row_pointers[y], NULL, number_of_rows);
|
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL,
|
||||||
|
number_of_rows);
|
||||||
png_read_rows(png_ptr, NULL, row_pointers[y], number_of_rows);
|
|
||||||
#else no_sparkle /* Read the image using the "rectangle" effect */
|
#else no_sparkle /* Read the image using the "rectangle" effect */
|
||||||
png_read_rows(png_ptr, NULL, &row_pointers[y], number_of_rows);
|
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
|
||||||
|
number_of_rows);
|
||||||
#endif no_sparkle /* use only one of these two methods */
|
#endif no_sparkle /* use only one of these two methods */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +382,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
|||||||
/* At this point you have read the entire image */
|
/* At this point you have read the entire image */
|
||||||
|
|
||||||
/* clean up after the read, and free any memory allocated - REQUIRED */
|
/* clean up after the read, and free any memory allocated - REQUIRED */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||||
|
|
||||||
/* close the file */
|
/* close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -414,13 +415,13 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
|
|
||||||
if (*info_ptr == NULL)
|
if (*info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +450,7 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
/* Free the png_ptr and info_ptr memory on error */
|
/* Free the png_ptr and info_ptr memory on error */
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, (png_infopp)NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,21 +482,47 @@ info_callback(png_structp png_ptr, png_infop info)
|
|||||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
png_uint_32 row_num, int pass)
|
png_uint_32 row_num, int pass)
|
||||||
{
|
{
|
||||||
/* this function is called for every row in the image. If the
|
/*
|
||||||
* image is interlacing, and you turned on the interlace handler,
|
* This function is called for every row in the image. If the
|
||||||
|
* image is interlaced, and you turned on the interlace handler,
|
||||||
* this function will be called for every row in every pass.
|
* this function will be called for every row in every pass.
|
||||||
* Some of these rows will not be changed from the previous pass.
|
*
|
||||||
* When the row is not changed, the new_row variable will be NULL.
|
* In this function you will receive a pointer to new row data from
|
||||||
|
* libpng called new_row that is to replace a corresponding row (of
|
||||||
|
* the same data format) in a buffer allocated by your application.
|
||||||
|
*
|
||||||
|
* The new row data pointer new_row may be NULL, indicating there is
|
||||||
|
* no new data to be replaced (in cases of interlace loading).
|
||||||
|
*
|
||||||
|
* If new_row is not NULL then you need to call
|
||||||
|
* png_progressive_combine_row() to replace the corresponding row as
|
||||||
|
* shown below:
|
||||||
|
*/
|
||||||
|
/* Check if row_num is in bounds. */
|
||||||
|
if((row_num >= 0) && (row_num < height))
|
||||||
|
{
|
||||||
|
/* Get pointer to corresponding row in our
|
||||||
|
* PNG read buffer.
|
||||||
|
*/
|
||||||
|
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||||
|
|
||||||
|
/* If both rows are allocated then copy the new row
|
||||||
|
* data to the corresponding row data.
|
||||||
|
*/
|
||||||
|
if((old_row != NULL) && (new_row != NULL))
|
||||||
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
}
|
||||||
|
/*
|
||||||
* The rows and passes are called in order, so you don't really
|
* The rows and passes are called in order, so you don't really
|
||||||
* need the row_num and pass, but I'm supplying them because it
|
* need the row_num and pass, but I'm supplying them because it
|
||||||
* may make your life easier.
|
* may make your life easier.
|
||||||
*
|
*
|
||||||
* For the non-NULL rows of interlaced images, you must call
|
* For the non-NULL rows of interlaced images, you must call
|
||||||
* png_progressive_combine_row() passing in the row and the
|
* png_progressive_combine_row() passing in the new row and the
|
||||||
* old row. You can call this function for NULL rows (it will
|
* old row, as demonstrated above. You can call this function for
|
||||||
* just return) and for non-interlaced images (it just does the
|
* NULL rows (it will just return) and for non-interlaced images
|
||||||
* memcpy for you) if it will make the code easier. Thus, you
|
* (it just does the png_memcpy for you) if it will make the code
|
||||||
* can just do this for all cases:
|
* easier. Thus, you can just do this for all cases:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
@@ -504,8 +531,8 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
|||||||
* that the first pass (pass == 0 really) will completely cover
|
* that the first pass (pass == 0 really) will completely cover
|
||||||
* the old row, so the rows do not have to be initialized. After
|
* the old row, so the rows do not have to be initialized. After
|
||||||
* the first pass (and only for interlaced images), you will have
|
* the first pass (and only for interlaced images), you will have
|
||||||
* to pass the current row, and the function will combine the
|
* to pass the current row as new_row, and the function will combine
|
||||||
* old row and the new row.
|
* the old row and the new row.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +582,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +614,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* image info living info in the structure. You could "|" many
|
* image info living info in the structure. You could "|" many
|
||||||
* PNG_TRANSFORM flags into the png_transforms integer here.
|
* PNG_TRANSFORM flags into the png_transforms integer here.
|
||||||
*/
|
*/
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
||||||
#else
|
#else
|
||||||
/* This is the hard way */
|
/* This is the hard way */
|
||||||
|
|
||||||
@@ -603,9 +630,10 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
/* set the palette if there is one. REQUIRED for indexed-color images */
|
/* set the palette if there is one. REQUIRED for indexed-color images */
|
||||||
palette = (png_colorp)png_malloc(png_ptr, 256 * sizeof (png_color));
|
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||||
|
* sizeof (png_color));
|
||||||
/* ... set palette colors ... */
|
/* ... set palette colors ... */
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, 256);
|
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||||
the palette that you malloced. Wait until you are about to destroy
|
the palette that you malloced. Wait until you are about to destroy
|
||||||
the png structure. */
|
the png structure. */
|
||||||
|
|||||||
382
libpng.txt
382
libpng.txt
@@ -1,9 +1,9 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.9beta2 - November 19, 2000
|
libpng version 1.0.13 - April 15, 2002
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alum.rpi.edu>
|
<randeg@alum.rpi.edu>
|
||||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
For conditions of distribution and use, see copyright
|
For conditions of distribution and use, see copyright
|
||||||
notice in png.h.
|
notice in png.h.
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ majority of the needs of its users.
|
|||||||
|
|
||||||
Libpng uses zlib for its compression and decompression of PNG files.
|
Libpng uses zlib for its compression and decompression of PNG files.
|
||||||
Further information about zlib, and the latest version of zlib, can
|
Further information about zlib, and the latest version of zlib, can
|
||||||
be found at the zlib home page, <ftp://ftp.freesoftware.com/pub/infozip/zlib/>.
|
be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>.
|
||||||
The zlib compression utility is a general purpose utility that is
|
The zlib compression utility is a general purpose utility that is
|
||||||
useful for more than PNG files, and can be used without libpng.
|
useful for more than PNG files, and can be used without libpng.
|
||||||
See the documentation delivered with zlib for more details.
|
See the documentation delivered with zlib for more details.
|
||||||
@@ -78,7 +78,9 @@ Libpng is thread safe, provided the threads are using different
|
|||||||
instances of the structures. Each thread should have its own
|
instances of the structures. Each thread should have its own
|
||||||
png_struct and png_info instances, and thus its own image.
|
png_struct and png_info instances, and thus its own image.
|
||||||
Libpng does not protect itself against two threads using the
|
Libpng does not protect itself against two threads using the
|
||||||
same instance of a structure.
|
same instance of a structure. Note: thread safety may be defeated
|
||||||
|
by use of some of the MMX assembler code in pnggccrd.c, which is only
|
||||||
|
compiled when the user defines PNG_THREAD_UNSAFE_OK.
|
||||||
|
|
||||||
|
|
||||||
II. Structures
|
II. Structures
|
||||||
@@ -257,10 +259,11 @@ input stream. You must supply the function
|
|||||||
png_byte name[5];
|
png_byte name[5];
|
||||||
png_byte *data;
|
png_byte *data;
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
/* Note that libpng has already taken care of the
|
/* Note that libpng has already taken care of
|
||||||
CRC handling */
|
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 (-n); /* chunk had an error */
|
||||||
return (0); /* did not recognize */
|
return (0); /* did not recognize */
|
||||||
@@ -285,7 +288,8 @@ called after each row has been read, which you can use to control
|
|||||||
a progress meter or the like. It's demonstrated in pngtest.c.
|
a progress meter or the like. It's demonstrated in pngtest.c.
|
||||||
You must supply a function
|
You must supply a function
|
||||||
|
|
||||||
void read_row_callback(png_ptr ptr, png_uint_32 row, int pass);
|
void read_row_callback(png_ptr ptr, png_uint_32 row,
|
||||||
|
int pass);
|
||||||
{
|
{
|
||||||
/* put your code here */
|
/* put your code here */
|
||||||
}
|
}
|
||||||
@@ -331,16 +335,23 @@ the entire image into memory, and (b) the input transformations
|
|||||||
you want to do are limited to the following set:
|
you want to do are limited to the following set:
|
||||||
|
|
||||||
PNG_TRANSFORM_IDENTITY No transformation
|
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_STRIP_ALPHA Discard the alpha channel
|
||||||
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit samples to bytes
|
PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit
|
||||||
PNG_TRANSFORM_PACKSWAP Change order of packed pixels to LSB first
|
samples to bytes
|
||||||
|
PNG_TRANSFORM_PACKSWAP Change order of packed
|
||||||
|
pixels to LSB first
|
||||||
PNG_TRANSFORM_EXPAND Perform set_expand()
|
PNG_TRANSFORM_EXPAND Perform set_expand()
|
||||||
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
|
PNG_TRANSFORM_INVERT_MONO Invert monochrome images
|
||||||
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
|
PNG_TRANSFORM_SHIFT Normalize pixels to the
|
||||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
|
sBIT depth
|
||||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
|
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
|
||||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
|
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_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||||
|
|
||||||
(This excludes setting a background color, doing gamma transformation,
|
(This excludes setting a background color, doing gamma transformation,
|
||||||
@@ -368,10 +379,12 @@ 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
|
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 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++)
|
for (int i=0; i<height, i++)
|
||||||
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
|
row_pointers[i]=png_malloc(png_ptr,
|
||||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
width*pixel_size);
|
||||||
|
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||||
|
|
||||||
Alternatively you could allocate your image in one big block and define
|
Alternatively you could allocate your image in one big block and define
|
||||||
row_pointers[i] to point into the proper places in your block.
|
row_pointers[i] to point into the proper places in your block.
|
||||||
@@ -400,7 +413,7 @@ in until png_read_end() has read the chunk data following the image.
|
|||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height,
|
||||||
&bit_depth, &color_type, &interlace_type,
|
&bit_depth, &color_type, &interlace_type,
|
||||||
&compression_type, &filter_type);
|
&compression_type, &filter_method);
|
||||||
|
|
||||||
width - holds the width of the image
|
width - holds the width of the image
|
||||||
in pixels (up to 2^31).
|
in pixels (up to 2^31).
|
||||||
@@ -428,15 +441,18 @@ in until png_read_end() has read the chunk data following the image.
|
|||||||
PNG_COLOR_MASK_COLOR
|
PNG_COLOR_MASK_COLOR
|
||||||
PNG_COLOR_MASK_ALPHA
|
PNG_COLOR_MASK_ALPHA
|
||||||
|
|
||||||
filter_type - (must be PNG_FILTER_TYPE_BASE
|
filter_method - (must be PNG_FILTER_TYPE_BASE
|
||||||
for PNG 1.0)
|
for PNG 1.0, and can also be
|
||||||
|
PNG_INTRAPIXEL_DIFFERENCING if
|
||||||
|
the PNG datastream is embedded in
|
||||||
|
a MNG-1.0 datastream)
|
||||||
compression_type - (must be PNG_COMPRESSION_TYPE_BASE
|
compression_type - (must be PNG_COMPRESSION_TYPE_BASE
|
||||||
for PNG 1.0)
|
for PNG 1.0)
|
||||||
interlace_type - (PNG_INTERLACE_NONE or
|
interlace_type - (PNG_INTERLACE_NONE or
|
||||||
PNG_INTERLACE_ADAM7)
|
PNG_INTERLACE_ADAM7)
|
||||||
Any or all of interlace_type, compression_type, of
|
Any or all of interlace_type, compression_type, of
|
||||||
filter_type can be NULL if you are not
|
filter_method can be NULL if you are
|
||||||
interested in their values.
|
not interested in their values.
|
||||||
|
|
||||||
channels = png_get_channels(png_ptr, info_ptr);
|
channels = png_get_channels(png_ptr, info_ptr);
|
||||||
channels - number of channels of info for the
|
channels - number of channels of info for the
|
||||||
@@ -466,7 +482,7 @@ in until png_read_end() has read the chunk data following the image.
|
|||||||
info_ptr);
|
info_ptr);
|
||||||
color_type = png_get_color_type(png_ptr,
|
color_type = png_get_color_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
filter_type = png_get_filter_type(png_ptr,
|
filter_method = png_get_filter_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
compression_type = png_get_compression_type(png_ptr,
|
compression_type = png_get_compression_type(png_ptr,
|
||||||
info_ptr);
|
info_ptr);
|
||||||
@@ -499,14 +515,15 @@ into the info_ptr is returned for any complex types.
|
|||||||
implies specific values of gAMA and
|
implies specific values of gAMA and
|
||||||
cHRM.
|
cHRM.
|
||||||
|
|
||||||
png_get_iCCP(png_ptr, info_ptr, &name, &compression_type,
|
png_get_iCCP(png_ptr, info_ptr, &name,
|
||||||
&profile, &proflen);
|
&compression_type, &profile, &proflen);
|
||||||
name - The profile name.
|
name - The profile name.
|
||||||
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
|
compression - The compression type; always
|
||||||
for PNG 1.0. You may give NULL to this argument
|
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||||
to ignore it.
|
You may give NULL to this argument to
|
||||||
profile - International Color Consortium color profile
|
ignore it.
|
||||||
data. May contain NULs.
|
profile - International Color Consortium color
|
||||||
|
profile data. May contain NULs.
|
||||||
proflen - length of profile data in bytes.
|
proflen - length of profile data in bytes.
|
||||||
|
|
||||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
@@ -560,23 +577,26 @@ into the info_ptr is returned for any complex types.
|
|||||||
after decompression, 0 for tEXt/zTXt
|
after decompression, 0 for tEXt/zTXt
|
||||||
text_ptr[i].lang - language of comment (empty
|
text_ptr[i].lang - language of comment (empty
|
||||||
string for unknown).
|
string for unknown).
|
||||||
text_ptr[i].translated_keyword - keyword in UTF-8
|
text_ptr[i].lang_key - keyword in UTF-8
|
||||||
(empty string for unknown).
|
(empty string for unknown).
|
||||||
num_text - number of comments (same as num_comments;
|
num_text - number of comments (same as
|
||||||
you can put NULL here to avoid the duplication)
|
num_comments; you can put NULL here
|
||||||
Note while png_set_text() will accept text, language, and
|
to avoid the duplication)
|
||||||
translated keywords that can be NULL pointers, the structure
|
Note while png_set_text() will accept text, language,
|
||||||
returned by png_get_text will always contain regular
|
and translated keywords that can be NULL pointers, the
|
||||||
zero-terminated C strings. They might be empty strings but
|
structure returned by png_get_text will always contain
|
||||||
they will never be NULL pointers.
|
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
|
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.
|
num_spalettes - number of sPLT chunks read.
|
||||||
|
|
||||||
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
|
png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y,
|
||||||
&unit_type);
|
&unit_type);
|
||||||
offset_x - positive offset from the left edge
|
offset_x - positive offset from the left edge
|
||||||
of the screen
|
of the screen
|
||||||
offset_y - positive offset from the top edge
|
offset_y - positive offset from the top edge
|
||||||
@@ -584,7 +604,7 @@ into the info_ptr is returned for any complex types.
|
|||||||
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER
|
||||||
|
|
||||||
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
|
png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y,
|
||||||
&unit_type);
|
&unit_type);
|
||||||
res_x - pixels/unit physical resolution in
|
res_x - pixels/unit physical resolution in
|
||||||
x direction
|
x direction
|
||||||
res_y - pixels/unit physical resolution in
|
res_y - pixels/unit physical resolution in
|
||||||
@@ -592,47 +612,50 @@ into the info_ptr is returned for any complex types.
|
|||||||
unit_type - PNG_RESOLUTION_UNKNOWN,
|
unit_type - PNG_RESOLUTION_UNKNOWN,
|
||||||
PNG_RESOLUTION_METER
|
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)
|
unit - physical scale units (an integer)
|
||||||
width - width of a pixel in physical scale units
|
width - width of a pixel in physical scale units
|
||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are doubles)
|
(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)
|
unit - physical scale units (an integer)
|
||||||
width - width of a pixel in physical scale units
|
width - width of a pixel in physical scale units
|
||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are strings like "2.54")
|
(width and height are strings like "2.54")
|
||||||
|
|
||||||
num_unknown_chunks = png_get_unknown_chunks(png_ptr, info_ptr,
|
num_unknown_chunks = png_get_unknown_chunks(png_ptr,
|
||||||
&unknowns)
|
info_ptr, &unknowns)
|
||||||
unknowns - array of png_unknown_chunk structures holding
|
unknowns - array of png_unknown_chunk
|
||||||
unknown chunks
|
structures holding unknown chunks
|
||||||
unknowns[i].name - name of unknown chunk
|
unknowns[i].name - name of unknown chunk
|
||||||
unknowns[i].data - data of unknown chunk
|
unknowns[i].data - data of unknown chunk
|
||||||
unknowns[i].size - size of unknown chunk's data
|
unknowns[i].size - size of unknown chunk's data
|
||||||
unknowns[i].location - position of chunk in file
|
unknowns[i].location - position of chunk in file
|
||||||
|
|
||||||
The value of "i" corresponds to the order in which the chunks were read
|
The value of "i" corresponds to the order in which the
|
||||||
from the PNG file or inserted with the png_set_unknown_chunks() function.
|
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
|
The data from the pHYs chunk can be retrieved in several convenient
|
||||||
forms:
|
forms:
|
||||||
|
|
||||||
res_x = png_get_x_pixels_per_meter(png_ptr,
|
res_x = png_get_x_pixels_per_meter(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
res_y = png_get_y_pixels_per_meter(png_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,
|
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,
|
res_x = png_get_x_pixels_per_inch(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
res_y = png_get_y_pixels_per_inch(png_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,
|
res_x_and_y = png_get_pixels_per_inch(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
|
aspect_ratio = png_get_pixel_aspect_ratio(png_ptr,
|
||||||
info_ptr)
|
info_ptr)
|
||||||
|
|
||||||
(Each of these returns 0 [signifying "unknown"] if
|
(Each of these returns 0 [signifying "unknown"] if
|
||||||
the data is not present or if res_x is 0;
|
the data is not present or if res_x is 0;
|
||||||
@@ -647,8 +670,8 @@ forms:
|
|||||||
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
|
y_offset = png_get_y_offset_inches(png_ptr, info_ptr);
|
||||||
|
|
||||||
(Each of these returns 0 [signifying "unknown" if both
|
(Each of these returns 0 [signifying "unknown" if both
|
||||||
x and y are 0] if the data is not present or if the chunk
|
x and y are 0] if the data is not present or if the
|
||||||
is present but the unit is the pixel)
|
chunk is present but the unit is the pixel)
|
||||||
|
|
||||||
For more information, see the png_info definition in png.h and the
|
For more information, see the png_info definition in png.h and the
|
||||||
PNG specification for chunk contents. Be careful with trusting
|
PNG specification for chunk contents. Be careful with trusting
|
||||||
@@ -769,7 +792,7 @@ higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] to
|
|||||||
convert the PNG pixel data back to the original bit depth of the image.
|
convert the PNG pixel data back to the original bit depth of the image.
|
||||||
This call reduces the pixels back down to the original bit depth:
|
This call reduces the pixels back down to the original bit depth:
|
||||||
|
|
||||||
png_color_16p sig_bit;
|
png_color_8p sig_bit;
|
||||||
|
|
||||||
if (png_get_sBIT(png_ptr, info_ptr, &sig_bit))
|
if (png_get_sBIT(png_ptr, info_ptr, &sig_bit))
|
||||||
png_set_shift(png_ptr, sig_bit);
|
png_set_shift(png_ptr, sig_bit);
|
||||||
@@ -781,17 +804,18 @@ changes the storage of the pixels to blue, green, red:
|
|||||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
PNG files store RGB pixels packed into 3 bytes. This code expands them
|
PNG files store RGB pixels packed into 3 or 6 bytes. This code expands them
|
||||||
into 4 bytes for windowing systems that need them in this format:
|
into 4 or 8 bytes for windowing systems that need them in this format:
|
||||||
|
|
||||||
if (bit_depth == 8 && color_type ==
|
if (color_type == PNG_COLOR_TYPE_RGB)
|
||||||
PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr,
|
png_set_filler(png_ptr, filler, PNG_FILLER_BEFORE);
|
||||||
filler, PNG_FILLER_BEFORE);
|
|
||||||
|
|
||||||
where "filler" is the 8 or 16-bit number to fill with, and the location is
|
where "filler" is the 8 or 16-bit number to fill with, and the location is
|
||||||
either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether
|
either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether
|
||||||
you want the filler before the RGB or after. This transformation
|
you want the filler before the RGB or after. This transformation
|
||||||
does not affect images that already have full alpha channels.
|
does not affect images that already have full alpha channels. To add an
|
||||||
|
opaque alpha channel, use filler=0xff or 0xffff and PNG_FILLER_AFTER which
|
||||||
|
will generate RGBA pixels.
|
||||||
|
|
||||||
If you are reading an image with an alpha channel, and you need the
|
If you are reading an image with an alpha channel, and you need the
|
||||||
data as ARGB instead of the normal PNG format RGBA:
|
data as ARGB instead of the normal PNG format RGBA:
|
||||||
@@ -861,8 +885,8 @@ which can be expressed with integers as
|
|||||||
The calculation is done in a linear colorspace, if the image gamma
|
The calculation is done in a linear colorspace, if the image gamma
|
||||||
is known.
|
is known.
|
||||||
|
|
||||||
If you have a grayscale and you are using png_set_expand_depth() or
|
If you have a grayscale and you are using png_set_expand_depth(),
|
||||||
png_set_expand() to change to
|
png_set_expand(), or png_set_gray_to_rgb to change to truecolor or to
|
||||||
a higher bit-depth, you must either supply the background color as a gray
|
a higher bit-depth, you must either supply the background color as a gray
|
||||||
value at the original file bit-depth (need_expand = 1) or else supply the
|
value at the original file bit-depth (need_expand = 1) or else supply the
|
||||||
background color as an RGB triplet at the final, expanded bit depth
|
background color as an RGB triplet at the final, expanded bit depth
|
||||||
@@ -959,7 +983,7 @@ histogram, it may not do as good a job.
|
|||||||
if (png_get_valid(png_ptr, info_ptr,
|
if (png_get_valid(png_ptr, info_ptr,
|
||||||
PNG_INFO_PLTE))
|
PNG_INFO_PLTE))
|
||||||
{
|
{
|
||||||
png_color_16p histogram;
|
png_uint_16p histogram;
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr,
|
png_get_hIST(png_ptr, info_ptr,
|
||||||
&histogram);
|
&histogram);
|
||||||
@@ -981,7 +1005,13 @@ PNG files describe monochrome as black being zero and white being one.
|
|||||||
The following code will reverse this (make black be one and white be
|
The following code will reverse this (make black be one and white be
|
||||||
zero):
|
zero):
|
||||||
|
|
||||||
if (bit_depth == 1 && color_type == PNG_COLOR_GRAY)
|
if (bit_depth == 1 && color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
|
This function can also be used to invert grayscale and gray-alpha images:
|
||||||
|
|
||||||
|
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||||
|
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
PNG files store 16 bit pixels in network byte order (big-endian,
|
PNG files store 16 bit pixels in network byte order (big-endian,
|
||||||
@@ -1182,7 +1212,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
|
It is also possible to individually free the info_ptr members that
|
||||||
point to libpng-allocated storage with the following function:
|
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
|
mask - identifies data to be freed, a mask
|
||||||
containing the logical OR of one or
|
containing the logical OR of one or
|
||||||
more of
|
more of
|
||||||
@@ -1192,16 +1222,17 @@ point to libpng-allocated storage with the following function:
|
|||||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||||
or simply PNG_FREE_ALL
|
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)
|
(-1 for all items)
|
||||||
|
|
||||||
This function may be safely called when the relevant storage has
|
This function may be safely called when the relevant storage has
|
||||||
already been freed, or has not yet been allocated, or was allocated
|
already been freed, or has not yet been allocated, or was allocated
|
||||||
by the user and not by libpng, and will in those
|
by the user and not by libpng, and will in those
|
||||||
cases do nothing. The "n" parameter is ignored if only one item
|
cases do nothing. The "seq" parameter is ignored if only one item
|
||||||
of the selected data type, such as PLTE, is allowed. If "n" is not
|
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
|
-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
|
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,
|
by libpng. This can be changed, so that libpng will not free the data,
|
||||||
@@ -1225,8 +1256,7 @@ or png_destroy_*() is supposed to free the data. When the user assumes
|
|||||||
responsibility for libpng-allocated data, the application must use
|
responsibility for libpng-allocated data, the application must use
|
||||||
png_free() to free it, and when the user transfers responsibility to libpng
|
png_free() to free it, and when the user transfers responsibility to libpng
|
||||||
for data that the user has allocated, the user must have used png_malloc()
|
for data that the user has allocated, the user must have used png_malloc()
|
||||||
or png_zalloc() to allocate it (the png_zalloc() function is the same
|
or png_zalloc() to allocate it.
|
||||||
as png_malloc() except that it also zeroes the newly-allocated memory).
|
|
||||||
|
|
||||||
If you allocated your row_pointers in a single block, as suggested above in
|
If you allocated your row_pointers in a single block, as suggested above in
|
||||||
the description of the high level read interface, you must not transfer
|
the description of the high level read interface, you must not transfer
|
||||||
@@ -1247,7 +1277,7 @@ application instead of by libpng, you can use
|
|||||||
png_set_invalid(png_ptr, info_ptr, mask);
|
png_set_invalid(png_ptr, info_ptr, mask);
|
||||||
mask - identifies the chunks to be made invalid,
|
mask - identifies the chunks to be made invalid,
|
||||||
containing the logical OR of one or
|
containing the logical OR of one or
|
||||||
more of
|
more of
|
||||||
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
||||||
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
||||||
PNG_INFO_tRNS, PNG_INFO_bKGD,
|
PNG_INFO_tRNS, PNG_INFO_bKGD,
|
||||||
@@ -1520,7 +1550,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.
|
a progress meter or the like. It's demonstrated in pngtest.c.
|
||||||
You must supply a function
|
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 */
|
/* put your code here */
|
||||||
}
|
}
|
||||||
@@ -1539,16 +1570,18 @@ maximum possible compression at the expense of slower writing. If you
|
|||||||
have no special needs in this area, let the library do what it wants by
|
have no special needs in this area, let the library do what it wants by
|
||||||
not calling this function at all, as it has been tuned to deliver a good
|
not calling this function at all, as it has been tuned to deliver a good
|
||||||
speed/compression ratio. The second parameter to png_set_filter() is
|
speed/compression ratio. The second parameter to png_set_filter() is
|
||||||
the filter method, for which the only valid value is '0' (as of the
|
the filter method, for which the only valid values are 0 (as of the
|
||||||
July 1999 PNG specification, version 1.2). The third parameter is a
|
July 1999 PNG specification, version 1.2) or 64 (if you are writing
|
||||||
flag that indicates which filter type(s) are to be tested for each
|
a PNG datastream that is to be embedded in a MNG datastream). The third
|
||||||
scanline. See the PNG specification for details on the specific filter
|
parameter is a flag that indicates which filter type(s) are to be tested
|
||||||
|
for each scanline. See the PNG specification for details on the specific filter
|
||||||
types.
|
types.
|
||||||
|
|
||||||
|
|
||||||
/* turn on or off filtering, and/or choose
|
/* turn on or off filtering, and/or choose
|
||||||
specific filters. You can use either a single PNG_FILTER_VALUE_NAME
|
specific filters. You can use either a single
|
||||||
or the logical OR of one or more PNG_FILTER_NAME masks. */
|
PNG_FILTER_VALUE_NAME or the logical OR of one
|
||||||
|
or more PNG_FILTER_NAME masks. */
|
||||||
png_set_filter(png_ptr, 0,
|
png_set_filter(png_ptr, 0,
|
||||||
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
|
||||||
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
|
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
|
||||||
@@ -1563,6 +1596,9 @@ it should start out with all of the filters (to ensure that the previous
|
|||||||
row of pixels will be stored in case it's needed later), and then add
|
row of pixels will be stored in case it's needed later), and then add
|
||||||
and remove them after the start of compression.
|
and remove them after the start of compression.
|
||||||
|
|
||||||
|
If you are writing a PNG datastream that is to be embedded in a MNG
|
||||||
|
datastream, the second parameter can be either 0 or 64.
|
||||||
|
|
||||||
The png_set_compression_*() functions interface to the zlib compression
|
The png_set_compression_*() functions interface to the zlib compression
|
||||||
library, and should mostly be ignored unless you really know what you are
|
library, and should mostly be ignored unless you really know what you are
|
||||||
doing. The only generally useful call is png_set_compression_level()
|
doing. The only generally useful call is png_set_compression_level()
|
||||||
@@ -1601,7 +1637,7 @@ Some of the more important parts of the png_info are:
|
|||||||
|
|
||||||
png_set_IHDR(png_ptr, info_ptr, width, height,
|
png_set_IHDR(png_ptr, info_ptr, width, height,
|
||||||
bit_depth, color_type, interlace_type,
|
bit_depth, color_type, interlace_type,
|
||||||
compression_type, filter_type)
|
compression_type, filter_method)
|
||||||
width - holds the width of the image
|
width - holds the width of the image
|
||||||
in pixels (up to 2^31).
|
in pixels (up to 2^31).
|
||||||
height - holds the height of the image
|
height - holds the height of the image
|
||||||
@@ -1633,7 +1669,11 @@ Some of the more important parts of the png_info are:
|
|||||||
PNG_INTERLACE_ADAM7
|
PNG_INTERLACE_ADAM7
|
||||||
compression_type - (must be
|
compression_type - (must be
|
||||||
PNG_COMPRESSION_TYPE_DEFAULT)
|
PNG_COMPRESSION_TYPE_DEFAULT)
|
||||||
filter_type - (must be PNG_FILTER_TYPE_DEFAULT)
|
filter_method - (must be PNG_FILTER_TYPE_DEFAULT
|
||||||
|
or, if you are writing a PNG to
|
||||||
|
be embedded in a MNG datastream,
|
||||||
|
can also be
|
||||||
|
PNG_INTRAPIXEL_DIFFERENCING)
|
||||||
|
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette,
|
png_set_PLTE(png_ptr, info_ptr, palette,
|
||||||
num_palette);
|
num_palette);
|
||||||
@@ -1677,11 +1717,12 @@ Some of the more important parts of the png_info are:
|
|||||||
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
|
png_set_iCCP(png_ptr, info_ptr, name, compression_type,
|
||||||
profile, proflen);
|
profile, proflen);
|
||||||
name - The profile name.
|
name - The profile name.
|
||||||
compression - The compression type; always PNG_COMPRESSION_TYPE_BASE
|
compression - The compression type; always
|
||||||
for PNG 1.0. You may give NULL to this argument
|
PNG_COMPRESSION_TYPE_BASE for PNG 1.0.
|
||||||
to ignore it.
|
You may give NULL to this argument to
|
||||||
profile - International Color Consortium color profile
|
ignore it.
|
||||||
data. May contain NULs.
|
profile - International Color Consortium color
|
||||||
|
profile data. May contain NULs.
|
||||||
proflen - length of profile data in bytes.
|
proflen - length of profile data in bytes.
|
||||||
|
|
||||||
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
png_set_sBIT(png_ptr, info_ptr, sig_bit);
|
||||||
@@ -1735,11 +1776,13 @@ Some of the more important parts of the png_info are:
|
|||||||
or empty for unknown).
|
or empty for unknown).
|
||||||
num_text - number of comments
|
num_text - number of comments
|
||||||
|
|
||||||
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, num_spalettes);
|
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
|
||||||
palette_ptr - array of png_sPLT_struct structures to be
|
num_spalettes);
|
||||||
added to the list of palettes in the info
|
palette_ptr - array of png_sPLT_struct structures
|
||||||
structure.
|
to be added to the list of palettes
|
||||||
num_spalettes - number of palette structures to be added.
|
in the info structure.
|
||||||
|
num_spalettes - number of palette structures to be
|
||||||
|
added.
|
||||||
|
|
||||||
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
|
png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y,
|
||||||
unit_type);
|
unit_type);
|
||||||
@@ -1770,9 +1813,10 @@ Some of the more important parts of the png_info are:
|
|||||||
height - height of a pixel in physical scale units
|
height - height of a pixel in physical scale units
|
||||||
(width and height are strings like "2.54")
|
(width and height are strings like "2.54")
|
||||||
|
|
||||||
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, num_unknowns)
|
png_set_unknown_chunks(png_ptr, info_ptr, &unknowns,
|
||||||
unknowns - array of png_unknown_chunk structures holding
|
num_unknowns)
|
||||||
unknown chunks
|
unknowns - array of png_unknown_chunk
|
||||||
|
structures holding unknown chunks
|
||||||
unknowns[i].name - name of unknown chunk
|
unknowns[i].name - name of unknown chunk
|
||||||
unknowns[i].data - data of unknown chunk
|
unknowns[i].data - data of unknown chunk
|
||||||
unknowns[i].size - size of unknown chunk's data
|
unknowns[i].size - size of unknown chunk's data
|
||||||
@@ -1781,14 +1825,15 @@ Some of the more important parts of the png_info are:
|
|||||||
PNG_HAVE_IHDR: before PLTE
|
PNG_HAVE_IHDR: before PLTE
|
||||||
PNG_HAVE_PLTE: before IDAT
|
PNG_HAVE_PLTE: before IDAT
|
||||||
PNG_AFTER_IDAT: after IDAT
|
PNG_AFTER_IDAT: after IDAT
|
||||||
The "location" member is set automatically according to
|
|
||||||
what part of the output file has already been written.
|
The "location" member is set automatically according to
|
||||||
You can change its value after calling png_set_unknown_chunks()
|
what part of the output file has already been written.
|
||||||
as demonstrated in pngtest.c. Within each of the "locations",
|
You can change its value after calling png_set_unknown_chunks()
|
||||||
the chunks are sequenced according to their position in the
|
as demonstrated in pngtest.c. Within each of the "locations",
|
||||||
structure (that is, the value of "i", which is the order in which
|
the chunks are sequenced according to their position in the
|
||||||
the chunk was either read from the input file or defined with
|
structure (that is, the value of "i", which is the order in which
|
||||||
png_set_unknown_chunks).
|
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
|
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.
|
structures. num_text is the number of valid structures in the array.
|
||||||
@@ -1889,12 +1934,17 @@ transformations are permitted, enabled by the following masks.
|
|||||||
|
|
||||||
PNG_TRANSFORM_IDENTITY No transformation
|
PNG_TRANSFORM_IDENTITY No transformation
|
||||||
PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples
|
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_INVERT_MONO Invert monochrome images
|
||||||
PNG_TRANSFORM_SHIFT Normalize pixels to the sBIT depth
|
PNG_TRANSFORM_SHIFT Normalize pixels to the
|
||||||
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA to BGRA
|
sBIT depth
|
||||||
PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA to AG
|
PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA
|
||||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency
|
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_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
||||||
|
|
||||||
@@ -2158,7 +2208,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
|
It is also possible to individually free the info_ptr members that
|
||||||
point to libpng-allocated storage with the following function:
|
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
|
mask - identifies data to be freed, a mask
|
||||||
containing the logical OR of one or
|
containing the logical OR of one or
|
||||||
more of
|
more of
|
||||||
@@ -2168,16 +2218,17 @@ point to libpng-allocated storage with the following function:
|
|||||||
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
PNG_FREE_SCAL, PNG_FREE_SPLT,
|
||||||
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
PNG_FREE_TEXT, PNG_FREE_UNKN,
|
||||||
or simply PNG_FREE_ALL
|
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)
|
(-1 for all items)
|
||||||
|
|
||||||
This function may be safely called when the relevant storage has
|
This function may be safely called when the relevant storage has
|
||||||
already been freed, or has not yet been allocated, or was allocated
|
already been freed, or has not yet been allocated, or was allocated
|
||||||
by the user and not by libpng, and will in those
|
by the user and not by libpng, and will in those
|
||||||
cases do nothing. The "n" parameter is ignored if only one item
|
cases do nothing. The "seq" parameter is ignored if only one item
|
||||||
of the selected data type, such as PLTE, is allowed. If "n" is not
|
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
|
-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
|
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
|
in to libpng with png_set_*, you must not free it until just before the call to
|
||||||
@@ -2231,13 +2282,22 @@ For a more compact example of writing a PNG image, see the file example.c.
|
|||||||
|
|
||||||
V. Modifying/Customizing libpng:
|
V. Modifying/Customizing libpng:
|
||||||
|
|
||||||
There are two issues here. The first is changing how libpng does
|
There are three issues here. The first is changing how libpng does
|
||||||
standard things like memory allocation, input/output, and error handling.
|
standard things like memory allocation, input/output, and error handling.
|
||||||
The second deals with more complicated things like adding new chunks,
|
The second deals with more complicated things like adding new chunks,
|
||||||
adding new transformations, and generally changing how libpng works.
|
adding new transformations, and generally changing how libpng works.
|
||||||
|
Both of those are compile-time issues; that is, they are generally
|
||||||
|
determined at the time the code is written, and there is rarely a need
|
||||||
|
to provide the user with a means of changing them. The third is a
|
||||||
|
run-time issue: choosing between and/or tuning one or more alternate
|
||||||
|
versions of computationally intensive routines; specifically, optimized
|
||||||
|
assembly-language (and therefore compiler- and platform-dependent)
|
||||||
|
versions.
|
||||||
|
|
||||||
|
Memory allocation, input/output, and error handling
|
||||||
|
|
||||||
All of the memory allocation, input/output, and error handling in libpng
|
All of the memory allocation, input/output, and error handling in libpng
|
||||||
goes through callbacks that are user settable. The default routines are
|
goes through callbacks that are user-settable. The default routines are
|
||||||
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
|
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
|
||||||
these functions, call the appropriate png_set_*_fn() function.
|
these functions, call the appropriate png_set_*_fn() function.
|
||||||
|
|
||||||
@@ -2249,8 +2309,8 @@ memory allocation on a platform will change between applications, these
|
|||||||
functions must be modified in the library at compile time. If you prefer
|
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
|
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
|
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr,
|
||||||
malloc_fn, png_free_ptr free_fn)
|
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
|
||||||
|
|
||||||
This function also provides a void pointer that can be retrieved via
|
This function also provides a void pointer that can be retrieved via
|
||||||
|
|
||||||
@@ -2258,9 +2318,14 @@ This function also provides a void pointer that can be retrieved via
|
|||||||
|
|
||||||
Your replacement memory functions must have prototypes as follows:
|
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_size_t size);
|
||||||
void free_fn(png_structp png_ptr, png_voidp ptr);
|
void free_fn(png_structp png_ptr, png_voidp ptr);
|
||||||
|
|
||||||
|
Your malloc_fn() can return NULL in case of failure. The png_malloc()
|
||||||
|
function will call png_error() if it receives a NULL from the system
|
||||||
|
memory allocator or from your replacement malloc_fn().
|
||||||
|
|
||||||
Input/Output in libpng is done through png_read() and png_write(),
|
Input/Output in libpng is done through png_read() and png_write(),
|
||||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||||
png_struct and is initialized via png_init_io(). If you wish to change
|
png_struct and is initialized via png_init_io(). If you wish to change
|
||||||
@@ -2420,6 +2485,10 @@ compression level by calling:
|
|||||||
Another useful one is to reduce the memory level used by the library.
|
Another useful one is to reduce the memory level used by the library.
|
||||||
The memory level defaults to 8, but it can be lowered if you are
|
The memory level defaults to 8, but it can be lowered if you are
|
||||||
short on memory (running DOS, for example, where you only have 640K).
|
short on memory (running DOS, for example, where you only have 640K).
|
||||||
|
Note that the memory level does have an effect on compression; among
|
||||||
|
other things, lower levels will result in sections of incompressible
|
||||||
|
data being emitted in smaller stored blocks, with a correspondingly
|
||||||
|
larger relative overhead of up to 15% in the worst case.
|
||||||
|
|
||||||
png_set_compression_mem_level(png_ptr, level);
|
png_set_compression_mem_level(png_ptr, level);
|
||||||
|
|
||||||
@@ -2454,34 +2523,39 @@ to turn filtering on and off, respectively.
|
|||||||
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
|
||||||
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
|
||||||
ORed together with '|' to specify one or more filters to use.
|
ORed together with '|' to specify one or more filters to use.
|
||||||
These filters are described in more detail in the PNG specification. If
|
These filters are described in more detail in the PNG specification.
|
||||||
you intend to change the filter type during the course of writing
|
If you intend to change the filter type during the course of writing
|
||||||
the image, you should start with flags set for all of the filters
|
the image, you should start with flags set for all of the filters
|
||||||
you intend to use so that libpng can initialize its internal
|
you intend to use so that libpng can initialize its internal
|
||||||
structures appropriately for all of the filter types.
|
structures appropriately for all of the filter types. (Note that this
|
||||||
|
means the first row must always be adaptively filtered, because libpng
|
||||||
|
currently does not allocate the filter buffers until png_write_row()
|
||||||
|
is called for the first time.)
|
||||||
|
|
||||||
filters = PNG_FILTER_NONE | PNG_FILTER_SUB
|
filters = PNG_FILTER_NONE | PNG_FILTER_SUB
|
||||||
PNG_FILTER_UP | PNG_FILTER_AVE |
|
PNG_FILTER_UP | PNG_FILTER_AVE |
|
||||||
PNG_FILTER_PAETH | PNG_ALL_FILTERS;
|
PNG_FILTER_PAETH | PNG_ALL_FILTERS;
|
||||||
or
|
|
||||||
filters = one of PNG_FILTER_VALUE_NONE,
|
|
||||||
PNG_FILTER_VALUE_SUB, PNG_FILTER_VALUE_UP,
|
|
||||||
PNG_FILTER_VALUE_AVE, PNG_FILTER_VALUE_PAETH
|
|
||||||
|
|
||||||
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
|
||||||
filters);
|
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().
|
||||||
|
|
||||||
It is also possible to influence how libpng chooses from among the
|
It is also possible to influence how libpng chooses from among the
|
||||||
available filters. This is done in two ways - by telling it how
|
available filters. This is done in one or both of two ways - by
|
||||||
important it is to keep the same filter for successive rows, and
|
telling it how important it is to keep the same filter for successive
|
||||||
by telling it the relative computational costs of the filters.
|
rows, and by telling it the relative computational costs of the filters.
|
||||||
|
|
||||||
double weights[3] = {1.5, 1.3, 1.1},
|
double weights[3] = {1.5, 1.3, 1.1},
|
||||||
costs[PNG_FILTER_VALUE_LAST] =
|
costs[PNG_FILTER_VALUE_LAST] =
|
||||||
{1.0, 1.3, 1.3, 1.5, 1.7};
|
{1.0, 1.3, 1.3, 1.5, 1.7};
|
||||||
|
|
||||||
png_set_filter_selection(png_ptr,
|
png_set_filter_heuristics(png_ptr,
|
||||||
PNG_FILTER_SELECTION_WEIGHTED, 3,
|
PNG_FILTER_HEURISTIC_WEIGHTED, 3,
|
||||||
weights, costs);
|
weights, costs);
|
||||||
|
|
||||||
The weights are multiplying factors that indicate to libpng that the
|
The weights are multiplying factors that indicate to libpng that the
|
||||||
@@ -2581,7 +2655,32 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
|
|||||||
having level = 0 will be printed. There aren't any such statements in
|
having level = 0 will be printed. There aren't any such statements in
|
||||||
this version of libpng, but if you insert some they will be printed.
|
this version of libpng, but if you insert some they will be printed.
|
||||||
|
|
||||||
VI. Changes to Libpng from version 0.88
|
VI. MNG support
|
||||||
|
|
||||||
|
The MNG specification (available at http://www.libpng.org/pub/mng) allows
|
||||||
|
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
|
||||||
|
Libpng can support some of these extensions. To enable them, use the
|
||||||
|
png_permit_mng_features() function:
|
||||||
|
|
||||||
|
feature_set = png_permit_mng_features(png_ptr, mask)
|
||||||
|
mask is a png_uint_32 containing the logical OR of the
|
||||||
|
features you want to enable. These include
|
||||||
|
PNG_FLAG_MNG_EMPTY_PLTE
|
||||||
|
PNG_FLAG_MNG_FILTER_64
|
||||||
|
PNG_ALL_MNG_FEATURES
|
||||||
|
feature_set is a png_byte that is the logical AND of
|
||||||
|
your mask with the set of MNG features that is
|
||||||
|
supported by the version of libpng that you are using.
|
||||||
|
|
||||||
|
It is an error to use this function when reading or writing a standalone
|
||||||
|
PNG file with the PNG 8-byte signature. The PNG datastream must be wrapped
|
||||||
|
in a MNG datastream. As a minimum, it must have the MNG 8-byte signature
|
||||||
|
and the MHDR and MEND chunks. Libpng does not provide support for these
|
||||||
|
or any other MNG chunks; your application must provide its own support for
|
||||||
|
them. You may wish to consider using libmng (available at
|
||||||
|
http://www.libmng.com) instead.
|
||||||
|
|
||||||
|
VII. Changes to Libpng from version 0.88
|
||||||
|
|
||||||
It should be noted that versions of libpng later than 0.96 are not
|
It should be noted that versions of libpng later than 0.96 are not
|
||||||
distributed by the original libpng author, Guy Schalnat, nor by
|
distributed by the original libpng author, Guy Schalnat, nor by
|
||||||
@@ -2591,7 +2690,7 @@ of the original PNG Group, Glenn Randers-Pehrson. Guy and Andreas are
|
|||||||
still alive and well, but they have moved on to other things.
|
still alive and well, but they have moved on to other things.
|
||||||
|
|
||||||
The old libpng functions png_read_init(), png_write_init(),
|
The old libpng functions png_read_init(), png_write_init(),
|
||||||
png_info_init(), png_read_destroy(), and png_write_destory() have been
|
png_info_init(), png_read_destroy(), and png_write_destroy() have been
|
||||||
moved to PNG_INTERNAL in version 0.95 to discourage their use. These
|
moved to PNG_INTERNAL in version 0.95 to discourage their use. These
|
||||||
functions will be removed from libpng version 2.0.0.
|
functions will be removed from libpng version 2.0.0.
|
||||||
|
|
||||||
@@ -2632,13 +2731,13 @@ application:
|
|||||||
|
|
||||||
VII. Y2K Compliance in libpng
|
VII. Y2K Compliance in libpng
|
||||||
|
|
||||||
November 19, 2000
|
April 15, 2002
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.0.9beta2 are Y2K compliant. It is my belief that earlier
|
upward through 1.0.13 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
@@ -2656,7 +2755,8 @@ There are seven time-related functions:
|
|||||||
|
|
||||||
png_convert_to_rfc_1123() in png.c
|
png_convert_to_rfc_1123() in png.c
|
||||||
(formerly png_convert_to_rfc_1152() in error)
|
(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_convert_from_time_t() in pngwrite.c
|
||||||
png_get_tIME() in pngget.c
|
png_get_tIME() in pngget.c
|
||||||
png_handle_tIME() in pngrutil.c, called in pngread.c
|
png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||||
|
|||||||
27
libpngpf.3
27
libpngpf.3
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNGPF 3 "November 19, 2000"
|
.TH LIBPNGPF 3 "April 15, 2002"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta2
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.13
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include <png.h>\fP
|
\fB#include <png.h>\fP
|
||||||
@@ -47,11 +47,11 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta2
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_voidp png_create_struct (int \fP\fItype\fP\fB, png_malloc_ptr \fImalloc_fn\fP\fB);\fP
|
\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBpng_voidp png_create_struct_2 (int \fItype\fP\fB);\fP
|
\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta2
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP
|
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@@ -191,10 +191,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta2
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBint png_handle_as_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -425,6 +421,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta2
|
|||||||
|
|
||||||
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
|
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
@@ -529,17 +527,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.9beta2
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The functions listed above are used privately by libpng
|
The functions listed above are used privately by libpng
|
||||||
and are not recommended for use by applications. They
|
and are not recommended for use by applications. They are
|
||||||
|
not "exported" to applications using shared libraries. They
|
||||||
are listed alphabetically here as an aid to libpng maintainers.
|
are listed alphabetically here as an aid to libpng maintainers.
|
||||||
See png.h for more information on these functions.
|
See png.h for more information on these functions.
|
||||||
|
|
||||||
|
|||||||
2
png.5
2
png.5
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "November 19, 2000"
|
.TH PNG 5 "April 15, 2002"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
|||||||
178
png.c
178
png.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng version 1.0.9beta2 - November 19, 2000
|
* libpng version 1.0.13 - April 15, 2002
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_0_9beta2 Your_png_h_is_not_version_1_0_9beta2;
|
typedef version_1_0_13 Your_png_h_is_not_version_1_0_13;
|
||||||
|
|
||||||
/* Version information for C files. This had better match the version
|
/* Version information for C files. This had better match the version
|
||||||
* string defined in png.h. */
|
* string defined in png.h. */
|
||||||
|
|
||||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||||
const char png_libpng_ver[18] = "1.0.9beta2";
|
const char png_libpng_ver[18] = "1.0.13";
|
||||||
|
|
||||||
/* png_sig was changed to a function in version 1.0.5c */
|
/* png_sig was changed to a function in version 1.0.5c */
|
||||||
/* Place to hold the signature string for a PNG file. */
|
/* Place to hold the signature string for a PNG file. */
|
||||||
@@ -139,9 +139,18 @@ voidpf PNGAPI
|
|||||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||||
{
|
{
|
||||||
png_uint_32 num_bytes = (png_uint_32)items * size;
|
png_uint_32 num_bytes = (png_uint_32)items * size;
|
||||||
png_voidp ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
png_voidp ptr;
|
||||||
|
png_structp p=png_ptr;
|
||||||
|
png_uint_32 save_flags=p->flags;
|
||||||
|
|
||||||
|
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
||||||
|
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
||||||
|
p->flags=save_flags;
|
||||||
|
|
||||||
#ifndef PNG_NO_ZALLOC_ZERO
|
#ifndef PNG_NO_ZALLOC_ZERO
|
||||||
|
if (ptr == NULL)
|
||||||
|
return ((voidpf)ptr);
|
||||||
|
|
||||||
if (num_bytes > (png_uint_32)0x8000L)
|
if (num_bytes > (png_uint_32)0x8000L)
|
||||||
{
|
{
|
||||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
png_memset(ptr, 0, (png_size_t)0x8000L);
|
||||||
@@ -212,14 +221,13 @@ png_create_info_struct(png_structp png_ptr)
|
|||||||
png_debug(1, "in png_create_info_struct\n");
|
png_debug(1, "in png_create_info_struct\n");
|
||||||
if(png_ptr == NULL) return (NULL);
|
if(png_ptr == NULL) return (NULL);
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if ((info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
|
||||||
png_ptr->malloc_fn)) != NULL)
|
png_ptr->malloc_fn, png_ptr->mem_ptr);
|
||||||
#else
|
#else
|
||||||
if ((info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO)) != NULL)
|
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||||
#endif
|
#endif
|
||||||
{
|
if (info_ptr != NULL)
|
||||||
png_info_init(info_ptr);
|
png_info_init_3(&info_ptr, sizeof(png_info));
|
||||||
}
|
|
||||||
|
|
||||||
return (info_ptr);
|
return (info_ptr);
|
||||||
}
|
}
|
||||||
@@ -243,11 +251,12 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
|||||||
png_info_destroy(png_ptr, info_ptr);
|
png_info_destroy(png_ptr, info_ptr);
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn);
|
png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn,
|
||||||
|
png_ptr->mem_ptr);
|
||||||
#else
|
#else
|
||||||
png_destroy_struct((png_voidp)info_ptr);
|
png_destroy_struct((png_voidp)info_ptr);
|
||||||
#endif
|
#endif
|
||||||
*info_ptr_ptr = (png_infop)NULL;
|
*info_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,10 +264,28 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
|
|||||||
* and applications using it are urged to use png_create_info_struct()
|
* and applications using it are urged to use png_create_info_struct()
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
|
#undef png_info_init
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_info_init(png_infop info_ptr)
|
png_info_init(png_infop info_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_info_init\n");
|
/* We only come here via pre-1.0.12-compiled applications */
|
||||||
|
png_info_init_3(&info_ptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PNGAPI
|
||||||
|
png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
||||||
|
{
|
||||||
|
png_infop info_ptr = *ptr_ptr;
|
||||||
|
|
||||||
|
png_debug(1, "in png_info_init_3\n");
|
||||||
|
|
||||||
|
if(sizeof(png_info) > png_info_struct_size)
|
||||||
|
{
|
||||||
|
png_destroy_struct(info_ptr);
|
||||||
|
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||||
|
*ptr_ptr = info_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* set everything to 0 */
|
/* set everything to 0 */
|
||||||
png_memset(info_ptr, 0, sizeof (png_info));
|
png_memset(info_ptr, 0, sizeof (png_info));
|
||||||
}
|
}
|
||||||
@@ -282,7 +309,8 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
|
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
||||||
|
int num)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_free_data\n");
|
png_debug(1, "in png_free_data\n");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
@@ -326,6 +354,9 @@ if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
|
|||||||
{
|
{
|
||||||
png_free(png_ptr, info_ptr->trans);
|
png_free(png_ptr, info_ptr->trans);
|
||||||
info_ptr->valid &= ~PNG_INFO_tRNS;
|
info_ptr->valid &= ~PNG_INFO_tRNS;
|
||||||
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
|
||||||
|
#endif
|
||||||
info_ptr->trans = NULL;
|
info_ptr->trans = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -469,6 +500,9 @@ if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST))
|
|||||||
png_free(png_ptr, info_ptr->hist);
|
png_free(png_ptr, info_ptr->hist);
|
||||||
info_ptr->hist = NULL;
|
info_ptr->hist = NULL;
|
||||||
info_ptr->valid &= ~PNG_INFO_hIST;
|
info_ptr->valid &= ~PNG_INFO_hIST;
|
||||||
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -482,6 +516,9 @@ if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE))
|
|||||||
png_zfree(png_ptr, info_ptr->palette);
|
png_zfree(png_ptr, info_ptr->palette);
|
||||||
info_ptr->palette = NULL;
|
info_ptr->palette = NULL;
|
||||||
info_ptr->valid &= ~PNG_INFO_PLTE;
|
info_ptr->valid &= ~PNG_INFO_PLTE;
|
||||||
|
#ifndef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_ptr->flags &= ~PNG_FLAG_FREE_PLTE;
|
||||||
|
#endif
|
||||||
info_ptr->num_palette = 0;
|
info_ptr->num_palette = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +563,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_debug(1, "in png_info_destroy\n");
|
png_debug(1, "in png_info_destroy\n");
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
if (png_ptr->num_chunk_list)
|
if (png_ptr->num_chunk_list)
|
||||||
{
|
{
|
||||||
@@ -536,7 +573,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_info_init(info_ptr);
|
png_info_init_3(&info_ptr, sizeof(png_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function returns a pointer to the io_ptr associated with the user
|
/* This function returns a pointer to the io_ptr associated with the user
|
||||||
@@ -582,31 +619,31 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE)
|
||||||
{
|
{
|
||||||
wchar_t time_buf[29];
|
wchar_t time_buf[29];
|
||||||
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
|
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
|
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
{
|
{
|
||||||
char near_time_buf[29];
|
char near_time_buf[29];
|
||||||
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||||
29*sizeof(char));
|
29*sizeof(char));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
#endif
|
#endif
|
||||||
#endif /* _WIN32_WCE */
|
#endif /* _WIN32_WCE */
|
||||||
return ((png_charp)png_ptr->time_buffer);
|
return ((png_charp)png_ptr->time_buffer);
|
||||||
@@ -626,10 +663,10 @@ png_charp PNGAPI
|
|||||||
png_get_copyright(png_structp png_ptr)
|
png_get_copyright(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
||||||
return ((png_charp) "\n libpng version 1.0.9beta2 - November 19, 2000\n\
|
return ((png_charp) "\n libpng version 1.0.13 - April 15, 2002\n\
|
||||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson\n\
|
Copyright (c) 1998-2002 Glenn Randers-Pehrson\n\
|
||||||
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
Copyright (c) 1996-1997 Andreas Dilger\n\
|
||||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||||
return ((png_charp) "");
|
return ((png_charp) "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,8 +681,8 @@ png_get_libpng_ver(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
/* Version of *.c files used when building libpng */
|
/* Version of *.c files used when building libpng */
|
||||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||||
return((png_charp) "1.0.9beta2");
|
return((png_charp) "1.0.13");
|
||||||
return((png_charp) "1.0.9beta2");
|
return((png_charp) "1.0.13");
|
||||||
}
|
}
|
||||||
|
|
||||||
png_charp PNGAPI
|
png_charp PNGAPI
|
||||||
@@ -695,5 +732,66 @@ png_uint_32 PNGAPI
|
|||||||
png_access_version_number(void)
|
png_access_version_number(void)
|
||||||
{
|
{
|
||||||
/* Version of *.c files used when building libpng */
|
/* Version of *.c files used when building libpng */
|
||||||
return((png_uint_32) 10009L);
|
return((png_uint_32) 10013L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
||||||
|
/* this INTERNAL function was added to libpng 1.2.0 */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_init_mmx_flags (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
png_ptr->mmx_rowbytes_threshold = 0;
|
||||||
|
png_ptr->mmx_bitdepth_threshold = 0;
|
||||||
|
|
||||||
|
# if (defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD))
|
||||||
|
|
||||||
|
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_COMPILED;
|
||||||
|
|
||||||
|
if (png_mmx_support()) {
|
||||||
|
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||||
|
# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
||||||
|
# endif
|
||||||
|
# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||||
|
;
|
||||||
|
# else
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||||
|
|
||||||
|
png_ptr->mmx_rowbytes_threshold = PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT;
|
||||||
|
png_ptr->mmx_bitdepth_threshold = PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT;
|
||||||
|
# endif
|
||||||
|
} else {
|
||||||
|
png_ptr->asm_flags &= ~( PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||||
|
| PNG_MMX_READ_FLAGS
|
||||||
|
| PNG_MMX_WRITE_FLAGS );
|
||||||
|
}
|
||||||
|
|
||||||
|
# else /* !((PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */
|
||||||
|
|
||||||
|
/* clear all MMX flags; no support is compiled in */
|
||||||
|
png_ptr->asm_flags &= ~( PNG_MMX_FLAGS );
|
||||||
|
|
||||||
|
# endif /* ?(PNGVCRD || PNGGCCRD) */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !(PNG_ASSEMBLER_CODE_SUPPORTED) */
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
#if !defined(PNG_USE_PNGGCCRD) && \
|
||||||
|
!(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD))
|
||||||
|
int PNGAPI
|
||||||
|
png_mmx_support(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
|||||||
449
png.h
449
png.h
@@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.0.9beta2 - November 19, 2000
|
* libpng version 1.0.13 - April 15, 2002
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* 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.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.0.9beta2 - November 19, 2000: Glenn
|
* libpng versions 0.97, January 1998, through 1.0.13 - April 15, 2002: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
@@ -52,18 +52,46 @@
|
|||||||
* 1.0.6h 10007 10.6h (testing xy.z so-numbering)
|
* 1.0.6h 10007 10.6h (testing xy.z so-numbering)
|
||||||
* 1.0.6i 10007 10.6i
|
* 1.0.6i 10007 10.6i
|
||||||
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
|
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
|
||||||
* 1.0.7beta11-18 10007 2.1.0.7beta11-18 (binary compatible)
|
* 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
|
||||||
* 1.0.7rc1-2 10007 2.1.0.7rc1-2 (binary compatible)
|
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
||||||
* 1.0.7 10007 (still compatible)
|
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
||||||
* 1.0.8beta1-4 10008 2.1.0.8beta1-4
|
* 1.0.7 1 10007 (still compatible)
|
||||||
* 1.0.8rc1 10008 2.1.0.8rc1
|
* 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
|
||||||
* 1.0.8 10008 2.1.0.8
|
* 1.0.8rc1 1 10008 2.1.0.8rc1
|
||||||
* 1.0.9beta1-2 10009 2.1.0.9
|
* 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.10beta1 1 10010 2.1.0.10beta1
|
||||||
|
* 1.0.10rc1 1 10010 2.1.0.10rc1
|
||||||
|
* 1.0.10 1 10010 2.1.0.10
|
||||||
|
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||||
|
* 1.0.11rc1 1 10011 2.1.0.11rc1
|
||||||
|
* 1.0.11 1 10011 2.1.0.11
|
||||||
|
* 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
|
||||||
|
* 1.0.12rc1 2 10012 2.1.0.12rc1
|
||||||
|
* 1.0.12 2 10012 2.1.0.12
|
||||||
|
* 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
|
||||||
|
* 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
|
||||||
|
* 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
|
||||||
|
* 1.2.0rc1 3 10200 3.1.2.0rc1
|
||||||
|
* 1.2.0 3 10200 3.1.2.0
|
||||||
|
* 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
|
||||||
|
* 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
|
||||||
|
* 1.2.1 3 10201 3.1.2.1
|
||||||
|
* 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
|
||||||
|
* 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
|
||||||
|
* 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
|
||||||
|
* 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
|
||||||
|
* 1.2.2 12 10202 12.so.0.1.2.2
|
||||||
|
* 1.0.13 10 10013 10.so.0.1.0.13
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
* used for changes in backward compatibility, as it is intended. The
|
* used for changes in backward compatibility, as it is intended. The
|
||||||
* PNG_PNGLIB_VER macro, which is not used within libpng but is available
|
* PNG_LIBPNG_VER macro, which is not used within libpng but is available
|
||||||
* for applications, is an unsigned integer of the form xyyzz corresponding
|
* 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
|
* to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||||
* were given the previous public release number plus a letter, until
|
* were given the previous public release number plus a letter, until
|
||||||
@@ -74,6 +102,9 @@
|
|||||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||||
* application is loaded with a different version of the library.
|
* application is loaded with a different version of the library.
|
||||||
*
|
*
|
||||||
|
* DLLNUM will change each time there are forward or backward changes
|
||||||
|
* in binary compatibility (e.g., when a new feature is added).
|
||||||
|
*
|
||||||
* See libpng.txt or libpng.3 for more information. The PNG specification
|
* See libpng.txt or libpng.3 for more information. The PNG specification
|
||||||
* is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
|
* is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
|
||||||
* and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
|
* and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
|
||||||
@@ -85,8 +116,8 @@
|
|||||||
* If you modify libpng you may insert additional notices immediately following
|
* If you modify libpng you may insert additional notices immediately following
|
||||||
* this sentence.
|
* this sentence.
|
||||||
*
|
*
|
||||||
* libpng versions 1.0.7, July 1, 2000, through 1.0.9beta2, November 19, 2000, are
|
* libpng versions 1.0.7, July 1, 2000, through 1.0.13, April 15, 2002, are
|
||||||
* Copyright (c) 2000 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
|
||||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
* distributed according to the same disclaimer and license as libpng-1.0.6
|
||||||
* with the following individuals added to the list of Contributing Authors
|
* with the following individuals added to the list of Contributing Authors
|
||||||
*
|
*
|
||||||
@@ -150,11 +181,11 @@
|
|||||||
*
|
*
|
||||||
* 1. The origin of this source code must not be misrepresented.
|
* 1. The origin of this source code must not be misrepresented.
|
||||||
*
|
*
|
||||||
* 2. Altered versions must be plainly marked as such and must not
|
* 2. Altered versions must be plainly marked as such and
|
||||||
* be misrepresented as being the original source.
|
* must not be misrepresented as being the original source.
|
||||||
*
|
*
|
||||||
* 3. This Copyright notice may not be removed or altered from any
|
* 3. This Copyright notice may not be removed or altered from
|
||||||
* source or altered source distribution.
|
* any source or altered source distribution.
|
||||||
*
|
*
|
||||||
* The Contributing Authors and Group 42, Inc. specifically permit, without
|
* The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
* fee, and encourage the use of this source code as a component to
|
* fee, and encourage the use of this source code as a component to
|
||||||
@@ -190,13 +221,13 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* November 19, 2000
|
* April 15, 2002
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.0.9beta2 are Y2K compliant. It is my belief that earlier
|
* upward through 1.0.13 are Y2K compliant. It is my belief that earlier
|
||||||
* versions were also Y2K compliant.
|
* versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
@@ -252,39 +283,43 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.0.9beta2"
|
#define PNG_LIBPNG_VER_STRING "1.0.13"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 2
|
#define PNG_LIBPNG_VER_SONUM 0
|
||||||
|
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
|
||||||
|
|
||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 0
|
#define PNG_LIBPNG_VER_MINOR 0
|
||||||
#define PNG_LIBPNG_VER_RELEASE 9
|
#define PNG_LIBPNG_VER_RELEASE 13
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||||
#define PNG_LIBPNG_VER_BUILD 2
|
|
||||||
#define PNG_LIBPNG_BUILD_TYPE beta /* alpha, beta, rc, stable, patched */
|
#define PNG_LIBPNG_VER_BUILD 0
|
||||||
|
|
||||||
|
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||||
|
#define PNG_LIBPNG_BUILD_BETA 2
|
||||||
|
#define PNG_LIBPNG_BUILD_RC 3
|
||||||
|
#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
|
||||||
|
|
||||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||||
* We must not include leading zeros.
|
* We must not include leading zeros.
|
||||||
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
|
* 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 10013 /* 1.0.13 */
|
||||||
|
|
||||||
#ifndef PNG_VERSION_INFO_ONLY
|
#ifndef PNG_VERSION_INFO_ONLY
|
||||||
|
|
||||||
/* include the compression library's header */
|
/* include the compression library's header */
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
/* include all user configurable info */
|
/* include all user configurable info, including optional assembler routines */
|
||||||
#include "pngconf.h"
|
#include "pngconf.h"
|
||||||
|
|
||||||
/* macros for optional assembler routines */
|
|
||||||
#if defined(PNG_INTERNAL) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
|
||||||
# include "pngasmrd.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
|
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -296,6 +331,40 @@ extern "C" {
|
|||||||
* which applications aren't expected to use directly.
|
* which applications aren't expected to use directly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef PNG_NO_TYPECAST_NULL
|
||||||
|
#define int_p_NULL (int *)NULL
|
||||||
|
#define png_bytep_NULL (png_bytep)NULL
|
||||||
|
#define png_bytepp_NULL (png_bytepp)NULL
|
||||||
|
#define png_doublep_NULL (png_doublep)NULL
|
||||||
|
#define png_error_ptr_NULL (png_error_ptr)NULL
|
||||||
|
#define png_flush_ptr_NULL (png_flush_ptr)NULL
|
||||||
|
#define png_free_ptr_NULL (png_free_ptr)NULL
|
||||||
|
#define png_infopp_NULL (png_infopp)NULL
|
||||||
|
#define png_malloc_ptr_NULL (png_malloc_ptr)NULL
|
||||||
|
#define png_read_status_ptr_NULL (png_read_status_ptr)NULL
|
||||||
|
#define png_rw_ptr_NULL (png_rw_ptr)NULL
|
||||||
|
#define png_structp_NULL (png_structp)NULL
|
||||||
|
#define png_uint_16p_NULL (png_uint_16p)NULL
|
||||||
|
#define png_voidp_NULL (png_voidp)NULL
|
||||||
|
#define png_write_status_ptr_NULL (png_write_status_ptr)NULL
|
||||||
|
#else
|
||||||
|
#define int_p_NULL NULL
|
||||||
|
#define png_bytep_NULL NULL
|
||||||
|
#define png_bytepp_NULL NULL
|
||||||
|
#define png_doublep_NULL NULL
|
||||||
|
#define png_error_ptr_NULL NULL
|
||||||
|
#define png_flush_ptr_NULL NULL
|
||||||
|
#define png_free_ptr_NULL NULL
|
||||||
|
#define png_infopp_NULL NULL
|
||||||
|
#define png_malloc_ptr_NULL NULL
|
||||||
|
#define png_read_status_ptr_NULL NULL
|
||||||
|
#define png_rw_ptr_NULL NULL
|
||||||
|
#define png_structp_NULL NULL
|
||||||
|
#define png_uint_16p_NULL NULL
|
||||||
|
#define png_voidp_NULL NULL
|
||||||
|
#define png_write_status_ptr_NULL NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
|
||||||
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
|
||||||
/* Version information for C files, stored in png.c. This had better match
|
/* Version information for C files, stored in png.c. This had better match
|
||||||
@@ -438,7 +507,7 @@ typedef png_text FAR * FAR * png_textpp;
|
|||||||
* Two conversions are provided, both from time_t and struct tm. There
|
* Two conversions are provided, both from time_t and struct tm. There
|
||||||
* is no portable way to convert to either of these structures, as far
|
* is no portable way to convert to either of these structures, as far
|
||||||
* as I know. If you know of a portable way, send it to me. As a side
|
* as I know. If you know of a portable way, send it to me. As a side
|
||||||
* note - PNG is Year 2000 compliant!
|
* note - PNG has always been Year 2000 compliant!
|
||||||
*/
|
*/
|
||||||
typedef struct png_time_struct
|
typedef struct png_time_struct
|
||||||
{
|
{
|
||||||
@@ -496,20 +565,20 @@ typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
|
|||||||
* The following members may have allocated storage attached that should be
|
* The following members may have allocated storage attached that should be
|
||||||
* cleaned up before the structure is discarded: palette, trans, text,
|
* cleaned up before the structure is discarded: palette, trans, text,
|
||||||
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
|
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
|
||||||
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these are
|
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
|
||||||
* automatically freed when the info structure is deallocated, if they were
|
* are automatically freed when the info structure is deallocated, if they were
|
||||||
* allocated internally by libpng. This behavior can be changed by means
|
* allocated internally by libpng. This behavior can be changed by means
|
||||||
* of the png_data_freer() function.
|
* of the png_data_freer() function.
|
||||||
*
|
*
|
||||||
* More allocation details: all the chunk-reading functions that change these
|
* More allocation details: all the chunk-reading functions that
|
||||||
* members go through the corresponding png_set_* functions. A function to
|
* change these members go through the corresponding png_set_*
|
||||||
* clear these members is available: see png_free_data(). Some of the
|
* functions. A function to clear these members is available: see
|
||||||
* png_set_* functions do not depend on being able to point info structure
|
* png_free_data(). The png_set_* functions do not depend on being
|
||||||
* members to any of the storage they are passed (they make their own copies),
|
* able to point info structure members to any of the storage they are
|
||||||
* EXCEPT that the png_set_text functions use the same storage passed to them
|
* passed (they make their own copies), EXCEPT that the png_set_text
|
||||||
* in the text_ptr or itxt_ptr structure argument, and the png_set_tRNS,
|
* functions use the same storage passed to them in the text_ptr or
|
||||||
* png_set_PLTE, png_set_hIST, png_set_iCCP, png_set_rows, png_set_sPLT,
|
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
|
||||||
* and png_set_unknowns do not make their own copies.
|
* functions do not make their own copies.
|
||||||
*/
|
*/
|
||||||
typedef struct png_info_struct
|
typedef struct png_info_struct
|
||||||
{
|
{
|
||||||
@@ -681,6 +750,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||||||
png_byte pcal_nparams; /* number of parameters given in pcal_params */
|
png_byte pcal_nparams; /* number of parameters given in pcal_params */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.6 */
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
#endif
|
#endif
|
||||||
@@ -695,6 +765,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||||||
/* iCCP chunk data. */
|
/* iCCP chunk data. */
|
||||||
png_charp iccp_name; /* profile name */
|
png_charp iccp_name; /* profile name */
|
||||||
png_charp iccp_profile; /* International Color Consortium profile data */
|
png_charp iccp_profile; /* International Color Consortium profile data */
|
||||||
|
/* Note to maintainer: should be png_bytep */
|
||||||
png_uint_32 iccp_proflen; /* ICC profile data length */
|
png_uint_32 iccp_proflen; /* ICC profile data length */
|
||||||
png_byte iccp_compression; /* Always zero */
|
png_byte iccp_compression; /* Always zero */
|
||||||
#endif
|
#endif
|
||||||
@@ -775,6 +846,7 @@ typedef png_info FAR * FAR * png_infopp;
|
|||||||
|
|
||||||
/* This is for filter type. PNG 1.0-1.2 only define the single type. */
|
/* This is for filter type. PNG 1.0-1.2 only define the single type. */
|
||||||
#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
|
#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
|
||||||
|
#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
|
||||||
#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
|
#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
|
||||||
|
|
||||||
/* These are for the interlacing type. These values should NOT be changed. */
|
/* These are for the interlacing type. These values should NOT be changed. */
|
||||||
@@ -815,6 +887,8 @@ typedef png_info FAR * FAR * png_infopp;
|
|||||||
/* This is for text chunks */
|
/* This is for text chunks */
|
||||||
#define PNG_KEYWORD_MAX_LENGTH 79
|
#define PNG_KEYWORD_MAX_LENGTH 79
|
||||||
|
|
||||||
|
/* Maximum number of entries in PLTE/sPLT/tRNS arrays */
|
||||||
|
#define PNG_MAX_PALETTE_LENGTH 256
|
||||||
|
|
||||||
/* These determine if an ancillary chunk's data has been successfully read
|
/* These determine if an ancillary chunk's data has been successfully read
|
||||||
* from the PNG header, or if the application has filled in the corresponding
|
* from the PNG header, or if the application has filled in the corresponding
|
||||||
@@ -886,10 +960,10 @@ typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
|
|||||||
png_row_infop, png_bytep));
|
png_row_infop, png_bytep));
|
||||||
#endif
|
#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));
|
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
|
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -909,8 +983,9 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
|
|||||||
#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
|
#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
|
||||||
|
|
||||||
/* Flags for MNG supported features */
|
/* Flags for MNG supported features */
|
||||||
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
|
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
|
||||||
#define PNG_ALL_MNG_FEATURES 0x01
|
#define PNG_FLAG_MNG_FILTER_64 0x04
|
||||||
|
#define PNG_ALL_MNG_FEATURES 0x05
|
||||||
|
|
||||||
typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
|
typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
|
||||||
typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
|
typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
|
||||||
@@ -1008,16 +1083,16 @@ struct png_struct_def
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
#if defined(PNG_bKGD_SUPPORTED)
|
||||||
png_byte background_gamma_type;
|
png_byte background_gamma_type;
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
float background_gamma;
|
float background_gamma;
|
||||||
# endif
|
# endif
|
||||||
png_color_16 background; /* background color in screen gamma space */
|
png_color_16 background; /* background color in screen gamma space */
|
||||||
# if defined(PNG_READ_GAMMA_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
||||||
# endif /* PNG_READ_GAMMA && PNG_READ_bKGD_SUPPORTED */
|
#endif
|
||||||
#endif /* PNG_READ_bKGD_SUPPORTED */
|
#endif /* PNG_bKGD_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
png_flush_ptr output_flush_fn;/* Function for flushing output */
|
png_flush_ptr output_flush_fn;/* Function for flushing output */
|
||||||
@@ -1042,7 +1117,7 @@ struct png_struct_def
|
|||||||
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
|
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
|
||||||
#endif
|
#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 */
|
png_color_8 sig_bit; /* significant bits in each available channel */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1050,7 +1125,7 @@ struct png_struct_def
|
|||||||
png_color_8 shift; /* shift for significant bit tranformation */
|
png_color_8 shift; /* shift for significant bit tranformation */
|
||||||
#endif
|
#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)
|
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
png_bytep trans; /* transparency values for paletted files */
|
png_bytep trans; /* transparency values for paletted files */
|
||||||
png_color_16 trans_values; /* transparency values for non-paletted files */
|
png_color_16 trans_values; /* transparency values for non-paletted files */
|
||||||
@@ -1075,12 +1150,12 @@ struct png_struct_def
|
|||||||
int process_mode; /* what push library is currently doing */
|
int process_mode; /* what push library is currently doing */
|
||||||
int cur_palette; /* current push library palette index */
|
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_size; /* current size of text input data */
|
||||||
png_size_t current_text_left; /* how much text left to read in input */
|
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; /* current text chunk buffer */
|
||||||
png_charp current_text_ptr; /* current location in current_text */
|
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 */
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
@@ -1098,7 +1173,7 @@ struct png_struct_def
|
|||||||
png_bytep dither_index; /* index translation for palette files */
|
png_bytep dither_index; /* index translation for palette files */
|
||||||
#endif
|
#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 */
|
png_uint_16p hist; /* histogram */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1116,19 +1191,13 @@ struct png_struct_def
|
|||||||
png_charp time_buffer; /* String to hold RFC 1123 time text */
|
png_charp time_buffer; /* String to hold RFC 1123 time text */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_voidp mem_ptr; /* user supplied struct for mem functions */
|
|
||||||
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
|
||||||
png_free_ptr free_fn; /* function for freeing memory */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New members added in libpng-1.0.6 */
|
/* New members added in libpng-1.0.6 */
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_USER_CHUNKS_SUPPORTED)
|
||||||
png_voidp user_chunk_ptr;
|
png_voidp user_chunk_ptr;
|
||||||
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
||||||
#endif
|
#endif
|
||||||
@@ -1138,30 +1207,65 @@ struct png_struct_def
|
|||||||
png_bytep chunk_list;
|
png_bytep chunk_list;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.3 */
|
||||||
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
png_byte rgb_to_gray_status;
|
png_byte rgb_to_gray_status;
|
||||||
|
/* These were changed from png_byte in libpng-1.0.6 */
|
||||||
png_uint_16 rgb_to_gray_red_coeff;
|
png_uint_16 rgb_to_gray_red_coeff;
|
||||||
png_uint_16 rgb_to_gray_green_coeff;
|
png_uint_16 rgb_to_gray_green_coeff;
|
||||||
png_uint_16 rgb_to_gray_blue_coeff;
|
png_uint_16 rgb_to_gray_blue_coeff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
||||||
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
|
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
|
||||||
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
|
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
|
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
|
||||||
/* Note to maintainer: change this to png_uint_32 at next opportunity */
|
/* changed from png_byte to png_uint_32 at version 1.2.0 */
|
||||||
|
#ifdef PNG_1_0_X
|
||||||
png_byte mng_features_permitted;
|
png_byte mng_features_permitted;
|
||||||
|
#else
|
||||||
|
png_uint_32 mng_features_permitted;
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.7 */
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
png_fixed_point int_gamma;
|
png_fixed_point int_gamma;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
png_byte filter_type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))
|
||||||
|
/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
|
||||||
|
png_uint_32 row_buf_size;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.2.0 */
|
||||||
|
#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
png_byte mmx_bitdepth_threshold;
|
||||||
|
png_uint_32 mmx_rowbytes_threshold;
|
||||||
|
png_uint_32 asm_flags;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
png_voidp mem_ptr; /* user supplied struct for mem functions */
|
||||||
|
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
||||||
|
png_free_ptr free_fn; /* function for freeing memory */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
|
|
||||||
and png.h are both at * version 1.0.9beta2
|
/* This prevents a compiler error in png.c if png.c and png.h are both at
|
||||||
|
version 1.0.13
|
||||||
*/
|
*/
|
||||||
typedef png_structp version_1_0_9beta2;
|
typedef png_structp version_1_0_13;
|
||||||
|
|
||||||
typedef png_struct FAR * FAR * png_structpp;
|
typedef png_struct FAR * FAR * png_structpp;
|
||||||
|
|
||||||
@@ -1212,6 +1316,7 @@ extern PNG_EXPORT(void,png_set_compression_buffer_size)
|
|||||||
/* Reset the compression stream */
|
/* Reset the compression stream */
|
||||||
extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
|
extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
|
/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
extern PNG_EXPORT(png_structp,png_create_read_struct_2)
|
extern PNG_EXPORT(png_structp,png_create_read_struct_2)
|
||||||
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
|
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
|
||||||
@@ -1242,8 +1347,11 @@ extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
|
|||||||
extern PNG_EXPORT(png_infop,png_create_info_struct)
|
extern PNG_EXPORT(png_infop,png_create_info_struct)
|
||||||
PNGARG((png_structp png_ptr));
|
PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
/* Initialize the info structure (old interface - NOT DLL EXPORTED) */
|
/* Initialize the info structure (old interface - DEPRECATED) */
|
||||||
extern void png_info_init PNGARG((png_infop info_ptr));
|
extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
|
||||||
|
#define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info));
|
||||||
|
extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
|
||||||
|
png_size_t png_info_struct_size));
|
||||||
|
|
||||||
/* Writes all the PNG information before the image. */
|
/* Writes all the PNG information before the image. */
|
||||||
extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
|
||||||
@@ -1465,9 +1573,6 @@ extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
|
|||||||
extern PNG_EXPORT(void,png_destroy_write_struct)
|
extern PNG_EXPORT(void,png_destroy_write_struct)
|
||||||
PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
|
PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
|
||||||
|
|
||||||
/* free any memory used in info_ptr struct (old method - NOT DLL EXPORTED) */
|
|
||||||
extern void png_write_destroy_info PNGARG((png_infop info_ptr));
|
|
||||||
|
|
||||||
/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
|
/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
|
||||||
extern void png_write_destroy PNGARG((png_structp png_ptr));
|
extern void png_write_destroy PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
@@ -1675,7 +1780,7 @@ extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
|
|||||||
PNGARG((png_structp png_ptr));
|
PNGARG((png_structp png_ptr));
|
||||||
#endif
|
#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,
|
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));
|
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
|
extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
|
||||||
@@ -1712,6 +1817,13 @@ extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
|
|||||||
/* frees a pointer allocated by png_malloc() */
|
/* frees a pointer allocated by png_malloc() */
|
||||||
extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
|
extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
|
||||||
|
|
||||||
|
/* Function to allocate memory for zlib. */
|
||||||
|
extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
|
||||||
|
uInt size));
|
||||||
|
|
||||||
|
/* Function to free memory for zlib */
|
||||||
|
extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
|
||||||
|
|
||||||
/* Free data that was allocated internally */
|
/* Free data that was allocated internally */
|
||||||
extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_uint_32 free_me, int num));
|
png_infop info_ptr, png_uint_32 free_me, int num));
|
||||||
@@ -1868,7 +1980,7 @@ png_ptr, png_infop info_ptr));
|
|||||||
extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_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,
|
extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_color_16p *background));
|
png_infop info_ptr, png_color_16p *background));
|
||||||
#endif
|
#endif
|
||||||
@@ -1878,7 +1990,7 @@ extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, png_color_16p background));
|
png_infop info_ptr, png_color_16p background));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
#if defined(PNG_cHRM_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
|
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,
|
png_infop info_ptr, double *white_x, double *white_y, double *red_x,
|
||||||
@@ -1909,7 +2021,7 @@ extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
#if defined(PNG_gAMA_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, double *file_gamma));
|
png_infop info_ptr, double *file_gamma));
|
||||||
@@ -1927,7 +2039,7 @@ extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, png_fixed_point int_file_gamma));
|
png_infop info_ptr, png_fixed_point int_file_gamma));
|
||||||
#endif
|
#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,
|
extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_uint_16p *hist));
|
png_infop info_ptr, png_uint_16p *hist));
|
||||||
#endif
|
#endif
|
||||||
@@ -1947,7 +2059,7 @@ extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
|
|||||||
int color_type, int interlace_method, int compression_method,
|
int color_type, int interlace_method, int compression_method,
|
||||||
int filter_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,
|
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,
|
png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
|
||||||
int *unit_type));
|
int *unit_type));
|
||||||
@@ -1959,7 +2071,7 @@ extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
|
|||||||
int unit_type));
|
int unit_type));
|
||||||
#endif
|
#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,
|
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,
|
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));
|
int *type, int *nparams, png_charp *units, png_charpp *params));
|
||||||
@@ -1971,7 +2083,7 @@ extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
|
|||||||
int type, int nparams, png_charp units, png_charpp params));
|
int type, int nparams, png_charp units, png_charpp params));
|
||||||
#endif
|
#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,
|
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));
|
png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
|
||||||
#endif
|
#endif
|
||||||
@@ -1987,7 +2099,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,
|
extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_colorp palette, int num_palette));
|
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,
|
extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_color_8p *sig_bit));
|
png_infop info_ptr, png_color_8p *sig_bit));
|
||||||
#endif
|
#endif
|
||||||
@@ -1997,7 +2109,7 @@ extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, png_color_8p sig_bit));
|
png_infop info_ptr, png_color_8p sig_bit));
|
||||||
#endif
|
#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,
|
extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, int *intent));
|
png_infop info_ptr, int *intent));
|
||||||
#endif
|
#endif
|
||||||
@@ -2009,19 +2121,21 @@ extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, int intent));
|
png_infop info_ptr, int intent));
|
||||||
#endif
|
#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,
|
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_infop info_ptr, png_charpp name, int *compression_type,
|
||||||
png_charpp profile, png_uint_32 *proflen));
|
png_charpp profile, png_uint_32 *proflen));
|
||||||
|
/* Note to maintainer: profile should be png_bytepp */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_iCCP_SUPPORTED)
|
#if defined(PNG_iCCP_SUPPORTED)
|
||||||
extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_charp name, int compression_type,
|
png_infop info_ptr, png_charp name, int compression_type,
|
||||||
png_charp profile, png_uint_32 proflen));
|
png_charp profile, png_uint_32 proflen));
|
||||||
|
/* Note to maintainer: profile should be png_bytep */
|
||||||
#endif
|
#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,
|
extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_sPLT_tpp entries));
|
png_infop info_ptr, png_sPLT_tpp entries));
|
||||||
#endif
|
#endif
|
||||||
@@ -2031,7 +2145,7 @@ extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, png_sPLT_tp entries, int nentries));
|
png_infop info_ptr, png_sPLT_tp entries, int nentries));
|
||||||
#endif
|
#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 */
|
/* 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,
|
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));
|
png_infop info_ptr, png_textp *text_ptr, int *num_text));
|
||||||
@@ -2050,7 +2164,7 @@ extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, png_textp text_ptr, int num_text));
|
png_infop info_ptr, png_textp text_ptr, int num_text));
|
||||||
#endif
|
#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,
|
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_timep *mod_time));
|
png_infop info_ptr, png_timep *mod_time));
|
||||||
#endif
|
#endif
|
||||||
@@ -2060,7 +2174,7 @@ extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
|
|||||||
png_infop info_ptr, png_timep mod_time));
|
png_infop info_ptr, png_timep mod_time));
|
||||||
#endif
|
#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,
|
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_infop info_ptr, png_bytep *trans, int *num_trans,
|
||||||
png_color_16p *trans_values));
|
png_color_16p *trans_values));
|
||||||
@@ -2075,7 +2189,7 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
|
|||||||
#if defined(PNG_tRNS_SUPPORTED)
|
#if defined(PNG_tRNS_SUPPORTED)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_sCAL_SUPPORTED)
|
#if defined(PNG_sCAL_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, int *unit, double *width, double *height));
|
png_infop info_ptr, int *unit, double *width, double *height));
|
||||||
@@ -2085,7 +2199,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));
|
png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_sCAL_SUPPORTED */
|
#endif /* PNG_sCAL_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_sCAL_SUPPORTED)
|
#if defined(PNG_sCAL_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
@@ -2096,7 +2210,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,
|
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));
|
png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
|
#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
/* provide a list of chunks and how they are to be handled, if the built-in
|
/* provide a list of chunks and how they are to be handled, if the built-in
|
||||||
@@ -2117,6 +2231,10 @@ extern PNG_EXPORT(void, png_set_unknown_chunk_location)
|
|||||||
extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
|
extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
|
||||||
png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
|
png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
|
||||||
|
chunk_name));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Png_free_data() will turn off the "valid" flag for anything it frees.
|
/* Png_free_data() will turn off the "valid" flag for anything it frees.
|
||||||
If you need to turn it off for a chunk that your application has freed,
|
If you need to turn it off for a chunk that your application has freed,
|
||||||
@@ -2199,8 +2317,84 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
|
|||||||
png_ptr, png_uint_32 mng_features_permitted));
|
png_ptr, png_uint_32 mng_features_permitted));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Added to version 1.2.0 */
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
|
||||||
|
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
|
||||||
|
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
|
||||||
|
#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08
|
||||||
|
#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10
|
||||||
|
#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20
|
||||||
|
#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40
|
||||||
|
#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
|
||||||
|
#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */
|
||||||
|
|
||||||
|
#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
||||||
|
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
|
||||||
|
#define PNG_MMX_WRITE_FLAGS ( 0 )
|
||||||
|
|
||||||
|
#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
|
||||||
|
| PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \
|
||||||
|
| PNG_MMX_READ_FLAGS \
|
||||||
|
| PNG_MMX_WRITE_FLAGS )
|
||||||
|
|
||||||
|
#define PNG_SELECT_READ 1
|
||||||
|
#define PNG_SELECT_WRITE 2
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
/* pngget.c */
|
||||||
|
extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
|
||||||
|
PNGARG((int flag_select, int *compilerID));
|
||||||
|
|
||||||
|
/* pngget.c */
|
||||||
|
extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
|
||||||
|
PNGARG((int flag_select));
|
||||||
|
|
||||||
|
/* pngget.c */
|
||||||
|
extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
|
||||||
|
PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
|
/* pngget.c */
|
||||||
|
extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
|
||||||
|
PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
|
/* pngget.c */
|
||||||
|
extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
|
||||||
|
PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
|
/* pngset.c */
|
||||||
|
extern PNG_EXPORT(void,png_set_asm_flags)
|
||||||
|
PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
|
||||||
|
|
||||||
|
/* pngset.c */
|
||||||
|
extern PNG_EXPORT(void,png_set_mmx_thresholds)
|
||||||
|
PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
|
||||||
|
png_uint_32 mmx_rowbytes_threshold));
|
||||||
|
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
/* png.c, pnggccrd.c, or pngvcrd.c */
|
||||||
|
extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
|
||||||
|
|
||||||
|
/* Strip the prepended error numbers ("#nnn ") from error and warning
|
||||||
|
* messages before passing them to the error or warning handler. */
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
|
||||||
|
png_ptr, png_uint_32 strip_mode));
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
|
||||||
|
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
|
||||||
|
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.0.9beta2 - November 19, 2000 (header)\n"
|
" libpng version 1.0.13 - April 15, 2002 (header)\n"
|
||||||
|
|
||||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
/* With these routines we avoid an integer divide, which will be slower on
|
/* With these routines we avoid an integer divide, which will be slower on
|
||||||
@@ -2266,6 +2460,7 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
|
|||||||
#define PNG_WROTE_tIME 0x200
|
#define PNG_WROTE_tIME 0x200
|
||||||
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
|
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
|
||||||
#define PNG_BACKGROUND_IS_GRAY 0x800
|
#define PNG_BACKGROUND_IS_GRAY 0x800
|
||||||
|
#define PNG_HAVE_PNG_SIGNATURE 0x1000
|
||||||
|
|
||||||
/* flags for the transformations the PNG library does on the image data */
|
/* flags for the transformations the PNG library does on the image data */
|
||||||
#define PNG_BGR 0x0001
|
#define PNG_BGR 0x0001
|
||||||
@@ -2322,6 +2517,9 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
|
|||||||
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
|
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
|
||||||
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
|
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
|
||||||
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
|
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
|
||||||
|
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
|
||||||
|
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
|
||||||
|
#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
|
||||||
|
|
||||||
/* For use in png_set_keep_unknown, png_handle_as_unknown */
|
/* For use in png_set_keep_unknown, png_handle_as_unknown */
|
||||||
#define HANDLE_CHUNK_AS_DEFAULT 0
|
#define HANDLE_CHUNK_AS_DEFAULT 0
|
||||||
@@ -2413,13 +2611,13 @@ PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
|
|||||||
* values, which is almost certainly true.
|
* values, which is almost certainly true.
|
||||||
*/
|
*/
|
||||||
#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
|
#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)))
|
# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
|
||||||
# endif
|
# endif
|
||||||
# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
|
# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
|
||||||
# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
|
# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
|
||||||
#else
|
#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));
|
PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
|
||||||
# endif
|
# endif
|
||||||
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
|
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
|
||||||
@@ -2427,21 +2625,25 @@ PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
|
|||||||
#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
|
#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
|
||||||
|
|
||||||
/* Initialize png_ptr struct for reading, and allocate any other memory.
|
/* Initialize png_ptr struct for reading, and allocate any other memory.
|
||||||
* (old interface - DEPRECATED).
|
* (old interface - DEPRECATED - use png_create_read_struct instead).
|
||||||
*/
|
*/
|
||||||
extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
|
extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
|
||||||
#define png_read_init(png_ptr) png_read_init_2(png_ptr, \
|
#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
|
||||||
PNG_LIBPNG_VER_STRING, sizeof(png_struct), sizeof(png_info));
|
PNG_LIBPNG_VER_STRING, sizeof(png_struct));
|
||||||
|
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
|
||||||
|
png_const_charp user_png_ver, png_size_t png_struct_size));
|
||||||
extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
|
||||||
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
|
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
|
||||||
png_info_size));
|
png_info_size));
|
||||||
|
|
||||||
/* Initialize png_ptr struct for writing, and allocate any other memory.
|
/* Initialize png_ptr struct for writing, and allocate any other memory.
|
||||||
* (old interface - DEPRECATED).
|
* (old interface - DEPRECATED - use png_create_write_struct instead).
|
||||||
*/
|
*/
|
||||||
extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
|
extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
|
||||||
#define png_write_init(png_ptr) png_write_init_2(png_ptr, \
|
#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
|
||||||
PNG_LIBPNG_VER_STRING, sizeof(png_struct), sizeof(png_info));
|
PNG_LIBPNG_VER_STRING, sizeof(png_struct));
|
||||||
|
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
|
||||||
|
png_const_charp user_png_ver, png_size_t png_struct_size));
|
||||||
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
|
||||||
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
|
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
|
||||||
png_info_size));
|
png_info_size));
|
||||||
@@ -2453,20 +2655,14 @@ PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
|
|||||||
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
|
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
|
||||||
|
|
||||||
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
|
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
|
||||||
malloc_fn));
|
malloc_fn, png_voidp mem_ptr));
|
||||||
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
|
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
|
||||||
png_free_ptr free_fn));
|
png_free_ptr free_fn, png_voidp mem_ptr));
|
||||||
|
|
||||||
/* Free any memory that info_ptr points to and reset struct. */
|
/* Free any memory that info_ptr points to and reset struct. */
|
||||||
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
|
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr));
|
png_infop info_ptr));
|
||||||
|
|
||||||
/* Function to allocate memory for zlib. */
|
|
||||||
PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
|
|
||||||
|
|
||||||
/* Function to free memory for zlib */
|
|
||||||
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
|
|
||||||
|
|
||||||
/* Reset the CRC variable */
|
/* Reset the CRC variable */
|
||||||
PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
|
PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
@@ -2483,8 +2679,8 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
|
|||||||
png_size_t length));
|
png_size_t length));
|
||||||
|
|
||||||
/* Decompress data in a chunk that uses compression */
|
/* Decompress data in a chunk that uses compression */
|
||||||
#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \
|
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
|
||||||
defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED)
|
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
|
||||||
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
|
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
|
||||||
int comp_type, png_charp chunkdata, png_size_t chunklength,
|
int comp_type, png_charp chunkdata, png_size_t chunklength,
|
||||||
png_size_t prefix_length, png_size_t *data_length));
|
png_size_t prefix_length, png_size_t *data_length));
|
||||||
@@ -2513,7 +2709,7 @@ PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
|
|||||||
*/
|
*/
|
||||||
PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
|
PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
|
||||||
|
|
||||||
#if defined(PNG_WRITE_pCAL_SUPPORTED)
|
#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
||||||
PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
|
PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2584,6 +2780,7 @@ PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
|
|||||||
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
|
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
|
||||||
png_charp name, int compression_type,
|
png_charp name, int compression_type,
|
||||||
png_charp profile, int proflen));
|
png_charp profile, int proflen));
|
||||||
|
/* Note to maintainer: profile should be png_bytep */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_sPLT_SUPPORTED)
|
#if defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||||
@@ -2630,7 +2827,7 @@ PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
|
|||||||
|
|
||||||
#if defined(PNG_WRITE_oFFs_SUPPORTED)
|
#if defined(PNG_WRITE_oFFs_SUPPORTED)
|
||||||
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
|
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
|
||||||
png_uint_32 x_offset, png_uint_32 y_offset, int unit_type));
|
png_int_32 x_offset, png_int_32 y_offset, int unit_type));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_pCAL_SUPPORTED)
|
#if defined(PNG_WRITE_pCAL_SUPPORTED)
|
||||||
@@ -2678,10 +2875,15 @@ PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
|
|||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED)
|
#if defined(PNG_READ_INTERLACING_SUPPORTED)
|
||||||
/* expand an interlaced row */
|
/* expand an interlaced row */
|
||||||
|
/* OLD pre-1.0.9 interface:
|
||||||
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
|
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
|
||||||
png_bytep row, int pass, png_uint_32 transformations));
|
png_bytep row, int pass, png_uint_32 transformations));
|
||||||
|
*/
|
||||||
|
PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||||
/* grab pixels out of a row for an interlaced pass */
|
/* grab pixels out of a row for an interlaced pass */
|
||||||
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
|
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
|
||||||
@@ -2800,12 +3002,17 @@ PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
|
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
|
||||||
png_color_16p trans_values, png_color_16p background,
|
png_color_16p trans_values, png_color_16p background,
|
||||||
png_color_16p background_1,
|
png_color_16p background_1,
|
||||||
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
|
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
|
||||||
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
|
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
|
||||||
png_uint_16pp gamma_16_to_1, int gamma_shift));
|
png_uint_16pp gamma_16_to_1, int gamma_shift));
|
||||||
|
#else
|
||||||
|
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
|
||||||
|
png_color_16p trans_values, png_color_16p background));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
@@ -2918,11 +3125,6 @@ PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
|
|||||||
png_uint_32 length));
|
png_uint_32 length));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
||||||
PNG_EXTERN int png_handle_as_unknown PNGARG((png_structp png_ptr, png_bytep
|
|
||||||
chunk_name));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
|
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
|
||||||
png_infop info_ptr, png_uint_32 length));
|
png_infop info_ptr, png_uint_32 length));
|
||||||
|
|
||||||
@@ -2986,6 +3188,19 @@ PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
|
|||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row));
|
||||||
|
PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
|
||||||
|
png_bytep row));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
/* png.c */ /* PRIVATE */
|
||||||
|
PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
|
||||||
|
#endif
|
||||||
|
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
|
||||||
|
|
||||||
#endif /* PNG_INTERNAL */
|
#endif /* PNG_INTERNAL */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
36
pngasmrd.h
36
pngasmrd.h
@@ -1,39 +1,11 @@
|
|||||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 2002 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PNGASMRD_H
|
/* This file is obsolete in libpng-1.0.9 and later; its contents now appear
|
||||||
#define PNGASMRD_H
|
* at the end of pngconf.h.
|
||||||
|
|
||||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
|
|
||||||
/* Set this in the makefile for VC++ on Pentium, not in pngconf.h */
|
|
||||||
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
|
|
||||||
* MMX will be detected at run time and used if present.
|
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_USE_PNGVCRD
|
|
||||||
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set this in the makefile for gcc/as on Pentium, not in pngconf.h */
|
|
||||||
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
|
|
||||||
* MMX will be detected at run time and used if present.
|
|
||||||
*/
|
|
||||||
#ifdef PNG_USE_PNGGCCRD
|
|
||||||
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
||||||
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
GRR notes:
|
|
||||||
- see pnggccrd.c for info about what is currently enabled
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif /* PNGASMRD_H */
|
|
||||||
|
|||||||
120
pngerror.c
120
pngerror.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -31,6 +31,38 @@ png_default_warning PNGARG((png_structp png_ptr,
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_error(png_structp png_ptr, png_const_charp message)
|
png_error(png_structp png_ptr, png_const_charp message)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
char msg[16];
|
||||||
|
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
if (*message == '#')
|
||||||
|
{
|
||||||
|
for (offset=1; offset<15; offset++)
|
||||||
|
if (*(message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; i<offset-1; i++)
|
||||||
|
msg[i]=message[i+1];
|
||||||
|
msg[i]='\0';
|
||||||
|
message=msg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
message+=offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
|
{
|
||||||
|
msg[0]='0';
|
||||||
|
msg[1]='\0';
|
||||||
|
message=msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (png_ptr->error_fn != NULL)
|
if (png_ptr->error_fn != NULL)
|
||||||
(*(png_ptr->error_fn))(png_ptr, message);
|
(*(png_ptr->error_fn))(png_ptr, message);
|
||||||
|
|
||||||
@@ -47,10 +79,22 @@ png_error(png_structp png_ptr, png_const_charp message)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_warning(png_structp png_ptr, png_const_charp message)
|
png_warning(png_structp png_ptr, png_const_charp message)
|
||||||
{
|
{
|
||||||
|
int offset = 0;
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (*message == '#')
|
||||||
|
{
|
||||||
|
for (offset=1; offset<15; offset++)
|
||||||
|
if (*(message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (png_ptr->warning_fn != NULL)
|
if (png_ptr->warning_fn != NULL)
|
||||||
(*(png_ptr->warning_fn))(png_ptr, message);
|
(*(png_ptr->warning_fn))(png_ptr, (png_const_charp)(message+offset));
|
||||||
else
|
else
|
||||||
png_default_warning(png_ptr, message);
|
png_default_warning(png_ptr, (png_const_charp)(message+offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These utilities are used internally to build an error message that relates
|
/* These utilities are used internally to build an error message that relates
|
||||||
@@ -61,11 +105,12 @@ png_warning(png_structp png_ptr, png_const_charp message)
|
|||||||
*/
|
*/
|
||||||
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
|
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||||
static PNG_CONST char png_digit[16] = {
|
static PNG_CONST char png_digit[16] = {
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
|
||||||
};
|
'F' };
|
||||||
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message)
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
|
message)
|
||||||
{
|
{
|
||||||
int iout = 0, iin = 0;
|
int iout = 0, iin = 0;
|
||||||
|
|
||||||
@@ -99,7 +144,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_error(png_structp png_ptr, png_const_charp message)
|
png_chunk_error(png_structp png_ptr, png_const_charp message)
|
||||||
{
|
{
|
||||||
char msg[16+64];
|
char msg[18+64];
|
||||||
png_format_buffer(png_ptr, msg, message);
|
png_format_buffer(png_ptr, msg, message);
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
@@ -107,7 +152,7 @@ png_chunk_error(png_structp png_ptr, png_const_charp message)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_warning(png_structp png_ptr, png_const_charp message)
|
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_format_buffer(png_ptr, msg, message);
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
@@ -121,6 +166,27 @@ static void /* PRIVATE */
|
|||||||
png_default_error(png_structp png_ptr, png_const_charp message)
|
png_default_error(png_structp png_ptr, png_const_charp message)
|
||||||
{
|
{
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
if (*message == '#')
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
char error_number[16];
|
||||||
|
for (offset=0; offset<15; offset++)
|
||||||
|
{
|
||||||
|
error_number[offset] = *(message+offset+1);
|
||||||
|
if (*(message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((offset > 1) && (offset < 15))
|
||||||
|
{
|
||||||
|
error_number[offset-1]='\0';
|
||||||
|
fprintf(stderr, "libpng error no. %s: %s\n", error_number, message+offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "libpng error: %s, offset=%d\n", message,offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
fprintf(stderr, "libpng error: %s\n", message);
|
fprintf(stderr, "libpng error: %s\n", message);
|
||||||
#else
|
#else
|
||||||
if (message)
|
if (message)
|
||||||
@@ -153,7 +219,29 @@ static void /* PRIVATE */
|
|||||||
png_default_warning(png_structp png_ptr, png_const_charp message)
|
png_default_warning(png_structp png_ptr, png_const_charp message)
|
||||||
{
|
{
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
fprintf(stderr, "libpng warning: %s\n", message);
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
if (*message == '#')
|
||||||
|
{
|
||||||
|
int offset;
|
||||||
|
char warning_number[16];
|
||||||
|
for (offset=0; offset<15; offset++)
|
||||||
|
{
|
||||||
|
warning_number[offset]=*(message+offset+1);
|
||||||
|
if (*(message+offset) == ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((offset > 1) && (offset < 15))
|
||||||
|
{
|
||||||
|
warning_number[offset-1]='\0';
|
||||||
|
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
|
||||||
|
message+offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "libpng warning: %s\n", message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
fprintf(stderr, "libpng warning: %s\n", message);
|
||||||
#else
|
#else
|
||||||
if (message)
|
if (message)
|
||||||
/* appease compiler */ ;
|
/* appease compiler */ ;
|
||||||
@@ -188,4 +276,14 @@ png_get_error_ptr(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
void PNGAPI
|
||||||
|
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
||||||
|
{
|
||||||
|
if(png_ptr != NULL)
|
||||||
|
{
|
||||||
|
png_ptr->flags &=
|
||||||
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
1101
pnggccrd.c
1101
pnggccrd.c
File diff suppressed because it is too large
Load Diff
154
pngget.c
154
pngget.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
@@ -137,7 +137,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#if defined(PNG_pHYs_SUPPORTED)
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
if (info_ptr->valid & PNG_INFO_pHYs)
|
if (info_ptr->valid & PNG_INFO_pHYs)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
||||||
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
||||||
return (0);
|
return (0);
|
||||||
else return (info_ptr->y_pixels_per_unit);
|
else return (info_ptr->y_pixels_per_unit);
|
||||||
@@ -297,7 +297,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
|||||||
*.00003937);
|
*.00003937);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
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)
|
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);
|
return (retval);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_pHYs_SUPPORTED */
|
#endif /* PNG_pHYs_SUPPORTED */
|
||||||
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
|
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
|
||||||
|
|
||||||
/* png_get_channels really belongs in here, too, but it's been around longer */
|
/* 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);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_bKGD_SUPPORTED)
|
#if defined(PNG_bKGD_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_color_16p *background)
|
png_color_16p *background)
|
||||||
@@ -371,7 +371,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_cHRM_SUPPORTED)
|
#if defined(PNG_cHRM_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_gAMA_SUPPORTED)
|
#if defined(PNG_gAMA_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_sRGB_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_iCCP_SUPPORTED)
|
#if defined(PNG_iCCP_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_charpp name, int *compression_type,
|
png_charpp name, int *compression_type,
|
||||||
@@ -504,7 +504,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_sPLT_SUPPORTED)
|
#if defined(PNG_sPLT_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_sPLT_tpp spalettes)
|
png_sPLT_tpp spalettes)
|
||||||
@@ -515,7 +515,7 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_hIST_SUPPORTED)
|
#if defined(PNG_hIST_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
||||||
{
|
{
|
||||||
@@ -547,7 +547,11 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
*width = info_ptr->width;
|
*width = info_ptr->width;
|
||||||
*height = info_ptr->height;
|
*height = info_ptr->height;
|
||||||
*bit_depth = info_ptr->bit_depth;
|
*bit_depth = info_ptr->bit_depth;
|
||||||
|
if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
|
||||||
|
png_error(png_ptr, "Invalid bit depth");
|
||||||
*color_type = info_ptr->color_type;
|
*color_type = info_ptr->color_type;
|
||||||
|
if (info_ptr->color_type > 6)
|
||||||
|
png_error(png_ptr, "Invalid color type");
|
||||||
if (compression_type != NULL)
|
if (compression_type != NULL)
|
||||||
*compression_type = info_ptr->compression_type;
|
*compression_type = info_ptr->compression_type;
|
||||||
if (filter_type != NULL)
|
if (filter_type != NULL)
|
||||||
@@ -556,9 +560,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
*interlace_type = info_ptr->interlace_type;
|
*interlace_type = info_ptr->interlace_type;
|
||||||
|
|
||||||
/* check for potential overflow of rowbytes */
|
/* check for potential overflow of rowbytes */
|
||||||
if (*color_type == PNG_COLOR_TYPE_PALETTE)
|
if (*color_type & PNG_COLOR_MASK_COLOR)
|
||||||
channels = 1;
|
|
||||||
else if (*color_type & PNG_COLOR_MASK_COLOR)
|
|
||||||
channels = 3;
|
channels = 3;
|
||||||
else
|
else
|
||||||
channels = 1;
|
channels = 1;
|
||||||
@@ -566,6 +568,10 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
channels++;
|
channels++;
|
||||||
pixel_depth = *bit_depth * channels;
|
pixel_depth = *bit_depth * channels;
|
||||||
rowbytes_per_pixel = (pixel_depth + 7) >> 3;
|
rowbytes_per_pixel = (pixel_depth + 7) >> 3;
|
||||||
|
if (width == 0 || *width > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid image width");
|
||||||
|
if (height == 0 || *height > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid image height");
|
||||||
if ((*width > PNG_MAX_UINT/rowbytes_per_pixel))
|
if ((*width > PNG_MAX_UINT/rowbytes_per_pixel))
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
@@ -576,7 +582,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_oFFs_SUPPORTED)
|
#if defined(PNG_oFFs_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
||||||
@@ -594,7 +600,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_pCAL_SUPPORTED)
|
#if defined(PNG_pCAL_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
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,
|
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
||||||
@@ -618,7 +624,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
|
#if defined(PNG_sCAL_SUPPORTED)
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
|
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
|
||||||
@@ -654,7 +660,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_pHYs_SUPPORTED)
|
#if defined(PNG_pHYs_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
||||||
@@ -701,7 +707,7 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_sBIT_SUPPORTED)
|
#if defined(PNG_sBIT_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
||||||
{
|
{
|
||||||
@@ -716,7 +722,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_TEXT_SUPPORTED)
|
#if defined(PNG_TEXT_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
||||||
int *num_text)
|
int *num_text)
|
||||||
@@ -738,7 +744,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_tIME_SUPPORTED)
|
#if defined(PNG_tIME_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
||||||
{
|
{
|
||||||
@@ -753,7 +759,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
#if defined(PNG_tRNS_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
||||||
@@ -792,7 +798,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_unknown_chunkpp unknowns)
|
png_unknown_chunkpp unknowns)
|
||||||
@@ -807,15 +813,15 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
|||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
png_get_rgb_to_gray_status (png_structp png_ptr)
|
png_get_rgb_to_gray_status (png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return png_ptr->rgb_to_gray_status;
|
return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_USER_CHUNKS_SUPPORTED)
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_user_chunk_ptr(png_structp png_ptr)
|
png_get_user_chunk_ptr(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return (png_ptr->user_chunk_ptr);
|
return (png_ptr? png_ptr->user_chunk_ptr : NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -823,5 +829,97 @@ png_get_user_chunk_ptr(png_structp png_ptr)
|
|||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_compression_buffer_size(png_structp png_ptr)
|
png_get_compression_buffer_size(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
return(png_ptr->zbuf_size);
|
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PNG_1_0_X
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
/* this function was added to libpng 1.2.0 and should exist by default*/
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_asm_flags (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 and should exist by default */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_asm_flagmask (int flag_select)
|
||||||
|
{
|
||||||
|
png_uint_32 settable_asm_flags = 0;
|
||||||
|
|
||||||
|
if (flag_select & PNG_SELECT_READ)
|
||||||
|
settable_asm_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||||
|
/* no non-MMX flags yet */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* GRR: no write-flags yet, either, but someday... */
|
||||||
|
if (flag_select & PNG_SELECT_WRITE)
|
||||||
|
settable_asm_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
return settable_asm_flags; /* _theoretically_ settable capabilities only */
|
||||||
|
}
|
||||||
|
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
|
||||||
|
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_mmx_flagmask (int flag_select, int *compilerID)
|
||||||
|
{
|
||||||
|
png_uint_32 settable_mmx_flags = 0;
|
||||||
|
|
||||||
|
if (flag_select & PNG_SELECT_READ)
|
||||||
|
settable_mmx_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
|
||||||
|
#if 0
|
||||||
|
/* GRR: no MMX write support yet, but someday... */
|
||||||
|
if (flag_select & PNG_SELECT_WRITE)
|
||||||
|
settable_mmx_flags |=
|
||||||
|
PNG_ASM_FLAG_MMX_WRITE_ [whatever] ;
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
|
if (compilerID != NULL) {
|
||||||
|
#ifdef PNG_USE_PNGVCRD
|
||||||
|
*compilerID = 1; /* MSVC */
|
||||||
|
#else
|
||||||
|
#ifdef PNG_USE_PNGGCCRD
|
||||||
|
*compilerID = 2; /* gcc/gas */
|
||||||
|
#else
|
||||||
|
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
png_byte PNGAPI
|
||||||
|
png_get_mmx_bitdepth_threshold (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_mmx_rowbytes_threshold (png_structp png_ptr)
|
||||||
|
{
|
||||||
|
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
|
||||||
|
}
|
||||||
|
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
|||||||
120
pngmem.c
120
pngmem.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -27,12 +27,12 @@ png_voidp /* PRIVATE */
|
|||||||
png_create_struct(int type)
|
png_create_struct(int type)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_struct_2(type, NULL));
|
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
||||||
png_voidp /* PRIVATE */
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn)
|
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
@@ -43,35 +43,36 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn)
|
|||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = sizeof(png_struct);
|
size = sizeof(png_struct);
|
||||||
else
|
else
|
||||||
return ((png_voidp)NULL);
|
return (png_get_copyright());
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if(malloc_fn != NULL)
|
if(malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
if ((struct_ptr = (*(malloc_fn))(NULL, size)) != NULL)
|
png_struct dummy_struct;
|
||||||
png_memset(struct_ptr, 0, size);
|
png_structp png_ptr = &dummy_struct;
|
||||||
return (struct_ptr);
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
|
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
|
struct_ptr = (png_voidp)farmalloc(size));
|
||||||
{
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
}
|
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL);
|
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
|
png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
@@ -81,6 +82,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
|||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
(*(free_fn))(png_ptr, struct_ptr);
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -115,11 +117,16 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
|
|||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
#endif
|
#endif
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return ((png_voidp)NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if(png_ptr->malloc_fn != NULL)
|
if(png_ptr->malloc_fn != NULL)
|
||||||
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
{
|
||||||
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||||
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of memory!");
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return png_malloc_default(png_ptr, size);
|
return png_malloc_default(png_ptr, size);
|
||||||
}
|
}
|
||||||
@@ -170,12 +177,22 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out Of Memory.");
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_size_t)table & 0xfff0)
|
if ((png_size_t)table & 0xfff0)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Farmalloc didn't return normalized pointer");
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr,
|
||||||
|
"Farmalloc didn't return normalized pointer");
|
||||||
|
else
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Farmalloc didn't return normalized pointer");
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->offset_table = table;
|
png_ptr->offset_table = table;
|
||||||
@@ -184,7 +201,11 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (png_ptr->offset_table_ptr == NULL)
|
if (png_ptr->offset_table_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out Of memory.");
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out Of memory.");
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
hptr = (png_byte huge *)table;
|
hptr = (png_byte huge *)table;
|
||||||
@@ -206,7 +227,13 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
||||||
png_error(png_ptr, "Out of Memory.");
|
{
|
||||||
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out of Memory.");
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
||||||
}
|
}
|
||||||
@@ -215,7 +242,10 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -281,14 +311,14 @@ png_voidp /* PRIVATE */
|
|||||||
png_create_struct(int type)
|
png_create_struct(int type)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_struct_2(type, NULL));
|
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
to improve performance noticably.*/
|
to improve performance noticably.*/
|
||||||
png_voidp /* PRIVATE */
|
png_voidp /* PRIVATE */
|
||||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn)
|
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
@@ -299,12 +329,16 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn)
|
|||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = sizeof(png_struct);
|
size = sizeof(png_struct);
|
||||||
else
|
else
|
||||||
return ((png_voidp)NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if(malloc_fn != NULL)
|
if(malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
if ((struct_ptr = (*(malloc_fn))(NULL, size)) != NULL)
|
png_struct dummy_struct;
|
||||||
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
|
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
||||||
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
@@ -332,12 +366,13 @@ void /* PRIVATE */
|
|||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2(struct_ptr, (png_free_ptr)NULL);
|
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
|
png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
@@ -347,6 +382,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
|||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
(*(free_fn))(png_ptr, struct_ptr);
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -373,19 +409,22 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
|
|||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
#endif
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return ((png_voidp)NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if(png_ptr->malloc_fn != NULL)
|
if(png_ptr->malloc_fn != NULL)
|
||||||
return ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
{
|
||||||
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||||
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Out of Memory!");
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return (png_malloc_default(png_ptr, size));
|
return (png_malloc_default(png_ptr, size));
|
||||||
}
|
}
|
||||||
png_voidp /* PRIVATE */
|
png_voidp PNGAPI
|
||||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
@@ -393,7 +432,12 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
{
|
||||||
|
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
|
png_error(png_ptr, "Cannot Allocate > 64K");
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
@@ -406,10 +450,8 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
{
|
|
||||||
png_error(png_ptr, "Out of Memory");
|
png_error(png_ptr, "Out of Memory");
|
||||||
}
|
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@@ -430,7 +472,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
}
|
}
|
||||||
else png_free_default(png_ptr, ptr);
|
else png_free_default(png_ptr, ptr);
|
||||||
}
|
}
|
||||||
void /* PRIVATE */
|
void PNGAPI
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
@@ -451,7 +493,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
|
|||||||
|
|
||||||
#endif /* Not Borland DOS special memory handler */
|
#endif /* Not Borland DOS special memory handler */
|
||||||
|
|
||||||
png_voidp /* PRIVATE */
|
png_voidp PNGAPI
|
||||||
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
||||||
png_uint_32 length)
|
png_uint_32 length)
|
||||||
{
|
{
|
||||||
@@ -464,7 +506,7 @@ png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
|||||||
return(png_memcpy (s1, s2, size));
|
return(png_memcpy (s1, s2, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp /* PRIVATE */
|
png_voidp PNGAPI
|
||||||
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
||||||
png_uint_32 length)
|
png_uint_32 length)
|
||||||
{
|
{
|
||||||
|
|||||||
114
pngpread.c
114
pngpread.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
@@ -240,6 +240,12 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
* header chunks, and we can start reading the image (or if this
|
* header chunks, and we can start reading the image (or if this
|
||||||
* is called after the image has been read - we have an error).
|
* is called after the image has been read - we have an error).
|
||||||
*/
|
*/
|
||||||
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
|
png_error(png_ptr, "Missing IHDR before IDAT");
|
||||||
|
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||||
|
!(png_ptr->mode & PNG_HAVE_PLTE))
|
||||||
|
png_error(png_ptr, "Missing PLTE before IDAT");
|
||||||
|
|
||||||
if (png_ptr->mode & PNG_HAVE_IDAT)
|
if (png_ptr->mode & PNG_HAVE_IDAT)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length == 0)
|
if (png_ptr->push_length == 0)
|
||||||
@@ -772,18 +778,42 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
|
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
|
||||||
{
|
{
|
||||||
if (png_ptr->pass < 6)
|
if (png_ptr->pass < 6)
|
||||||
|
/* old interface (pre-1.0.9):
|
||||||
png_do_read_interlace(&(png_ptr->row_info),
|
png_do_read_interlace(&(png_ptr->row_info),
|
||||||
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
|
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
|
||||||
|
*/
|
||||||
|
png_do_read_interlace(png_ptr);
|
||||||
|
|
||||||
switch (png_ptr->pass)
|
switch (png_ptr->pass)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8 && png_ptr->pass == 0; i++)
|
for (i = 0; i < 8 && png_ptr->pass == 0; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */
|
||||||
|
}
|
||||||
|
if (png_ptr->pass == 2) /* pass 1 might be empty */
|
||||||
|
{
|
||||||
|
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
||||||
|
{
|
||||||
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
|
png_read_push_finish_row(png_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (png_ptr->pass == 4 && png_ptr->height <= 4)
|
||||||
|
{
|
||||||
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
|
{
|
||||||
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
|
png_read_push_finish_row(png_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (png_ptr->pass == 6 && png_ptr->height <= 4)
|
||||||
|
{
|
||||||
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -795,11 +825,11 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
if (png_ptr->pass == 2)
|
if (png_ptr->pass == 2) /* skip top 4 generated rows */
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, NULL);
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -815,9 +845,17 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
for (i = 0; i < 4 && png_ptr->pass == 2; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, NULL);
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
|
if (png_ptr->pass == 4) /* pass 3 might be empty */
|
||||||
|
{
|
||||||
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
|
{
|
||||||
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
|
png_read_push_finish_row(png_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
@@ -828,11 +866,11 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
if (png_ptr->pass == 4)
|
if (png_ptr->pass == 4) /* skip top two generated rows */
|
||||||
{
|
{
|
||||||
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, NULL);
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -848,7 +886,12 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
for (i = 0; i < 2 && png_ptr->pass == 4; i++)
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, NULL);
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
|
png_read_push_finish_row(png_ptr);
|
||||||
|
}
|
||||||
|
if (png_ptr->pass == 6) /* pass 5 might be empty */
|
||||||
|
{
|
||||||
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -861,9 +904,9 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
if (png_ptr->pass == 6)
|
if (png_ptr->pass == 6) /* skip top generated row */
|
||||||
{
|
{
|
||||||
png_push_have_row(png_ptr, NULL);
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -874,7 +917,7 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
if (png_ptr->pass != 6)
|
if (png_ptr->pass != 6)
|
||||||
break;
|
break;
|
||||||
png_push_have_row(png_ptr, NULL);
|
png_push_have_row(png_ptr, png_bytep_NULL);
|
||||||
png_read_push_finish_row(png_ptr);
|
png_read_push_finish_row(png_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -928,6 +971,11 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
png_ptr->pass++;
|
png_ptr->pass++;
|
||||||
|
if ((png_ptr->pass == 1 && png_ptr->width < 5) ||
|
||||||
|
(png_ptr->pass == 3 && png_ptr->width < 3) ||
|
||||||
|
(png_ptr->pass == 5 && png_ptr->width < 2))
|
||||||
|
png_ptr->pass++;
|
||||||
|
|
||||||
if (png_ptr->pass >= 7)
|
if (png_ptr->pass >= 7)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -953,7 +1001,8 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_tEXt_SUPPORTED)
|
#if defined(PNG_READ_tEXt_SUPPORTED)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||||
|
length)
|
||||||
{
|
{
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||||
{
|
{
|
||||||
@@ -965,7 +1014,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
|||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
png_ptr->skip_length = 0; /* This may not be necessary */
|
png_ptr->skip_length = 0; /* This may not be necessary */
|
||||||
|
|
||||||
if (length > (png_uint_32)65535L) /* Can't hold the entire string in memory */
|
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "tEXt chunk too large to fit in memory");
|
png_warning(png_ptr, "tEXt chunk too large to fit in memory");
|
||||||
png_ptr->skip_length = length - (png_uint_32)65535L;
|
png_ptr->skip_length = length - (png_uint_32)65535L;
|
||||||
@@ -1029,8 +1078,8 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
text_ptr->lang = (char *)NULL;
|
text_ptr->lang = NULL;
|
||||||
text_ptr->lang_key = (char *)NULL;
|
text_ptr->lang_key = NULL;
|
||||||
#endif
|
#endif
|
||||||
text_ptr->text = text;
|
text_ptr->text = text;
|
||||||
|
|
||||||
@@ -1044,7 +1093,8 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||||
|
length)
|
||||||
{
|
{
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||||
{
|
{
|
||||||
@@ -1156,8 +1206,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
{
|
{
|
||||||
text = (png_charp)png_malloc(png_ptr,
|
text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out +
|
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
||||||
key_size + 1));
|
+ key_size + 1));
|
||||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||||
png_memcpy(text, key, key_size);
|
png_memcpy(text, key, key_size);
|
||||||
@@ -1213,8 +1263,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
text_ptr->lang = (char *)NULL;
|
text_ptr->lang = NULL;
|
||||||
text_ptr->lang_key = (char *)NULL;
|
text_ptr->lang_key = NULL;
|
||||||
#endif
|
#endif
|
||||||
text_ptr->text = text;
|
text_ptr->text = text;
|
||||||
|
|
||||||
@@ -1228,7 +1278,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_iTXt_SUPPORTED)
|
#if defined(PNG_READ_iTXt_SUPPORTED)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||||
|
length)
|
||||||
{
|
{
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||||
{
|
{
|
||||||
@@ -1240,7 +1291,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
|||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
png_ptr->skip_length = 0; /* This may not be necessary */
|
png_ptr->skip_length = 0; /* This may not be necessary */
|
||||||
|
|
||||||
if (length > (png_uint_32)65535L) /* Can't hold the entire string in memory */
|
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "iTXt chunk too large to fit in memory");
|
png_warning(png_ptr, "iTXt chunk too large to fit in memory");
|
||||||
png_ptr->skip_length = length - (png_uint_32)65535L;
|
png_ptr->skip_length = length - (png_uint_32)65535L;
|
||||||
@@ -1338,7 +1389,8 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
* name or a critical chunk), the chunk is (currently) silently ignored.
|
* name or a critical chunk), the chunk is (currently) silently ignored.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||||
|
length)
|
||||||
{
|
{
|
||||||
png_uint_32 skip=0;
|
png_uint_32 skip=0;
|
||||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||||
@@ -1349,7 +1401,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
|||||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||||
HANDLE_CHUNK_ALWAYS
|
HANDLE_CHUNK_ALWAYS
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
|
&& png_ptr->read_user_chunk_fn == NULL
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
@@ -1374,12 +1426,12 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||||
png_crc_read(png_ptr, chunk.data, length);
|
png_crc_read(png_ptr, chunk.data, length);
|
||||||
chunk.size = length;
|
chunk.size = length;
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
|
if(png_ptr->read_user_chunk_fn != NULL)
|
||||||
{
|
{
|
||||||
/* callback to user unknown chunk handler */
|
/* callback to user unknown chunk handler */
|
||||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||||
@@ -1445,7 +1497,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
|||||||
png_ptr->row_fn = row_fn;
|
png_ptr->row_fn = row_fn;
|
||||||
png_ptr->end_fn = end_fn;
|
png_ptr->end_fn = end_fn;
|
||||||
|
|
||||||
png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
|
png_set_read_fn(png_ptr, progressive_ptr, (png_rw_ptr)png_push_fill_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
@@ -1453,6 +1505,4 @@ png_get_progressive_ptr(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
return png_ptr->io_ptr;
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
|
|||||||
201
pngread.c
201
pngread.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -22,7 +22,7 @@ png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
|
return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
|
||||||
warn_fn, NULL, NULL, NULL));
|
warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate create PNG structure for reading, and allocate any memory needed. */
|
/* Alternate create PNG structure for reading, and allocate any memory needed. */
|
||||||
@@ -45,14 +45,19 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
|
|
||||||
png_debug(1, "in png_create_read_struct\n");
|
png_debug(1, "in png_create_read_struct\n");
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
|
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
|
||||||
(png_malloc_ptr)malloc_fn)) == NULL)
|
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
if ((png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG)) == NULL)
|
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
|
||||||
#endif
|
#endif
|
||||||
{
|
if (png_ptr == NULL)
|
||||||
return (png_structp)NULL;
|
return (NULL);
|
||||||
}
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
@@ -63,8 +68,14 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_ptr->zbuf=NULL;
|
png_ptr->zbuf=NULL;
|
||||||
png_destroy_struct(png_ptr);
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_structp)NULL;
|
png_destroy_struct_2((png_voidp)png_ptr,
|
||||||
|
(png_free_ptr)free_fn,
|
||||||
|
(png_voidp)mem_ptr);
|
||||||
|
#else
|
||||||
|
png_destroy_struct((png_voidp)png_ptr);
|
||||||
|
#endif
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||||
@@ -92,23 +103,27 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
* only check the first digit.
|
* only check the first digit.
|
||||||
*/
|
*/
|
||||||
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
|
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
|
||||||
|
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
|
||||||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
||||||
{
|
{
|
||||||
|
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||||
|
char msg[80];
|
||||||
|
if (user_png_ver)
|
||||||
|
{
|
||||||
|
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||||
|
user_png_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
|
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||||
|
png_libpng_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
png_ptr->flags=0;
|
||||||
|
#endif
|
||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"Incompatible libpng version in application and library");
|
"Incompatible libpng version in application and library");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Libpng 1.0.6 was not binary compatible, due to insertion of the
|
|
||||||
info_ptr->free_me member. Note to maintainer: this test can be
|
|
||||||
removed from version 2.0.0 and beyond because the previous test
|
|
||||||
would have already rejected it. */
|
|
||||||
|
|
||||||
if (user_png_ver[4] == '6' && user_png_ver[2] == '0' &&
|
|
||||||
user_png_ver[0] == '1' && user_png_ver[5] == '\0')
|
|
||||||
{
|
|
||||||
png_error(png_ptr,
|
|
||||||
"Application must be recompiled; version 1.0.6 was incompatible");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize zbuf - compression buffer */
|
/* initialize zbuf - compression buffer */
|
||||||
@@ -131,7 +146,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||||
|
|
||||||
png_set_read_fn(png_ptr, NULL, NULL);
|
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
|
||||||
|
|
||||||
return (png_ptr);
|
return (png_ptr);
|
||||||
}
|
}
|
||||||
@@ -144,18 +159,64 @@ void PNGAPI
|
|||||||
png_read_init(png_structp png_ptr)
|
png_read_init(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
/* We only come here via pre-1.0.7-compiled applications */
|
/* We only come here via pre-1.0.7-compiled applications */
|
||||||
png_read_init_2(png_ptr, "1.0.0", 10000, 10000);
|
png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef png_read_init_2
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||||
png_size_t png_struct_size, png_size_t png_info_size)
|
png_size_t png_struct_size, png_size_t png_info_size)
|
||||||
|
{
|
||||||
|
/* We only come here via pre-1.0.12-compiled applications */
|
||||||
|
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||||
|
if(sizeof(png_struct) > png_struct_size || sizeof(png_info) > png_info_size)
|
||||||
|
{
|
||||||
|
char msg[80];
|
||||||
|
png_ptr->warning_fn=NULL;
|
||||||
|
if (user_png_ver)
|
||||||
|
{
|
||||||
|
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||||
|
user_png_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
|
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||||
|
png_libpng_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if(sizeof(png_struct) > png_struct_size)
|
||||||
|
{
|
||||||
|
png_ptr->error_fn=NULL;
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
png_ptr->flags=0;
|
||||||
|
#endif
|
||||||
|
png_error(png_ptr,
|
||||||
|
"The png struct allocated by the application for reading is too small.");
|
||||||
|
}
|
||||||
|
if(sizeof(png_info) > png_info_size)
|
||||||
|
{
|
||||||
|
png_ptr->error_fn=NULL;
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
png_ptr->flags=0;
|
||||||
|
#endif
|
||||||
|
png_error(png_ptr,
|
||||||
|
"The info struct allocated by application for reading is too small.");
|
||||||
|
}
|
||||||
|
png_read_init_3(&png_ptr, user_png_ver, png_struct_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PNGAPI
|
||||||
|
png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||||
|
png_size_t png_struct_size)
|
||||||
{
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
jmp_buf tmp_jmp; /* to save current jump buffer */
|
jmp_buf tmp_jmp; /* to save current jump buffer */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
|
png_structp png_ptr=*ptr_ptr;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(user_png_ver[i] != png_libpng_ver[i])
|
if(user_png_ver[i] != png_libpng_ver[i])
|
||||||
@@ -163,28 +224,28 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||||||
#ifdef PNG_LEGACY_SUPPORTED
|
#ifdef PNG_LEGACY_SUPPORTED
|
||||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||||
#else
|
#else
|
||||||
png_ptr->error_fn=(png_error_ptr)NULL;
|
png_ptr->warning_fn=NULL;
|
||||||
png_error(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Application uses deprecated png_read_init() and must be recompiled.");
|
"Application uses deprecated png_read_init() and should be recompiled.");
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} while (png_libpng_ver[i++]);
|
} while (png_libpng_ver[i++]);
|
||||||
|
|
||||||
if(sizeof(png_struct) > png_struct_size ||
|
png_debug(1, "in png_read_init_3\n");
|
||||||
sizeof(png_info) > png_info_size)
|
|
||||||
{
|
|
||||||
png_ptr->error_fn=(png_error_ptr)NULL;
|
|
||||||
png_error(png_ptr,
|
|
||||||
"Application and library have different sized structs. Please recompile.");
|
|
||||||
}
|
|
||||||
|
|
||||||
png_debug(1, "in png_read_init_2\n");
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* save jump buffer and error functions */
|
/* save jump buffer and error functions */
|
||||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
|
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(sizeof(png_struct) > png_struct_size)
|
||||||
|
{
|
||||||
|
png_destroy_struct(png_ptr);
|
||||||
|
*ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
|
||||||
|
png_ptr = *ptr_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* reset all variables to 0 */
|
/* reset all variables to 0 */
|
||||||
png_memset(png_ptr, 0, sizeof (png_struct));
|
png_memset(png_ptr, 0, sizeof (png_struct));
|
||||||
|
|
||||||
@@ -213,7 +274,7 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||||
|
|
||||||
png_set_read_fn(png_ptr, NULL, NULL);
|
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the information before the actual image data. This has been
|
/* Read the information before the actual image data. This has been
|
||||||
@@ -246,6 +307,8 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
else
|
else
|
||||||
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
||||||
}
|
}
|
||||||
|
if (num_checked < 3)
|
||||||
|
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
@@ -319,6 +382,9 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name,
|
png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name,
|
||||||
length);
|
length);
|
||||||
|
|
||||||
|
if (length > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid chunk length.");
|
||||||
|
|
||||||
/* This should be a binary subdivision search or a hash for
|
/* This should be a binary subdivision search or a hash for
|
||||||
* matching the chunk name rather than a linear search.
|
* matching the chunk name rather than a linear search.
|
||||||
*/
|
*/
|
||||||
@@ -602,6 +668,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||||||
png_read_data(png_ptr, chunk_length, 4);
|
png_read_data(png_ptr, chunk_length, 4);
|
||||||
png_ptr->idat_size = png_get_uint_32(chunk_length);
|
png_ptr->idat_size = png_get_uint_32(chunk_length);
|
||||||
|
|
||||||
|
if (png_ptr->idat_size > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid chunk length.");
|
||||||
|
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
||||||
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||||
@@ -646,6 +715,15 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||||||
|
|
||||||
png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf,
|
png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf,
|
||||||
png_ptr->rowbytes + 1);
|
png_ptr->rowbytes + 1);
|
||||||
|
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||||
|
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
|
||||||
|
{
|
||||||
|
/* Intrapixel differencing */
|
||||||
|
png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (png_ptr->transformations)
|
if (png_ptr->transformations)
|
||||||
png_do_read_transformations(png_ptr);
|
png_do_read_transformations(png_ptr);
|
||||||
@@ -656,8 +734,11 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||||||
(png_ptr->transformations & PNG_INTERLACE))
|
(png_ptr->transformations & PNG_INTERLACE))
|
||||||
{
|
{
|
||||||
if (png_ptr->pass < 6)
|
if (png_ptr->pass < 6)
|
||||||
|
/* old interface (pre-1.0.9):
|
||||||
png_do_read_interlace(&(png_ptr->row_info),
|
png_do_read_interlace(&(png_ptr->row_info),
|
||||||
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
|
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
|
||||||
|
*/
|
||||||
|
png_do_read_interlace(png_ptr);
|
||||||
|
|
||||||
if (dsp_row != NULL)
|
if (dsp_row != NULL)
|
||||||
png_combine_row(png_ptr, dsp_row,
|
png_combine_row(png_ptr, dsp_row,
|
||||||
@@ -701,7 +782,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
|
* not called png_set_interlace_handling(), the display_row buffer will
|
||||||
* be ignored, so pass NULL to it.
|
* be ignored, so pass NULL to it.
|
||||||
*
|
*
|
||||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9beta2
|
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.13
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
@@ -728,14 +809,14 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
|||||||
for (i = 0; i < num_rows; i++)
|
for (i = 0; i < num_rows; i++)
|
||||||
{
|
{
|
||||||
png_bytep rptr = *rp;
|
png_bytep rptr = *rp;
|
||||||
png_read_row(png_ptr, rptr, NULL);
|
png_read_row(png_ptr, rptr, png_bytep_NULL);
|
||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
else if(dp != NULL)
|
else if(dp != NULL)
|
||||||
for (i = 0; i < num_rows; i++)
|
for (i = 0; i < num_rows; i++)
|
||||||
{
|
{
|
||||||
png_bytep dptr = *dp;
|
png_bytep dptr = *dp;
|
||||||
png_read_row(png_ptr, NULL, dptr);
|
png_read_row(png_ptr, png_bytep_NULL, dptr);
|
||||||
dp++;
|
dp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -750,7 +831,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
|||||||
* only call this function once. If you desire to have an image for
|
* only call this function once. If you desire to have an image for
|
||||||
* each pass of a interlaced image, use png_read_rows() instead.
|
* each pass of a interlaced image, use png_read_rows() instead.
|
||||||
*
|
*
|
||||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.9beta2
|
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.13
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||||
@@ -780,7 +861,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
|
|||||||
rp = image;
|
rp = image;
|
||||||
for (i = 0; i < image_height; i++)
|
for (i = 0; i < image_height; i++)
|
||||||
{
|
{
|
||||||
png_read_row(png_ptr, *rp, NULL);
|
png_read_row(png_ptr, *rp, png_bytep_NULL);
|
||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -868,6 +949,9 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name);
|
png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name);
|
||||||
|
|
||||||
|
if (length > PNG_MAX_UINT)
|
||||||
|
png_error(png_ptr, "Invalid chunk length.");
|
||||||
|
|
||||||
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
|
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
|
||||||
png_handle_IHDR(png_ptr, info_ptr, length);
|
png_handle_IHDR(png_ptr, info_ptr, length);
|
||||||
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
|
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
|
||||||
@@ -980,6 +1064,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
|
|||||||
png_infop info_ptr = NULL, end_info_ptr = NULL;
|
png_infop info_ptr = NULL, end_info_ptr = NULL;
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_free_ptr free_fn = NULL;
|
png_free_ptr free_fn = NULL;
|
||||||
|
png_voidp mem_ptr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(1, "in png_destroy_read_struct\n");
|
png_debug(1, "in png_destroy_read_struct\n");
|
||||||
@@ -995,6 +1080,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
|
|||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
free_fn = png_ptr->free_fn;
|
free_fn = png_ptr->free_fn;
|
||||||
|
mem_ptr = png_ptr->mem_ptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_read_destroy(png_ptr, info_ptr, end_info_ptr);
|
png_read_destroy(png_ptr, info_ptr, end_info_ptr);
|
||||||
@@ -1006,11 +1092,12 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)info_ptr, free_fn);
|
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
|
||||||
|
(png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
png_destroy_struct((png_voidp)info_ptr);
|
png_destroy_struct((png_voidp)info_ptr);
|
||||||
#endif
|
#endif
|
||||||
*info_ptr_ptr = (png_infop)NULL;
|
*info_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end_info_ptr != NULL)
|
if (end_info_ptr != NULL)
|
||||||
@@ -1019,26 +1106,28 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
|
|||||||
png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);
|
png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)end_info_ptr, free_fn);
|
png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn,
|
||||||
|
(png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
png_destroy_struct((png_voidp)end_info_ptr);
|
png_destroy_struct((png_voidp)end_info_ptr);
|
||||||
#endif
|
#endif
|
||||||
*end_info_ptr_ptr = (png_infop)NULL;
|
*end_info_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)png_ptr, free_fn);
|
png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
|
||||||
|
(png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
png_destroy_struct((png_voidp)png_ptr);
|
png_destroy_struct((png_voidp)png_ptr);
|
||||||
#endif
|
#endif
|
||||||
*png_ptr_ptr = (png_structp)NULL;
|
*png_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free all memory used by the read (old method) */
|
/* free all memory used by the read (old method) */
|
||||||
void PNGAPI
|
void /* PRIVATE */
|
||||||
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
|
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
@@ -1060,7 +1149,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
|
|||||||
png_info_destroy(png_ptr, end_info_ptr);
|
png_info_destroy(png_ptr, end_info_ptr);
|
||||||
|
|
||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_free(png_ptr, png_ptr->row_buf);
|
png_free(png_ptr, png_ptr->big_row_buf);
|
||||||
png_free(png_ptr, png_ptr->prev_row);
|
png_free(png_ptr, png_ptr->prev_row);
|
||||||
#if defined(PNG_READ_DITHER_SUPPORTED)
|
#if defined(PNG_READ_DITHER_SUPPORTED)
|
||||||
png_free(png_ptr, png_ptr->palette_lookup);
|
png_free(png_ptr, png_ptr->palette_lookup);
|
||||||
@@ -1291,7 +1380,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
/* Optional call to gamma correct and add the background to the palette
|
/* Optional call to gamma correct and add the background to the palette
|
||||||
* and update info structure. REQUIRED if you are expecting libpng to
|
* and update info structure. REQUIRED if you are expecting libpng to
|
||||||
* update the palette for you (ie you selected such a transform above).
|
* update the palette for you (i.e., you selected such a transform above).
|
||||||
*/
|
*/
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
@@ -1303,13 +1392,15 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if(info_ptr->row_pointers == NULL)
|
if(info_ptr->row_pointers == NULL)
|
||||||
{
|
{
|
||||||
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
||||||
info_ptr->height * sizeof(png_bytep));
|
info_ptr->height * sizeof(png_bytep));
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
info_ptr->free_me |= PNG_FREE_ROWS;
|
info_ptr->free_me |= PNG_FREE_ROWS;
|
||||||
#endif
|
#endif
|
||||||
for (row = 0; row < (int)info_ptr->height; row++)
|
for (row = 0; row < (int)info_ptr->height; row++)
|
||||||
info_ptr->row_pointers[row] = png_malloc(png_ptr,
|
{
|
||||||
|
info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
|
||||||
png_get_rowbytes(png_ptr, info_ptr));
|
png_get_rowbytes(png_ptr, info_ptr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
png_read_image(png_ptr, info_ptr->row_pointers);
|
png_read_image(png_ptr, info_ptr->row_pointers);
|
||||||
@@ -1318,7 +1409,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
||||||
png_read_end(png_ptr, info_ptr);
|
png_read_end(png_ptr, info_ptr);
|
||||||
|
|
||||||
if(transforms == 0 || params == (voidp)NULL)
|
if(transforms == 0 || params == NULL)
|
||||||
/* quiet compiler warnings */ return;
|
/* quiet compiler warnings */ return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
9
pngrio.c
9
pngrio.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_debug1(4,"reading %d bytes\n", length);
|
png_debug1(4,"reading %d bytes\n", (int)length);
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||||
else
|
else
|
||||||
@@ -140,7 +140,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
if (read_data_fn != NULL)
|
if (read_data_fn != NULL)
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
else
|
else
|
||||||
png_ptr->read_data_fn = png_default_read_data;
|
png_ptr->read_data_fn = (png_rw_ptr)png_default_read_data;
|
||||||
#else
|
#else
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
#endif
|
#endif
|
||||||
@@ -159,4 +159,3 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
181
pngrtran.c
181
pngrtran.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -510,13 +510,19 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
* only do transformations on images where the file_gamma and screen_gamma
|
* only do transformations on images where the file_gamma and screen_gamma
|
||||||
* are not close reciprocals, otherwise it slows things down slightly, and
|
* are not close reciprocals, otherwise it slows things down slightly, and
|
||||||
* also needlessly introduces small errors.
|
* also needlessly introduces small errors.
|
||||||
|
*
|
||||||
|
* We will turn off gamma transformation later if no semitransparent entries
|
||||||
|
* are present in the tRNS array for palette images. We can't do it here
|
||||||
|
* because we don't necessarily have the tRNS chunk yet.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
|
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_gamma\n");
|
png_debug(1, "in png_set_gamma\n");
|
||||||
if (fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD)
|
if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
|
||||||
png_ptr->transformations |= PNG_GAMMA;
|
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
|
||||||
|
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
|
||||||
|
png_ptr->transformations |= PNG_GAMMA;
|
||||||
png_ptr->gamma = (float)file_gamma;
|
png_ptr->gamma = (float)file_gamma;
|
||||||
png_ptr->screen_gamma = (float)scrn_gamma;
|
png_ptr->screen_gamma = (float)scrn_gamma;
|
||||||
}
|
}
|
||||||
@@ -692,23 +698,23 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
png_ptr->background.gray *= (png_uint_16)0xff;
|
png_ptr->background.gray *= (png_uint_16)0xff;
|
||||||
png_ptr->background.red = png_ptr->background.green =
|
png_ptr->background.red = png_ptr->background.green
|
||||||
png_ptr->background.blue = png_ptr->background.gray;
|
= png_ptr->background.blue = png_ptr->background.gray;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
png_ptr->background.gray *= (png_uint_16)0x55;
|
png_ptr->background.gray *= (png_uint_16)0x55;
|
||||||
png_ptr->background.red = png_ptr->background.green =
|
png_ptr->background.red = png_ptr->background.green
|
||||||
png_ptr->background.blue = png_ptr->background.gray;
|
= png_ptr->background.blue = png_ptr->background.gray;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
png_ptr->background.gray *= (png_uint_16)0x11;
|
png_ptr->background.gray *= (png_uint_16)0x11;
|
||||||
png_ptr->background.red = png_ptr->background.green =
|
png_ptr->background.red = png_ptr->background.green
|
||||||
png_ptr->background.blue = png_ptr->background.gray;
|
= png_ptr->background.blue = png_ptr->background.gray;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
case 16:
|
case 16:
|
||||||
png_ptr->background.red = png_ptr->background.green =
|
png_ptr->background.red = png_ptr->background.green
|
||||||
png_ptr->background.blue = png_ptr->background.gray;
|
= png_ptr->background.blue = png_ptr->background.gray;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -742,10 +748,26 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
png_ptr->background_1 = png_ptr->background;
|
png_ptr->background_1 = png_ptr->background;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||||
|
|
||||||
|
if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0)
|
||||||
|
&& (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0)
|
||||||
|
< PNG_GAMMA_THRESHOLD))
|
||||||
|
{
|
||||||
|
int i,k;
|
||||||
|
k=0;
|
||||||
|
for (i=0; i<png_ptr->num_trans; i++)
|
||||||
|
{
|
||||||
|
if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff)
|
||||||
|
k=1; /* partial transparency is present */
|
||||||
|
}
|
||||||
|
if (k == 0)
|
||||||
|
png_ptr->transformations &= (~PNG_GAMMA);
|
||||||
|
}
|
||||||
|
|
||||||
if (png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY))
|
if (png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY))
|
||||||
{
|
{
|
||||||
png_build_gamma_table(png_ptr);
|
png_build_gamma_table(png_ptr);
|
||||||
@@ -754,6 +776,8 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
|
/* could skip if no transparency and
|
||||||
|
*/
|
||||||
png_color back, back_1;
|
png_color back, back_1;
|
||||||
png_colorp palette = png_ptr->palette;
|
png_colorp palette = png_ptr->palette;
|
||||||
int num_palette = png_ptr->num_palette;
|
int num_palette = png_ptr->num_palette;
|
||||||
@@ -873,9 +897,16 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
png_ptr->background_1.gray = (png_uint_16)(pow(
|
||||||
|
(double)png_ptr->background.gray / m, g) * m + .5);
|
||||||
|
png_ptr->background.gray = (png_uint_16)(pow(
|
||||||
|
(double)png_ptr->background.gray / m, gs) * m + .5);
|
||||||
|
|
||||||
|
if ((png_ptr->background.red != png_ptr->background.green) ||
|
||||||
|
(png_ptr->background.red != png_ptr->background.blue) ||
|
||||||
|
(png_ptr->background.red != png_ptr->background.gray))
|
||||||
{
|
{
|
||||||
/* RGB or RGBA */
|
/* RGB or RGBA with color background */
|
||||||
png_ptr->background_1.red = (png_uint_16)(pow(
|
png_ptr->background_1.red = (png_uint_16)(pow(
|
||||||
(double)png_ptr->background.red / m, g) * m + .5);
|
(double)png_ptr->background.red / m, g) * m + .5);
|
||||||
png_ptr->background_1.green = (png_uint_16)(pow(
|
png_ptr->background_1.green = (png_uint_16)(pow(
|
||||||
@@ -891,17 +922,17 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* GRAY or GRAY ALPHA */
|
/* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */
|
||||||
png_ptr->background_1.gray = (png_uint_16)(pow(
|
png_ptr->background_1.red = png_ptr->background_1.green
|
||||||
(double)png_ptr->background.gray / m, g) * m + .5);
|
= png_ptr->background_1.blue = png_ptr->background_1.gray;
|
||||||
png_ptr->background.gray = (png_uint_16)(pow(
|
png_ptr->background.red = png_ptr->background.green
|
||||||
(double)png_ptr->background.gray / m, gs) * m + .5);
|
= png_ptr->background.blue = png_ptr->background.gray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* transformation does not include PNG_BACKGROUND */
|
/* transformation does not include PNG_BACKGROUND */
|
||||||
#endif
|
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
png_colorp palette = png_ptr->palette;
|
png_colorp palette = png_ptr->palette;
|
||||||
@@ -919,7 +950,7 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
/* No GAMMA transformation */
|
/* No GAMMA transformation */
|
||||||
if ((png_ptr->transformations & PNG_BACKGROUND) &&
|
if ((png_ptr->transformations & PNG_BACKGROUND) &&
|
||||||
@@ -952,7 +983,7 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED)
|
#if defined(PNG_READ_SHIFT_SUPPORTED)
|
||||||
if ((png_ptr->transformations & PNG_SHIFT) &&
|
if ((png_ptr->transformations & PNG_SHIFT) &&
|
||||||
@@ -977,7 +1008,7 @@ png_init_read_transformations(png_structp png_ptr)
|
|||||||
png_ptr->palette[i].blue >>= sb;
|
png_ptr->palette[i].blue >>= sb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PNG_READ_SHIFT_SUPPORTED */
|
||||||
}
|
}
|
||||||
#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \
|
#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \
|
||||||
&& !defined(PNG_READ_BACKGROUND_SUPPORTED)
|
&& !defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
@@ -1227,12 +1258,15 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
|||||||
((png_ptr->num_trans != 0 ) ||
|
((png_ptr->num_trans != 0 ) ||
|
||||||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA)))
|
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA)))
|
||||||
png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
||||||
&(png_ptr->trans_values), &(png_ptr->background),
|
&(png_ptr->trans_values), &(png_ptr->background)
|
||||||
&(png_ptr->background_1),
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
|
, &(png_ptr->background_1),
|
||||||
png_ptr->gamma_table, png_ptr->gamma_from_1,
|
png_ptr->gamma_table, png_ptr->gamma_from_1,
|
||||||
png_ptr->gamma_to_1, png_ptr->gamma_16_table,
|
png_ptr->gamma_to_1, png_ptr->gamma_16_table,
|
||||||
png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1,
|
png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1,
|
||||||
png_ptr->gamma_shift);
|
png_ptr->gamma_shift
|
||||||
|
#endif
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
@@ -2312,7 +2346,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
|||||||
* paletted. Most useful for gamma correction and simplification
|
* paletted. Most useful for gamma correction and simplification
|
||||||
* of code.
|
* of code.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void PNGAPI
|
||||||
png_build_grayscale_palette(int bit_depth, png_colorp palette)
|
png_build_grayscale_palette(int bit_depth, png_colorp palette)
|
||||||
{
|
{
|
||||||
int num_palette;
|
int num_palette;
|
||||||
@@ -2545,11 +2579,14 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
|
|||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_background(png_row_infop row_info, png_bytep row,
|
png_do_background(png_row_infop row_info, png_bytep row,
|
||||||
png_color_16p trans_values, png_color_16p background,
|
png_color_16p trans_values, png_color_16p background
|
||||||
png_color_16p background_1,
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
|
, png_color_16p background_1,
|
||||||
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
|
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
|
||||||
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
|
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
|
||||||
png_uint_16pp gamma_16_to_1, int gamma_shift)
|
png_uint_16pp gamma_16_to_1, int gamma_shift
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
@@ -2932,6 +2969,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
{
|
{
|
||||||
*dp = *sp;
|
*dp = *sp;
|
||||||
}
|
}
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
else if (a == 0)
|
else if (a == 0)
|
||||||
{
|
{
|
||||||
*dp = (png_byte)background->gray;
|
*dp = (png_byte)background->gray;
|
||||||
@@ -2940,6 +2978,9 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
{
|
{
|
||||||
png_composite(*dp, *sp, a, background_1->gray);
|
png_composite(*dp, *sp, a, background_1->gray);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
*dp = (png_byte)background->gray;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2963,12 +3004,17 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
*dp = (png_byte)((v >> 8) & 0xff);
|
*dp = (png_byte)((v >> 8) & 0xff);
|
||||||
*(dp + 1) = (png_byte)(v & 0xff);
|
*(dp + 1) = (png_byte)(v & 0xff);
|
||||||
}
|
}
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
else if (a == 0)
|
else if (a == 0)
|
||||||
|
#else
|
||||||
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/* background is already in screen gamma */
|
/* background is already in screen gamma */
|
||||||
*dp = (png_byte)((background->gray >> 8) & 0xff);
|
*dp = (png_byte)((background->gray >> 8) & 0xff);
|
||||||
*(dp + 1) = (png_byte)(background->gray & 0xff);
|
*(dp + 1) = (png_byte)(background->gray & 0xff);
|
||||||
}
|
}
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_uint_16 g, v, w;
|
png_uint_16 g, v, w;
|
||||||
@@ -2979,6 +3025,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
*dp = (png_byte)((w >> 8) & 0xff);
|
*dp = (png_byte)((w >> 8) & 0xff);
|
||||||
*(dp + 1) = (png_byte)(w & 0xff);
|
*(dp + 1) = (png_byte)(w & 0xff);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2993,11 +3040,16 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
{
|
{
|
||||||
png_memcpy(dp, sp, 2);
|
png_memcpy(dp, sp, 2);
|
||||||
}
|
}
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
else if (a == 0)
|
else if (a == 0)
|
||||||
|
#else
|
||||||
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
*dp = (png_byte)((background->gray >> 8) & 0xff);
|
*dp = (png_byte)((background->gray >> 8) & 0xff);
|
||||||
*(dp + 1) = (png_byte)(background->gray & 0xff);
|
*(dp + 1) = (png_byte)(background->gray & 0xff);
|
||||||
}
|
}
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_uint_16 g, v;
|
png_uint_16 g, v;
|
||||||
@@ -3007,6 +3059,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
*dp = (png_byte)((v >> 8) & 0xff);
|
*dp = (png_byte)((v >> 8) & 0xff);
|
||||||
*(dp + 1) = (png_byte)(v & 0xff);
|
*(dp + 1) = (png_byte)(v & 0xff);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3128,17 +3181,17 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
|||||||
png_uint_16 v, w, x;
|
png_uint_16 v, w, x;
|
||||||
|
|
||||||
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
|
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
|
||||||
png_composite_16(w, v, a, background->red);
|
png_composite_16(w, v, a, background_1->red);
|
||||||
x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
|
x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
|
||||||
*dp = (png_byte)((x >> 8) & 0xff);
|
*dp = (png_byte)((x >> 8) & 0xff);
|
||||||
*(dp + 1) = (png_byte)(x & 0xff);
|
*(dp + 1) = (png_byte)(x & 0xff);
|
||||||
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
|
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
|
||||||
png_composite_16(w, v, a, background->green);
|
png_composite_16(w, v, a, background_1->green);
|
||||||
x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
|
x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
|
||||||
*(dp + 2) = (png_byte)((x >> 8) & 0xff);
|
*(dp + 2) = (png_byte)((x >> 8) & 0xff);
|
||||||
*(dp + 3) = (png_byte)(x & 0xff);
|
*(dp + 3) = (png_byte)(x & 0xff);
|
||||||
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
|
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
|
||||||
png_composite_16(w, v, a, background->blue);
|
png_composite_16(w, v, a, background_1->blue);
|
||||||
x = gamma_16_from_1[(w & 0xff) >> gamma_shift][w >> 8];
|
x = gamma_16_from_1[(w & 0xff) >> gamma_shift][w >> 8];
|
||||||
*(dp + 4) = (png_byte)((x >> 8) & 0xff);
|
*(dp + 4) = (png_byte)((x >> 8) & 0xff);
|
||||||
*(dp + 5) = (png_byte)(x & 0xff);
|
*(dp + 5) = (png_byte)(x & 0xff);
|
||||||
@@ -4053,3 +4106,63 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
/* To do: install integer version of png_build_gamma_table here */
|
/* To do: install integer version of png_build_gamma_table here */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
/* undoes intrapixel differencing */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_do_read_intrapixel\n");
|
||||||
|
if (
|
||||||
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
|
{
|
||||||
|
int bytes_per_pixel;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
png_bytep rp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
bytes_per_pixel = 3;
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
bytes_per_pixel = 4;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
|
{
|
||||||
|
*(rp) = (png_byte)((256 + *rp + *(rp+1))&0xff);
|
||||||
|
*(rp+2) = (png_byte)((256 + *(rp+2) + *(rp+1))&0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row_info->bit_depth == 16)
|
||||||
|
{
|
||||||
|
png_bytep rp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
bytes_per_pixel = 6;
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
bytes_per_pixel = 8;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
|
{
|
||||||
|
png_uint_32 s0=*(rp )<<8 | *(rp+1);
|
||||||
|
png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
|
||||||
|
png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
|
||||||
|
png_uint_32 red=(65536+s0+s1)&0xffff;
|
||||||
|
png_uint_32 blue=(65536+s2+s1)&0xffff;
|
||||||
|
*(rp ) = (png_byte)((red>>8)&0xff);
|
||||||
|
*(rp+1) = (png_byte)(red&0xff);
|
||||||
|
*(rp+4) = (png_byte)((blue>>8)&0xff);
|
||||||
|
*(rp+5) = (png_byte)(blue&0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||||
|
|||||||
298
pngrutil.c
298
pngrutil.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@ __inline double strtod(const char *nptr, char **endptr)
|
|||||||
MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len);
|
MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len);
|
||||||
result = wcstod(str, &end);
|
result = wcstod(str, &end);
|
||||||
len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL);
|
len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL);
|
||||||
*endptr = (char *)nptr + (strlen(nptr) - len + 1);
|
*endptr = (char *)nptr + (png_strlen(nptr) - len + 1);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -174,7 +174,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
png_charp text = NULL;
|
png_charp text = NULL;
|
||||||
png_size_t text_size;
|
png_size_t text_size;
|
||||||
|
|
||||||
if (comp_type == PNG_TEXT_COMPRESSION_zTXt)
|
if (comp_type == PNG_COMPRESSION_TYPE_BASE)
|
||||||
{
|
{
|
||||||
int ret = Z_OK;
|
int ret = Z_OK;
|
||||||
png_ptr->zstream.next_in = (png_bytep)(chunkdata + prefix_size);
|
png_ptr->zstream.next_in = (png_bytep)(chunkdata + prefix_size);
|
||||||
@@ -220,7 +220,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||||
text = (png_charp)png_malloc(png_ptr, text_size + 1);
|
text = (png_charp)png_malloc(png_ptr, text_size + 1);
|
||||||
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
||||||
text_size - prefix_size);
|
text_size - prefix_size);
|
||||||
png_memcpy(text, chunkdata, prefix_size);
|
png_memcpy(text, chunkdata, prefix_size);
|
||||||
*(text + text_size) = 0x00;
|
*(text + text_size) = 0x00;
|
||||||
}
|
}
|
||||||
@@ -266,6 +266,13 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Incomplete compressed datastream in chunk other than IDAT");
|
"Incomplete compressed datastream in chunk other than IDAT");
|
||||||
#endif
|
#endif
|
||||||
|
text_size=prefix_size;
|
||||||
|
if (text == NULL)
|
||||||
|
{
|
||||||
|
text = (png_charp)png_malloc(png_ptr, text_size+1);
|
||||||
|
png_memcpy(text, chunkdata, prefix_size);
|
||||||
|
}
|
||||||
|
*(text + text_size) = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
inflateReset(&png_ptr->zstream);
|
inflateReset(&png_ptr->zstream);
|
||||||
@@ -275,7 +282,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
chunkdata = text;
|
chunkdata = text;
|
||||||
*newlength=text_size;
|
*newlength=text_size;
|
||||||
}
|
}
|
||||||
else /* if (comp_type != PNG_TEXT_COMPRESSION_zTXt) */
|
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
|
||||||
{
|
{
|
||||||
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||||
char umsg[50];
|
char umsg[50];
|
||||||
@@ -286,10 +293,8 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
png_warning(png_ptr, "Unknown zTXt compression type");
|
png_warning(png_ptr, "Unknown zTXt compression type");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Copy what we can of the error message into the text chunk */
|
*(chunkdata + prefix_size) = 0x00;
|
||||||
text_size = (png_size_t)(chunklength - (text - chunkdata));
|
*newlength=prefix_size;
|
||||||
text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
|
|
||||||
png_memcpy(text, msg, text_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunkdata;
|
return chunkdata;
|
||||||
@@ -327,34 +332,6 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
filter_type = buf[11];
|
filter_type = buf[11];
|
||||||
interlace_type = buf[12];
|
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 (filter_type != PNG_FILTER_TYPE_BASE)
|
|
||||||
png_error(png_ptr, "Unknown filter method in IHDR");
|
|
||||||
|
|
||||||
/* set internal variables */
|
/* set internal variables */
|
||||||
png_ptr->width = width;
|
png_ptr->width = width;
|
||||||
@@ -362,6 +339,9 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_ptr->bit_depth = (png_byte)bit_depth;
|
png_ptr->bit_depth = (png_byte)bit_depth;
|
||||||
png_ptr->interlaced = (png_byte)interlace_type;
|
png_ptr->interlaced = (png_byte)interlace_type;
|
||||||
png_ptr->color_type = (png_byte)color_type;
|
png_ptr->color_type = (png_byte)color_type;
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
png_ptr->filter_type = (png_byte)filter_type;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* find number of channels */
|
/* find number of channels */
|
||||||
switch (png_ptr->color_type)
|
switch (png_ptr->color_type)
|
||||||
@@ -397,7 +377,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
png_colorp palette;
|
png_color palette[PNG_MAX_PALETTE_LENGTH];
|
||||||
int num, i;
|
int num, i;
|
||||||
#ifndef PNG_NO_POINTER_INDEXING
|
#ifndef PNG_NO_POINTER_INDEXING
|
||||||
png_colorp pal_ptr;
|
png_colorp pal_ptr;
|
||||||
@@ -418,6 +398,13 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_ptr->mode |= PNG_HAVE_PLTE;
|
png_ptr->mode |= PNG_HAVE_PLTE;
|
||||||
|
|
||||||
|
if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring PLTE chunk in grayscale PNG");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
|
#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
|
||||||
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
@@ -426,7 +413,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (length > 768 || length % 3)
|
if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3)
|
||||||
{
|
{
|
||||||
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
@@ -442,8 +429,6 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
num = (int)length / 3;
|
num = (int)length / 3;
|
||||||
|
|
||||||
palette = (png_colorp)png_zalloc(png_ptr, (uInt)num, sizeof (png_color));
|
|
||||||
|
|
||||||
#ifndef PNG_NO_POINTER_INDEXING
|
#ifndef PNG_NO_POINTER_INDEXING
|
||||||
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
||||||
{
|
{
|
||||||
@@ -493,7 +478,6 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_chunk_warning(png_ptr, "CRC error");
|
png_chunk_warning(png_ptr, "CRC error");
|
||||||
png_zfree(png_ptr, palette);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,15 +488,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
png_ptr->palette = palette;
|
|
||||||
png_ptr->num_palette = (png_uint_16)num;
|
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
|
||||||
png_ptr->free_me |= PNG_FREE_PLTE;
|
|
||||||
#else
|
|
||||||
png_ptr->flags |= PNG_FLAG_FREE_PLTE;
|
|
||||||
#endif
|
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, num);
|
png_set_PLTE(png_ptr, info_ptr, palette, num);
|
||||||
|
|
||||||
#if defined(PNG_READ_tRNS_SUPPORTED)
|
#if defined(PNG_READ_tRNS_SUPPORTED)
|
||||||
@@ -545,9 +521,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
{
|
{
|
||||||
png_error(png_ptr, "No image in file");
|
png_error(png_ptr, "No image in file");
|
||||||
|
|
||||||
/* to quiet compiler warnings about unused info_ptr */
|
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
|
||||||
if (info_ptr == NULL)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
|
png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
|
||||||
@@ -608,7 +582,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);
|
igamma = (png_fixed_point)png_get_uint_32(buf);
|
||||||
/* check for zero gamma */
|
/* check for zero gamma */
|
||||||
if (igamma == 0)
|
if (igamma == 0)
|
||||||
return;
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring gAMA chunk with gamma=0");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
if (info_ptr->valid & PNG_INFO_sRGB)
|
if (info_ptr->valid & PNG_INFO_sRGB)
|
||||||
@@ -713,6 +691,8 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_fixed_point int_x_white, int_y_white, int_x_red, int_y_red, int_x_green,
|
png_fixed_point int_x_white, int_y_white, int_x_red, int_y_red, int_x_green,
|
||||||
int_y_green, int_x_blue, int_y_blue;
|
int_y_green, int_x_blue, int_y_blue;
|
||||||
|
|
||||||
|
png_uint_32 uint_x, uint_y;
|
||||||
|
|
||||||
png_debug(1, "in png_handle_cHRM\n");
|
png_debug(1, "in png_handle_cHRM\n");
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
@@ -746,60 +726,69 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_x_white = (png_fixed_point)png_get_uint_32(buf);
|
uint_x = png_get_uint_32(buf);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_y_white = (png_fixed_point)png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf);
|
||||||
|
|
||||||
if (int_x_white > 80000L || int_y_white > 80000L ||
|
if (uint_x > 80000L || uint_y > 80000L ||
|
||||||
int_x_white + int_y_white > 100000L)
|
uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM white point");
|
png_warning(png_ptr, "Invalid cHRM white point");
|
||||||
png_crc_finish(png_ptr, 24);
|
png_crc_finish(png_ptr, 24);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int_x_white = (png_fixed_point)uint_x;
|
||||||
|
int_y_white = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_x_red = (png_fixed_point)png_get_uint_32(buf);
|
uint_x = png_get_uint_32(buf);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_y_red = (png_fixed_point)png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf);
|
||||||
|
|
||||||
if (int_x_red > 80000L || int_y_red > 80000L ||
|
if (uint_x > 80000L || uint_y > 80000L ||
|
||||||
int_x_red + int_y_red > 100000L)
|
uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM red point");
|
png_warning(png_ptr, "Invalid cHRM red point");
|
||||||
png_crc_finish(png_ptr, 16);
|
png_crc_finish(png_ptr, 16);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int_x_red = (png_fixed_point)uint_x;
|
||||||
|
int_y_red = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_x_green = (png_fixed_point)png_get_uint_32(buf);
|
uint_x = png_get_uint_32(buf);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_y_green = (png_fixed_point)png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf);
|
||||||
|
|
||||||
if (int_x_green > 80000L || int_y_green > 80000L ||
|
if (uint_x > 80000L || uint_y > 80000L ||
|
||||||
int_x_green + int_y_green > 100000L)
|
uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM green point");
|
png_warning(png_ptr, "Invalid cHRM green point");
|
||||||
png_crc_finish(png_ptr, 8);
|
png_crc_finish(png_ptr, 8);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int_x_green = (png_fixed_point)uint_x;
|
||||||
|
int_y_green = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_x_blue = (png_fixed_point)png_get_uint_32(buf);
|
uint_x = png_get_uint_32(buf);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 4);
|
||||||
int_y_blue = (png_fixed_point)png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf);
|
||||||
|
|
||||||
if (int_x_blue > 80000L || int_y_blue > 80000L ||
|
if (uint_x > 80000L || uint_y > 80000L ||
|
||||||
int_x_blue + int_y_blue > 100000L)
|
uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM blue point");
|
png_warning(png_ptr, "Invalid cHRM blue point");
|
||||||
png_crc_finish(png_ptr, 0);
|
png_crc_finish(png_ptr, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int_x_blue = (png_fixed_point)uint_x;
|
||||||
|
int_y_blue = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
white_x = (float)int_x_white / (float)100000.0;
|
white_x = (float)int_x_white / (float)100000.0;
|
||||||
white_y = (float)int_y_white / (float)100000.0;
|
white_y = (float)int_y_white / (float)100000.0;
|
||||||
@@ -816,12 +805,12 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
{
|
{
|
||||||
if (abs(int_x_white - 31270L) > 1000 ||
|
if (abs(int_x_white - 31270L) > 1000 ||
|
||||||
abs(int_y_white - 32900L) > 1000 ||
|
abs(int_y_white - 32900L) > 1000 ||
|
||||||
abs( int_x_red - 64000L) > 1000 ||
|
abs(int_x_red - 64000L) > 1000 ||
|
||||||
abs( int_y_red - 33000L) > 1000 ||
|
abs(int_y_red - 33000L) > 1000 ||
|
||||||
abs(int_x_green - 30000L) > 1000 ||
|
abs(int_x_green - 30000L) > 1000 ||
|
||||||
abs(int_y_green - 60000L) > 1000 ||
|
abs(int_y_green - 60000L) > 1000 ||
|
||||||
abs( int_x_blue - 15000L) > 1000 ||
|
abs(int_x_blue - 15000L) > 1000 ||
|
||||||
abs( int_y_blue - 6000L) > 1000)
|
abs(int_y_blue - 6000L) > 1000)
|
||||||
{
|
{
|
||||||
|
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
@@ -916,17 +905,6 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
igamma=(int)(info_ptr->gamma * 100000.);
|
igamma=(int)(info_ptr->gamma * 100000.);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
|
||||||
#if 0 && defined(PNG_cHRM_SUPPORTED) && !defined(PNG_FIXED_POINT_SUPPORTED)
|
|
||||||
/* We need to define these here because they aren't in png.h */
|
|
||||||
png_fixed_point int_x_white;
|
|
||||||
png_fixed_point int_y_white;
|
|
||||||
png_fixed_point int_x_red;
|
|
||||||
png_fixed_point int_y_red;
|
|
||||||
png_fixed_point int_x_green;
|
|
||||||
png_fixed_point int_y_green;
|
|
||||||
png_fixed_point int_x_blue;
|
|
||||||
png_fixed_point int_y_blue;
|
|
||||||
#endif
|
#endif
|
||||||
if(igamma < 45000L || igamma > 46000L)
|
if(igamma < 45000L || igamma > 46000L)
|
||||||
{
|
{
|
||||||
@@ -950,12 +928,12 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
if (info_ptr->valid & PNG_INFO_cHRM)
|
if (info_ptr->valid & PNG_INFO_cHRM)
|
||||||
if (abs(info_ptr->int_x_white - 31270L) > 1000 ||
|
if (abs(info_ptr->int_x_white - 31270L) > 1000 ||
|
||||||
abs(info_ptr->int_y_white - 32900L) > 1000 ||
|
abs(info_ptr->int_y_white - 32900L) > 1000 ||
|
||||||
abs( info_ptr->int_x_red - 64000L) > 1000 ||
|
abs(info_ptr->int_x_red - 64000L) > 1000 ||
|
||||||
abs( info_ptr->int_y_red - 33000L) > 1000 ||
|
abs(info_ptr->int_y_red - 33000L) > 1000 ||
|
||||||
abs(info_ptr->int_x_green - 30000L) > 1000 ||
|
abs(info_ptr->int_x_green - 30000L) > 1000 ||
|
||||||
abs(info_ptr->int_y_green - 60000L) > 1000 ||
|
abs(info_ptr->int_y_green - 60000L) > 1000 ||
|
||||||
abs( info_ptr->int_x_blue - 15000L) > 1000 ||
|
abs(info_ptr->int_x_blue - 15000L) > 1000 ||
|
||||||
abs( info_ptr->int_y_blue - 6000L) > 1000)
|
abs(info_ptr->int_y_blue - 6000L) > 1000)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Ignoring incorrect cHRM value when sRGB is also present");
|
"Ignoring incorrect cHRM value when sRGB is also present");
|
||||||
@@ -974,6 +952,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
{
|
{
|
||||||
png_charp chunkdata;
|
png_charp chunkdata;
|
||||||
png_byte compression_type;
|
png_byte compression_type;
|
||||||
|
png_bytep pC;
|
||||||
png_charp profile;
|
png_charp profile;
|
||||||
png_uint_32 skip = 0;
|
png_uint_32 skip = 0;
|
||||||
png_uint_32 profile_size = 0;
|
png_uint_32 profile_size = 0;
|
||||||
@@ -1050,22 +1029,33 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
slength, prefix_length, &data_length);
|
slength, prefix_length, &data_length);
|
||||||
|
|
||||||
profile_length = data_length - prefix_length;
|
profile_length = data_length - prefix_length;
|
||||||
profile_size = ((*(chunkdata+prefix_length))<<24) |
|
|
||||||
((*(chunkdata+prefix_length+1))<<16) |
|
if ( prefix_length > data_length || profile_length < 4)
|
||||||
((*(chunkdata+prefix_length+2))<< 8) |
|
{
|
||||||
((*(chunkdata+prefix_length+3)) );
|
png_free(png_ptr, chunkdata);
|
||||||
|
png_warning(png_ptr, "Profile size field missing from iCCP chunk");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the profile_size recorded in the first 32 bits of the ICC profile */
|
||||||
|
pC = (png_bytep)(chunkdata+prefix_length);
|
||||||
|
profile_size = ((*(pC ))<<24) |
|
||||||
|
((*(pC+1))<<16) |
|
||||||
|
((*(pC+2))<< 8) |
|
||||||
|
((*(pC+3)) );
|
||||||
|
|
||||||
if(profile_size < profile_length)
|
if(profile_size < profile_length)
|
||||||
profile_length = profile_size;
|
profile_length = profile_size;
|
||||||
|
|
||||||
if(profile_size > profile_length)
|
if(profile_size > profile_length)
|
||||||
{
|
{
|
||||||
|
png_free(png_ptr, chunkdata);
|
||||||
png_warning(png_ptr, "Ignoring truncated iCCP profile.\n");
|
png_warning(png_ptr, "Ignoring truncated iCCP profile.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type,
|
png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type,
|
||||||
chunkdata + prefix_length, data_length-prefix_length);
|
chunkdata + prefix_length, profile_length);
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_iCCP_SUPPORTED */
|
#endif /* PNG_READ_iCCP_SUPPORTED */
|
||||||
@@ -1107,7 +1097,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
chunkdata = (png_bytep)png_malloc(png_ptr, length + 1);
|
chunkdata = (png_bytep)png_malloc(png_ptr, length + 1);
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, chunkdata, slength);
|
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||||
|
|
||||||
if (png_crc_finish(png_ptr, skip))
|
if (png_crc_finish(png_ptr, skip))
|
||||||
{
|
{
|
||||||
@@ -1137,7 +1127,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
if (data_length % entry_size)
|
if (data_length % entry_size)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
png_error(png_ptr, "sPLT chunk has bad length");
|
png_warning(png_ptr, "sPLT chunk has bad length");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_palette.nentries = data_length / entry_size;
|
new_palette.nentries = data_length / entry_size;
|
||||||
@@ -1202,6 +1193,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
|
png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
|
||||||
|
|
||||||
png_debug(1, "in png_handle_tRNS\n");
|
png_debug(1, "in png_handle_tRNS\n");
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||||
@@ -1239,8 +1232,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->trans = (png_bytep)png_malloc(png_ptr, length);
|
png_crc_read(png_ptr, readbuf, (png_size_t)length);
|
||||||
png_crc_read(png_ptr, png_ptr->trans, (png_size_t)length);
|
|
||||||
png_ptr->num_trans = (png_uint_16)length;
|
png_ptr->num_trans = (png_uint_16)length;
|
||||||
}
|
}
|
||||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
@@ -1285,15 +1277,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
if (png_crc_finish(png_ptr, 0))
|
if (png_crc_finish(png_ptr, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
|
||||||
png_ptr->free_me |= PNG_FREE_TRNS;
|
|
||||||
#else
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
|
||||||
png_ptr->flags |= PNG_FLAG_FREE_TRNS;
|
|
||||||
#endif
|
|
||||||
png_set_tRNS(png_ptr, info_ptr, png_ptr->trans, png_ptr->num_trans,
|
|
||||||
&(png_ptr->trans_values));
|
&(png_ptr->trans_values));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1392,6 +1376,7 @@ void /* PRIVATE */
|
|||||||
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
int num, i;
|
int num, i;
|
||||||
|
png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
|
||||||
|
|
||||||
png_debug(1, "in png_handle_hIST\n");
|
png_debug(1, "in png_handle_hIST\n");
|
||||||
|
|
||||||
@@ -1416,34 +1401,26 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length != (png_uint_32)(2 * png_ptr->num_palette))
|
num = (int)length / 2 ;
|
||||||
|
if (num != png_ptr->num_palette)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Incorrect hIST chunk length");
|
png_warning(png_ptr, "Incorrect hIST chunk length");
|
||||||
png_crc_finish(png_ptr, length);
|
png_crc_finish(png_ptr, length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = (int)length / 2 ;
|
|
||||||
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
|
|
||||||
(png_uint_32)(num * sizeof (png_uint_16)));
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
png_byte buf[2];
|
png_byte buf[2];
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 2);
|
png_crc_read(png_ptr, buf, 2);
|
||||||
png_ptr->hist[i] = png_get_uint_16(buf);
|
readbuf[i] = png_get_uint_16(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_crc_finish(png_ptr, 0))
|
if (png_crc_finish(png_ptr, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
png_set_hIST(png_ptr, info_ptr, readbuf);
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
|
||||||
png_ptr->free_me |= PNG_FREE_HIST;
|
|
||||||
#else
|
|
||||||
png_ptr->flags |= PNG_FLAG_FREE_HIST;
|
|
||||||
#endif
|
|
||||||
png_set_hIST(png_ptr, info_ptr, png_ptr->hist);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1708,8 +1685,8 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
swidth = (png_charp)png_malloc(png_ptr, strlen(ep) + 1);
|
swidth = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
||||||
png_memcpy(swidth, ep, (png_size_t)strlen(ep));
|
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1726,8 +1703,8 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
sheight = (png_charp)png_malloc(png_ptr, strlen(ep) + 1);
|
sheight = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
||||||
png_memcpy(sheight, ep, (png_size_t)strlen(ep));
|
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1900,7 +1877,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||||
if (png_crc_finish(png_ptr, 0))
|
if (png_crc_finish(png_ptr, 0))
|
||||||
{
|
{
|
||||||
@@ -1922,6 +1899,11 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
comp_type = *(++text);
|
comp_type = *(++text);
|
||||||
|
if (comp_type != PNG_TEXT_COMPRESSION_zTXt)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Unknown compression type in zTXt chunk");
|
||||||
|
comp_type = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
|
}
|
||||||
text++; /* skip the compression_method byte */
|
text++; /* skip the compression_method byte */
|
||||||
}
|
}
|
||||||
prefix_len = text - chunkdata;
|
prefix_len = text - chunkdata;
|
||||||
@@ -2069,7 +2051,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||||
HANDLE_CHUNK_ALWAYS
|
HANDLE_CHUNK_ALWAYS
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
|
&& png_ptr->read_user_chunk_fn == NULL
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
@@ -2089,12 +2071,12 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
length = (png_uint_32)65535L;
|
length = (png_uint_32)65535L;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||||
png_crc_read(png_ptr, chunk.data, length);
|
chunk.size = (png_size_t)length;
|
||||||
chunk.size = length;
|
png_crc_read(png_ptr, (png_bytep)chunk.data, length);
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
|
if(png_ptr->read_user_chunk_fn != NULL)
|
||||||
{
|
{
|
||||||
/* callback to user unknown chunk handler */
|
/* callback to user unknown chunk handler */
|
||||||
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
|
||||||
@@ -2118,8 +2100,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_crc_finish(png_ptr, skip);
|
png_crc_finish(png_ptr, skip);
|
||||||
|
|
||||||
#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
if (info_ptr == NULL)
|
info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
|
||||||
/* quiet compiler warnings about unused info_ptr */ ;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2152,13 +2133,9 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
|
|||||||
a zero indicates the pixel is to be skipped. This is in addition
|
a zero indicates the pixel is to be skipped. This is in addition
|
||||||
to any alpha or transparency value associated with the pixel. If
|
to any alpha or transparency value associated with the pixel. If
|
||||||
you want all pixels to be combined, pass 0xff (255) in mask. */
|
you want all pixels to be combined, pass 0xff (255) in mask. */
|
||||||
|
#ifndef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
||||||
png_combine_row_c
|
|
||||||
#else
|
|
||||||
png_combine_row
|
|
||||||
#endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */
|
|
||||||
(png_structp png_ptr, png_bytep row, int mask)
|
|
||||||
{
|
{
|
||||||
png_debug(1,"in png_combine_row\n");
|
png_debug(1,"in png_combine_row\n");
|
||||||
if (mask == 0xff)
|
if (mask == 0xff)
|
||||||
@@ -2358,25 +2335,28 @@ png_combine_row
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* !PNG_HAVE_ASSEMBLER_COMBINE_ROW */
|
||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED)
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
void /* PRIVATE */
|
#ifndef PNG_HAVE_ASSEMBLER_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */
|
||||||
#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
/* OLD pre-1.0.9 interface:
|
||||||
png_do_read_interlace_c
|
void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||||
#else
|
|
||||||
png_do_read_interlace
|
|
||||||
#endif /* PNG_HAVE_ASSEMBLER_READ_INTERLACE */
|
|
||||||
(png_row_infop row_info, png_bytep row, int pass,
|
|
||||||
png_uint_32 transformations)
|
png_uint_32 transformations)
|
||||||
|
*/
|
||||||
|
void /* PRIVATE */
|
||||||
|
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;
|
||||||
|
png_uint_32 transformations = png_ptr->transformations;
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||||
|
|
||||||
/* offset to next interlace block */
|
/* offset to next interlace block */
|
||||||
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(1,"in png_do_read_interlace\n");
|
png_debug(1,"in png_do_read_interlace (stock C version)\n");
|
||||||
if (row != NULL && row_info != NULL)
|
if (row != NULL && row_info != NULL)
|
||||||
{
|
{
|
||||||
png_uint_32 final_width;
|
png_uint_32 final_width;
|
||||||
@@ -2581,20 +2561,15 @@ png_do_read_interlace
|
|||||||
(png_uint_32)row_info->pixel_depth + 7) >> 3);
|
(png_uint_32)row_info->pixel_depth + 7) >> 3);
|
||||||
}
|
}
|
||||||
#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
|
#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
|
||||||
/* silence compiler warning */
|
transformations = transformations; /* silence compiler warning */
|
||||||
if (transformations)
|
|
||||||
return;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */
|
||||||
|
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||||
|
|
||||||
|
#ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
||||||
png_read_filter_row_c
|
|
||||||
#else
|
|
||||||
png_read_filter_row
|
|
||||||
#endif /* PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
|
|
||||||
(png_structp png_ptr, png_row_infop row_info, png_bytep row,
|
|
||||||
png_bytep prev_row, int filter)
|
png_bytep prev_row, int filter)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_read_filter_row\n");
|
png_debug(1, "in png_read_filter_row\n");
|
||||||
@@ -2715,6 +2690,7 @@ png_read_filter_row
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* !PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_read_finish_row(png_structp png_ptr)
|
png_read_finish_row(png_structp png_ptr)
|
||||||
@@ -3001,7 +2977,11 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||||||
if (row_bytes > (png_uint_32)65536L)
|
if (row_bytes > (png_uint_32)65536L)
|
||||||
png_error(png_ptr, "This image requires a row greater than 64KB");
|
png_error(png_ptr, "This image requires a row greater than 64KB");
|
||||||
#endif
|
#endif
|
||||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
|
png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64);
|
||||||
|
png_ptr->row_buf = png_ptr->big_row_buf+32;
|
||||||
|
#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)
|
||||||
|
png_ptr->row_buf_size = row_bytes;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
|
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
|
||||||
|
|||||||
334
pngset.c
334
pngset.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -40,6 +40,25 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (white_x < 0.0 || white_y < 0.0 ||
|
||||||
|
red_x < 0.0 || red_y < 0.0 ||
|
||||||
|
green_x < 0.0 || green_y < 0.0 ||
|
||||||
|
blue_x < 0.0 || blue_y < 0.0)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set negative chromaticity value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (white_x > 21474.83 || white_y > 21474.83 ||
|
||||||
|
red_x > 21474.83 || red_y > 21474.83 ||
|
||||||
|
green_x > 21474.83 || green_y > 21474.83 ||
|
||||||
|
blue_x > 21474.83 || blue_y > 21474.83)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set chromaticity value exceeding 21474.83");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
info_ptr->x_white = (float)white_x;
|
info_ptr->x_white = (float)white_x;
|
||||||
info_ptr->y_white = (float)white_y;
|
info_ptr->y_white = (float)white_y;
|
||||||
info_ptr->x_red = (float)red_x;
|
info_ptr->x_red = (float)red_x;
|
||||||
@@ -51,12 +70,12 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5);
|
info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5);
|
||||||
info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5);
|
info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5);
|
||||||
info_ptr->int_x_red = (png_fixed_point)(red_x*100000.+0.5);
|
info_ptr->int_x_red = (png_fixed_point)( red_x*100000.+0.5);
|
||||||
info_ptr->int_y_red = (png_fixed_point)(red_y*100000.+0.5);
|
info_ptr->int_y_red = (png_fixed_point)( red_y*100000.+0.5);
|
||||||
info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5);
|
info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5);
|
||||||
info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5);
|
info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5);
|
||||||
info_ptr->int_x_blue = (png_fixed_point)(blue_x*100000.+0.5);
|
info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000.+0.5);
|
||||||
info_ptr->int_y_blue = (png_fixed_point)(blue_y*100000.+0.5);
|
info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5);
|
||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_cHRM;
|
info_ptr->valid |= PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
@@ -72,6 +91,24 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (white_x < 0 || white_y < 0 ||
|
||||||
|
red_x < 0 || red_y < 0 ||
|
||||||
|
green_x < 0 || green_y < 0 ||
|
||||||
|
blue_x < 0 || blue_y < 0)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set negative chromaticity value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (white_x > (double) PNG_MAX_UINT || white_y > (double) PNG_MAX_UINT ||
|
||||||
|
red_x > (double) PNG_MAX_UINT || red_y > (double) PNG_MAX_UINT ||
|
||||||
|
green_x > (double) PNG_MAX_UINT || green_y > (double) PNG_MAX_UINT ||
|
||||||
|
blue_x > (double) PNG_MAX_UINT || blue_y > (double) PNG_MAX_UINT)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to set chromaticity value exceeding 21474.83");
|
||||||
|
return;
|
||||||
|
}
|
||||||
info_ptr->int_x_white = white_x;
|
info_ptr->int_x_white = white_x;
|
||||||
info_ptr->int_y_white = white_y;
|
info_ptr->int_y_white = white_y;
|
||||||
info_ptr->int_x_red = red_x;
|
info_ptr->int_x_red = red_x;
|
||||||
@@ -83,12 +120,12 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
info_ptr->x_white = (float)(white_x/100000.);
|
info_ptr->x_white = (float)(white_x/100000.);
|
||||||
info_ptr->y_white = (float)(white_y/100000.);
|
info_ptr->y_white = (float)(white_y/100000.);
|
||||||
info_ptr->x_red = (float)(red_x/100000.);
|
info_ptr->x_red = (float)( red_x/100000.);
|
||||||
info_ptr->y_red = (float)(red_y/100000.);
|
info_ptr->y_red = (float)( red_y/100000.);
|
||||||
info_ptr->x_green = (float)(green_x/100000.);
|
info_ptr->x_green = (float)(green_x/100000.);
|
||||||
info_ptr->y_green = (float)(green_y/100000.);
|
info_ptr->y_green = (float)(green_y/100000.);
|
||||||
info_ptr->x_blue = (float)(blue_x/100000.);
|
info_ptr->x_blue = (float)( blue_x/100000.);
|
||||||
info_ptr->y_blue = (float)(blue_y/100000.);
|
info_ptr->y_blue = (float)( blue_y/100000.);
|
||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_cHRM;
|
info_ptr->valid |= PNG_INFO_cHRM;
|
||||||
}
|
}
|
||||||
@@ -100,45 +137,98 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
||||||
{
|
{
|
||||||
|
double gamma;
|
||||||
png_debug1(1, "in %s storage function\n", "gAMA");
|
png_debug1(1, "in %s storage function\n", "gAMA");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
info_ptr->gamma = (float)file_gamma;
|
/* Check for overflow */
|
||||||
|
if (file_gamma > 21474.83)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||||
|
gamma=21474.83;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gamma=file_gamma;
|
||||||
|
info_ptr->gamma = (float)gamma;
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
info_ptr->int_gamma = (int)(file_gamma*100000.+.5);
|
info_ptr->int_gamma = (int)(gamma*100000.+.5);
|
||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_gAMA;
|
info_ptr->valid |= PNG_INFO_gAMA;
|
||||||
|
if(gamma == 0.0)
|
||||||
|
png_warning(png_ptr, "Setting gamma=0");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||||
int_gamma)
|
int_gamma)
|
||||||
{
|
{
|
||||||
|
png_fixed_point gamma;
|
||||||
|
|
||||||
png_debug1(1, "in %s storage function\n", "gAMA");
|
png_debug1(1, "in %s storage function\n", "gAMA");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (int_gamma > (png_fixed_point) PNG_MAX_UINT)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||||
|
gamma=PNG_MAX_UINT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (int_gamma < 0)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Setting negative gamma to zero");
|
||||||
|
gamma=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gamma=int_gamma;
|
||||||
|
}
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
info_ptr->gamma = (float)(int_gamma/100000.);
|
info_ptr->gamma = (float)(gamma/100000.);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
info_ptr->int_gamma = int_gamma;
|
info_ptr->int_gamma = gamma;
|
||||||
#endif
|
#endif
|
||||||
info_ptr->valid |= PNG_INFO_gAMA;
|
info_ptr->valid |= PNG_INFO_gAMA;
|
||||||
|
if(gamma == 0)
|
||||||
|
png_warning(png_ptr, "Setting gamma=0");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_hIST_SUPPORTED)
|
#if defined(PNG_hIST_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
png_debug1(1, "in %s storage function\n", "hIST");
|
png_debug1(1, "in %s storage function\n", "hIST");
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
if (info_ptr->num_palette == 0)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Palette size 0, hIST allocation skipped.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
info_ptr->hist = hist;
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
||||||
|
#endif
|
||||||
|
/* Changed from info->num_palette to 256 in version 1.2.1 */
|
||||||
|
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
|
||||||
|
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||||
|
|
||||||
|
for (i = 0; i < info_ptr->num_palette; i++)
|
||||||
|
png_ptr->hist[i] = hist[i];
|
||||||
|
info_ptr->hist = png_ptr->hist;
|
||||||
info_ptr->valid |= PNG_INFO_hIST;
|
info_ptr->valid |= PNG_INFO_hIST;
|
||||||
|
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
info_ptr->free_me |= PNG_FREE_HIST;
|
||||||
|
#else
|
||||||
|
png_ptr->flags |= PNG_FLAG_FREE_HIST;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -153,6 +243,61 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
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->width = width;
|
||||||
info_ptr->height = height;
|
info_ptr->height = height;
|
||||||
info_ptr->bit_depth = (png_byte)bit_depth;
|
info_ptr->bit_depth = (png_byte)bit_depth;
|
||||||
@@ -160,9 +305,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
|||||||
info_ptr->compression_type = (png_byte)compression_type;
|
info_ptr->compression_type = (png_byte)compression_type;
|
||||||
info_ptr->filter_type = (png_byte)filter_type;
|
info_ptr->filter_type = (png_byte)filter_type;
|
||||||
info_ptr->interlace_type = (png_byte)interlace_type;
|
info_ptr->interlace_type = (png_byte)interlace_type;
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
||||||
info_ptr->channels = 1;
|
|
||||||
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
|
||||||
info_ptr->channels = 3;
|
info_ptr->channels = 3;
|
||||||
else
|
else
|
||||||
info_ptr->channels = 1;
|
info_ptr->channels = 1;
|
||||||
@@ -229,6 +372,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
|
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)((nparams + 1) * sizeof(png_charp)));
|
(png_uint_32)((nparams + 1) * sizeof(png_charp)));
|
||||||
|
|
||||||
info_ptr->pcal_params[nparams] = NULL;
|
info_ptr->pcal_params[nparams] = NULL;
|
||||||
|
|
||||||
for (i = 0; i < nparams; i++)
|
for (i = 0; i < nparams; i++)
|
||||||
@@ -283,7 +427,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
length = png_strlen(sheight) + 1;
|
length = png_strlen(sheight) + 1;
|
||||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||||
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
info_ptr->scal_s_height = (png_charp)png_malloc(png_ptr, length);
|
||||||
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_sCAL;
|
info_ptr->valid |= PNG_INFO_sCAL;
|
||||||
@@ -320,9 +464,30 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
info_ptr->palette = palette;
|
/*
|
||||||
|
* It may not actually be necessary to set png_ptr->palette here;
|
||||||
|
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||||
|
* function used to do the allocation.
|
||||||
|
*/
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||||
|
#endif
|
||||||
|
/* Changed in libpng-1.2.1 to allocate 256 instead of num_palette entries,
|
||||||
|
in case of an invalid PNG file that has too-large sample values. */
|
||||||
|
png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)256,
|
||||||
|
sizeof (png_color));
|
||||||
|
if (png_ptr->palette == NULL)
|
||||||
|
png_error(png_ptr, "Unable to malloc palette");
|
||||||
|
png_memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
|
||||||
|
info_ptr->palette = png_ptr->palette;
|
||||||
|
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||||
|
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
info_ptr->free_me |= PNG_FREE_PLTE;
|
||||||
|
#else
|
||||||
|
png_ptr->flags |= PNG_FLAG_FREE_PLTE;
|
||||||
|
#endif
|
||||||
|
|
||||||
info_ptr->num_palette = (png_uint_16)num_palette;
|
|
||||||
info_ptr->valid |= PNG_INFO_PLTE;
|
info_ptr->valid |= PNG_INFO_PLTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,9 +601,9 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|||||||
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
|
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new_iccp_name = png_malloc(png_ptr, png_strlen(name)+1);
|
new_iccp_name = (png_charp)png_malloc(png_ptr, png_strlen(name)+1);
|
||||||
strcpy(new_iccp_name, name);
|
png_strcpy(new_iccp_name, name);
|
||||||
new_iccp_profile = png_malloc(png_ptr, proflen);
|
new_iccp_profile = (png_charp)png_malloc(png_ptr, proflen);
|
||||||
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
|
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
|
||||||
@@ -507,7 +672,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
png_size_t lang_len,lang_key_len;
|
png_size_t lang_len,lang_key_len;
|
||||||
png_textp textp = &(info_ptr->text[info_ptr->num_text]);
|
png_textp textp = &(info_ptr->text[info_ptr->num_text]);
|
||||||
|
|
||||||
if (text_ptr[i].key == (png_charp)NULL)
|
if (text_ptr[i].key == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
key_len = png_strlen(text_ptr[i].key);
|
key_len = png_strlen(text_ptr[i].key);
|
||||||
@@ -521,11 +686,11 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
{
|
{
|
||||||
/* set iTXt data */
|
/* set iTXt data */
|
||||||
if (text_ptr[i].key != (png_charp)NULL)
|
if (text_ptr[i].lang != NULL)
|
||||||
lang_len = png_strlen(text_ptr[i].lang);
|
lang_len = png_strlen(text_ptr[i].lang);
|
||||||
else
|
else
|
||||||
lang_len = 0;
|
lang_len = 0;
|
||||||
if (text_ptr[i].lang_key != (png_charp)NULL)
|
if (text_ptr[i].lang_key != NULL)
|
||||||
lang_key_len = png_strlen(text_ptr[i].lang_key);
|
lang_key_len = png_strlen(text_ptr[i].lang_key);
|
||||||
else
|
else
|
||||||
lang_key_len = 0;
|
lang_key_len = 0;
|
||||||
@@ -537,7 +702,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0')
|
if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0')
|
||||||
{
|
{
|
||||||
text_length = 0;
|
text_length = 0;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@@ -555,8 +720,9 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
|
|
||||||
textp->key = (png_charp)png_malloc(png_ptr,
|
textp->key = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
|
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
|
||||||
png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
|
png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n",
|
||||||
key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
|
(png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4),
|
||||||
|
(int)textp->key);
|
||||||
|
|
||||||
png_memcpy(textp->key, text_ptr[i].key,
|
png_memcpy(textp->key, text_ptr[i].key,
|
||||||
(png_size_t)(key_len));
|
(png_size_t)(key_len));
|
||||||
@@ -576,8 +742,8 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
textp->lang=(png_charp)NULL;
|
textp->lang=NULL;
|
||||||
textp->lang_key=(png_charp)NULL;
|
textp->lang_key=NULL;
|
||||||
#endif
|
#endif
|
||||||
textp->text=textp->key + key_len + 1;
|
textp->text=textp->key + key_len + 1;
|
||||||
}
|
}
|
||||||
@@ -631,7 +797,25 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (trans != NULL)
|
if (trans != NULL)
|
||||||
info_ptr->trans = trans;
|
{
|
||||||
|
/*
|
||||||
|
* It may not actually be necessary to set png_ptr->trans here;
|
||||||
|
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||||
|
* function used to do the allocation.
|
||||||
|
*/
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
|
||||||
|
#endif
|
||||||
|
/* Changed from num_trans to 256 in version 1.2.1 */
|
||||||
|
png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
|
||||||
|
(png_uint_32)256);
|
||||||
|
png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans);
|
||||||
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
|
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||||
|
#else
|
||||||
|
png_ptr->flags |= PNG_FLAG_FREE_TRNS;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (trans_values != NULL)
|
if (trans_values != NULL)
|
||||||
{
|
{
|
||||||
@@ -667,12 +851,12 @@ png_set_sPLT(png_structp png_ptr,
|
|||||||
png_sPLT_tp from = entries + i;
|
png_sPLT_tp from = entries + i;
|
||||||
|
|
||||||
to->name = (png_charp)png_malloc(png_ptr,
|
to->name = (png_charp)png_malloc(png_ptr,
|
||||||
png_strlen(from->name) + 1);
|
png_strlen(from->name) + 1);
|
||||||
png_strcpy(to->name, from->name);
|
png_strcpy(to->name, from->name);
|
||||||
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
||||||
from->nentries * sizeof(png_sPLT_t));
|
from->nentries * sizeof(png_sPLT_t));
|
||||||
png_memcpy(to->entries, from->entries,
|
png_memcpy(to->entries, from->entries,
|
||||||
from->nentries * sizeof(png_sPLT_t));
|
from->nentries * sizeof(png_sPLT_t));
|
||||||
to->nentries = from->nentries;
|
to->nentries = from->nentries;
|
||||||
to->depth = from->depth;
|
to->depth = from->depth;
|
||||||
}
|
}
|
||||||
@@ -686,7 +870,7 @@ png_set_sPLT(png_structp png_ptr,
|
|||||||
}
|
}
|
||||||
#endif /* PNG_sPLT_SUPPORTED */
|
#endif /* PNG_sPLT_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_unknown_chunks(png_structp png_ptr,
|
png_set_unknown_chunks(png_structp png_ptr,
|
||||||
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
|
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
|
||||||
@@ -730,7 +914,7 @@ void PNGAPI
|
|||||||
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
||||||
int chunk, int location)
|
int chunk, int location)
|
||||||
{
|
{
|
||||||
if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
|
if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
|
||||||
(int)info_ptr->unknown_chunks_num)
|
(int)info_ptr->unknown_chunks_num)
|
||||||
info_ptr->unknown_chunks[chunk].location = (png_byte)location;
|
info_ptr->unknown_chunks[chunk].location = (png_byte)location;
|
||||||
}
|
}
|
||||||
@@ -788,14 +972,17 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
|
|||||||
if (chunk_list == NULL)
|
if (chunk_list == NULL)
|
||||||
return;
|
return;
|
||||||
old_num_chunks=png_ptr->num_chunk_list;
|
old_num_chunks=png_ptr->num_chunk_list;
|
||||||
new_list=png_malloc(png_ptr,5*(num_chunks+old_num_chunks));
|
new_list=(png_bytep)png_malloc(png_ptr,
|
||||||
if(png_ptr->chunk_list != (png_bytep)NULL)
|
(png_uint_32)(5*(num_chunks+old_num_chunks)));
|
||||||
|
if(png_ptr->chunk_list != NULL)
|
||||||
{
|
{
|
||||||
png_memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
|
png_memcpy(new_list, png_ptr->chunk_list,
|
||||||
|
(png_size_t)(5*old_num_chunks));
|
||||||
png_free(png_ptr, png_ptr->chunk_list);
|
png_free(png_ptr, png_ptr->chunk_list);
|
||||||
png_ptr->chunk_list=NULL;
|
png_ptr->chunk_list=NULL;
|
||||||
}
|
}
|
||||||
png_memcpy(new_list+5*old_num_chunks, chunk_list, 5*num_chunks);
|
png_memcpy(new_list+5*old_num_chunks, chunk_list,
|
||||||
|
(png_size_t)(5*num_chunks));
|
||||||
for (p=new_list+5*old_num_chunks+4, i=0; i<num_chunks; i++, p+=5)
|
for (p=new_list+5*old_num_chunks+4, i=0; i<num_chunks; i++, p+=5)
|
||||||
*p=(png_byte)keep;
|
*p=(png_byte)keep;
|
||||||
png_ptr->num_chunk_list=old_num_chunks+num_chunks;
|
png_ptr->num_chunk_list=old_num_chunks+num_chunks;
|
||||||
@@ -831,7 +1018,6 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
|
|||||||
info_ptr->row_pointers = row_pointers;
|
info_ptr->row_pointers = row_pointers;
|
||||||
if(row_pointers)
|
if(row_pointers)
|
||||||
info_ptr->valid |= PNG_INFO_IDAT;
|
info_ptr->valid |= PNG_INFO_IDAT;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -842,8 +1028,6 @@ png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
|
|||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_ptr->zbuf_size = (png_size_t)size;
|
png_ptr->zbuf_size = (png_size_t)size;
|
||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
|
||||||
if(!png_ptr->zbuf)
|
|
||||||
png_error(png_ptr,"Unable to malloc zbuf");
|
|
||||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||||
}
|
}
|
||||||
@@ -854,3 +1038,61 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
|||||||
if (png_ptr && info_ptr)
|
if (png_ptr && info_ptr)
|
||||||
info_ptr->valid &= ~(mask);
|
info_ptr->valid &= ~(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PNG_1_0_X
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
/* this function was added to libpng 1.2.0 and should always exist by default */
|
||||||
|
void PNGAPI
|
||||||
|
png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
|
||||||
|
{
|
||||||
|
png_uint_32 settable_asm_flags;
|
||||||
|
png_uint_32 settable_mmx_flags;
|
||||||
|
|
||||||
|
settable_mmx_flags =
|
||||||
|
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
||||||
|
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
||||||
|
PNG_ASM_FLAG_MMX_READ_INTERLACE |
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
|
||||||
|
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH |
|
||||||
|
#endif
|
||||||
|
0;
|
||||||
|
|
||||||
|
/* could be some non-MMX ones in the future, but not currently: */
|
||||||
|
settable_asm_flags = settable_mmx_flags;
|
||||||
|
|
||||||
|
if (!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED) ||
|
||||||
|
!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU))
|
||||||
|
{
|
||||||
|
/* clear all MMX flags if MMX isn't supported */
|
||||||
|
settable_asm_flags &= ~settable_mmx_flags;
|
||||||
|
png_ptr->asm_flags &= ~settable_mmx_flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we're replacing the settable bits with those passed in by the user,
|
||||||
|
* so first zero them out of the master copy, then logical-OR in the
|
||||||
|
* allowed subset that was requested */
|
||||||
|
|
||||||
|
png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */
|
||||||
|
png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */
|
||||||
|
}
|
||||||
|
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
/* this function was added to libpng 1.2.0 */
|
||||||
|
void PNGAPI
|
||||||
|
png_set_mmx_thresholds (png_structp png_ptr,
|
||||||
|
png_byte mmx_bitdepth_threshold,
|
||||||
|
png_uint_32 mmx_rowbytes_threshold)
|
||||||
|
{
|
||||||
|
png_ptr->mmx_bitdepth_threshold = mmx_bitdepth_threshold;
|
||||||
|
png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold;
|
||||||
|
}
|
||||||
|
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
||||||
|
#endif /* ?PNG_1_0_X */
|
||||||
|
|||||||
167
pngtest.c
167
pngtest.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -50,9 +50,21 @@
|
|||||||
# define FCLOSE(file) fclose(file)
|
# define FCLOSE(file) fclose(file)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_NO_STDIO)
|
||||||
|
# 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) */
|
/* Makes pngtest verbose so we can find problems (needs to be before png.h) */
|
||||||
#ifndef PNG_DEBUG
|
#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
|
#endif
|
||||||
|
|
||||||
/* Turn on CPU timing
|
/* Turn on CPU timing
|
||||||
@@ -257,6 +269,7 @@ static int wrote_question = 0;
|
|||||||
not reading from a standard C stream, you should create a replacement
|
not reading from a standard C stream, you should create a replacement
|
||||||
read_data function and use it at run time with png_set_read_fn(), rather
|
read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
than changing the library. */
|
than changing the library. */
|
||||||
|
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
static void
|
static void
|
||||||
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
@@ -270,7 +283,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Read Error");
|
png_error(png_ptr, "Read Error!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -457,10 +470,8 @@ static int maximum_allocation = 0;
|
|||||||
static int total_allocation = 0;
|
static int total_allocation = 0;
|
||||||
static int num_allocations = 0;
|
static int num_allocations = 0;
|
||||||
|
|
||||||
extern PNG_EXPORT(png_voidp,png_debug_malloc) PNGARG((png_structp png_ptr,
|
png_voidp png_debug_malloc PNGARG((png_structp png_ptr, png_uint_32 size));
|
||||||
png_uint_32 size));
|
void png_debug_free PNGARG((png_structp png_ptr, png_voidp ptr));
|
||||||
extern PNG_EXPORT(void,png_debug_free) PNGARG((png_structp png_ptr,
|
|
||||||
png_voidp ptr));
|
|
||||||
|
|
||||||
png_voidp
|
png_voidp
|
||||||
png_debug_malloc(png_structp png_ptr, png_uint_32 size)
|
png_debug_malloc(png_structp png_ptr, png_uint_32 size)
|
||||||
@@ -470,26 +481,27 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size)
|
|||||||
png_debug_malloc directly, with png_ptr == NULL which is OK */
|
png_debug_malloc directly, with png_ptr == NULL which is OK */
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return (png_voidp)(NULL);
|
return (NULL);
|
||||||
|
|
||||||
/* This calls the library allocator twice, once to get the requested
|
/* This calls the library allocator twice, once to get the requested
|
||||||
buffer and once to get a new free list entry. */
|
buffer and once to get a new free list entry. */
|
||||||
{
|
{
|
||||||
memory_infop pinfo = png_malloc_default(png_ptr, sizeof *pinfo);
|
memory_infop pinfo = (memory_infop)png_malloc_default(png_ptr,
|
||||||
|
(png_uint_32)sizeof *pinfo);
|
||||||
pinfo->size = size;
|
pinfo->size = size;
|
||||||
current_allocation += size;
|
current_allocation += size;
|
||||||
total_allocation += size;
|
total_allocation += size;
|
||||||
num_allocations ++;
|
num_allocations ++;
|
||||||
if (current_allocation > maximum_allocation)
|
if (current_allocation > maximum_allocation)
|
||||||
maximum_allocation = current_allocation;
|
maximum_allocation = current_allocation;
|
||||||
pinfo->pointer = png_malloc_default(png_ptr, size);
|
pinfo->pointer = (png_voidp)png_malloc_default(png_ptr, size);
|
||||||
pinfo->next = pinformation;
|
pinfo->next = pinformation;
|
||||||
pinformation = pinfo;
|
pinformation = pinfo;
|
||||||
/* Make sure the caller isn't assuming zeroed memory. */
|
/* Make sure the caller isn't assuming zeroed memory. */
|
||||||
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||||
#if PNG_DEBUG
|
#if PNG_DEBUG
|
||||||
if(verbose)
|
if(verbose)
|
||||||
printf("png_malloc %d bytes at %x\n",size,pinfo->pointer);
|
printf("png_malloc %lu bytes at %x\n",size,pinfo->pointer);
|
||||||
#endif
|
#endif
|
||||||
assert(pinfo->size != 12345678);
|
assert(pinfo->size != 12345678);
|
||||||
return (png_voidp)(pinfo->pointer);
|
return (png_voidp)(pinfo->pointer);
|
||||||
@@ -524,14 +536,14 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
fprintf(STDERR, "Duplicate free of memory\n");
|
fprintf(STDERR, "Duplicate free of memory\n");
|
||||||
/* We must free the list element too, but first kill
|
/* We must free the list element too, but first kill
|
||||||
the memory that is to be freed. */
|
the memory that is to be freed. */
|
||||||
memset(ptr, 0x55, pinfo->size);
|
png_memset(ptr, 0x55, pinfo->size);
|
||||||
png_free_default(png_ptr, pinfo);
|
png_free_default(png_ptr, pinfo);
|
||||||
pinfo=NULL;
|
pinfo=NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pinfo->next == NULL)
|
if (pinfo->next == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Pointer %x not found\n", ptr);
|
fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ppinfo = &pinfo->next;
|
ppinfo = &pinfo->next;
|
||||||
@@ -555,8 +567,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
{
|
{
|
||||||
static png_FILE_p fpin;
|
static png_FILE_p fpin;
|
||||||
static png_FILE_p fpout; /* "static" prevents setjmp corruption */
|
static png_FILE_p fpout; /* "static" prevents setjmp corruption */
|
||||||
png_structp read_ptr, write_ptr;
|
png_structp read_ptr;
|
||||||
png_infop read_info_ptr, write_info_ptr, end_info_ptr, write_end_info_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_bytep row_buf;
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
png_uint_32 width, height;
|
png_uint_32 width, height;
|
||||||
@@ -573,7 +594,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#endif
|
#endif
|
||||||
char inbuf[256], outbuf[256];
|
char inbuf[256], outbuf[256];
|
||||||
|
|
||||||
row_buf = (png_bytep)NULL;
|
row_buf = NULL;
|
||||||
|
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE)
|
||||||
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
|
||||||
@@ -600,35 +621,37 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
|
|
||||||
png_debug(0, "Allocating read and write structures\n");
|
png_debug(0, "Allocating read and write structures\n");
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
|
read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
|
||||||
(png_error_ptr)NULL, (png_error_ptr)NULL, (png_voidp)NULL,
|
png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
|
||||||
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
|
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
|
||||||
#else
|
#else
|
||||||
read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
|
read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
|
||||||
(png_error_ptr)NULL, (png_error_ptr)NULL);
|
png_error_ptr_NULL, png_error_ptr_NULL);
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_NO_STDIO)
|
#if defined(PNG_NO_STDIO)
|
||||||
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
|
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
|
||||||
pngtest_warning);
|
pngtest_warning);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
|
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,
|
png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
|
||||||
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
|
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
|
||||||
#else
|
#else
|
||||||
write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL,
|
write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
|
||||||
(png_error_ptr)NULL, (png_error_ptr)NULL);
|
png_error_ptr_NULL, png_error_ptr_NULL);
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_NO_STDIO)
|
#if defined(PNG_NO_STDIO)
|
||||||
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
|
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
|
||||||
pngtest_warning);
|
pngtest_warning);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
png_debug(0, "Allocating read_info, write_info and end_info structures\n");
|
png_debug(0, "Allocating read_info, write_info and end_info structures\n");
|
||||||
read_info_ptr = png_create_info_struct(read_ptr);
|
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);
|
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);
|
write_end_info_ptr = png_create_info_struct(write_ptr);
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
@@ -641,8 +664,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
{
|
{
|
||||||
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
|
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
|
||||||
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
|
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_info_struct(write_ptr, &write_end_info_ptr);
|
||||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||||
|
#endif
|
||||||
FCLOSE(fpin);
|
FCLOSE(fpin);
|
||||||
FCLOSE(fpout);
|
FCLOSE(fpout);
|
||||||
return (1);
|
return (1);
|
||||||
@@ -651,6 +676,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_memcpy(png_jmpbuf(read_ptr),jmpbuf,sizeof(jmp_buf));
|
png_memcpy(png_jmpbuf(read_ptr),jmpbuf,sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_debug(0, "Setting jmpbuf for write struct\n");
|
png_debug(0, "Setting jmpbuf for write struct\n");
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
if (setjmp(jmpbuf))
|
if (setjmp(jmpbuf))
|
||||||
@@ -661,7 +687,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
fprintf(STDERR, "%s -> %s: libpng write error\n", inname, 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_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
|
||||||
png_destroy_info_struct(write_ptr, &write_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);
|
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||||
|
#endif
|
||||||
FCLOSE(fpin);
|
FCLOSE(fpin);
|
||||||
FCLOSE(fpout);
|
FCLOSE(fpout);
|
||||||
return (1);
|
return (1);
|
||||||
@@ -669,30 +697,39 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(png_jmpbuf(write_ptr),jmpbuf,sizeof(jmp_buf));
|
png_memcpy(png_jmpbuf(write_ptr),jmpbuf,sizeof(jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(0, "Initializing input and output streams\n");
|
png_debug(0, "Initializing input and output streams\n");
|
||||||
#if !defined(PNG_NO_STDIO)
|
#if !defined(PNG_NO_STDIO)
|
||||||
png_init_io(read_ptr, fpin);
|
png_init_io(read_ptr, fpin);
|
||||||
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
png_init_io(write_ptr, fpout);
|
png_init_io(write_ptr, fpout);
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data);
|
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,
|
png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data,
|
||||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
# if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||||
pngtest_flush);
|
pngtest_flush);
|
||||||
#else
|
# else
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if(status_dots_requested == 1)
|
if(status_dots_requested == 1)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_set_write_status_fn(write_ptr, write_row_callback);
|
png_set_write_status_fn(write_ptr, write_row_callback);
|
||||||
|
#endif
|
||||||
png_set_read_status_fn(read_ptr, read_row_callback);
|
png_set_read_status_fn(read_ptr, read_row_callback);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_set_write_status_fn(write_ptr, NULL);
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_set_read_status_fn(read_ptr, NULL);
|
png_set_write_status_fn(write_ptr, png_write_status_ptr_NULL);
|
||||||
|
#endif
|
||||||
|
png_set_read_status_fn(read_ptr, png_read_status_ptr_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||||
@@ -711,10 +748,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#define HANDLE_CHUNK_IF_SAFE 2
|
#define HANDLE_CHUNK_IF_SAFE 2
|
||||||
#define HANDLE_CHUNK_ALWAYS 3
|
#define HANDLE_CHUNK_ALWAYS 3
|
||||||
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
png_set_keep_unknown_chunks(read_ptr, HANDLE_CHUNK_ALWAYS, NULL, 0);
|
png_set_keep_unknown_chunks(read_ptr, HANDLE_CHUNK_ALWAYS,
|
||||||
|
png_bytep_NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
|
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_IF_SAFE, NULL, 0);
|
png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_IF_SAFE,
|
||||||
|
png_bytep_NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(0, "Reading info struct\n");
|
png_debug(0, "Reading info struct\n");
|
||||||
@@ -975,32 +1014,29 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_debug(0, "\nWriting info struct\n");
|
png_debug(0, "\nWriting info struct\n");
|
||||||
|
|
||||||
/* If we wanted, we could write info in two steps:
|
/* If we wanted, we could write info in two steps:
|
||||||
png_write_info_before_PLTE(write_ptr, write_info_ptr);
|
png_write_info_before_PLTE(write_ptr, write_info_ptr);
|
||||||
*/
|
*/
|
||||||
png_write_info(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,
|
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||||
if (row_buf == NULL)
|
png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf);
|
||||||
{
|
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||||
fprintf(STDERR, "No memory to allocate row buffer\n");
|
|
||||||
png_destroy_read_struct(&read_ptr, &read_info_ptr, (png_infopp)NULL);
|
|
||||||
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
|
|
||||||
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
|
||||||
FCLOSE(fpin);
|
|
||||||
FCLOSE(fpout);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
png_debug(0, "Writing row data\n");
|
png_debug(0, "Writing row data\n");
|
||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||||
num_pass = png_set_interlace_handling(read_ptr);
|
num_pass = png_set_interlace_handling(read_ptr);
|
||||||
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
png_set_interlace_handling(write_ptr);
|
png_set_interlace_handling(write_ptr);
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
num_pass=1;
|
num_pass=1;
|
||||||
#endif
|
#endif
|
||||||
@@ -1015,7 +1051,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_debug1(0, "Writing row data for pass %d\n",pass);
|
png_debug1(0, "Writing row data for pass %d\n",pass);
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
png_read_rows(read_ptr, (png_bytepp)&row_buf, (png_bytepp)NULL, 1);
|
#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
|
#ifdef PNGTEST_TIMING
|
||||||
t_stop = (float)clock();
|
t_stop = (float)clock();
|
||||||
t_decode += (t_stop - t_start);
|
t_decode += (t_stop - t_start);
|
||||||
@@ -1027,6 +1072,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
t_encode += (t_stop - t_start);
|
t_encode += (t_stop - t_start);
|
||||||
t_start = t_stop;
|
t_start = t_stop;
|
||||||
#endif
|
#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 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,7 +1140,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_write_end(write_ptr, write_end_info_ptr);
|
png_write_end(write_ptr, write_end_info_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
||||||
if(verbose)
|
if(verbose)
|
||||||
@@ -1103,11 +1156,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(0, "Destroying data structs\n");
|
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);
|
png_free(read_ptr, row_buf);
|
||||||
row_buf=NULL;
|
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);
|
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_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);
|
png_destroy_write_struct(&write_ptr, &write_info_ptr);
|
||||||
|
#endif
|
||||||
|
png_debug(0, "Destruction complete.\n");
|
||||||
|
|
||||||
FCLOSE(fpin);
|
FCLOSE(fpin);
|
||||||
FCLOSE(fpout);
|
FCLOSE(fpout);
|
||||||
@@ -1218,8 +1280,8 @@ main(int argc, char *argv[])
|
|||||||
/* Show the version of libpng used in building the application */
|
/* Show the version of libpng used in building the application */
|
||||||
fprintf(STDERR," pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
|
fprintf(STDERR," pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
|
||||||
PNG_HEADER_VERSION_STRING);
|
PNG_HEADER_VERSION_STRING);
|
||||||
fprintf(STDERR," sizeof(png_struct)=%d, sizeof(png_info)=%d\n",
|
fprintf(STDERR," sizeof(png_struct)=%ld, sizeof(png_info)=%ld\n",
|
||||||
sizeof(png_struct), sizeof(png_info));
|
(long)sizeof(png_struct), (long)sizeof(png_info));
|
||||||
|
|
||||||
/* Do some consistency checking on the memory allocation settings, I'm
|
/* Do some consistency checking on the memory allocation settings, I'm
|
||||||
not sure this matters, but it is nice to know, the first of these
|
not sure this matters, but it is nice to know, the first of these
|
||||||
@@ -1334,7 +1396,8 @@ main(int argc, char *argv[])
|
|||||||
current_allocation);
|
current_allocation);
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, " %d bytes at %x\n", pinfo->size, pinfo->pointer);
|
fprintf(STDERR, " %lu bytes at %x\n", pinfo->size,
|
||||||
|
(unsigned int) pinfo->pointer);
|
||||||
pinfo = pinfo->next;
|
pinfo = pinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1408,8 +1471,8 @@ main(int argc, char *argv[])
|
|||||||
current_allocation);
|
current_allocation);
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR," %d bytes at %x\n",
|
fprintf(STDERR," %lu bytes at %x\n",
|
||||||
pinfo->size, pinfo->pointer);
|
pinfo->size, (unsigned int)pinfo->pointer);
|
||||||
pinfo = pinfo->next;
|
pinfo = pinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1449,4 +1512,4 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_0_9beta2 your_png_h_is_not_version_1_0_9beta2;
|
typedef version_1_0_13 your_png_h_is_not_version_1_0_13;
|
||||||
|
|||||||
46
pngtrans.c
46
pngtrans.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
@@ -153,11 +153,14 @@ void /* PRIVATE */
|
|||||||
png_do_invert(png_row_infop row_info, png_bytep row)
|
png_do_invert(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_invert\n");
|
png_debug(1, "in png_do_invert\n");
|
||||||
if (row_info->bit_depth == 1 &&
|
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
||||||
|
* if (row_info->bit_depth == 1 &&
|
||||||
|
*/
|
||||||
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
row != NULL && row_info != NULL &&
|
if (row == NULL || row_info == NULL)
|
||||||
|
return;
|
||||||
#endif
|
#endif
|
||||||
row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
@@ -169,6 +172,33 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
|
row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
png_bytep rp = row;
|
||||||
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
|
for (i = 0; i < istop; i+=2)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(~(*rp));
|
||||||
|
rp+=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
|
row_info->bit_depth == 16)
|
||||||
|
{
|
||||||
|
png_bytep rp = row;
|
||||||
|
png_uint_32 i;
|
||||||
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
|
|
||||||
|
for (i = 0; i < istop; i+=4)
|
||||||
|
{
|
||||||
|
*rp = (png_byte)(~(*rp));
|
||||||
|
*(rp+1) = (png_byte)(~(*(rp+1)));
|
||||||
|
rp+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -392,11 +422,12 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
sp += 8; dp += 6;
|
sp += 8; dp += 6;
|
||||||
for (i = 1; i < row_width; i++)
|
for (i = 1; i < row_width; i++)
|
||||||
{
|
{
|
||||||
/* This could be (although memcpy is probably slower):
|
/* This could be (although png_memcpy is probably slower):
|
||||||
png_memcpy(dp, sp, 6);
|
png_memcpy(dp, sp, 6);
|
||||||
sp += 8;
|
sp += 8;
|
||||||
dp += 6;
|
dp += 6;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
@@ -411,11 +442,12 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
|||||||
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
/* This could be (although memcpy is probably slower):
|
/* This could be (although png_memcpy is probably slower):
|
||||||
png_memcpy(dp, sp, 6);
|
png_memcpy(dp, sp, 6);
|
||||||
sp += 8;
|
sp += 8;
|
||||||
dp += 6;
|
dp += 6;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sp+=2;
|
sp+=2;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
|
|||||||
203
pngvcrd.c
203
pngvcrd.c
@@ -2,16 +2,25 @@
|
|||||||
*
|
*
|
||||||
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng version 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1998, Intel Corporation
|
* Copyright (c) 1998, Intel Corporation
|
||||||
*
|
*
|
||||||
* Contributed by Nirav Chhatrapati, Intel Corporation, 1998
|
* Contributed by Nirav Chhatrapati, Intel Corporation, 1998
|
||||||
* Interface to libpng contributed by Gilles Vollant, 1999
|
* Interface to libpng contributed by Gilles Vollant, 1999
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* In png_do_read_interlace() in libpng versions 1.0.3a through 1.0.4d,
|
||||||
|
* a sign error in the post-MMX cleanup code for each pixel_depth resulted
|
||||||
|
* in bad pixels at the beginning of some rows of some images, and also
|
||||||
|
* (due to out-of-range memory reads and writes) caused heap corruption
|
||||||
|
* when compiled with MSVC 6.0. The error was fixed in version 1.0.4e.
|
||||||
|
*
|
||||||
* [png_read_filter_row_mmx_avg() bpp == 2 bugfix, GRR 20000916]
|
* [png_read_filter_row_mmx_avg() bpp == 2 bugfix, GRR 20000916]
|
||||||
*
|
*
|
||||||
|
* [runtime MMX configuration, GRR 20010102]
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
@@ -19,25 +28,18 @@
|
|||||||
|
|
||||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)
|
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)
|
||||||
|
|
||||||
/*
|
|
||||||
One of these might need to be defined.
|
|
||||||
#define DISABLE_PNGVCRD_COMBINE
|
|
||||||
#define DISABLE_PNGVCRD_INTERLACE
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int mmx_supported=2;
|
static int mmx_supported=2;
|
||||||
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info,
|
|
||||||
png_bytep row, png_bytep prev_row, int filter);
|
|
||||||
|
|
||||||
static int mmxsupport()
|
int PNGAPI
|
||||||
|
png_mmx_support(void)
|
||||||
{
|
{
|
||||||
int mmx_supported_local = 0;
|
int mmx_supported_local = 0;
|
||||||
_asm {
|
_asm {
|
||||||
push ebx //CPUID will trash these
|
push ebx //CPUID will trash these
|
||||||
push ecx
|
push ecx
|
||||||
push edx
|
push edx
|
||||||
|
|
||||||
pushfd //Save Eflag to stack
|
pushfd //Save Eflag to stack
|
||||||
pop eax //Get Eflag from stack into eax
|
pop eax //Get Eflag from stack into eax
|
||||||
mov ecx, eax //Make another copy of Eflag in ecx
|
mov ecx, eax //Make another copy of Eflag in ecx
|
||||||
@@ -47,6 +49,8 @@ static int mmxsupport()
|
|||||||
popfd //Restored modified value back to Eflag reg
|
popfd //Restored modified value back to Eflag reg
|
||||||
pushfd //Save Eflag to stack
|
pushfd //Save Eflag to stack
|
||||||
pop eax //Get Eflag from stack
|
pop eax //Get Eflag from stack
|
||||||
|
push ecx // save original Eflag to stack
|
||||||
|
popfd // restore original Eflag
|
||||||
xor eax, ecx //Compare the new Eflag with the original Eflag
|
xor eax, ecx //Compare the new Eflag with the original Eflag
|
||||||
jz NOT_SUPPORTED //If the same, CPUID instruction is not supported,
|
jz NOT_SUPPORTED //If the same, CPUID instruction is not supported,
|
||||||
//skip following instructions and jump to
|
//skip following instructions and jump to
|
||||||
@@ -83,6 +87,7 @@ NOT_SUPPORTED:
|
|||||||
//mmx_supported_local=0; // test code for force don't support MMX
|
//mmx_supported_local=0; // test code for force don't support MMX
|
||||||
//printf("MMX : %u (1=MMX supported)\n",mmx_supported_local);
|
//printf("MMX : %u (1=MMX supported)\n",mmx_supported_local);
|
||||||
|
|
||||||
|
mmx_supported = mmx_supported_local;
|
||||||
return mmx_supported_local;
|
return mmx_supported_local;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,19 +111,14 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
|||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
#endif
|
#endif
|
||||||
#ifdef DISABLE_PNGVCRD_COMBINE
|
|
||||||
int save_mmx_supported = mmx_supported;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_debug(1,"in png_combine_row_asm\n");
|
png_debug(1,"in png_combine_row_asm\n");
|
||||||
|
|
||||||
#ifdef DISABLE_PNGVCRD_COMBINE
|
if (mmx_supported == 2) {
|
||||||
if ((png_ptr->transformations & PNG_INTERLACE) && png_ptr->pass != 6)
|
/* this should have happened in png_init_mmx_flags() already */
|
||||||
mmx_supported = 0;
|
png_warning(png_ptr, "asm_flags may not have been initialized");
|
||||||
else
|
png_mmx_support();
|
||||||
#endif
|
}
|
||||||
if (mmx_supported == 2)
|
|
||||||
mmx_supported = mmxsupport();
|
|
||||||
|
|
||||||
if (mask == 0xff)
|
if (mask == 0xff)
|
||||||
{
|
{
|
||||||
@@ -307,7 +307,8 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
|
|||||||
|
|
||||||
__int64 mask0=0x0102040810204080;
|
__int64 mask0=0x0102040810204080;
|
||||||
|
|
||||||
if (mmx_supported)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||||
|
/* && mmx_supported */ )
|
||||||
{
|
{
|
||||||
srcptr = png_ptr->row_buf + 1;
|
srcptr = png_ptr->row_buf + 1;
|
||||||
dstptr = row;
|
dstptr = row;
|
||||||
@@ -407,7 +408,8 @@ end8:
|
|||||||
__int64 mask1=0x0101020204040808,
|
__int64 mask1=0x0101020204040808,
|
||||||
mask0=0x1010202040408080;
|
mask0=0x1010202040408080;
|
||||||
|
|
||||||
if (mmx_supported)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||||
|
/* && mmx_supported */ )
|
||||||
{
|
{
|
||||||
srcptr = png_ptr->row_buf + 1;
|
srcptr = png_ptr->row_buf + 1;
|
||||||
dstptr = row;
|
dstptr = row;
|
||||||
@@ -527,7 +529,8 @@ end16:
|
|||||||
len = (png_ptr->width)&~7;
|
len = (png_ptr->width)&~7;
|
||||||
diff = (png_ptr->width)&7;
|
diff = (png_ptr->width)&7;
|
||||||
|
|
||||||
if (mmx_supported)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||||
|
/* && mmx_supported */ )
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@@ -658,7 +661,8 @@ end24:
|
|||||||
len = (png_ptr->width)&~7;
|
len = (png_ptr->width)&~7;
|
||||||
diff = (png_ptr->width)&7;
|
diff = (png_ptr->width)&7;
|
||||||
|
|
||||||
if (mmx_supported)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||||
|
/* && mmx_supported */ )
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@@ -792,7 +796,8 @@ end32:
|
|||||||
mask1=0x2020202040404040,
|
mask1=0x2020202040404040,
|
||||||
mask0=0x4040808080808080;
|
mask0=0x4040808080808080;
|
||||||
|
|
||||||
if (mmx_supported)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
|
||||||
|
/* && mmx_supported */ )
|
||||||
{
|
{
|
||||||
srcptr = png_ptr->row_buf + 1;
|
srcptr = png_ptr->row_buf + 1;
|
||||||
dstptr = row;
|
dstptr = row;
|
||||||
@@ -963,43 +968,29 @@ end48:
|
|||||||
} /* end switch (png_ptr->row_info.pixel_depth) */
|
} /* end switch (png_ptr->row_info.pixel_depth) */
|
||||||
} /* end if (non-trivial mask) */
|
} /* end if (non-trivial mask) */
|
||||||
|
|
||||||
#ifdef DISABLE_PNGVCRD_COMBINE
|
|
||||||
mmx_supported = save_mmx_supported;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} /* end png_combine_row() */
|
} /* end png_combine_row() */
|
||||||
|
|
||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED)
|
#if defined(PNG_READ_INTERLACING_SUPPORTED)
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
png_do_read_interlace(png_structp png_ptr)
|
||||||
png_uint_32 transformations)
|
|
||||||
{
|
{
|
||||||
|
png_row_infop row_info = &(png_ptr->row_info);
|
||||||
|
png_bytep row = png_ptr->row_buf + 1;
|
||||||
|
int pass = png_ptr->pass;
|
||||||
|
png_uint_32 transformations = png_ptr->transformations;
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
#endif
|
#endif
|
||||||
#ifdef DISABLE_PNGVCRD_INTERLACE
|
|
||||||
int save_mmx_supported = mmx_supported;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_debug(1,"in png_do_read_interlace\n");
|
png_debug(1,"in png_do_read_interlace\n");
|
||||||
|
|
||||||
#ifdef DISABLE_PNGVCRD_INTERLACE
|
if (mmx_supported == 2) {
|
||||||
/* In libpng versions 1.0.3a through 1.0.4d,
|
/* this should have happened in png_init_mmx_flags() already */
|
||||||
* a sign error in the post-MMX cleanup code for each pixel_depth resulted
|
png_warning(png_ptr, "asm_flags may not have been initialized");
|
||||||
* in bad pixels at the beginning of some rows of some images, and also
|
png_mmx_support();
|
||||||
* (due to out-of-range memory reads and writes) caused heap corruption
|
}
|
||||||
* when compiled with MSVC 6.0. The error was fixed in version 1.0.4e,
|
|
||||||
* and the code appears to work completely correctly, so it is enabled
|
|
||||||
* by default.
|
|
||||||
*/
|
|
||||||
if (1) /* all passes caused a heap problem in the old code */
|
|
||||||
mmx_supported = 0;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (mmx_supported == 2)
|
|
||||||
mmx_supported = mmxsupport();
|
|
||||||
|
|
||||||
if (row != NULL && row_info != NULL)
|
if (row != NULL && row_info != NULL)
|
||||||
{
|
{
|
||||||
@@ -1197,7 +1188,9 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
|||||||
// sign fix by GRR
|
// sign fix by GRR
|
||||||
// NOTE: there is NO MMX code for 48-bit and 64-bit images
|
// NOTE: there is NO MMX code for 48-bit and 64-bit images
|
||||||
|
|
||||||
if (mmx_supported) // use MMX routine if machine supports it
|
// use MMX routine if machine supports it
|
||||||
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)
|
||||||
|
/* && mmx_supported */ )
|
||||||
{
|
{
|
||||||
if (pixel_bytes == 3)
|
if (pixel_bytes == 3)
|
||||||
{
|
{
|
||||||
@@ -1885,9 +1878,6 @@ loop4_pass4:
|
|||||||
(png_uint_32)row_info->pixel_depth + 7) >> 3);
|
(png_uint_32)row_info->pixel_depth + 7) >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISABLE_PNGVCRD_INTERLACE
|
|
||||||
mmx_supported = save_mmx_supported;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||||
@@ -3323,7 +3313,7 @@ dsub3lp:
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// Placed here just in case this is a duplicate of the
|
// Placed here just in case this is a duplicate of the
|
||||||
// non-MMX code for the SUB filter in png_read_filter_row above
|
// non-MMX code for the SUB filter in png_read_filter_row below
|
||||||
//
|
//
|
||||||
// png_bytep rp;
|
// png_bytep rp;
|
||||||
// png_bytep lp;
|
// png_bytep lp;
|
||||||
@@ -3658,61 +3648,56 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
|||||||
row, png_bytep prev_row, int filter)
|
row, png_bytep prev_row, int filter)
|
||||||
{
|
{
|
||||||
#ifdef PNG_DEBUG
|
#ifdef PNG_DEBUG
|
||||||
char filnm[6];
|
char filnm[10];
|
||||||
#endif
|
#endif
|
||||||
#define UseMMX 1
|
|
||||||
|
|
||||||
if (mmx_supported == 2)
|
if (mmx_supported == 2) {
|
||||||
mmx_supported = mmxsupport();
|
/* this should have happened in png_init_mmx_flags() already */
|
||||||
|
png_warning(png_ptr, "asm_flags may not have been initialized");
|
||||||
if (!mmx_supported)
|
png_mmx_support();
|
||||||
{
|
|
||||||
png_read_filter_row_c(png_ptr, row_info, row, prev_row, filter);
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_DEBUG
|
#ifdef PNG_DEBUG
|
||||||
png_debug(1, "in png_read_filter_row\n");
|
png_debug(1, "in png_read_filter_row\n");
|
||||||
# if (UseMMX == 1)
|
|
||||||
png_debug1(0,"%s, ", "MMX");
|
|
||||||
# else
|
|
||||||
png_debug1(0,"%s, ", "x86");
|
|
||||||
# endif
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
{
|
{
|
||||||
case 0: sprintf(filnm, "None ");
|
case 0: sprintf(filnm, "none");
|
||||||
break;
|
break;
|
||||||
case 1: sprintf(filnm, "Sub ");
|
case 1: sprintf(filnm, "sub-%s",
|
||||||
|
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : "x86");
|
||||||
break;
|
break;
|
||||||
case 2: sprintf(filnm, "Up ");
|
case 2: sprintf(filnm, "up-%s",
|
||||||
|
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : "x86");
|
||||||
break;
|
break;
|
||||||
case 3: sprintf(filnm, "Avg ");
|
case 3: sprintf(filnm, "avg-%s",
|
||||||
|
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : "x86");
|
||||||
break;
|
break;
|
||||||
case 4: sprintf(filnm, "Paeth");
|
case 4: sprintf(filnm, "Paeth-%s",
|
||||||
|
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":"x86");
|
||||||
break;
|
break;
|
||||||
default: sprintf(filnm, "Unknw");
|
default: sprintf(filnm, "unknw");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
png_debug2(0,"row=%5d, %s, ", png_ptr->row_number, filnm);
|
png_debug2(0,"row=%5d, %s, ", png_ptr->row_number, filnm);
|
||||||
png_debug2(0, "pd=%2d, b=%d, ", (int)row_info->pixel_depth,
|
png_debug2(0, "pd=%2d, b=%d, ", (int)row_info->pixel_depth,
|
||||||
(int)((row_info->pixel_depth + 7) >> 3));
|
(int)((row_info->pixel_depth + 7) >> 3));
|
||||||
png_debug1(0,"len=%8d, ", row_info->rowbytes);
|
png_debug1(0,"len=%8d, ", row_info->rowbytes);
|
||||||
#endif
|
#endif /* PNG_DEBUG */
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
{
|
{
|
||||||
case PNG_FILTER_VALUE_NONE:
|
case PNG_FILTER_VALUE_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PNG_FILTER_VALUE_SUB:
|
case PNG_FILTER_VALUE_SUB:
|
||||||
{
|
{
|
||||||
#if (UseMMX == 1)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
|
||||||
if ((row_info->pixel_depth > 8) &&
|
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||||
(row_info->rowbytes >= 128) )
|
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
|
||||||
{
|
{
|
||||||
png_read_filter_row_mmx_sub(row_info, row);
|
png_read_filter_row_mmx_sub(row_info, row);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
@@ -3725,41 +3710,43 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
|||||||
*rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
|
*rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
|
||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
} //end !UseMMX
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PNG_FILTER_VALUE_UP:
|
case PNG_FILTER_VALUE_UP:
|
||||||
{
|
{
|
||||||
#if (UseMMX == 1)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
|
||||||
if ((row_info->pixel_depth > 8) &&
|
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||||
(row_info->rowbytes >= 128) )
|
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
|
||||||
{
|
{
|
||||||
png_read_filter_row_mmx_up(row_info, row, prev_row);
|
png_read_filter_row_mmx_up(row_info, row, prev_row);
|
||||||
} //end if UseMMX
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
|
||||||
png_bytep pp;
|
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
for (i = 0, rp = row, pp = prev_row;
|
png_uint_32 istop = row_info->rowbytes;
|
||||||
i < row_info->rowbytes; i++, rp++, pp++)
|
png_bytep rp = row;
|
||||||
|
png_bytep pp = prev_row;
|
||||||
|
|
||||||
|
for (i = 0; i < istop; ++i)
|
||||||
{
|
{
|
||||||
*rp = (png_byte)(((int)(*rp) + (int)(*pp)) & 0xff);
|
*rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
|
||||||
|
rp++;
|
||||||
}
|
}
|
||||||
} //end !UseMMX
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PNG_FILTER_VALUE_AVG:
|
case PNG_FILTER_VALUE_AVG:
|
||||||
{
|
{
|
||||||
#if (UseMMX == 1)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
|
||||||
if ((row_info->pixel_depth > 8) &&
|
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||||
(row_info->rowbytes >= 128) )
|
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
|
||||||
{
|
{
|
||||||
png_read_filter_row_mmx_avg(row_info, row, prev_row);
|
png_read_filter_row_mmx_avg(row_info, row, prev_row);
|
||||||
} //end if UseMMX
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
@@ -3781,19 +3768,19 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
|||||||
((int)(*pp++ + *lp++) >> 1)) & 0xff);
|
((int)(*pp++ + *lp++) >> 1)) & 0xff);
|
||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
} //end !UseMMX
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PNG_FILTER_VALUE_PAETH:
|
case PNG_FILTER_VALUE_PAETH:
|
||||||
{
|
{
|
||||||
#if (UseMMX == 1)
|
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
|
||||||
if ((row_info->pixel_depth > 8) &&
|
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
|
||||||
(row_info->rowbytes >= 128) )
|
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
|
||||||
{
|
{
|
||||||
png_read_filter_row_mmx_paeth(row_info, row, prev_row);
|
png_read_filter_row_mmx_paeth(row_info, row, prev_row);
|
||||||
} //end if UseMMX
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
@@ -3844,13 +3831,15 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
|
|||||||
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
|
*rp = (png_byte)(((int)(*rp) + p) & 0xff);
|
||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
} //end !UseMMX
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
png_warning(png_ptr, "Ignoring bad adaptive filter type");
|
png_warning(png_ptr, "Ignoring bad row filter type");
|
||||||
*row=0;
|
*row=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGVCRD */
|
||||||
|
|||||||
10
pngwio.c
10
pngwio.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
writes to a file pointer. Note that this routine sometimes gets called
|
writes to a file pointer. Note that this routine sometimes gets called
|
||||||
@@ -170,7 +171,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
if (write_data_fn != NULL)
|
if (write_data_fn != NULL)
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
else
|
else
|
||||||
png_ptr->write_data_fn = png_default_write_data;
|
png_ptr->write_data_fn = (png_rw_ptr)png_default_write_data;
|
||||||
#else
|
#else
|
||||||
png_ptr->write_data_fn = write_data_fn;
|
png_ptr->write_data_fn = write_data_fn;
|
||||||
#endif
|
#endif
|
||||||
@@ -180,7 +181,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
if (output_flush_fn != NULL)
|
if (output_flush_fn != NULL)
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
else
|
else
|
||||||
png_ptr->output_flush_fn = png_default_flush;
|
png_ptr->output_flush_fn = (png_flush_ptr)png_default_flush;
|
||||||
#else
|
#else
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
#endif
|
#endif
|
||||||
@@ -224,3 +225,4 @@ void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
209
pngwrite.c
209
pngwrite.c
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
/* get internal access to png.h */
|
/* get internal access to png.h */
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Writes all the PNG information. This is the suggested way to use the
|
/* 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,
|
* library. If you have a new chunk to add, make a function to write it,
|
||||||
@@ -28,6 +29,13 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
|||||||
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
||||||
{
|
{
|
||||||
png_write_sig(png_ptr); /* write PNG signature */
|
png_write_sig(png_ptr); /* write PNG signature */
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
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");
|
||||||
|
png_ptr->mng_features_permitted=0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* write IHDR information. */
|
/* write IHDR information. */
|
||||||
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
|
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
|
||||||
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
|
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
|
||||||
@@ -57,7 +65,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(PNG_WRITE_iCCP_SUPPORTED)
|
#if defined(PNG_WRITE_iCCP_SUPPORTED)
|
||||||
if (info_ptr->valid & PNG_INFO_iCCP)
|
if (info_ptr->valid & PNG_INFO_iCCP)
|
||||||
png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_TEXT_COMPRESSION_zTXt,
|
png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
|
||||||
info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
|
info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
|
||||||
#endif
|
#endif
|
||||||
#if defined(PNG_WRITE_sBIT_SUPPORTED)
|
#if defined(PNG_WRITE_sBIT_SUPPORTED)
|
||||||
@@ -375,7 +383,11 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
/* write end of PNG file */
|
/* write end of PNG file */
|
||||||
png_write_IEND(png_ptr);
|
png_write_IEND(png_ptr);
|
||||||
|
#if 0
|
||||||
|
/* This flush, added in libpng-1.0.8, causes some applications to crash
|
||||||
|
because they do not set png_ptr->output_flush_fn */
|
||||||
png_flush(png_ptr);
|
png_flush(png_ptr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
#if defined(PNG_WRITE_tIME_SUPPORTED)
|
||||||
@@ -412,7 +424,7 @@ png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
|
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
|
||||||
warn_fn, NULL, NULL, NULL));
|
warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate initialize png_ptr structure, and allocate any memory needed */
|
/* Alternate initialize png_ptr structure, and allocate any memory needed */
|
||||||
@@ -431,14 +443,19 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
int i;
|
int i;
|
||||||
png_debug(1, "in png_create_write_struct\n");
|
png_debug(1, "in png_create_write_struct\n");
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
|
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
|
||||||
(png_malloc_ptr)malloc_fn)) == NULL)
|
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
if ((png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG)) == NULL)
|
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
{
|
if (png_ptr == NULL)
|
||||||
return ((png_structp)NULL);
|
return (NULL);
|
||||||
}
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
@@ -450,7 +467,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_free(png_ptr, png_ptr->zbuf);
|
png_free(png_ptr, png_ptr->zbuf);
|
||||||
png_ptr->zbuf=NULL;
|
png_ptr->zbuf=NULL;
|
||||||
png_destroy_struct(png_ptr);
|
png_destroy_struct(png_ptr);
|
||||||
return ((png_structp)NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
|
||||||
@@ -477,23 +494,27 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
* only check the first digit.
|
* only check the first digit.
|
||||||
*/
|
*/
|
||||||
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
|
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
|
||||||
|
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
|
||||||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
|
||||||
{
|
{
|
||||||
|
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||||
|
char msg[80];
|
||||||
|
if (user_png_ver)
|
||||||
|
{
|
||||||
|
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||||
|
user_png_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
|
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||||
|
png_libpng_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
png_ptr->flags=0;
|
||||||
|
#endif
|
||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"Incompatible libpng version in application and library");
|
"Incompatible libpng version in application and library");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Libpng 1.0.6 was not binary compatible, due to insertion of the
|
|
||||||
info_ptr->free_me member. Note to maintainer: this test can be
|
|
||||||
removed from version 2.0.0 and beyond because the previous test
|
|
||||||
would have already rejected it. */
|
|
||||||
|
|
||||||
if (user_png_ver[4] == '6' && user_png_ver[2] == '0' &&
|
|
||||||
user_png_ver[0] == '1' && user_png_ver[5] == '\0')
|
|
||||||
{
|
|
||||||
png_error(png_ptr,
|
|
||||||
"Application must be recompiled; version 1.0.6 was incompatible");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize zbuf - compression buffer */
|
/* initialize zbuf - compression buffer */
|
||||||
@@ -501,11 +522,12 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
|
||||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
|
||||||
|
png_flush_ptr_NULL);
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||||
1, NULL, NULL);
|
1, png_doublep_NULL, png_doublep_NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ((png_structp)png_ptr);
|
return ((png_structp)png_ptr);
|
||||||
@@ -517,13 +539,58 @@ void PNGAPI
|
|||||||
png_write_init(png_structp png_ptr)
|
png_write_init(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
/* We only come here via pre-1.0.7-compiled applications */
|
/* We only come here via pre-1.0.7-compiled applications */
|
||||||
png_write_init_2(png_ptr, "1.0.0", 10000, 10000);
|
png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef png_write_init_2
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
||||||
png_size_t png_struct_size, png_size_t png_info_size)
|
png_size_t png_struct_size, png_size_t png_info_size)
|
||||||
{
|
{
|
||||||
|
/* We only come here via pre-1.0.12-compiled applications */
|
||||||
|
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
|
||||||
|
if(sizeof(png_struct) > png_struct_size || sizeof(png_info) > png_info_size)
|
||||||
|
{
|
||||||
|
char msg[80];
|
||||||
|
png_ptr->warning_fn=NULL;
|
||||||
|
if (user_png_ver)
|
||||||
|
{
|
||||||
|
sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
|
||||||
|
user_png_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
|
sprintf(msg, "Application is running with png.c from libpng-%.20s",
|
||||||
|
png_libpng_ver);
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if(sizeof(png_struct) > png_struct_size)
|
||||||
|
{
|
||||||
|
png_ptr->error_fn=NULL;
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
png_ptr->flags=0;
|
||||||
|
#endif
|
||||||
|
png_error(png_ptr,
|
||||||
|
"The png struct allocated by the application for writing is too small.");
|
||||||
|
}
|
||||||
|
if(sizeof(png_info) > png_info_size)
|
||||||
|
{
|
||||||
|
png_ptr->error_fn=NULL;
|
||||||
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
|
png_ptr->flags=0;
|
||||||
|
#endif
|
||||||
|
png_error(png_ptr,
|
||||||
|
"The info struct allocated by the application for writing is too small.");
|
||||||
|
}
|
||||||
|
png_write_init_3(&png_ptr, user_png_ver, png_struct_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PNGAPI
|
||||||
|
png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||||
|
png_size_t png_struct_size)
|
||||||
|
{
|
||||||
|
png_structp png_ptr=*ptr_ptr;
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
jmp_buf tmp_jmp; /* to save current jump buffer */
|
jmp_buf tmp_jmp; /* to save current jump buffer */
|
||||||
#endif
|
#endif
|
||||||
@@ -535,45 +602,53 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||||||
#ifdef PNG_LEGACY_SUPPORTED
|
#ifdef PNG_LEGACY_SUPPORTED
|
||||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||||
#else
|
#else
|
||||||
png_ptr->error_fn=(png_error_ptr)NULL;
|
png_ptr->warning_fn=NULL;
|
||||||
png_error(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Application uses deprecated png_write_init() and must be recompiled.");
|
"Application uses deprecated png_write_init() and should be recompiled.");
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} while (png_libpng_ver[i++]);
|
} while (png_libpng_ver[i++]);
|
||||||
|
|
||||||
if (sizeof(png_struct) > png_struct_size ||
|
png_debug(1, "in png_write_init_3\n");
|
||||||
sizeof(png_info) > png_info_size)
|
|
||||||
{
|
|
||||||
png_ptr->error_fn=(png_error_ptr)NULL;
|
|
||||||
png_error(png_ptr,
|
|
||||||
"Application and library have different sized structs. Please recompile.");
|
|
||||||
}
|
|
||||||
|
|
||||||
png_debug(1, "in png_write_init_2\n");
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* save jump buffer and error functions */
|
/* save jump buffer and error functions */
|
||||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
|
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (sizeof(png_struct) > png_struct_size)
|
||||||
|
{
|
||||||
|
png_destroy_struct(png_ptr);
|
||||||
|
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
|
||||||
|
*ptr_ptr = png_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* reset all variables to 0 */
|
/* reset all variables to 0 */
|
||||||
png_memset(png_ptr, 0, sizeof (png_struct));
|
png_memset(png_ptr, 0, sizeof (png_struct));
|
||||||
|
|
||||||
|
#if !defined(PNG_1_0_X)
|
||||||
|
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
||||||
|
png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_1_0_X */
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* restore jump buffer */
|
/* restore jump buffer */
|
||||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
|
||||||
|
png_flush_ptr_NULL);
|
||||||
|
|
||||||
/* initialize zbuf - compression buffer */
|
/* initialize zbuf - compression buffer */
|
||||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||||
1, NULL, NULL);
|
1, png_doublep_NULL, png_doublep_NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,6 +710,11 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
/* initialize transformations and other stuff if first time */
|
/* initialize transformations and other stuff if first time */
|
||||||
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
|
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
|
||||||
{
|
{
|
||||||
|
/* make sure we wrote the header info */
|
||||||
|
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
||||||
|
png_error(png_ptr,
|
||||||
|
"png_write_info was never called before png_write_row.");
|
||||||
|
|
||||||
/* check for transforms that have been set but were defined out */
|
/* check for transforms that have been set but were defined out */
|
||||||
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
|
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
|
||||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||||
@@ -769,6 +849,24 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
|||||||
if (png_ptr->transformations)
|
if (png_ptr->transformations)
|
||||||
png_do_write_transformations(png_ptr);
|
png_do_write_transformations(png_ptr);
|
||||||
|
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
/* Write filter_method 64 (intrapixel differencing) only if
|
||||||
|
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
|
||||||
|
* 2. Libpng did not write 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->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||||
|
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
|
||||||
|
{
|
||||||
|
/* Intrapixel differencing */
|
||||||
|
png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Find a filter if necessary, filter the row and write it out. */
|
/* Find a filter if necessary, filter the row and write it out. */
|
||||||
png_write_find_filter(png_ptr, &(png_ptr->row_info));
|
png_write_find_filter(png_ptr, &(png_ptr->row_info));
|
||||||
|
|
||||||
@@ -846,6 +944,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
|||||||
png_infop info_ptr = NULL;
|
png_infop info_ptr = NULL;
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_free_ptr free_fn = NULL;
|
png_free_ptr free_fn = NULL;
|
||||||
|
png_voidp mem_ptr = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_debug(1, "in png_destroy_write_struct\n");
|
png_debug(1, "in png_destroy_write_struct\n");
|
||||||
@@ -854,6 +953,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
|||||||
png_ptr = *png_ptr_ptr;
|
png_ptr = *png_ptr_ptr;
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
free_fn = png_ptr->free_fn;
|
free_fn = png_ptr->free_fn;
|
||||||
|
mem_ptr = png_ptr->mem_ptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,28 +974,30 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)info_ptr, free_fn);
|
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
|
||||||
|
(png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
png_destroy_struct((png_voidp)info_ptr);
|
png_destroy_struct((png_voidp)info_ptr);
|
||||||
#endif
|
#endif
|
||||||
*info_ptr_ptr = (png_infop)NULL;
|
*info_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_write_destroy(png_ptr);
|
png_write_destroy(png_ptr);
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2((png_voidp)png_ptr, free_fn);
|
png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
|
||||||
|
(png_voidp)mem_ptr);
|
||||||
#else
|
#else
|
||||||
png_destroy_struct((png_voidp)png_ptr);
|
png_destroy_struct((png_voidp)png_ptr);
|
||||||
#endif
|
#endif
|
||||||
*png_ptr_ptr = (png_structp)NULL;
|
*png_ptr_ptr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Free any memory used in png_ptr struct (old method) */
|
/* Free any memory used in png_ptr struct (old method) */
|
||||||
void PNGAPI
|
void /* PRIVATE */
|
||||||
png_write_destroy(png_structp png_ptr)
|
png_write_destroy(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
@@ -964,6 +1066,11 @@ void PNGAPI
|
|||||||
png_set_filter(png_structp png_ptr, int method, int filters)
|
png_set_filter(png_structp png_ptr, int method, int filters)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_filter\n");
|
png_debug(1, "in png_set_filter\n");
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||||
|
(method == PNG_INTRAPIXEL_DIFFERENCING))
|
||||||
|
method = PNG_FILTER_TYPE_BASE;
|
||||||
|
#endif
|
||||||
if (method == PNG_FILTER_TYPE_BASE)
|
if (method == PNG_FILTER_TYPE_BASE)
|
||||||
{
|
{
|
||||||
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
||||||
@@ -1103,12 +1210,11 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
|||||||
|
|
||||||
if (png_ptr->filter_weights == NULL)
|
if (png_ptr->filter_weights == NULL)
|
||||||
{
|
{
|
||||||
png_ptr->filter_weights = (png_uint_16p) png_malloc(png_ptr,
|
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
||||||
|
|
||||||
png_ptr->inv_filter_weights = (png_uint_16p) png_malloc(png_ptr,
|
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
||||||
|
|
||||||
for (i = 0; i < num_weights; i++)
|
for (i = 0; i < num_weights; i++)
|
||||||
{
|
{
|
||||||
png_ptr->inv_filter_weights[i] =
|
png_ptr->inv_filter_weights[i] =
|
||||||
@@ -1138,10 +1244,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
|||||||
*/
|
*/
|
||||||
if (png_ptr->filter_costs == NULL)
|
if (png_ptr->filter_costs == NULL)
|
||||||
{
|
{
|
||||||
png_ptr->filter_costs = (png_uint_16p) png_malloc(png_ptr,
|
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
(png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||||
|
|
||||||
png_ptr->inv_filter_costs = (png_uint_16p) png_malloc(png_ptr,
|
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
(png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||||
|
|
||||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
||||||
@@ -1325,7 +1431,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
/* It is REQUIRED to call this to finish writing the rest of the file */
|
||||||
png_write_end(png_ptr, info_ptr);
|
png_write_end(png_ptr, info_ptr);
|
||||||
|
|
||||||
if(transforms == 0 || params == (voidp)NULL)
|
if(transforms == 0 || params == NULL)
|
||||||
/* quiet compiler warnings */ return;
|
/* quiet compiler warnings */ return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
67
pngwtran.c
67
pngwtran.c
@@ -1,15 +1,16 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Transform the data according to the user's wishes. The order of
|
/* Transform the data according to the user's wishes. The order of
|
||||||
* transformations is significant.
|
* transformations is significant.
|
||||||
@@ -498,3 +499,65 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
/* undoes intrapixel differencing */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||||
|
{
|
||||||
|
png_debug(1, "in png_do_write_intrapixel\n");
|
||||||
|
if (
|
||||||
|
#if defined(PNG_USELESS_TESTS_SUPPORTED)
|
||||||
|
row != NULL && row_info != NULL &&
|
||||||
|
#endif
|
||||||
|
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
|
{
|
||||||
|
int bytes_per_pixel;
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
png_bytep rp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
bytes_per_pixel = 3;
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
bytes_per_pixel = 4;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
|
{
|
||||||
|
*(rp) = (png_byte)((*rp - *(rp+1))&0xff);
|
||||||
|
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (row_info->bit_depth == 16)
|
||||||
|
{
|
||||||
|
png_bytep rp;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
|
bytes_per_pixel = 6;
|
||||||
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
bytes_per_pixel = 8;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
|
{
|
||||||
|
png_uint_32 s0=*(rp )<<8 | *(rp+1);
|
||||||
|
png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
|
||||||
|
png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
|
||||||
|
png_uint_32 red=(s0-s1)&0xffff;
|
||||||
|
png_uint_32 blue=(s2-s1)&0xffff;
|
||||||
|
*(rp ) = (png_byte)((red>>8)&0xff);
|
||||||
|
*(rp+1) = (png_byte)(red&0xff);
|
||||||
|
*(rp+4) = (png_byte)((blue>>8)&0xff);
|
||||||
|
*(rp+5) = (png_byte)(blue&0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
192
pngwutil.c
192
pngwutil.c
@@ -1,15 +1,16 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.9beta2 - November 19, 2000
|
* libpng 1.0.13 - April 15, 2002
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#define PNG_INTERNAL
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Place a 32-bit number into a buffer in PNG byte order. We work
|
/* Place a 32-bit number into a buffer in PNG byte order. We work
|
||||||
* with unsigned numbers for convenience, although one supported
|
* with unsigned numbers for convenience, although one supported
|
||||||
@@ -24,7 +25,7 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
|
|||||||
buf[3] = (png_byte)(i & 0xff);
|
buf[3] = (png_byte)(i & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_WRITE_pCAL_SUPPORTED)
|
#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
|
||||||
/* The png_save_int_32 function assumes integers are stored in two's
|
/* The png_save_int_32 function assumes integers are stored in two's
|
||||||
* complement format. If this isn't the case, then this routine needs to
|
* complement format. If this isn't the case, then this routine needs to
|
||||||
* be modified to write data in two's complement format.
|
* be modified to write data in two's complement format.
|
||||||
@@ -131,6 +132,8 @@ png_write_sig(png_structp png_ptr)
|
|||||||
/* write the rest of the 8 byte signature */
|
/* write the rest of the 8 byte signature */
|
||||||
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
|
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
|
||||||
(png_size_t)8 - png_ptr->sig_bytes);
|
(png_size_t)8 - png_ptr->sig_bytes);
|
||||||
|
if(png_ptr->sig_bytes < 3)
|
||||||
|
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
|
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
|
||||||
@@ -232,8 +235,8 @@ png_text_compress(png_structp png_ptr,
|
|||||||
old_ptr = comp->output_ptr;
|
old_ptr = comp->output_ptr;
|
||||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
||||||
png_memcpy(comp->output_ptr, old_ptr,
|
png_memcpy(comp->output_ptr, old_ptr, old_max
|
||||||
old_max * sizeof (png_charp));
|
* sizeof (png_charp));
|
||||||
png_free(png_ptr, old_ptr);
|
png_free(png_ptr, old_ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -282,7 +285,7 @@ png_text_compress(png_structp png_ptr,
|
|||||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
||||||
png_memcpy(comp->output_ptr, old_ptr,
|
png_memcpy(comp->output_ptr, old_ptr,
|
||||||
old_max * sizeof (png_charp));
|
old_max * sizeof (png_charp));
|
||||||
png_free(png_ptr, old_ptr);
|
png_free(png_ptr, old_ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -329,7 +332,8 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
|
|||||||
/* handle the no-compression case */
|
/* handle the no-compression case */
|
||||||
if (comp->input)
|
if (comp->input)
|
||||||
{
|
{
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)comp->input, comp->input_len);
|
png_write_chunk_data(png_ptr, (png_bytep)comp->input,
|
||||||
|
(png_size_t)comp->input_len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +423,24 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
compression_type = PNG_COMPRESSION_TYPE_BASE;
|
compression_type = PNG_COMPRESSION_TYPE_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter_type != PNG_FILTER_TYPE_BASE)
|
/* Write filter_method 64 (intrapixel differencing) only if
|
||||||
|
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
|
||||||
|
* 2. Libpng did not write 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 (
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||||
|
((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
|
||||||
|
(color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
|
||||||
|
(filter_type == PNG_INTRAPIXEL_DIFFERENCING)) &&
|
||||||
|
#endif
|
||||||
|
filter_type != PNG_FILTER_TYPE_BASE)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid filter type specified");
|
png_warning(png_ptr, "Invalid filter type specified");
|
||||||
filter_type = PNG_FILTER_TYPE_BASE;
|
filter_type = PNG_FILTER_TYPE_BASE;
|
||||||
@@ -440,6 +461,9 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||||||
png_ptr->bit_depth = (png_byte)bit_depth;
|
png_ptr->bit_depth = (png_byte)bit_depth;
|
||||||
png_ptr->color_type = (png_byte)color_type;
|
png_ptr->color_type = (png_byte)color_type;
|
||||||
png_ptr->interlaced = (png_byte)interlace_type;
|
png_ptr->interlaced = (png_byte)interlace_type;
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
png_ptr->filter_type = (png_byte)filter_type;
|
||||||
|
#endif
|
||||||
png_ptr->width = width;
|
png_ptr->width = width;
|
||||||
png_ptr->height = height;
|
png_ptr->height = height;
|
||||||
|
|
||||||
@@ -518,16 +542,23 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
|
|||||||
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
||||||
#endif
|
#endif
|
||||||
num_pal == 0) || num_pal > 256)
|
num_pal == 0) || num_pal > 256)
|
||||||
|
{
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
png_error(png_ptr, "Invalid number of colors in palette");
|
||||||
{
|
}
|
||||||
png_error(png_ptr, "Invalid number of colors in palette");
|
else
|
||||||
}
|
{
|
||||||
else
|
png_warning(png_ptr, "Invalid number of colors in palette");
|
||||||
{
|
return;
|
||||||
png_warning(png_ptr, "Invalid number of colors in palette");
|
}
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring request to write a PLTE chunk in grayscale PNG");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->num_palette = (png_uint_16)num_pal;
|
png_ptr->num_palette = (png_uint_16)num_pal;
|
||||||
@@ -577,7 +608,8 @@ png_write_IEND(png_structp png_ptr)
|
|||||||
PNG_IEND;
|
PNG_IEND;
|
||||||
#endif
|
#endif
|
||||||
png_debug(1, "in png_write_IEND\n");
|
png_debug(1, "in png_write_IEND\n");
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_IEND, NULL, (png_size_t)0);
|
png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL,
|
||||||
|
(png_size_t)0);
|
||||||
png_ptr->mode |= PNG_HAVE_IEND;
|
png_ptr->mode |= PNG_HAVE_IEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +643,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
|
|||||||
|
|
||||||
png_debug(1, "in png_write_gAMA\n");
|
png_debug(1, "in png_write_gAMA\n");
|
||||||
/* file_gamma is saved in 1/100,000ths */
|
/* file_gamma is saved in 1/100,000ths */
|
||||||
png_save_uint_32(buf, file_gamma);
|
png_save_uint_32(buf, (png_uint_32)file_gamma);
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
|
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -657,7 +689,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compression_type)
|
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
|
||||||
png_warning(png_ptr, "Unknown compression type in iCCP chunk");
|
png_warning(png_ptr, "Unknown compression type in iCCP chunk");
|
||||||
|
|
||||||
if (profile == NULL)
|
if (profile == NULL)
|
||||||
@@ -665,7 +697,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
|||||||
|
|
||||||
if (profile_len)
|
if (profile_len)
|
||||||
profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len,
|
profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len,
|
||||||
PNG_TEXT_COMPRESSION_zTXt, &comp);
|
PNG_COMPRESSION_TYPE_BASE, &comp);
|
||||||
|
|
||||||
/* make sure we include the NULL after the name and the compression type */
|
/* make sure we include the NULL after the name and the compression type */
|
||||||
png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
|
png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
|
||||||
@@ -708,7 +740,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make sure we include the NULL after the name */
|
/* make sure we include the NULL after the name */
|
||||||
png_write_chunk_start(png_ptr, (png_bytep) png_sPLT,
|
png_write_chunk_start(png_ptr, (png_bytep)png_sPLT,
|
||||||
(png_uint_32)(name_len + 2 + palette_size));
|
(png_uint_32)(name_len + 2 + palette_size));
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1);
|
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1);
|
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1);
|
||||||
@@ -733,7 +765,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
|
|||||||
png_save_uint_16(entrybuf + 6, ep->alpha);
|
png_save_uint_16(entrybuf + 6, ep->alpha);
|
||||||
png_save_uint_16(entrybuf + 8, ep->frequency);
|
png_save_uint_16(entrybuf + 8, ep->frequency);
|
||||||
}
|
}
|
||||||
png_write_chunk_data(png_ptr, entrybuf, entry_size);
|
png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ep=spalette->entries;
|
ep=spalette->entries;
|
||||||
@@ -908,32 +940,32 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
png_save_uint_32(buf, white_x);
|
png_save_uint_32(buf, (png_uint_32)white_x);
|
||||||
png_save_uint_32(buf + 4, white_y);
|
png_save_uint_32(buf + 4, (png_uint_32)white_y);
|
||||||
|
|
||||||
if (red_x > 80000L || red_y > 80000L || red_x + red_y > 100000L)
|
if (red_x > 80000L || red_y > 80000L || red_x + red_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM fixed red point specified");
|
png_warning(png_ptr, "Invalid cHRM fixed red point specified");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
png_save_uint_32(buf + 8, red_x);
|
png_save_uint_32(buf + 8, (png_uint_32)red_x);
|
||||||
png_save_uint_32(buf + 12, red_y);
|
png_save_uint_32(buf + 12, (png_uint_32)red_y);
|
||||||
|
|
||||||
if (green_x > 80000L || green_y > 80000L || green_x + green_y > 100000L)
|
if (green_x > 80000L || green_y > 80000L || green_x + green_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid fixed cHRM green point specified");
|
png_warning(png_ptr, "Invalid fixed cHRM green point specified");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
png_save_uint_32(buf + 16, green_x);
|
png_save_uint_32(buf + 16, (png_uint_32)green_x);
|
||||||
png_save_uint_32(buf + 20, green_y);
|
png_save_uint_32(buf + 20, (png_uint_32)green_y);
|
||||||
|
|
||||||
if (blue_x > 80000L || blue_y > 80000L || blue_x + blue_y > 100000L)
|
if (blue_x > 80000L || blue_y > 80000L || blue_x + blue_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid fixed cHRM blue point specified");
|
png_warning(png_ptr, "Invalid fixed cHRM blue point specified");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
png_save_uint_32(buf + 24, blue_x);
|
png_save_uint_32(buf + 24, (png_uint_32)blue_x);
|
||||||
png_save_uint_32(buf + 28, blue_y);
|
png_save_uint_32(buf + 28, (png_uint_32)blue_y);
|
||||||
|
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
|
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
|
||||||
}
|
}
|
||||||
@@ -965,6 +997,12 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
|
|||||||
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
/* one 16 bit value */
|
/* one 16 bit value */
|
||||||
|
if(tran->gray >= (1 << png_ptr->bit_depth))
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to write tRNS chunk out-of-range for bit_depth");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_save_uint_16(buf, tran->gray);
|
png_save_uint_16(buf, tran->gray);
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2);
|
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2);
|
||||||
}
|
}
|
||||||
@@ -974,6 +1012,12 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
|
|||||||
png_save_uint_16(buf, tran->red);
|
png_save_uint_16(buf, tran->red);
|
||||||
png_save_uint_16(buf + 2, tran->green);
|
png_save_uint_16(buf + 2, tran->green);
|
||||||
png_save_uint_16(buf + 4, tran->blue);
|
png_save_uint_16(buf + 4, tran->blue);
|
||||||
|
if(png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6);
|
png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1014,10 +1058,22 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
|
|||||||
png_save_uint_16(buf, back->red);
|
png_save_uint_16(buf, back->red);
|
||||||
png_save_uint_16(buf + 2, back->green);
|
png_save_uint_16(buf + 2, back->green);
|
||||||
png_save_uint_16(buf + 4, back->blue);
|
png_save_uint_16(buf + 4, back->blue);
|
||||||
|
if(png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6);
|
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(back->gray >= (1 << png_ptr->bit_depth))
|
||||||
|
{
|
||||||
|
png_warning(png_ptr,
|
||||||
|
"Ignoring attempt to write bKGD chunk out-of-range for bit_depth");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_save_uint_16(buf, back->gray);
|
png_save_uint_16(buf, back->gray);
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2);
|
png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2);
|
||||||
}
|
}
|
||||||
@@ -1072,13 +1128,14 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
png_size_t key_len;
|
png_size_t key_len;
|
||||||
png_charp kp, dp;
|
png_charp kp, dp;
|
||||||
int kflag;
|
int kflag;
|
||||||
|
int kwarn=0;
|
||||||
|
|
||||||
png_debug(1, "in png_check_keyword\n");
|
png_debug(1, "in png_check_keyword\n");
|
||||||
*new_key = NULL;
|
*new_key = NULL;
|
||||||
|
|
||||||
if (key == NULL || (key_len = png_strlen(key)) == 0)
|
if (key == NULL || (key_len = png_strlen(key)) == 0)
|
||||||
{
|
{
|
||||||
png_chunk_warning(png_ptr, "zero length keyword");
|
png_warning(png_ptr, "zero length keyword");
|
||||||
return ((png_size_t)0);
|
return ((png_size_t)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1095,9 +1152,9 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
char msg[40];
|
char msg[40];
|
||||||
|
|
||||||
sprintf(msg, "invalid keyword character 0x%02X", *kp);
|
sprintf(msg, "invalid keyword character 0x%02X", *kp);
|
||||||
png_chunk_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
#else
|
#else
|
||||||
png_chunk_warning(png_ptr, "invalid character in keyword");
|
png_warning(png_ptr, "invalid character in keyword");
|
||||||
#endif
|
#endif
|
||||||
*dp = ' ';
|
*dp = ' ';
|
||||||
}
|
}
|
||||||
@@ -1112,7 +1169,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
kp = *new_key + key_len - 1;
|
kp = *new_key + key_len - 1;
|
||||||
if (*kp == ' ')
|
if (*kp == ' ')
|
||||||
{
|
{
|
||||||
png_chunk_warning(png_ptr, "trailing spaces removed from keyword");
|
png_warning(png_ptr, "trailing spaces removed from keyword");
|
||||||
|
|
||||||
while (*kp == ' ')
|
while (*kp == ' ')
|
||||||
{
|
{
|
||||||
@@ -1125,7 +1182,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
kp = *new_key;
|
kp = *new_key;
|
||||||
if (*kp == ' ')
|
if (*kp == ' ')
|
||||||
{
|
{
|
||||||
png_chunk_warning(png_ptr, "leading spaces removed from keyword");
|
png_warning(png_ptr, "leading spaces removed from keyword");
|
||||||
|
|
||||||
while (*kp == ' ')
|
while (*kp == ' ')
|
||||||
{
|
{
|
||||||
@@ -1147,6 +1204,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
else if (*kp == ' ')
|
else if (*kp == ' ')
|
||||||
{
|
{
|
||||||
key_len--;
|
key_len--;
|
||||||
|
kwarn=1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1155,17 +1213,19 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dp = '\0';
|
*dp = '\0';
|
||||||
|
if(kwarn)
|
||||||
|
png_warning(png_ptr, "extra interior spaces removed from keyword");
|
||||||
|
|
||||||
if (key_len == 0)
|
if (key_len == 0)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, *new_key);
|
png_free(png_ptr, *new_key);
|
||||||
*new_key=NULL;
|
*new_key=NULL;
|
||||||
png_chunk_warning(png_ptr, "Zero length keyword");
|
png_warning(png_ptr, "Zero length keyword");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key_len > 79)
|
if (key_len > 79)
|
||||||
{
|
{
|
||||||
png_chunk_warning(png_ptr, "keyword length must be 1 - 79 characters");
|
png_warning(png_ptr, "keyword length must be 1 - 79 characters");
|
||||||
new_key[79] = '\0';
|
new_key[79] = '\0';
|
||||||
key_len = 79;
|
key_len = 79;
|
||||||
}
|
}
|
||||||
@@ -1289,22 +1349,28 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
|||||||
png_warning(png_ptr, "Empty keyword in iTXt chunk");
|
png_warning(png_ptr, "Empty keyword in iTXt chunk");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang,
|
if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0)
|
||||||
&new_lang))==0)
|
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Empty language field in iTXt chunk");
|
png_warning(png_ptr, "Empty language field in iTXt chunk");
|
||||||
return;
|
new_lang = NULL;
|
||||||
|
lang_len = 0;
|
||||||
}
|
}
|
||||||
lang_key_len = png_strlen(lang_key);
|
|
||||||
text_len = png_strlen(text);
|
|
||||||
|
|
||||||
if (text == NULL || *text == '\0')
|
if (lang_key == NULL)
|
||||||
|
lang_key_len = 0;
|
||||||
|
else
|
||||||
|
lang_key_len = png_strlen(lang_key);
|
||||||
|
|
||||||
|
if (text == NULL)
|
||||||
text_len = 0;
|
text_len = 0;
|
||||||
|
else
|
||||||
|
text_len = png_strlen(text);
|
||||||
|
|
||||||
/* compute the compressed data; do it now for the length */
|
/* compute the compressed data; do it now for the length */
|
||||||
text_len = png_text_compress(png_ptr, text, text_len, compression-2,
|
text_len = png_text_compress(png_ptr, text, text_len, compression-2,
|
||||||
&comp);
|
&comp);
|
||||||
|
|
||||||
|
|
||||||
/* make sure we include the compression flag, the compression byte,
|
/* make sure we include the compression flag, the compression byte,
|
||||||
* and the NULs after the key, lang, and lang_key parts */
|
* and the NULs after the key, lang, and lang_key parts */
|
||||||
|
|
||||||
@@ -1334,23 +1400,22 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
|||||||
cbuf[1] = 0;
|
cbuf[1] = 0;
|
||||||
png_write_chunk_data(png_ptr, cbuf, 2);
|
png_write_chunk_data(png_ptr, cbuf, 2);
|
||||||
|
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)new_lang, lang_len + 1);
|
cbuf[0] = 0;
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)lang_key, lang_key_len+1);
|
png_write_chunk_data(png_ptr, (new_lang ? (png_bytep)new_lang : cbuf), lang_len + 1);
|
||||||
png_write_chunk_data(png_ptr, '\0', 1);
|
png_write_chunk_data(png_ptr, (lang_key ? (png_bytep)lang_key : cbuf), lang_key_len + 1);
|
||||||
|
|
||||||
png_write_compressed_data_out(png_ptr, &comp);
|
png_write_compressed_data_out(png_ptr, &comp);
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_write_chunk_end(png_ptr);
|
||||||
png_free(png_ptr, new_key);
|
png_free(png_ptr, new_key);
|
||||||
png_free(png_ptr, new_lang);
|
if (new_lang)
|
||||||
|
png_free(png_ptr, new_lang);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_oFFs_SUPPORTED)
|
#if defined(PNG_WRITE_oFFs_SUPPORTED)
|
||||||
/* write the oFFs chunk */
|
/* write the oFFs chunk */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset,
|
png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
|
||||||
png_uint_32 y_offset,
|
|
||||||
int unit_type)
|
int unit_type)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
@@ -1362,8 +1427,8 @@ png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset,
|
|||||||
if (unit_type >= PNG_OFFSET_LAST)
|
if (unit_type >= PNG_OFFSET_LAST)
|
||||||
png_warning(png_ptr, "Unrecognized unit type for oFFs chunk");
|
png_warning(png_ptr, "Unrecognized unit type for oFFs chunk");
|
||||||
|
|
||||||
png_save_uint_32(buf, x_offset);
|
png_save_int_32(buf, x_offset);
|
||||||
png_save_uint_32(buf + 4, y_offset);
|
png_save_int_32(buf + 4, y_offset);
|
||||||
buf[8] = (png_byte)unit_type;
|
buf[8] = (png_byte)unit_type;
|
||||||
|
|
||||||
png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9);
|
png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9);
|
||||||
@@ -1390,9 +1455,9 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
|||||||
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
|
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
|
||||||
|
|
||||||
purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1;
|
purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1;
|
||||||
png_debug1(3, "pCAL purpose length = %d\n", purpose_len);
|
png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len);
|
||||||
units_len = png_strlen(units) + (nparams == 0 ? 0 : 1);
|
units_len = png_strlen(units) + (nparams == 0 ? 0 : 1);
|
||||||
png_debug1(3, "pCAL units length = %d\n", units_len);
|
png_debug1(3, "pCAL units length = %d\n", (int)units_len);
|
||||||
total_len = purpose_len + units_len + 10;
|
total_len = purpose_len + units_len + 10;
|
||||||
|
|
||||||
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
|
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
|
||||||
@@ -1407,7 +1472,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
|||||||
total_len += (png_size_t)params_len[i];
|
total_len += (png_size_t)params_len[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
png_debug1(3, "pCAL total length = %d\n", total_len);
|
png_debug1(3, "pCAL total length = %d\n", (int)total_len);
|
||||||
png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len);
|
png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len);
|
png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len);
|
||||||
png_save_int_32(buf, X0);
|
png_save_int_32(buf, X0);
|
||||||
@@ -1459,11 +1524,11 @@ png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
|
|||||||
#endif
|
#endif
|
||||||
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
||||||
|
|
||||||
png_debug1(3, "sCAL total length = %d\n", total_len);
|
png_debug1(3, "sCAL total length = %d\n", (int)total_len);
|
||||||
png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len);
|
png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)&unit, 1);
|
png_write_chunk_data(png_ptr, (png_bytep)&unit, 1);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)wbuf, strlen(wbuf)+1);
|
png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)hbuf, strlen(hbuf));
|
png_write_chunk_data(png_ptr, (png_bytep)hbuf, png_strlen(hbuf));
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_write_chunk_end(png_ptr);
|
||||||
}
|
}
|
||||||
@@ -1481,15 +1546,15 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
|
|||||||
|
|
||||||
png_debug(1, "in png_write_sCAL_s\n");
|
png_debug(1, "in png_write_sCAL_s\n");
|
||||||
|
|
||||||
strcpy(wbuf,(const char *)width);
|
png_strcpy(wbuf,(const char *)width);
|
||||||
strcpy(hbuf,(const char *)height);
|
png_strcpy(hbuf,(const char *)height);
|
||||||
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
||||||
|
|
||||||
png_debug1(3, "sCAL total length = %d\n", total_len);
|
png_debug1(3, "sCAL total length = %d\n", total_len);
|
||||||
png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len);
|
png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)&unit, 1);
|
png_write_chunk_data(png_ptr, (png_bytep)&unit, 1);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)wbuf, strlen(wbuf)+1);
|
png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)hbuf, strlen(hbuf));
|
png_write_chunk_data(png_ptr, (png_bytep)hbuf, png_strlen(hbuf));
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_write_chunk_end(png_ptr);
|
||||||
}
|
}
|
||||||
@@ -2607,3 +2672,4 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|||||||
BIN
projects/beos/x86-shared.proj
Normal file
BIN
projects/beos/x86-shared.proj
Normal file
Binary file not shown.
22
projects/beos/x86-shared.txt
Normal file
22
projects/beos/x86-shared.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
This project builds a shared library version of libpng on x86 BeOS.
|
||||||
|
|
||||||
|
It defines PNG_USE_PNGGCCRD, which activates the assembly code in
|
||||||
|
pnggccrd.c; this hasn't been extensively tested on BeOS.
|
||||||
|
|
||||||
|
To install:
|
||||||
|
|
||||||
|
1) build
|
||||||
|
|
||||||
|
Note: As of version 1.0.10, you'll get a fair number of warnings when
|
||||||
|
you compile pnggccrd.c. As far as I know, these are harmless,
|
||||||
|
but it would be better if someone fixed them.
|
||||||
|
|
||||||
|
2) copy and png.h, pngconf.h somewhere; /boot/home/config/include (which
|
||||||
|
you'll have to make) is a good choice
|
||||||
|
|
||||||
|
3) copy libpng.so to /boot/home/config/lib
|
||||||
|
|
||||||
|
4) build your libpng.so applications (remember to include libz.a as
|
||||||
|
well when you link)
|
||||||
|
|
||||||
|
- Chris Herborth, March 27, 2001
|
||||||
BIN
projects/beos/x86-static.proj
Normal file
BIN
projects/beos/x86-static.proj
Normal file
Binary file not shown.
22
projects/beos/x86-static.txt
Normal file
22
projects/beos/x86-static.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
This project builds a static library version of libpng on x86 BeOS.
|
||||||
|
|
||||||
|
It defines PNG_USE_PNGGCCRD, which activates the assembly code in
|
||||||
|
pnggccrd.c; this hasn't been extensively tested on BeOS.
|
||||||
|
|
||||||
|
To install:
|
||||||
|
|
||||||
|
1) build
|
||||||
|
|
||||||
|
Note: As of version 1.0.10, you'll get a fair number of warnings when
|
||||||
|
you compile pnggccrd.c. As far as I know, these are harmless,
|
||||||
|
but it would be better if someone fixed them.
|
||||||
|
|
||||||
|
2) copy and png.h, pngconf.h somewhere; /boot/home/config/include (which
|
||||||
|
you'll have to make) is a good choice
|
||||||
|
|
||||||
|
3) copy libpng.a to /boot/home/config/lib
|
||||||
|
|
||||||
|
4) build your libpng.a applications (remember to include libz.a as
|
||||||
|
well when you link)
|
||||||
|
|
||||||
|
- Chris Herborth, March 27, 2001
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
Microsoft Developer Studio Build File, Format Version 6.00 for
|
Microsoft Developer Studio Build File, Format Version 6.00 for
|
||||||
libpng 1.0.9beta2 (November 19, 2000) and zlib
|
libpng 1.0.13 (April 15, 2002) and zlib
|
||||||
|
|
||||||
Copyright (C) 2000 Simon-Pierre Cadieux
|
Copyright (C) 2000 Simon-Pierre Cadieux
|
||||||
For conditions of distribution and use, see copyright notice in png.h
|
For conditions of distribution and use, see copyright notice in png.h
|
||||||
@@ -24,12 +24,12 @@ To build:
|
|||||||
This project will build the PNG Development Group's "official" versions of
|
This project will build the PNG Development Group's "official" versions of
|
||||||
libpng and zlib libraries:
|
libpng and zlib libraries:
|
||||||
|
|
||||||
libpng1.dll (default version, currently C code only)
|
libpng10.dll (default version, currently C code only)
|
||||||
libpng1a.dll (C + Assembler version)
|
libpng10.dll (C + Assembler version)
|
||||||
libpng1b.dll (C + Assembler debug version)
|
libpng10.dll (C + Assembler debug version)
|
||||||
libpng1d.dll (C code debug version)
|
libpng10.dll (C code debug version)
|
||||||
libpng1[c,e-m].dll (reserved for official versions)
|
libpng10[c,e-m].dll (reserved for official versions)
|
||||||
libpng1[n-z].dll (available for private versions)
|
libpng10[n-z].dll (available for private versions)
|
||||||
zlib.dll (default version, currently C code only)
|
zlib.dll (default version, currently C code only)
|
||||||
zlibd.dll (debug version)
|
zlibd.dll (debug version)
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||||
# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng1.dll"
|
# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng10.dll"
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
|
||||||
@@ -84,7 +84,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng1d.dll"
|
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng10d.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM"
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /machine:I386
|
# ADD BASE LINK32 /nologo /dll /machine:I386
|
||||||
# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng1a.dll"
|
# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng10a.dll"
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM"
|
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug ASM"
|
||||||
@@ -139,7 +139,7 @@ BSC32=bscmake.exe
|
|||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng1b.dll"
|
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng10b.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "libpng - Win32 LIB"
|
!ELSEIF "$(CFG)" == "libpng - Win32 LIB"
|
||||||
|
|
||||||
|
|||||||
@@ -50,23 +50,18 @@
|
|||||||
# define VS_SPECIALBUILD 0
|
# define VS_SPECIALBUILD 0
|
||||||
#endif /* SPECIALBUILD */
|
#endif /* SPECIALBUILD */
|
||||||
|
|
||||||
#if defined(PNG_LIBPNG_BUILD_TYPE)
|
#if ((PNG_LIBPNG_BUILD_TYPE & PNG_LIBPNG_BUILD_TYPEMASK) != \
|
||||||
# if (PNG_LIBPNG_BUILD_TYPE != stable)
|
PNG_LIBPNG_BUILD_STABLE)
|
||||||
# if(PNG_LIBPNG_BUILD_TYPE == patched)
|
# define VS_PRERELEASE VS_FF_PRERELEASE
|
||||||
# define VS_PATCHED VS_FF_PATCHED
|
# define VS_PATCHED 0
|
||||||
# define VS_PRERELEASE 0
|
|
||||||
# else
|
|
||||||
# define VS_PRERELEASE VS_FF_PRERELEASE
|
|
||||||
# define VS_PATCHED 0
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define VS_PRERELEASE 0
|
|
||||||
# define VS_PATCHED 0
|
|
||||||
# endif /* PNG_LIBPNG_BUILD_TYPE != stable */
|
|
||||||
#else
|
#else
|
||||||
# define VS_PRERELEASE 0
|
# define VS_PRERELEASE 0
|
||||||
# define VS_PATCHED 0
|
# if (PNG_LIBPNG_BUILD_TYPE & PNG_LIBPNG_BUILD_PATCHED)
|
||||||
#endif /* PNG_LIBPNG_BUILD_TYPE */
|
# define VS_PATCHED VS_FF_PATCHED
|
||||||
|
# else
|
||||||
|
# define VS_PATCHED 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION PNG_LIBPNG_VER_MAJOR, PNG_LIBPNG_VER_MINOR, PNG_LIBPNG_VER_RELEASE, PNG_LIBPNG_VER_BUILD
|
FILEVERSION PNG_LIBPNG_VER_MAJOR, PNG_LIBPNG_VER_MINOR, PNG_LIBPNG_VER_RELEASE, PNG_LIBPNG_VER_BUILD
|
||||||
@@ -86,7 +81,7 @@ BEGIN
|
|||||||
VALUE "FileDescription", "PNG image compression library\000"
|
VALUE "FileDescription", "PNG image compression library\000"
|
||||||
VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000"
|
VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000"
|
||||||
VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX " (Windows 32 bit)\000"
|
VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX " (Windows 32 bit)\000"
|
||||||
VALUE "LegalCopyright", "\251 1998-2000 Glenn Randers-Pehrson\000"
|
VALUE "LegalCopyright", "\251 1998-2002 Glenn Randers-Pehrson\000"
|
||||||
VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX ".DLL\000"
|
VALUE "OriginalFilename", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_MAJOR) DLLFNAME_POSTFIX ".DLL\000"
|
||||||
#ifdef PRIVATEBUILD
|
#ifdef PRIVATEBUILD
|
||||||
VALUE "PrivateBuild", PRIVATEBUILD
|
VALUE "PrivateBuild", PRIVATEBUILD
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ LIBRARY
|
|||||||
DESCRIPTION "PNG image compression library for Windows"
|
DESCRIPTION "PNG image compression library for Windows"
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
;Version 1.0.9beta2
|
;Version 1.0.13
|
||||||
png_build_grayscale_palette @1
|
png_build_grayscale_palette @1
|
||||||
png_check_sig @2
|
png_check_sig @2
|
||||||
png_chunk_error @3
|
png_chunk_error @3
|
||||||
@@ -77,12 +77,14 @@ EXPORTS
|
|||||||
png_malloc @68
|
png_malloc @68
|
||||||
png_memcpy_check @69
|
png_memcpy_check @69
|
||||||
png_memset_check @70
|
png_memset_check @70
|
||||||
|
; png_permit_empty_plte is deprecated
|
||||||
png_permit_empty_plte @71
|
png_permit_empty_plte @71
|
||||||
png_process_data @72
|
png_process_data @72
|
||||||
png_progressive_combine_row @73
|
png_progressive_combine_row @73
|
||||||
png_read_end @74
|
png_read_end @74
|
||||||
png_read_image @75
|
png_read_image @75
|
||||||
png_read_info @76
|
png_read_info @76
|
||||||
|
; png_read_init is deprecated
|
||||||
png_read_init @77
|
png_read_init @77
|
||||||
png_read_png @78
|
png_read_png @78
|
||||||
png_read_row @79
|
png_read_row @79
|
||||||
@@ -168,11 +170,51 @@ EXPORTS
|
|||||||
png_write_image @159
|
png_write_image @159
|
||||||
png_write_info @160
|
png_write_info @160
|
||||||
png_write_info_before_PLTE @161
|
png_write_info_before_PLTE @161
|
||||||
|
; png_write_init is deprecated
|
||||||
png_write_init @162
|
png_write_init @162
|
||||||
png_write_png @163
|
png_write_png @163
|
||||||
png_write_row @164
|
png_write_row @164
|
||||||
png_write_rows @165
|
png_write_rows @165
|
||||||
|
; png_read_init_2 and png_write_init_2 are deprecated.
|
||||||
png_read_init_2 @166
|
png_read_init_2 @166
|
||||||
png_write_init_2 @167
|
png_write_init_2 @167
|
||||||
png_access_version_number @168
|
png_access_version_number @168
|
||||||
; png_sig_bytes @169
|
; png_sig_bytes @169
|
||||||
|
; png_libpng_ver @170
|
||||||
|
png_init_io @171
|
||||||
|
png_convert_to_rfc1123 @172
|
||||||
|
png_set_invalid @173
|
||||||
|
; Added at version 1.0.12
|
||||||
|
; For compatiblity with 1.0.7-1.0.11
|
||||||
|
png_info_init @174
|
||||||
|
png_read_init_3 @175
|
||||||
|
png_write_init_3 @176
|
||||||
|
png_info_init_3 @177
|
||||||
|
png_destroy_struct @178
|
||||||
|
; Added at version 1.2.0
|
||||||
|
; For use with PNG_USER_MEM_SUPPORTED
|
||||||
|
; png_destroy_struct_2 @179
|
||||||
|
; png_create_read_struct_2 @180
|
||||||
|
; png_create_write_struct_2 @181
|
||||||
|
; png_malloc_default @182
|
||||||
|
; png_free_default @183
|
||||||
|
; MNG features
|
||||||
|
; png_permit_mng_features @184
|
||||||
|
; MMX support
|
||||||
|
; png_mmx_support @185
|
||||||
|
; png_get_mmx_flagmask @186
|
||||||
|
; png_get_asm_flagmask @187
|
||||||
|
; png_get_asm_flags @188
|
||||||
|
; png_get_mmx_bitdepth_threshold @189
|
||||||
|
; png_get_mmx_rowbytes_threshold @190
|
||||||
|
; png_set_asm_flags @191
|
||||||
|
; png_init_mmx_flags @192
|
||||||
|
; Strip error numbers
|
||||||
|
; png_set_strip_error_numbers @193
|
||||||
|
; Added at version 1.2.2
|
||||||
|
png_handle_as_unknown @179
|
||||||
|
png_zalloc @180
|
||||||
|
png_zfree @181
|
||||||
|
; png_handle_as_unknown @194
|
||||||
|
; png_zalloc @195
|
||||||
|
; png_zfree @196
|
||||||
|
|||||||
6
projects/netware.txt
Normal file
6
projects/netware.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
A set of project files is available for Netware. Get
|
||||||
|
libpng-1.0.13-project-netware.zip from a libpng distribution
|
||||||
|
site such as http://libpng.sourceforge.net
|
||||||
|
|
||||||
|
Put the zip file in this directory (projects) and then run
|
||||||
|
"unzip -a libpng-1.0.13-project-netware.zip"
|
||||||
6
projects/wince.txt
Normal file
6
projects/wince.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
A set of project files is available for WinCE. Get
|
||||||
|
libpng-1.0.13-project-wince.zip from a libpng distribution
|
||||||
|
site such as http://libpng.sourceforge.net
|
||||||
|
|
||||||
|
Put the zip file in this directory (projects) and then run
|
||||||
|
"unzip -a libpng-1.0.13-project-wince.zip"
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
libpng for WindowsCE Rel.1.0
|
|
||||||
============================
|
|
||||||
Copyright (c) 2000 Glenn Randers-Pehrson
|
|
||||||
Copyright (c) 2000 Tenik Co.,Ltd.
|
|
||||||
|
|
||||||
Porting for WindowsCE by Tenik Co.,Ltd.(Kazuo Adachi)
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
|
||||||
============
|
|
||||||
This is libpng 1.0.9beta2 ported to WindowsCE 2.0 and 2.11.
|
|
||||||
libpng 1.0.9beta2 is a PNG reference library.
|
|
||||||
See README, a document of original libpng 1.0.9beta2.
|
|
||||||
|
|
||||||
zlib for WindowsCE
|
|
||||||
==================
|
|
||||||
This library requires zlib for WindowsCE. You can use the supplied
|
|
||||||
zlib.diff and zlibce.def files to add WindowsCE support to libpng-1.1.3.
|
|
||||||
|
|
||||||
Copyright notice
|
|
||||||
================
|
|
||||||
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.9beta2, for conditions
|
|
||||||
of use and distribution.
|
|
||||||
|
|
||||||
Files
|
|
||||||
=====
|
|
||||||
|
|
||||||
READMEE.WCE - this file(in English)
|
|
||||||
READMEJ.WCE - this file(in Japanese)
|
|
||||||
png32ce.def - module definition file to make DLLs
|
|
||||||
|
|
||||||
Sample programs(../../pngtest.c and ../../contrib/*) can build on WindowsCE
|
|
||||||
2.11. WindowsCE 2.0 and below do not support 'console' functions.
|
|
||||||
|
|
||||||
Author
|
|
||||||
======
|
|
||||||
Tenik Co.,Ltd.
|
|
||||||
Kazuo Adachi
|
|
||||||
adachi@tenik.co.jp
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
libpng for WindowsCE Rel.1.0
|
|
||||||
============================
|
|
||||||
Copyright (c) 2000 Glenn Randers-Pehrson
|
|
||||||
Copyright (c) 2000 Tenik Co.,Ltd.
|
|
||||||
|
|
||||||
Porting for WindowsCE by Tenik Co.,Ltd.(Kazuo Adachi)
|
|
||||||
|
|
||||||
|
|
||||||
<EFBFBD>͂<EFBFBD><EFBFBD>߂<EFBFBD>
|
|
||||||
========
|
|
||||||
libpng for WindowsCE<43><45> PNG<4E>`<60><><EFBFBD>̉摜<CC89>f<EFBFBD>[<5B>^<5E><><EFBFBD>C<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD> libpng<6E><67>WindowsCE
|
|
||||||
<EFBFBD>łł<EFBFBD><EFBFBD>Blibpng<EFBFBD>ɂ<EFBFBD><EFBFBD>Ă̏ڂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD><EFBFBD> README <20><><EFBFBD><EFBFBD><EFBFBD>ǂ݂<C782><DD82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|
||||||
|
|
||||||
zlib for WindowsCE
|
|
||||||
==================
|
|
||||||
libpng<EFBFBD>ł́A<EFBFBD>f<EFBFBD>[<5B>^<5E><><EFBFBD>k<EFBFBD><6B><EFBFBD>C<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><C682><EFBFBD> zlib<69><62><EFBFBD>g<EFBFBD>p<EFBFBD><70><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82>Blibpng<6E><67>
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>p<EFBFBD><EFBFBD><EFBFBD>邽<EFBFBD>߂ɂ́A<EFBFBD>ʓr zlib<69><62><EFBFBD>p<EFBFBD>ӂ<EFBFBD><D382><EFBFBD><EFBFBD>K<EFBFBD>v<EFBFBD><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82>B
|
|
||||||
|
|
||||||
<EFBFBD>Ȃ<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>̃p<EFBFBD>b<EFBFBD>P<EFBFBD>[<5B>W<EFBFBD>ŗ<EFBFBD><C597>p<EFBFBD>ł<EFBFBD><C582><EFBFBD> zlib<69>͎<EFBFBD><CD8E>̍쐬<CC8D><EC90AC><EFBFBD><EFBFBD> zlibce.dll<6C>ł<EFBFBD><C582>B
|
|
||||||
|
|
||||||
<EFBFBD>g<EFBFBD>p<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
========
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>̃\<5C>t<EFBFBD>g<EFBFBD>E<EFBFBD>F<EFBFBD>A<EFBFBD>͖<EFBFBD><CD96>ۏł<D882><C582>B<EFBFBD><42><EFBFBD>̃\<5C>t<EFBFBD>g<EFBFBD>E<EFBFBD>F<EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŗ<EFBFBD><C597>p<EFBFBD>҂<EFBFBD><D282><EFBFBD><EFBFBD>邱<EFBFBD><E982B1>
|
|
||||||
<EFBFBD>ɂȂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD>ɂ<EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>ҁA<EFBFBD>z<EFBFBD>z<EFBFBD>ҁA<EFBFBD><EFBFBD><EFBFBD>̑<EFBFBD><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>҈ȊO<EFBFBD>̐l<EFBFBD><EFBFBD><EFBFBD>A
|
|
||||||
<EFBFBD>c<EFBFBD>̂ɐӔC<EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><EFBFBD>`<60><><EFBFBD>͂Ȃ<CD82><C882><EFBFBD><EFBFBD>̂Ƃ<CC82><C682>܂<EFBFBD><DC82>B
|
|
||||||
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>̑<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>̃\<5C>t<EFBFBD>g<EFBFBD>E<EFBFBD>F<EFBFBD>A<EFBFBD>̗<EFBFBD><CC97>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>ɂ<C982><C282>ẮA<CD81><41><EFBFBD>łł<C582><C582><EFBFBD> libpng 1.0.9beta2<EFBFBD><EFBFBD>
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂Ƃ<EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>B<EFBFBD>ڂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD><EFBFBD> README,LICENSE <20><><EFBFBD><EFBFBD><EFBFBD>ǂ݂<C782><DD82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|
||||||
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>^<5E><><EFBFBD>e
|
|
||||||
========
|
|
||||||
|
|
||||||
READMEJ.WCE - <20><><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43>
|
|
||||||
READMEE.WCE - <20><><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43>(<28>p<EFBFBD><70>)
|
|
||||||
png32ce.def - DLL<4C>쐬<EFBFBD>p <20><><EFBFBD>`<60>t<EFBFBD>@<40>C<EFBFBD><43>
|
|
||||||
|
|
||||||
<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><EFBFBD><EFBFBD>v<EFBFBD><EFBFBD><EFBFBD>E<EFBFBD>v<EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD>o<EFBFBD>͂̓s<CC93><73><EFBFBD><EFBFBD><EFBFBD>AWindowsCE 2.11<EFBFBD>ȍ~
|
|
||||||
<EFBFBD>ł̂ݎg<EFBFBD>p<EFBFBD>\<5C>ł<EFBFBD><C582>B
|
|
||||||
|
|
||||||
<EFBFBD>z<EFBFBD>z<EFBFBD><EFBFBD>
|
|
||||||
======
|
|
||||||
<EFBFBD>e<EFBFBD>j<EFBFBD>b<EFBFBD>N<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>J<EFBFBD><4A><EFBFBD><EFBFBD>
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>a<EFBFBD>Y
|
|
||||||
adachi@tenik.co.jp
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
zlib for WindowsCE Rel.1.0
|
|
||||||
==========================
|
|
||||||
(C) 1995-1998 Jean-loup Gailly and Mark Adler
|
|
||||||
(C) 2000 Tenik Co.,Ltd.
|
|
||||||
|
|
||||||
Porting for WindowsCE by Tenik Co.,Ltd.(Kazuo Adachi)
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
|
||||||
============
|
|
||||||
This is zlib 1.1.3 ported to WindowsCE 2.0 and 2.11.
|
|
||||||
zlib 1.1.3 is a general purpose data compression library.
|
|
||||||
See README, a document of original zlib 1.1.3.
|
|
||||||
|
|
||||||
Copyright notice
|
|
||||||
================
|
|
||||||
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, a document of original zlib 1.1.3, for conditions of use and
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
Files
|
|
||||||
=====
|
|
||||||
|
|
||||||
READMEE.WCE - this file(in English)
|
|
||||||
READMEJ.WCE - this file(in Japanese)
|
|
||||||
zlibce.def - module definition file to make DLLs
|
|
||||||
zlibce.diff - patch file for source code
|
|
||||||
|
|
||||||
Sample programs(minigzip.c and example.c) can build on WindowsCE 2.11.
|
|
||||||
WindowsCE 2.0 and below is not support 'console' functions.
|
|
||||||
|
|
||||||
Author
|
|
||||||
======
|
|
||||||
Tenik Co.,Ltd.
|
|
||||||
Kazuo Adachi
|
|
||||||
adachi@tenik.co.jp
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
zlib for WindowsCE Rel.1.0
|
|
||||||
==========================
|
|
||||||
(C) 1995-1998 Jean-loup Gailly and Mark Adler
|
|
||||||
(C) 2000 Tenik Co.,Ltd.
|
|
||||||
|
|
||||||
Porting for WindowsCE by Tenik Co.,Ltd.(Kazuo Adachi)
|
|
||||||
|
|
||||||
|
|
||||||
<EFBFBD>͂<EFBFBD><EFBFBD>߂<EFBFBD>
|
|
||||||
========
|
|
||||||
zlib for WindowsCE<43>͔ėp<C497>̃f<CC83>[<5B>^<5E><><EFBFBD>k<EFBFBD><6B><EFBFBD>C<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD> zlib<69><62> WindowsCE<43>łł<C582><C582>B
|
|
||||||
zlib<EFBFBD>ɂ<EFBFBD><EFBFBD>Ă̏ڂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD><EFBFBD> README <20><><EFBFBD><EFBFBD><EFBFBD>ǂ݂<C782><DD82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|
||||||
|
|
||||||
<EFBFBD>g<EFBFBD>p<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
========
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>̃\<5C>t<EFBFBD>g<EFBFBD>E<EFBFBD>F<EFBFBD>A<EFBFBD>͖<EFBFBD><CD96>ۏł<D882><C582>B<EFBFBD><42><EFBFBD>̃\<5C>t<EFBFBD>g<EFBFBD>E<EFBFBD>F<EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŗ<EFBFBD><C597>p<EFBFBD>҂<EFBFBD><D282><EFBFBD><EFBFBD>邱<EFBFBD><E982B1>
|
|
||||||
<EFBFBD>ɂȂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD>ɂ<EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>ҁA<EFBFBD>z<EFBFBD>z<EFBFBD>ҁA<EFBFBD><EFBFBD><EFBFBD>̑<EFBFBD><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>҈ȊO<EFBFBD>̐l<EFBFBD><EFBFBD><EFBFBD>A
|
|
||||||
<EFBFBD>c<EFBFBD>̂ɐӔC<EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><EFBFBD>`<60><><EFBFBD>͂Ȃ<CD82><C882><EFBFBD><EFBFBD>̂Ƃ<CC82><C682>܂<EFBFBD><DC82>B
|
|
||||||
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>̑<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD><EFBFBD>̃\<5C>t<EFBFBD>g<EFBFBD>E<EFBFBD>F<EFBFBD>A<EFBFBD>̗<EFBFBD><CC97>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>ɂ<C982><C282>ẮA<CD81><41><EFBFBD>łł<C582><C582><EFBFBD> zlib 1.1.3<EFBFBD><EFBFBD>
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂Ƃ<EFBFBD><EFBFBD>܂<EFBFBD><EFBFBD>B<EFBFBD>ڂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>́A<EFBFBD>t<EFBFBD><EFBFBD><EFBFBD><EFBFBD> README <20><><EFBFBD><EFBFBD><EFBFBD>ǂ݂<C782><DD82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
|
|
||||||
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>^<5E><><EFBFBD>e
|
|
||||||
========
|
|
||||||
|
|
||||||
READMEJ.WCE - <20><><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43>
|
|
||||||
READMEE.WCE - <20><><EFBFBD>̃t<CC83>@<40>C<EFBFBD><43>(<28>p<EFBFBD><70>)
|
|
||||||
zlibce.diff - <20>\<5C>[<5B>X<EFBFBD>R<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43>
|
|
||||||
zlibce.def - DLL<4C>쐬<EFBFBD>p <20><><EFBFBD>`<60>t<EFBFBD>@<40>C<EFBFBD><43>
|
|
||||||
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD> zlib 1.1.3<EFBFBD>Ƃ̍ő<EFBFBD><EFBFBD>̈Ⴂ<EFBFBD>́Agzio.c<>̃R<CC83>[<5B>h<EFBFBD>ł<EFBFBD><C582>BWindowsCE<43>ɂ<EFBFBD>
|
|
||||||
stdio.h(open<65><6E><EFBFBD>̊<CC8A>)<29><><EFBFBD><EFBFBD><EFBFBD>݂<EFBFBD><DD82>Ȃ<EFBFBD><C882><EFBFBD><EFBFBD>߁A<DF81>Ǝ<EFBFBD><C68E><EFBFBD> gziowce.c<><63><EFBFBD>쐬<EFBFBD><EC90AC><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B
|
|
||||||
|
|
||||||
minigzip.c<><63> example.c<>̕t<CC95><74><EFBFBD>T<EFBFBD><54><EFBFBD>v<EFBFBD><76><EFBFBD>E<EFBFBD>v<EFBFBD><76><EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>́A<CD81><41><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD>o<EFBFBD>͂<EFBFBD>
|
|
||||||
<EFBFBD>s<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>AWindowsCE 2.11<EFBFBD>ȍ~<7E>ł̂ݎg<DD8E>p<EFBFBD>\<5C>ł<EFBFBD><C582>B
|
|
||||||
|
|
||||||
<EFBFBD>z<EFBFBD>z<EFBFBD><EFBFBD>
|
|
||||||
======
|
|
||||||
<EFBFBD>e<EFBFBD>j<EFBFBD>b<EFBFBD>N<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>J<EFBFBD><4A><EFBFBD><EFBFBD>
|
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>a<EFBFBD>Y
|
|
||||||
adachi@tenik.co.jp
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "lpngce"=.\lpngce.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
Begin Project Dependency
|
|
||||||
Project_Dep_Name zlibce
|
|
||||||
End Project Dependency
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "zlibce"=.\zlibce.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
;------------------------------------------
|
|
||||||
; LIBPNG module definition file for Windows
|
|
||||||
;------------------------------------------
|
|
||||||
|
|
||||||
LIBRARY lpngce
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
;Version 1.0.9beta2
|
|
||||||
png_build_grayscale_palette @1
|
|
||||||
png_check_sig @2
|
|
||||||
png_chunk_error @3
|
|
||||||
png_chunk_warning @4
|
|
||||||
; png_convert_from_struct_tm @5
|
|
||||||
; png_convert_from_time_t @6
|
|
||||||
png_create_info_struct @7
|
|
||||||
png_create_read_struct @8
|
|
||||||
png_create_write_struct @9
|
|
||||||
png_data_freer @10
|
|
||||||
png_destroy_info_struct @11
|
|
||||||
png_destroy_read_struct @12
|
|
||||||
png_destroy_write_struct @13
|
|
||||||
png_error @14
|
|
||||||
png_free @15
|
|
||||||
png_free_data @16
|
|
||||||
png_get_IHDR @17
|
|
||||||
png_get_PLTE @18
|
|
||||||
png_get_bKGD @19
|
|
||||||
png_get_bit_depth @20
|
|
||||||
png_get_cHRM @21
|
|
||||||
png_get_cHRM_fixed @22
|
|
||||||
png_get_channels @23
|
|
||||||
png_get_color_type @24
|
|
||||||
png_get_compression_buffer_size @25
|
|
||||||
png_get_compression_type @26
|
|
||||||
png_get_copyright @27
|
|
||||||
png_get_error_ptr @28
|
|
||||||
png_get_filter_type @29
|
|
||||||
png_get_gAMA @30
|
|
||||||
png_get_gAMA_fixed @31
|
|
||||||
png_get_hIST @32
|
|
||||||
png_get_header_ver @33
|
|
||||||
png_get_header_version @34
|
|
||||||
png_get_iCCP @35
|
|
||||||
png_get_image_height @36
|
|
||||||
png_get_image_width @37
|
|
||||||
png_get_interlace_type @38
|
|
||||||
png_get_io_ptr @39
|
|
||||||
png_get_libpng_ver @40
|
|
||||||
png_get_oFFs @41
|
|
||||||
png_get_pCAL @42
|
|
||||||
png_get_pHYs @43
|
|
||||||
png_get_pixel_aspect_ratio @44
|
|
||||||
png_get_pixels_per_meter @45
|
|
||||||
png_get_progressive_ptr @46
|
|
||||||
png_get_rgb_to_gray_status @47
|
|
||||||
png_get_rowbytes @48
|
|
||||||
png_get_rows @49
|
|
||||||
png_get_sBIT @50
|
|
||||||
png_get_sCAL @51
|
|
||||||
png_get_sPLT @52
|
|
||||||
png_get_sRGB @53
|
|
||||||
png_get_signature @54
|
|
||||||
png_get_tIME @55
|
|
||||||
png_get_tRNS @56
|
|
||||||
png_get_text @57
|
|
||||||
png_get_unknown_chunks @58
|
|
||||||
png_get_user_chunk_ptr @59
|
|
||||||
png_get_user_transform_ptr @60
|
|
||||||
png_get_valid @61
|
|
||||||
png_get_x_offset_microns @62
|
|
||||||
png_get_x_offset_pixels @63
|
|
||||||
png_get_x_pixels_per_meter @64
|
|
||||||
png_get_y_offset_microns @65
|
|
||||||
png_get_y_offset_pixels @66
|
|
||||||
png_get_y_pixels_per_meter @67
|
|
||||||
png_malloc @68
|
|
||||||
png_memcpy_check @69
|
|
||||||
png_memset_check @70
|
|
||||||
png_permit_empty_plte @71
|
|
||||||
png_process_data @72
|
|
||||||
png_progressive_combine_row @73
|
|
||||||
png_read_end @74
|
|
||||||
png_read_image @75
|
|
||||||
png_read_info @76
|
|
||||||
png_read_init @77
|
|
||||||
png_read_png @78
|
|
||||||
png_read_row @79
|
|
||||||
png_read_rows @80
|
|
||||||
png_read_update_info @81
|
|
||||||
png_reset_zstream @82
|
|
||||||
png_set_IHDR @83
|
|
||||||
png_set_PLTE @84
|
|
||||||
png_set_bKGD @85
|
|
||||||
png_set_background @86
|
|
||||||
png_set_bgr @87
|
|
||||||
png_set_cHRM @88
|
|
||||||
png_set_cHRM_fixed @89
|
|
||||||
png_set_compression_buffer_size @90
|
|
||||||
png_set_compression_level @91
|
|
||||||
png_set_compression_mem_level @92
|
|
||||||
png_set_compression_method @93
|
|
||||||
png_set_compression_strategy @94
|
|
||||||
png_set_compression_window_bits @95
|
|
||||||
png_set_crc_action @96
|
|
||||||
png_set_dither @97
|
|
||||||
png_set_error_fn @98
|
|
||||||
png_set_expand @99
|
|
||||||
png_set_filler @100
|
|
||||||
png_set_filter @101
|
|
||||||
png_set_filter_heuristics @102
|
|
||||||
png_set_flush @103
|
|
||||||
png_set_gAMA @104
|
|
||||||
png_set_gAMA_fixed @105
|
|
||||||
png_set_gamma @106
|
|
||||||
png_set_gray_1_2_4_to_8 @107
|
|
||||||
png_set_gray_to_rgb @108
|
|
||||||
png_set_hIST @109
|
|
||||||
png_set_iCCP @110
|
|
||||||
png_set_interlace_handling @111
|
|
||||||
png_set_invert_alpha @112
|
|
||||||
png_set_invert_mono @113
|
|
||||||
png_set_keep_unknown_chunks @114
|
|
||||||
png_set_oFFs @115
|
|
||||||
png_set_pCAL @116
|
|
||||||
png_set_pHYs @117
|
|
||||||
png_set_packing @118
|
|
||||||
png_set_packswap @119
|
|
||||||
png_set_palette_to_rgb @120
|
|
||||||
png_set_progressive_read_fn @121
|
|
||||||
png_set_read_fn @122
|
|
||||||
png_set_read_status_fn @123
|
|
||||||
png_set_read_user_chunk_fn @124
|
|
||||||
png_set_read_user_transform_fn @125
|
|
||||||
png_set_rgb_to_gray @126
|
|
||||||
png_set_rgb_to_gray_fixed @127
|
|
||||||
png_set_rows @128
|
|
||||||
png_set_sBIT @129
|
|
||||||
png_set_sCAL @130
|
|
||||||
png_set_sPLT @131
|
|
||||||
png_set_sRGB @132
|
|
||||||
png_set_sRGB_gAMA_and_cHRM @133
|
|
||||||
png_set_shift @134
|
|
||||||
png_set_sig_bytes @135
|
|
||||||
png_set_strip_16 @136
|
|
||||||
png_set_strip_alpha @137
|
|
||||||
png_set_swap @138
|
|
||||||
png_set_swap_alpha @139
|
|
||||||
png_set_tIME @140
|
|
||||||
png_set_tRNS @141
|
|
||||||
png_set_tRNS_to_alpha @142
|
|
||||||
png_set_text @143
|
|
||||||
png_set_unknown_chunk_location @144
|
|
||||||
png_set_unknown_chunks @145
|
|
||||||
png_set_user_transform_info @146
|
|
||||||
png_set_write_fn @147
|
|
||||||
png_set_write_status_fn @148
|
|
||||||
png_set_write_user_transform_fn @149
|
|
||||||
png_sig_cmp @150
|
|
||||||
png_start_read_image @151
|
|
||||||
png_warning @152
|
|
||||||
png_write_chunk @153
|
|
||||||
png_write_chunk_data @154
|
|
||||||
png_write_chunk_end @155
|
|
||||||
png_write_chunk_start @156
|
|
||||||
png_write_end @157
|
|
||||||
png_write_flush @158
|
|
||||||
png_write_image @159
|
|
||||||
png_write_info @160
|
|
||||||
png_write_info_before_PLTE @161
|
|
||||||
png_write_init @162
|
|
||||||
png_write_png @163
|
|
||||||
png_write_row @164
|
|
||||||
png_write_rows @165
|
|
||||||
png_read_init_2 @166
|
|
||||||
png_write_init_2 @167
|
|
||||||
png_access_version_number @168
|
|
||||||
; png_sig_bytes @169
|
|
||||||
png_libpng_ver @170
|
|
||||||
png_init_io @171
|
|
||||||
png_convert_to_rfc1123 @172
|
|
||||||
@@ -1,828 +0,0 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="pngtest" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (WCE x86) Application" 0x8301
|
|
||||||
# TARGTYPE "Win32 (WCE ARM) Application" 0x8501
|
|
||||||
# TARGTYPE "Win32 (WCE PPC) Application" 0x8401
|
|
||||||
# TARGTYPE "Win32 (WCE x86em) Application" 0x7f01
|
|
||||||
# TARGTYPE "Win32 (WCE SH3) Application" 0x8101
|
|
||||||
# TARGTYPE "Win32 (WCE SH4) Application" 0x8601
|
|
||||||
# TARGTYPE "Win32 (WCE MIPS) Application" 0x8201
|
|
||||||
# TARGTYPE "Win32 (WCE MIPSFP) Application" 0x8701
|
|
||||||
|
|
||||||
CFG=pngtest - Win32 (WCE MIPS) Debug
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "pngtest.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "pngtest.mak" CFG="pngtest - Win32 (WCE MIPS) Debug"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE MIPS) Release" (based on "Win32 (WCE MIPS) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE MIPS) Debug" (based on "Win32 (WCE MIPS) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE SH4) Release" (based on "Win32 (WCE SH4) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE SH4) Debug" (based on "Win32 (WCE SH4) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE SH3) Release" (based on "Win32 (WCE SH3) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE SH3) Debug" (based on "Win32 (WCE SH3) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE ARM) Release" (based on "Win32 (WCE ARM) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE ARM) Debug" (based on "Win32 (WCE ARM) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE MIPSFP) Release" (based on "Win32 (WCE MIPSFP) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE MIPSFP) Debug" (based on "Win32 (WCE MIPSFP) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE x86) Release" (based on "Win32 (WCE x86) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE x86) Debug" (based on "Win32 (WCE x86) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE x86em) Release" (based on "Win32 (WCE x86em) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE x86em) Debug" (based on "Win32 (WCE x86em) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE PPC) Release" (based on "Win32 (WCE PPC) Application")
|
|
||||||
!MESSAGE "pngtest - Win32 (WCE PPC) Debug" (based on "Win32 (WCE PPC) Application")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
|
||||||
# PROP Scc_LocalPath "H/PC Pro 2.11"
|
|
||||||
# PROP WCE_FormatVersion "6.0"
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "pngtest - Win32 (WCE MIPS) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WMIPSRel"
|
|
||||||
# PROP BASE Intermediate_Dir "WMIPSRel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WMIPSRel"
|
|
||||||
# PROP Intermediate_Dir "WMIPSRel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clmips.exe
|
|
||||||
# ADD BASE CPP /nologo /M$(CECrt) /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /QMRWCE /c
|
|
||||||
# ADD CPP /nologo /M$(CECrt) /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /QMRWCE /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPS) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WMIPSDbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WMIPSDbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WMIPSDbg"
|
|
||||||
# PROP Intermediate_Dir "WMIPSDbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clmips.exe
|
|
||||||
# ADD BASE CPP /nologo /M$(CECrtDebug) /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /QMRWCE /c
|
|
||||||
# ADD CPP /nologo /M$(CECrtDebug) /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /QMRWCE /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH4) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WCESH4Rel"
|
|
||||||
# PROP BASE Intermediate_Dir "WCESH4Rel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WCESH4Rel"
|
|
||||||
# PROP Intermediate_Dir "WCESH4Rel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=shcl.exe
|
|
||||||
# ADD BASE CPP /nologo /Qsh4 /MC /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /Qsh4 /MC /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "SHx" /d "SH4" /d "_SH4_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "SHx" /d "SH4" /d "_SH4_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:SH4 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /machine:SH4 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH4) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WCESH4Dbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WCESH4Dbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WCESH4Dbg"
|
|
||||||
# PROP Intermediate_Dir "WCESH4Dbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=shcl.exe
|
|
||||||
# ADD BASE CPP /nologo /Qsh4 /MC /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /Qsh4 /MC /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "DEBUG" /D "SHx" /D "SH4" /D "_SH4_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "SHx" /d "SH4" /d "_SH4_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "SHx" /d "SH4" /d "_SH4_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:SH4 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:SH4 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH3) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WCESH3Rel"
|
|
||||||
# PROP BASE Intermediate_Dir "WCESH3Rel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WCESH3Rel"
|
|
||||||
# PROP Intermediate_Dir "WCESH3Rel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=shcl.exe
|
|
||||||
# ADD BASE CPP /nologo /M$(CECrt) /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /M$(CECrt) /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:SH3 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /machine:SH3 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH3) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WCESH3Dbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WCESH3Dbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WCESH3Dbg"
|
|
||||||
# PROP Intermediate_Dir "WCESH3Dbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=shcl.exe
|
|
||||||
# ADD BASE CPP /nologo /M$(CECrtDebug) /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /M$(CECrtDebug) /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:SH3 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:SH3 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE ARM) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WCEARMRel"
|
|
||||||
# PROP BASE Intermediate_Dir "WCEARMRel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WCEARMRel"
|
|
||||||
# PROP Intermediate_Dir "WCEARMRel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clarm.exe
|
|
||||||
# ADD BASE CPP /nologo /MC /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /MC /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "ARM" /D "_ARM_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "ARM" /d "_ARM_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "ARM" /d "_ARM_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 coredll.lib commctrl.lib /nologo /machine:ARM /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 coredll.lib commctrl.lib /nologo /machine:ARM /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE ARM) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WCEARMDbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WCEARMDbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WCEARMDbg"
|
|
||||||
# PROP Intermediate_Dir "WCEARMDbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clarm.exe
|
|
||||||
# ADD BASE CPP /nologo /MC /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /MC /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "DEBUG" /D "ARM" /D "_ARM_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "ARM" /d "_ARM_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "ARM" /d "_ARM_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 coredll.lib commctrl.lib /nologo /debug /machine:ARM /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 coredll.lib commctrl.lib /nologo /debug /machine:ARM /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPSFP) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WMIPSFPRel"
|
|
||||||
# PROP BASE Intermediate_Dir "WMIPSFPRel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WMIPSFPRel"
|
|
||||||
# PROP Intermediate_Dir "WMIPSFPRel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clmips.exe
|
|
||||||
# ADD BASE CPP /nologo /QMFWCE /MC /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /QMFWCE /MC /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPSFP) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WMIPSFPDbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WMIPSFPDbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WMIPSFPDbg"
|
|
||||||
# PROP Intermediate_Dir "WMIPSFPDbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clmips.exe
|
|
||||||
# ADD BASE CPP /nologo /QMFWCE /MC /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /QMFWCE /MC /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:MIPS /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WCEX86Rel"
|
|
||||||
# PROP BASE Intermediate_Dir "WCEX86Rel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WCEX86Rel"
|
|
||||||
# PROP Intermediate_Dir "WCEX86Rel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=cl.exe
|
|
||||||
# ADD BASE CPP /nologo /ML /W3 /O2 /D "x86" /D "_i386_" /D "_x86_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "NDEBUG" /D "i_386_" /D "_MBCS" /Gs8192 /GF /c
|
|
||||||
# ADD CPP /nologo /ML /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "x86" /D "_i386_" /D "_x86_" /D "NDEBUG" /D "i_386_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /Gs8192 /GF /c
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "x86" /d "_i386_" /d "_x86_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "x86" /d "_i386_" /d "_x86_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /machine:IX86 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /machine:IX86 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WCEX86Dbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WCEX86Dbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WCEX86Dbg"
|
|
||||||
# PROP Intermediate_Dir "WCEX86Dbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=cl.exe
|
|
||||||
# ADD BASE CPP /nologo /MLd /W3 /Zi /Od /D "x86" /D "_i386_" /D "_x86_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "DEBUG" /D "i_386_" /D "_MBCS" /Gs8192 /GF /c
|
|
||||||
# ADD CPP /nologo /MLd /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "x86" /D "_i386_" /D "_x86_" /D "DEBUG" /D "i_386_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /Gs8192 /GF /c
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "x86" /d "_i386_" /d "_x86_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "x86" /d "_i386_" /d "_x86_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /debug /machine:IX86 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /debug /machine:IX86 /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86em) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "x86emRel"
|
|
||||||
# PROP BASE Intermediate_Dir "x86emRel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "x86emRel"
|
|
||||||
# PROP Intermediate_Dir "x86emRel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=cl.exe
|
|
||||||
# ADD BASE CPP /nologo /ML /W3 /O2 /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "STRICT" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "NDEBUG" /D "x86" /D "i486" /D "_x86_" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /ML /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "_UNICODE" /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "NDEBUG" /D "x86" /D "i486" /D "_x86_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /stack:0x10000,0x1000 /subsystem:windows /machine:I386 /nodefaultlib:"$(CENoDefaultLib)" /windowsce:emulation
|
|
||||||
# ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /stack:0x10000,0x1000 /subsystem:windows /machine:I386 /nodefaultlib:"$(CENoDefaultLib)" /windowsce:emulation
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86em) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "x86emDbg"
|
|
||||||
# PROP BASE Intermediate_Dir "x86emDbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "x86emDbg"
|
|
||||||
# PROP Intermediate_Dir "x86emDbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=cl.exe
|
|
||||||
# ADD BASE CPP /nologo /MLd /W3 /Gm /Zi /Od /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "STRICT" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "_DEBUG" /D "x86" /D "i486" /D "_x86_" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /MLd /W3 /Gm /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "_UNICODE" /D "WIN32" /D "STRICT" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "_DEBUG" /D "x86" /D "i486" /D "_x86_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "_DEBUG" /d "x86" /d "i486" /d "_x86_"
|
|
||||||
# ADD RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "_DEBUG" /d "x86" /d "i486" /d "_x86_"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /stack:0x10000,0x1000 /subsystem:windows /debug /machine:I386 /nodefaultlib:"$(CENoDefaultLib)" /windowsce:emulation
|
|
||||||
# ADD LINK32 $(CEx86Corelibc) commctrl.lib coredll.lib /nologo /stack:0x10000,0x1000 /subsystem:windows /debug /machine:I386 /nodefaultlib:"$(CENoDefaultLib)" /windowsce:emulation
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE PPC) Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "WCEPPCRel"
|
|
||||||
# PROP BASE Intermediate_Dir "WCEPPCRel"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "WCEPPCRel"
|
|
||||||
# PROP Intermediate_Dir "WCEPPCRel"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clppc.exe
|
|
||||||
# ADD BASE CPP /nologo /M$(CECrt) /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "PPC" /D "_PPC_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /M$(CECrt) /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "PPC" /D "_PPC_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "ppc" /d "_ppc_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "ppc" /d "_ppc_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "NDEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:PPC /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /machine:PPC /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE PPC) Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "WCEPPCDbg"
|
|
||||||
# PROP BASE Intermediate_Dir "WCEPPCDbg"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "WCEPPCDbg"
|
|
||||||
# PROP Intermediate_Dir "WCEPPCDbg"
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
CPP=clppc.exe
|
|
||||||
# ADD BASE CPP /nologo /M$(CECrtDebug) /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "PPC" /D "_PPC_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /YX /c
|
|
||||||
# ADD CPP /nologo /M$(CECrtDebug) /W3 /Zi /Od /I "..\.." /I "..\..\..\zlib" /D "DEBUG" /D "PPC" /D "_PPC_" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_MBCS" /D "PNG_USE_DLL" /c
|
|
||||||
# SUBTRACT CPP /YX
|
|
||||||
RSC=rc.exe
|
|
||||||
# ADD BASE RSC /l 0x411 /r /d "ppc" /d "_ppc_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "DEBUG"
|
|
||||||
# ADD RSC /l 0x411 /r /d "ppc" /d "_ppc_" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "DEBUG"
|
|
||||||
MTL=midl.exe
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:PPC /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
|
|
||||||
# ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:PPC /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /STACK:65536,4096
|
|
||||||
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "pngtest - Win32 (WCE MIPS) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE MIPS) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE SH4) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE SH4) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE SH3) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE SH3) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE ARM) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE ARM) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE MIPSFP) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE MIPSFP) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE x86) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE x86) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE x86em) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE x86em) Debug"
|
|
||||||
# Name "pngtest - Win32 (WCE PPC) Release"
|
|
||||||
# Name "pngtest - Win32 (WCE PPC) Debug"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\pngtest.c
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "pngtest - Win32 (WCE MIPS) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPS) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH4) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH4) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH3) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH3) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE ARM) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE ARM) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPSFP) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPSFP) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86em) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86em) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE PPC) Release"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE PPC) Debug"
|
|
||||||
|
|
||||||
DEP_CPP_PNGTE=\
|
|
||||||
"..\..\..\zlib\zconf.h"\
|
|
||||||
"..\..\..\zlib\zlib.h"\
|
|
||||||
"..\..\png.h"\
|
|
||||||
"..\..\pngasmrd.h"\
|
|
||||||
"..\..\pngconf.h"\
|
|
||||||
|
|
||||||
NODEP_CPP_PNGTE=\
|
|
||||||
"..\..\alloc.h"\
|
|
||||||
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\winmain.c
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "pngtest - Win32 (WCE MIPS) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPS) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH4) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH4) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH3) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE SH3) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE ARM) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE ARM) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPSFP) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE MIPSFP) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86em) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE x86em) Debug"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE PPC) Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "pngtest - Win32 (WCE PPC) Debug"
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Resource Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "lpngce"=.\lpngce.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
Begin Project Dependency
|
|
||||||
Project_Dep_Name zlibce
|
|
||||||
End Project Dependency
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "pngtest"=.\pngtest.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
Begin Project Dependency
|
|
||||||
Project_Dep_Name lpngce
|
|
||||||
End Project Dependency
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "zlibce"=.\zlibce.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
|
|
||||||
/* winmain.c - a simple entry point for WindowsCE
|
|
||||||
*
|
|
||||||
* Copyright (c) 2000 Tenik Co.,Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
extern int main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpszCmdLine, int nCmdShow)
|
|
||||||
{
|
|
||||||
#define SIZE_ARGV (32)
|
|
||||||
|
|
||||||
TCHAR path[MAX_PATH];
|
|
||||||
LPTSTR file;
|
|
||||||
char prog[MAX_PATH];
|
|
||||||
int argc;
|
|
||||||
char *argv[SIZE_ARGV];
|
|
||||||
int size;
|
|
||||||
char *buff;
|
|
||||||
char *argp;
|
|
||||||
char *args;
|
|
||||||
char quote;
|
|
||||||
|
|
||||||
// get program name
|
|
||||||
argc = 0;
|
|
||||||
GetModuleFileName(GetCurrentProcess(), path, MAX_PATH);
|
|
||||||
file = _tcsrchr(path, TEXT('\\'));
|
|
||||||
if (NULL == file) {
|
|
||||||
file = path;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
file++;
|
|
||||||
}
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, file, -1, prog, MAX_PATH, NULL, NULL);
|
|
||||||
argv[argc++] = prog;
|
|
||||||
|
|
||||||
// analyze parameters
|
|
||||||
size = WideCharToMultiByte(CP_ACP, 0, lpszCmdLine, -1, NULL, 0, NULL, NULL);
|
|
||||||
buff = (char *)malloc(size);
|
|
||||||
size = WideCharToMultiByte(CP_ACP, 0, lpszCmdLine, -1, buff, size, NULL, NULL);
|
|
||||||
quote = 0x00;
|
|
||||||
args = argp = buff;
|
|
||||||
if (argp && *argp && size) {
|
|
||||||
argv[argc++] = args;
|
|
||||||
while (*argp) {
|
|
||||||
if (quote) {
|
|
||||||
if (*argp == quote) {
|
|
||||||
argp++;
|
|
||||||
if (*argp != quote) {
|
|
||||||
quote = 0x00;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*args++ = *argp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*args++ = *argp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (*argp == ' ') {
|
|
||||||
*args++ = *argp++ = '\0';
|
|
||||||
while (*argp && *argp == ' ') {
|
|
||||||
argp++;
|
|
||||||
}
|
|
||||||
if (*argp && argc < SIZE_ARGV) {
|
|
||||||
argv[argc++] = args;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (*argp == '\"') {
|
|
||||||
quote = *argp++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*args++ = *argp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*args = '\0';
|
|
||||||
return main(argc, argv);
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
|||||||
LIBRARY zlibce.dll
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
adler32 @1
|
|
||||||
compress @2
|
|
||||||
crc32 @3
|
|
||||||
deflate @4
|
|
||||||
deflateCopy @5
|
|
||||||
deflateEnd @6
|
|
||||||
deflateInit2_ @7
|
|
||||||
deflateInit_ @8
|
|
||||||
deflateParams @9
|
|
||||||
deflateReset @10
|
|
||||||
deflateSetDictionary @11
|
|
||||||
gzclose @12
|
|
||||||
gzdopen @13
|
|
||||||
gzerror @14
|
|
||||||
gzflush @15
|
|
||||||
gzopen @16
|
|
||||||
gzread @17
|
|
||||||
gzwrite @18
|
|
||||||
inflate @19
|
|
||||||
inflateEnd @20
|
|
||||||
inflateInit2_ @21
|
|
||||||
inflateInit_ @22
|
|
||||||
inflateReset @23
|
|
||||||
inflateSetDictionary @24
|
|
||||||
inflateSync @25
|
|
||||||
uncompress @26
|
|
||||||
zlibVersion @27
|
|
||||||
gzprintf @28
|
|
||||||
gzputc @29
|
|
||||||
gzgetc @30
|
|
||||||
gzseek @31
|
|
||||||
gzrewind @32
|
|
||||||
gztell @33
|
|
||||||
gzeof @34
|
|
||||||
gzsetparams @35
|
|
||||||
zError @36
|
|
||||||
inflateSyncPoint @37
|
|
||||||
get_crc_table @38
|
|
||||||
compress2 @39
|
|
||||||
gzputs @40
|
|
||||||
gzgets @41
|
|
||||||
File diff suppressed because it is too large
Load Diff
11
scripts/libpng.pc.in
Normal file
11
scripts/libpng.pc.in
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
prefix=@PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
includedir=${exec_prefix}/include
|
||||||
|
|
||||||
|
Name: libpng10
|
||||||
|
Description: Loads and saves PNG files
|
||||||
|
Version: 1.0.13
|
||||||
|
Libs: -L${libdir} -lpng10
|
||||||
|
Cflags: -I${includedir}/libpng10
|
||||||
147
scripts/makefile.32sunu
Normal file
147
scripts/makefile.32sunu
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# makefile for libpng on Solaris 2.x with gcc
|
||||||
|
# Contributed by William L. Sebok, based on makefile.linux
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 1998 Greg Roelofs
|
||||||
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
SUN_CC_FLAGS=-fast -xtarget=ultra
|
||||||
|
SUN_LD_FLAGS=-fast -xtarget=ultra
|
||||||
|
|
||||||
|
# where make install puts libpng.a, libpng10.so and libpng10/png.h
|
||||||
|
prefix=/a
|
||||||
|
|
||||||
|
# Where the zlib library and include files are located
|
||||||
|
# Changing these to ../zlib poses a security risk. If you want
|
||||||
|
# to have zlib in an adjacent directory, specify the full path instead of "..".
|
||||||
|
#ZLIBLIB=../zlib
|
||||||
|
#ZLIBINC=../zlib
|
||||||
|
|
||||||
|
ZLIBLIB=/usr/lib
|
||||||
|
ZLIBINC=/usr/include
|
||||||
|
|
||||||
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
|
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
||||||
|
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
|
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
|
||||||
|
|
||||||
|
#RANLIB=ranlib
|
||||||
|
RANLIB=echo
|
||||||
|
|
||||||
|
LIBNAME=libpng10
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
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) -KPIC -o $@ $*.c
|
||||||
|
|
||||||
|
all: libpng.a $(LIBNAME).so pngtest
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
|
||||||
|
@case "`type ld`" in *ucb*) \
|
||||||
|
echo; \
|
||||||
|
echo '## WARNING:'; \
|
||||||
|
echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
|
||||||
|
echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
|
||||||
|
echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
|
||||||
|
echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
|
||||||
|
echo '## at all. If it is, things are likely to break because of'; \
|
||||||
|
echo '## the libucb dependency that is created.'; \
|
||||||
|
echo; \
|
||||||
|
;; \
|
||||||
|
esac
|
||||||
|
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
|
||||||
|
-o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
|
||||||
|
|
||||||
|
pngtest: pngtest.o $(LIBNAME).so
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
|
||||||
|
install-headers: png.h pngconf.h
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm $(INCPATH)/libpng
|
||||||
|
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
clean:
|
||||||
|
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* 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
|
||||||
147
scripts/makefile.64sunu
Normal file
147
scripts/makefile.64sunu
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# makefile for libpng on Solaris 2.x with gcc
|
||||||
|
# Contributed by William L. Sebok, based on makefile.linux
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 1998 Greg Roelofs
|
||||||
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9
|
||||||
|
SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9
|
||||||
|
|
||||||
|
# where make install puts libpng.a, libpng10.so and libpng10/png.h
|
||||||
|
prefix=/a
|
||||||
|
|
||||||
|
# Where the zlib library and include files are located
|
||||||
|
# Changing these to ../zlib poses a security risk. If you want
|
||||||
|
# to have zlib in an adjacent directory, specify the full path instead of "..".
|
||||||
|
#ZLIBLIB=../zlib
|
||||||
|
#ZLIBINC=../zlib
|
||||||
|
|
||||||
|
ZLIBLIB=/usr/lib
|
||||||
|
ZLIBINC=/usr/include
|
||||||
|
|
||||||
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
|
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
||||||
|
# $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
|
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
|
||||||
|
|
||||||
|
#RANLIB=ranlib
|
||||||
|
RANLIB=echo
|
||||||
|
|
||||||
|
LIBNAME=libpng10
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
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) -KPIC -o $@ $*.c
|
||||||
|
|
||||||
|
all: libpng.a $(LIBNAME).so pngtest
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
|
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
|
||||||
|
@case "`type ld`" in *ucb*) \
|
||||||
|
echo; \
|
||||||
|
echo '## WARNING:'; \
|
||||||
|
echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
|
||||||
|
echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
|
||||||
|
echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
|
||||||
|
echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
|
||||||
|
echo '## at all. If it is, things are likely to break because of'; \
|
||||||
|
echo '## the libucb dependency that is created.'; \
|
||||||
|
echo; \
|
||||||
|
;; \
|
||||||
|
esac
|
||||||
|
$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
|
||||||
|
-o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
|
||||||
|
|
||||||
|
pngtest: pngtest.o $(LIBNAME).so
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
|
||||||
|
install-headers: png.h pngconf.h
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm $(INCPATH)/libpng
|
||||||
|
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2; \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
clean:
|
||||||
|
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* 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
|
||||||
@@ -2,40 +2,40 @@
|
|||||||
|
|
||||||
|
|
||||||
# Toolflags:
|
# Toolflags:
|
||||||
CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback -DRISCOS -fnah
|
CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback -DRISCOS -fnah
|
||||||
C++flags = -c -depend !Depend -IC: -throwback
|
C++flags = -c -depend !Depend -IC: -throwback
|
||||||
Linkflags = -aif -c++ -o $@
|
Linkflags = -aif -c++ -o $@
|
||||||
ObjAsmflags = -throwback -NoCache -depend !Depend
|
ObjAsmflags = -throwback -NoCache -depend !Depend
|
||||||
CMHGflags =
|
CMHGflags =
|
||||||
LibFileflags = -c -l -o $@
|
LibFileflags = -c -l -o $@
|
||||||
Squeezeflags = -o $@
|
Squeezeflags = -o $@
|
||||||
|
|
||||||
|
|
||||||
# Final targets:
|
# Final targets:
|
||||||
@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
|
@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
|
||||||
@.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \
|
@.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \
|
||||||
@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
|
@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
|
||||||
LibFile $(LibFileflags) @.o.png @.o.pngerror @.o.pngrio @.o.pngrtran \
|
LibFile $(LibFileflags) @.o.png @.o.pngerror @.o.pngrio @.o.pngrtran \
|
||||||
@.o.pngmem @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngwio \
|
@.o.pngmem @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngwio \
|
||||||
@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
|
@.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
|
||||||
@.mm-libpng-lib: @.mm.png @.mm.pngerror @.mm.pngrio @.mm.pngwio @.mm.pngmem \
|
@.mm-libpng-lib: @.mm.png @.mm.pngerror @.mm.pngrio @.mm.pngwio @.mm.pngmem \
|
||||||
@.mm.pngpread @.mm.pngset @.mm.pngget @.mm.pngread @.mm.pngrtran \
|
@.mm.pngpread @.mm.pngset @.mm.pngget @.mm.pngread @.mm.pngrtran \
|
||||||
@.mm.pngrutil @.mm.pngtrans @.mm.pngwrite @.mm.pngwtran @.mm.pngwutil
|
@.mm.pngrutil @.mm.pngtrans @.mm.pngwrite @.mm.pngwtran @.mm.pngwutil
|
||||||
LibFile $(LibFileflags) @.mm.png @.mm.pngerror @.mm.pngrio \
|
LibFile $(LibFileflags) @.mm.png @.mm.pngerror @.mm.pngrio \
|
||||||
@.mm.pngwio @.mm.pngmem @.mm.pngpread @.mm.pngset @.mm.pngget \
|
@.mm.pngwio @.mm.pngmem @.mm.pngpread @.mm.pngset @.mm.pngget \
|
||||||
@.mm.pngread @.mm.pngrtran @.mm.pngrutil @.mm.pngtrans @.mm.pngwrite \
|
@.mm.pngread @.mm.pngrtran @.mm.pngrutil @.mm.pngtrans @.mm.pngwrite \
|
||||||
@.mm.pngwtran @.mm.pngwutil
|
@.mm.pngwtran @.mm.pngwutil
|
||||||
|
|
||||||
|
|
||||||
# User-editable dependencies:
|
# User-editable dependencies:
|
||||||
# (C) Copyright 1997 Tom Tanner
|
# (C) Copyright 1997 Tom Tanner
|
||||||
Test: @.pngtest
|
Test: @.pngtest
|
||||||
<Prefix$Dir>.pngtest
|
<Prefix$Dir>.pngtest
|
||||||
@remove <Prefix$Dir>.pngtest
|
@remove <Prefix$Dir>.pngtest
|
||||||
|
|
||||||
#It would be nice if you could stop "make" listing from here on!
|
#It would be nice if you could stop "make" listing from here on!
|
||||||
@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||||
Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
|
||||||
|
|
||||||
.SUFFIXES: .o .mm .c
|
.SUFFIXES: .o .mm .c
|
||||||
|
|
||||||
|
|||||||
87
scripts/makefile.aix
Normal file
87
scripts/makefile.aix
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# makefile for libpng using gcc (generic, static library)
|
||||||
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
# Copyright (C) 2000 Cosmin Truta
|
||||||
|
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# Location of the zlib library and include files
|
||||||
|
ZLIBINC = ../zlib
|
||||||
|
ZLIBLIB = ../zlib
|
||||||
|
|
||||||
|
# Compiler, linker, lib and other tools
|
||||||
|
CC = gcc
|
||||||
|
LD = $(CC)
|
||||||
|
AR = ar rcs
|
||||||
|
RANLIB = ranlib
|
||||||
|
RM = rm -f
|
||||||
|
|
||||||
|
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
|
||||||
|
# have to change it.
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
|
prefix=/usr/local
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
|
CDEBUG = -g -DPNG_DEBUG=5
|
||||||
|
LDDEBUG =
|
||||||
|
CRELEASE = -O2
|
||||||
|
LDRELEASE = -s
|
||||||
|
CFLAGS = -I$(ZLIBINC) -Wall $(CRELEASE)
|
||||||
|
LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm $(LDRELEASE)
|
||||||
|
|
||||||
|
# File extensions
|
||||||
|
O=.o
|
||||||
|
A=.a
|
||||||
|
E=
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||||
|
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
|
||||||
|
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
||||||
|
|
||||||
|
# Targets
|
||||||
|
all: libpng$(A) pngtest$(E)
|
||||||
|
|
||||||
|
libpng$(A): $(OBJS)
|
||||||
|
$(AR) $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
test: pngtest$(E)
|
||||||
|
./pngtest$(E)
|
||||||
|
|
||||||
|
pngtest$(E): pngtest$(O) libpng$(A)
|
||||||
|
$(LD) -o $@ pngtest$(O) $(LDFLAGS)
|
||||||
|
|
||||||
|
install: libpng.a
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/libpng ]; then mkdir $(INCPATH)/libpng; fi
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@rm $(INCPATH)/png.h
|
||||||
|
-@rm $(INCPATH)/pngconf.h
|
||||||
|
cp png.h pngconf.h $(INCPATH)/libpng
|
||||||
|
chmod 644 $(INCPATH)/libpng/png.h $(INCPATH)/libpng/pngconf.h
|
||||||
|
cp libpng.a $(LIBPATH)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
/bin/rm -f *.o libpng.a pngtest pngout.png
|
||||||
|
|
||||||
|
png$(O): png.h pngconf.h
|
||||||
|
pngerror$(O): png.h pngconf.h
|
||||||
|
pngget$(O): png.h pngconf.h
|
||||||
|
pngmem$(O): png.h pngconf.h
|
||||||
|
pngpread$(O): png.h pngconf.h
|
||||||
|
pngread$(O): png.h pngconf.h
|
||||||
|
pngrio$(O): png.h pngconf.h
|
||||||
|
pngrtran$(O): png.h pngconf.h
|
||||||
|
pngrutil$(O): png.h pngconf.h
|
||||||
|
pngset$(O): png.h pngconf.h
|
||||||
|
pngtest$(O): png.h pngconf.h
|
||||||
|
pngtrans$(O): png.h pngconf.h
|
||||||
|
pngwio$(O): png.h pngconf.h
|
||||||
|
pngwrite$(O): png.h pngconf.h
|
||||||
|
pngwtran$(O): png.h pngconf.h
|
||||||
|
pngwutil$(O): png.h pngconf.h
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ CC=sc
|
|||||||
# So use V6.55 or set NOOPTGO!!!!!!!!!
|
# So use V6.55 or set NOOPTGO!!!!!!!!!
|
||||||
CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
|
CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
|
||||||
OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 INCLUDEDIR=$(ZLIB) \
|
OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 INCLUDEDIR=$(ZLIB) \
|
||||||
DEFINE=PNG_INTERNAL
|
DEFINE=PNG_INTERNAL
|
||||||
#linker flags
|
#linker flags
|
||||||
LDFLAGS= SD ND BATCH
|
LDFLAGS= SD ND BATCH
|
||||||
#link libs
|
#link libs
|
||||||
|
|||||||
@@ -26,8 +26,11 @@ pngtest.ttp: pngtest.o $(LBR)
|
|||||||
|
|
||||||
install: libpng.a
|
install: libpng.a
|
||||||
-@mkdir $(prefix)/include
|
-@mkdir $(prefix)/include
|
||||||
|
-@mkdir $(prefix)/include/libpng
|
||||||
-@mkdir $(prefix)/lib
|
-@mkdir $(prefix)/lib
|
||||||
cp png.h $(prefix)/include
|
-@rm -f $(prefix)/include/png.h
|
||||||
cp pngconf.h $(prefix)/include
|
-@rm -f $(prefix)/include/pngconf.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
cp png.h $(prefix)/include/libpng
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
cp pngconf.h $(prefix)/include/libpng
|
||||||
|
chmod 644 $(prefix)/include/libpng/png.h
|
||||||
|
chmod 644 $(prefix)/include/libpng/pngconf.h
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ PNGLIB=png32bd.lib
|
|||||||
|
|
||||||
CC=bcc32
|
CC=bcc32
|
||||||
CFLAGS= -ps -O2 -N- -k- -d -r- -w-par -w-aus -I$(ZLIBDIR) \
|
CFLAGS= -ps -O2 -N- -k- -d -r- -w-par -w-aus -I$(ZLIBDIR) \
|
||||||
-DPNG_NO_GLOBAL_ARRAYS #-DPNG_DEBUG=5
|
-DPNG_NO_GLOBAL_ARRAYS #-DPNG_DEBUG=5
|
||||||
#LINK=tlink32
|
#LINK=tlink32
|
||||||
#LINK=ilink32
|
#LINK=ilink32
|
||||||
LINK=bcc32
|
LINK=bcc32
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# makefile for libpng on BeOS x86 ELF with gcc
|
# makefile for libpng on BeOS x86 ELF with gcc
|
||||||
# modified from makefile.linux by Sander Stoks
|
# modified from makefile.linux by Sander Stoks
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1999 Greg Roelofs
|
# Copyright (C) 1999 Greg Roelofs
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
@@ -10,6 +11,12 @@ CC=gcc
|
|||||||
ZLIBLIB=/usr/local/lib
|
ZLIBLIB=/usr/local/lib
|
||||||
ZLIBINC=/usr/local/include
|
ZLIBINC=/usr/local/include
|
||||||
|
|
||||||
|
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
|
||||||
|
# have to change it.
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
ALIGN=
|
ALIGN=
|
||||||
# For i386:
|
# For i386:
|
||||||
# ALIGN=-malign-loops=2 -malign-functions=2
|
# ALIGN=-malign-loops=2 -malign-functions=2
|
||||||
@@ -23,21 +30,16 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|||||||
CFLAGS=-I$(ZLIBINC) -Wall -O1 -funroll-loops \
|
CFLAGS=-I$(ZLIBINC) -Wall -O1 -funroll-loops \
|
||||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
||||||
LDFLAGS=-L. -Wl,-soname=libpng.so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm
|
LDFLAGS=-L. -Wl,-soname=$(LIBNAME).so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
#RANLIB=echo
|
#RANLIB=echo
|
||||||
|
|
||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# where make install puts libpng.a, libpng10.so*, and png.h
|
||||||
# have to change it.
|
|
||||||
PNGMAJ = 2
|
|
||||||
PNGMIN = 1.0.9beta2
|
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
|
||||||
|
|
||||||
# where make install puts libpng.a, libpng.so*, and png.h
|
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(prefix)/lib
|
LIBPATH=$(prefix)/lib
|
||||||
|
LIBNAME=libpng10
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
@@ -47,42 +49,70 @@ OBJSDLL = $(OBJS)
|
|||||||
|
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
all: libpng.a libpng.so pngtest
|
all: libpng.a $(LIBNAME).so pngtest
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
cp libpng.so* /boot/home/config/lib
|
cp $(LIBNAME).so* /boot/home/config/lib
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJSDLL)
|
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
|
||||||
$(CC) -L$(ZLIBLIB) -lz -nostart -Wl,-soname,libpng.so.$(PNGMAJ) -o
|
$(CC) -L$(ZLIBLIB) -lz -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o
|
||||||
libpng.so.$(PNGVER) \
|
$(LIBNAME).so.$(PNGVER) \
|
||||||
$(OBJSDLL)
|
$(OBJSDLL)
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.so
|
pngtest: pngtest.o $(LIBNAME).so
|
||||||
$(CC) -L$(ZLIBLIB) -lz -lpng -o pngtest pngtest.o
|
$(CC) -L$(ZLIBLIB) -lz -lpng10 -o pngtest pngtest.o
|
||||||
|
|
||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a libpng.so.$(PNGVER)
|
install-headers: png.h pngconf.h
|
||||||
-@mkdir $(INCPATH) $(LIBPATH)
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
cp png.h pngconf.h $(INCPATH)
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
(cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
|
||||||
|
pngtest pngout.png
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# builds both dll (with import lib) and static lib versions
|
# builds both dll (with import lib) and static lib versions
|
||||||
# of the library, and builds two copies of pngtest: one
|
# of the library, and builds two copies of pngtest: one
|
||||||
# statically linked and one dynamically linked.
|
# statically linked and one dynamically linked.
|
||||||
#
|
#
|
||||||
# based on makefile for linux-elf w/mmx by:
|
# based on makefile for linux-elf w/mmx by:
|
||||||
# Copyright (C) 1998-2000 Greg Roelofs
|
# Copyright (C) 1998-2000 Greg Roelofs
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
@@ -12,8 +12,12 @@
|
|||||||
# $CFLAGS, and include pnggccrd.o in $OBJS, below.
|
# $CFLAGS, and include pnggccrd.o in $OBJS, below.
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
ifdef MINGW
|
||||||
|
MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
|
||||||
|
MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
|
||||||
|
endif
|
||||||
|
|
||||||
# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
|
# where "make install" puts libpng.a, libpng.so*, png.h, and pngconf.h
|
||||||
prefix=/usr
|
prefix=/usr
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
@@ -32,24 +36,24 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|||||||
|
|
||||||
#CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
#CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
||||||
# -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
|
# -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
CFLAGS=$(MINGW_CCFLAGS) -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
||||||
-fomit-frame-pointer
|
-fomit-frame-pointer
|
||||||
|
|
||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
PNGMAJ = 0
|
||||||
# have to change it.
|
#PNGDLL = $10
|
||||||
PNGMAJ = 2
|
PNGMIN = 1.0.13
|
||||||
PNGMIN = 1.0.9beta2
|
PNGMIN_BASE = 1.0.13
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
SHAREDLIB=cygpng$(PNGMAJ).dll
|
SHAREDLIB=cygpng$(PNGDLL).dll
|
||||||
STATLIB=libpng.a
|
STATLIB=libpng.a
|
||||||
IMPLIB=libpng.dll.a
|
IMPLIB=libpng.dll.a
|
||||||
SHAREDDEF=libpng.def
|
SHAREDDEF=libpng.def
|
||||||
LIBS=$(SHAREDLIB) $(STATLIB)
|
LIBS=$(SHAREDLIB) $(STATLIB)
|
||||||
EXE=.exe
|
EXE=.exe
|
||||||
|
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
|
LDFLAGS=-L. $(MINGW_LDFLAGS) -L$(ZLIBLIB) -lpng -lz
|
||||||
LDSHARED=gcc -shared -Wl,--enable-auto-image-base
|
LDSFLAGS=-shared -L. $(MINGW_LDFLAGS) -Wl,--enable-auto-image-base
|
||||||
LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(SHAREDDEF)
|
LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(SHAREDDEF)
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
@@ -60,7 +64,7 @@ LIBPATH=$(prefix)/lib
|
|||||||
BINPATH=$(prefix)/bin
|
BINPATH=$(prefix)/bin
|
||||||
MANPATH=$(prefix)/man
|
MANPATH=$(prefix)/man
|
||||||
MAN3PATH=$(MANPATH)/man3
|
MAN3PATH=$(MANPATH)/man3
|
||||||
DOCPATH=$(prefix)/doc/libpng-$(PNGMIN)
|
DOCPATH=$(prefix)/doc/libpng-$(PNGMIN_BASE)
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
@@ -86,14 +90,14 @@ all-static: $(STATLIB) pngtest-stat$(EXE)
|
|||||||
|
|
||||||
all-shared: $(SHAREDLIB) pngtest$(EXE)
|
all-shared: $(SHAREDLIB) pngtest$(EXE)
|
||||||
|
|
||||||
pnggccrd.o: png.h pngconf.h pngasmrd.h
|
pnggccrd.o: png.h pngconf.h
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo ' You can ignore the single "control reaches end of non-void function"'
|
@echo ' You can ignore the single "control reaches end of non-void function"'
|
||||||
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
||||||
@echo ""
|
@echo ""
|
||||||
$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $*.c
|
$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $*.c
|
||||||
|
|
||||||
pnggccrd.pic.o: png.h pngconf.h pngasmrd.h
|
pnggccrd.pic.o: png.h pngconf.h
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo ' You can ignore the single "control reaches end of non-void function"'
|
@echo ' You can ignore the single "control reaches end of non-void function"'
|
||||||
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
||||||
@@ -104,11 +108,12 @@ $(STATLIB): $(OBJS)
|
|||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
$(SHAREDDEF): msvc/png32ms.def
|
$(SHAREDDEF): projects/msvc/png32ms.def
|
||||||
cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' > $@
|
cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
|
||||||
|
sed -e 's/\([^;]*\);/;/' > $@
|
||||||
|
|
||||||
$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
|
$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
|
||||||
$(LDSHARED) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz
|
$(CC) $(LDSFLAGS) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz
|
||||||
|
|
||||||
pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
|
pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
|
||||||
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
|
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
|
||||||
@@ -132,7 +137,7 @@ test-shared: pngtest$(EXE)
|
|||||||
|
|
||||||
install: install-static install-shared
|
install: install-static install-shared
|
||||||
|
|
||||||
install-static: $(STATLIB) install-headers install-docs install-man
|
install-static: $(STATLIB) install-headers install-docs install-man
|
||||||
-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi
|
-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi
|
||||||
install -m 755 $(STATLIB) $(LIBPATH)
|
install -m 755 $(STATLIB) $(LIBPATH)
|
||||||
|
|
||||||
@@ -143,7 +148,10 @@ install-shared: $(SHAREDLIB) install-headers install-docs install-man
|
|||||||
install -s -m 755 $(SHAREDLIB) $(BINPATH)
|
install -s -m 755 $(SHAREDLIB) $(BINPATH)
|
||||||
|
|
||||||
install-headers:
|
install-headers:
|
||||||
-@if [ ! -d $(INCPATH) ]; then mkdir -p $(INCPATH); fi
|
-@if [ ! -d $(INCPATH)]; then mkdir -p $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/libpng ]; then mkdir -p $(INCPATH)/libpng; fi
|
||||||
|
-@rm -f ${INCPATH)/png.h
|
||||||
|
-@rm -f ${INCPATH)/pngconf.h
|
||||||
install -m 644 png.h pngconf.h $(INCPATH)
|
install -m 644 png.h pngconf.h $(INCPATH)
|
||||||
|
|
||||||
install-docs:
|
install-docs:
|
||||||
@@ -164,7 +172,7 @@ writelock:
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
png.o png.pic.o: png.h pngconf.h png.c pngasmrd.h
|
png.o png.pic.o: png.h pngconf.h png.c
|
||||||
pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
|
pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
|
||||||
pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
|
pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
|
||||||
pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
|
pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
|
||||||
@@ -173,7 +181,7 @@ pngset.o pngset.pic.o: png.h pngconf.h pngset.c
|
|||||||
pngget.o pngget.pic.o: png.h pngconf.h pngget.c
|
pngget.o pngget.pic.o: png.h pngconf.h pngget.c
|
||||||
pngread.o pngread.pic.o: png.h pngconf.h pngread.c
|
pngread.o pngread.pic.o: png.h pngconf.h pngread.c
|
||||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
|
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
|
||||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c pngasmrd.h
|
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
|
||||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
|
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
|
||||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
|
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
|
||||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
|
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
|
||||||
|
|||||||
134
scripts/makefile.darwin
Normal file
134
scripts/makefile.darwin
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
# makefile for libpng on Darwin / Mac OS X
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 2001 Christoph Pfisterer
|
||||||
|
# derived from makefile.linux:
|
||||||
|
# Copyright (C) 1998, 1999 Greg Roelofs
|
||||||
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where "make install" puts libpng.a, libpng10.dylib, png.h and pngconf.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
|
# Where the zlib library and include files are located
|
||||||
|
#ZLIBLIB=/usr/local/lib
|
||||||
|
#ZLIBINC=/usr/local/include
|
||||||
|
ZLIBLIB=../zlib
|
||||||
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops
|
||||||
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
|
||||||
|
|
||||||
|
#RANLIB=echo
|
||||||
|
RANLIB=ranlib
|
||||||
|
|
||||||
|
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
|
||||||
|
# have to change it.
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
LIBNAME = libpng10
|
||||||
|
|
||||||
|
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) -fno-common -o $@ $*.c
|
||||||
|
|
||||||
|
all: libpng.a $(LIBNAME).dylib pngtest
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
$(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib
|
||||||
|
ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
|
||||||
|
|
||||||
|
$(LIBNAME).$(PNGMAJ).dylib: $(LIBNAME).$(PNGVER).dylib
|
||||||
|
ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib
|
||||||
|
|
||||||
|
$(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
|
||||||
|
$(CC) -dynamiclib \
|
||||||
|
-install_name $(LIBPATH)/$(LIBNAME).$(PNGMAJ).dylib \
|
||||||
|
-current_version $(PNGMIN) -compatibility_version $(PNGMIN) \
|
||||||
|
-o $(LIBNAME).$(PNGVER).dylib \
|
||||||
|
$(OBJSDLL) -L$(ZLIBLIB) -lz
|
||||||
|
|
||||||
|
pngtest: pngtest.o $(LIBNAME).dylib
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
|
||||||
|
install-headers: png.h pngconf.h
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).dylib
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.dylib
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).dylib
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.dylib
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.2.dylib
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.2.*.dylib
|
||||||
|
cp $(LIBNAME).$(PNGVER).dylib $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).$(PNGVER).dylib
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \
|
||||||
|
ln -sf $(LIBNAME).$(PNGVER).dylib libpng.2.dylib; \
|
||||||
|
ln -sf $(LIBNAME).$(PNGVER).dylib libpng.2.$(PNGMIN).dylib; \
|
||||||
|
ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
|
||||||
|
ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libpng.a $(LIBNAME).*dylib 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
|
||||||
@@ -14,11 +14,12 @@ LIBPATH=$(prefix)/lib
|
|||||||
ZLIBLIB=../zlib
|
ZLIBLIB=../zlib
|
||||||
ZLIBINC=../zlib
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 0
|
||||||
PNGMIN = 1.0.9beta2
|
PNGMIN = 1.0.13
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
LIBNAME = libpng10
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
||||||
@@ -31,19 +32,19 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
|||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
|
||||||
all: libpng.so libpng.a pngtest
|
all: $(LIBNAME).so libpng.a pngtest
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
ln -f -s libpng.so.$(PNGMAJ) libpng.so
|
ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJS)
|
$(LIBNAME).so.$(PNGVER): $(OBJS)
|
||||||
$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) -lz -lm
|
$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) -lz -lm
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.a
|
pngtest: pngtest.o libpng.a
|
||||||
@@ -52,23 +53,45 @@ pngtest: pngtest.o libpng.a
|
|||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a libpng.so.$(PNGVER)
|
install-headers: png.h pngconf.h
|
||||||
-@mkdir $(INCPATH)
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
-@mkdir $(LIBPATH)
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
cp png.h $(INCPATH)
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
cp pngconf.h $(INCPATH)
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
chmod 644 $(INCPATH)/png.h
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
chmod 644 $(INCPATH)/pngconf.h
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
cp libpng.a $(LIBPATH)
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
cp libpng.so.$(PNGVER) $(LIBPATH)
|
|
||||||
chmod 644 $(LIBPATH)/libpng.a
|
install-static: install-headers libpng.a
|
||||||
chmod 644 $(LIBPATH)/libpng.so.$(PNGVER)
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
(cd $(LIBPATH)); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
ln -f -s libpng.so.$(PNGMAJ) libpng.so)
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png libpng.so*
|
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
|
|||||||
93
scripts/makefile.freebsd
Normal file
93
scripts/makefile.freebsd
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
# makefile for libpng under FreeBSD
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson and Andrey A. Chernov
|
||||||
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
|
PNGMAJ= 5
|
||||||
|
.if (${OBJFORMAT} == "elf")
|
||||||
|
PNGVER= $(PNGMAJ)
|
||||||
|
.else
|
||||||
|
PNGMIN= 0
|
||||||
|
PNGVER= $(PNGMAJ).$(PNGMIN)
|
||||||
|
.endif
|
||||||
|
|
||||||
|
CFLAGS+= -I. -DPNG_USE_PNGGCCRD
|
||||||
|
.if (${MACHINE_ARCH} != "i386")
|
||||||
|
CFLAGS+= -DPNG_NO_ASSEMBLER_CODE
|
||||||
|
.endif
|
||||||
|
LDFLAGS+=-L. -lpng -lz -lm -static
|
||||||
|
|
||||||
|
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 pnggccrd.o
|
||||||
|
|
||||||
|
.SUFFIXES: .c .so .o
|
||||||
|
|
||||||
|
.c.so:
|
||||||
|
${CC} ${CFLAGS} -fPIC -DPIC -o $@ -c $<
|
||||||
|
|
||||||
|
all: libpng.a libpng.so.${PNGVER} pngtest
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
libpng.so.${PNGVER}: $(OBJS:S/o$/so/g)
|
||||||
|
.if (${OBJFORMAT} == "elf")
|
||||||
|
${CC} -shared -Wl,-x,-soname,$@ -o $@ $(OBJS:S/o$/so/g) -lz -lm
|
||||||
|
.else
|
||||||
|
${CC} -shared -Wl,-x -o $@ $(OBJS:S/o$/so/g) -lz -lm
|
||||||
|
.endif
|
||||||
|
|
||||||
|
pngtest: pngtest.o libpng.a
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
|
||||||
|
install: libpng.a libpng.so.${PNGVER}
|
||||||
|
-@mkdir $(prefix)/include/libpng
|
||||||
|
${INSTALL} -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} \
|
||||||
|
png.h pngconf.h $(prefix)/include/libpng
|
||||||
|
ln -sf libpng/png.h $(prefix)/include/png.h
|
||||||
|
ln -sf libpng/pngconf.h $(prefix)/include/pngconf.h
|
||||||
|
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||||
|
libpng.a libpng.so.${PNGVER} $(prefix)/lib
|
||||||
|
$(RANLIB) $(prefix)/lib/libpng.a
|
||||||
|
ln -sf libpng.so.${PNGVER} $(prefix)/lib/libpng.so
|
||||||
|
/sbin/ldconfig -R
|
||||||
|
${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
|
||||||
|
libpng.3 libpngpf.3 $(prefix)/man/man3
|
||||||
|
${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
|
||||||
|
png.5 $(prefix)/man/man5
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libpng.a libpng.so libpng.so.${PNGVER} 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.h pngconf.h
|
||||||
|
pngerror.o: png.h pngconf.h
|
||||||
|
pngrio.o: png.h pngconf.h
|
||||||
|
pngwio.o: png.h pngconf.h
|
||||||
|
pngmem.o: png.h pngconf.h
|
||||||
|
pngset.o: png.h pngconf.h
|
||||||
|
pngget.o: png.h pngconf.h
|
||||||
|
pngread.o: png.h pngconf.h
|
||||||
|
pngrtran.o: png.h pngconf.h
|
||||||
|
pngrutil.o: png.h pngconf.h
|
||||||
|
pngtest.o: png.h pngconf.h
|
||||||
|
pngtrans.o: png.h pngconf.h
|
||||||
|
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
|
||||||
|
|
||||||
@@ -1,13 +1,27 @@
|
|||||||
# makefile for libpng on Linux ELF with gcc using MMX assembler code
|
# makefile for libpng.a and libpng10.so on Linux ELF with gcc using MMX
|
||||||
|
# assembler code
|
||||||
|
# Copyright 2002 Greg Roelofs and Glenn Randers-Pehrson
|
||||||
|
# Copyright 1998-2001 Greg Roelofs
|
||||||
# Copyright 1996-1997 Andreas Dilger
|
# Copyright 1996-1997 Andreas Dilger
|
||||||
# Copyright 1998-2000 Greg Roelofs
|
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
# CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier.
|
# CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier.
|
||||||
|
|
||||||
|
# WARNING: The assembler code in pnggccrd.c may not be thread safe.
|
||||||
|
|
||||||
|
# NOTE: When testing MMX performance on a multitasking system, make sure
|
||||||
|
# there are no floating-point programs (e.g., SETI@Home) running in
|
||||||
|
# the background! Context switches between MMX and FPU are expensive.
|
||||||
|
|
||||||
|
LIBNAME = libpng10
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
|
||||||
# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
|
# where "make install" puts libpng.a, libpng10/libpng10.so*,
|
||||||
|
# $(LIBNAME)/png.h and $(LIBNAME)/pngconf.h
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
@@ -26,20 +40,26 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|||||||
|
|
||||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||||
|
|
||||||
CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
# Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety
|
||||||
-fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
|
### for generic gcc:
|
||||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall \
|
||||||
|
-O3 $(ALIGN) -funroll-loops \
|
||||||
|
-fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
|
### for gcc 2.95.2 on 686:
|
||||||
|
#CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \
|
||||||
|
# -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
|
||||||
|
# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
|
||||||
|
### for gcc 2.7.2.3 on 486 and up:
|
||||||
|
#CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \
|
||||||
|
# -m486 -malign-double -ffast-math \
|
||||||
|
# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
|
||||||
|
|
||||||
|
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
|
||||||
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
|
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
#RANLIB=echo
|
#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.9beta2
|
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(prefix)/lib
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
@@ -54,71 +74,90 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
|||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a libpng.so pngtest pngtest-static
|
all: libpng.a $(LIBNAME).so pngtest pngtest-static
|
||||||
|
|
||||||
pnggccrd.o: pnggccrd.c png.h pngconf.h pngasmrd.h
|
pnggccrd.o: pnggccrd.c png.h pngconf.h
|
||||||
@echo ""
|
|
||||||
@echo ' You can ignore the single "control reaches end of non-void function"'
|
|
||||||
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
|
||||||
@echo ""
|
|
||||||
$(CC) -c $(CFLAGS) -o $@ $*.c
|
$(CC) -c $(CFLAGS) -o $@ $*.c
|
||||||
|
|
||||||
pnggccrd.pic.o: pnggccrd.c png.h pngconf.h pngasmrd.h
|
pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
|
||||||
@echo ""
|
|
||||||
@echo ' You can ignore the single "control reaches end of non-void function"'
|
|
||||||
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
|
||||||
@echo ""
|
|
||||||
$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
|
$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
$(LIBNAME).a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJSDLL)
|
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
|
||||||
$(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
|
||||||
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
|
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.so
|
pngtest: pngtest.o $(LIBNAME).so
|
||||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
pngtest-static: pngtest.o libpng.a
|
pngtest-static: pngtest.o $(LIBNAME).a
|
||||||
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
|
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
|
||||||
|
|
||||||
test: pngtest pngtest-static
|
test: pngtest pngtest-static
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " Testing dynamically linked version:"
|
@echo " Running pngtest dynamically linked with libpng10.so:"
|
||||||
@echo ""
|
@echo ""
|
||||||
./pngtest
|
./pngtest
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " Testing statically linked version:"
|
@echo " Running pngtest statically linked with libpng.a:"
|
||||||
@echo ""
|
@echo ""
|
||||||
./pngtest-static
|
./pngtest-static
|
||||||
|
|
||||||
install: libpng.a libpng.so.$(PNGVER)
|
install-headers: png.h pngconf.h
|
||||||
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
cp png.h pngconf.h $(INCPATH)
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
|
||||||
(cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
|
||||||
|
pngtest pngout.png
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
||||||
chmod a-w *.[ch35] $(DOCS) scripts/*
|
chmod a-w *.[ch35] $(DOCS) scripts/*
|
||||||
|
|
||||||
png.o png.pic.o: png.h pngconf.h png.c pngasmrd.h
|
png.o png.pic.o: png.h pngconf.h png.c
|
||||||
pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
|
pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
|
||||||
pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
|
pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
|
||||||
pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
|
pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
|
||||||
@@ -127,7 +166,7 @@ pngset.o pngset.pic.o: png.h pngconf.h pngset.c
|
|||||||
pngget.o pngget.pic.o: png.h pngconf.h pngget.c
|
pngget.o pngget.pic.o: png.h pngconf.h pngget.c
|
||||||
pngread.o pngread.pic.o: png.h pngconf.h pngread.c
|
pngread.o pngread.pic.o: png.h pngconf.h pngread.c
|
||||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
|
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
|
||||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c pngasmrd.h
|
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
|
||||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
|
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
|
||||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
|
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
|
||||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
|
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
|
||||||
|
|||||||
142
scripts/makefile.hpgcc
Normal file
142
scripts/makefile.hpgcc
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# makefile for libpng on HP-UX using GCC
|
||||||
|
# Copyright (C) 2002, Glenn Randers-Pehrson
|
||||||
|
# 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 0. You should not
|
||||||
|
# have to change it.
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
LIBNAME = libpng10
|
||||||
|
|
||||||
|
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 $(LIBNAME).sl pngtest
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
|
||||||
|
ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
|
||||||
|
|
||||||
|
$(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
|
||||||
|
ln -f -s $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
|
||||||
|
|
||||||
|
$(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
|
||||||
|
$(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \
|
||||||
|
+h libpng.sl.$(PNGMAJ) -o libpng.sl.$(PNGVER) $(OBJSDLL) -lz
|
||||||
|
|
||||||
|
pngtest: pngtest.o $(LIBNAME).sl
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
|
||||||
|
|
||||||
|
install-headers: png.h pngconf.h
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).sl.$(PNGVER)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).sl
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).sl.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).sl.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2; \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
|
clean:
|
||||||
|
/bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \
|
||||||
|
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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# makefile for libpng, HPUX (10.20 and 11.00)
|
# makefile for libpng, HPUX (10.20 and 11.00)
|
||||||
# Copyright (C) 1999, 2000 Glenn Randers-Pehrson
|
# Copyright (C) 1999-2002 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
||||||
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
@@ -10,19 +10,23 @@ ZLIBINC=/opt/zlib/include
|
|||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
|
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
|
CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
|
||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 0
|
||||||
PNGMIN = 1.0.9beta2
|
PNGMIN = 1.0.13
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
LIBNAME = libpng10
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
# where make install puts libpng.a, libpng10.sl, and png.h
|
||||||
prefix=/opt/libpng
|
prefix=/opt/libpng
|
||||||
|
LIBPATH=$prefix/lib
|
||||||
|
INCPATH=$prefix/include
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
@@ -35,21 +39,22 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
|||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) +z -o $@ $*.c
|
$(CC) -c $(CFLAGS) +z -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a libpng.sl pngtest
|
all: libpng.a $(LIBNAME).sl pngtest
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.sl: libpng.sl.$(PNGMAJ)
|
$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
|
||||||
ln -f -s libpng.sl.$(PNGMAJ) libpng.sl
|
ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
|
||||||
|
|
||||||
libpng.sl.$(PNGMAJ): libpng.sl.$(PNGVER)
|
$(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
|
||||||
ln -f -s libpng.sl.$(PNGVER) libpng.sl.$(PNGMAJ)
|
ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.sl.$(PNGVER): $(OBJSDLL)
|
$(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
|
||||||
$(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \
|
$(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \
|
||||||
+h libpng.sl.$(PNGMAJ) -o libpng.sl.$(PNGVER) $(OBJSDLL) -lz
|
+h $(LIBNAME).sl.$(PNGMAJ) -o $(LIBNAME).sl.$(PNGVER) \
|
||||||
|
$(OBJSDLL) -lz
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.a
|
pngtest: pngtest.o libpng.a
|
||||||
$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
|
||||||
@@ -57,21 +62,46 @@ pngtest: pngtest.o libpng.a
|
|||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
install: libpng.a
|
install-headers: png.h pngconf.h
|
||||||
-@mkdir $(prefix)/include
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
-@mkdir $(prefix)/lib
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
cp png.h $(prefix)/include
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
cp pngconf.h $(prefix)/include
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
cp libpng.a libpng.sl.$(PNGVER) $(prefix)/lib
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
|
||||||
chmod 755 $(prefix)/lib/libpng.sl.$(PNGVER)
|
install-static: install-headers libpng.a
|
||||||
(cd $(prefix)/lib; ln -f -s libpng.sl.$(PNGVER) libpng.sl.$(PNGMAJ); \
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
ln -f -s libpng.sl.$(PNGMAJ) libpng.sl)
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).sl.$(PNGVER)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).sl
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.sl
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.sl.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.sl.2.*
|
||||||
|
cp $(LIBNAME).sl.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).sl.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl; \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2; \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.2.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a libpng.sl* pngtest pngout.png
|
/bin/rm -f *.o libpng.a $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
|
||||||
|
pngtest pngout.png
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# Notes:
|
# Notes:
|
||||||
# Derived from makefile.std
|
# Derived from makefile.std
|
||||||
# All modules are compiled in C mode
|
# All modules are compiled in C mode
|
||||||
# Tested with IBM C 3.6.5 under Win32, expected to work under OS/2 too
|
# Tested under Win32, expected to work under OS/2
|
||||||
# Can be easily adapted for IBM VisualAge/C++ for AIX
|
# Can be easily adapted for IBM VisualAge/C++ for AIX
|
||||||
|
|
||||||
# Location of the zlib library and include files
|
# Location of the zlib library and include files
|
||||||
@@ -18,7 +18,7 @@ LD = ilink
|
|||||||
AR = ilib
|
AR = ilib
|
||||||
RM = del
|
RM = del
|
||||||
|
|
||||||
CFLAGS = -I$(ZLIBINC) -O2 -W3
|
CFLAGS = -I$(ZLIBINC) -Mc -O2 -W3
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
# File extensions
|
# File extensions
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
|
|||||||
|
|
||||||
O=.obj
|
O=.obj
|
||||||
|
|
||||||
OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)\
|
OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) \
|
||||||
pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)\
|
pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O) \
|
||||||
pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O)
|
pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O)
|
||||||
|
|
||||||
|
|
||||||
all: test
|
all: test
|
||||||
@@ -70,7 +70,7 @@ pngrtran$(O): png.h pngconf.h
|
|||||||
pngrutil$(O): png.h pngconf.h
|
pngrutil$(O): png.h pngconf.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngvcrd$(O): png.h pngconf.h pngasmrd.h
|
pngvcrd$(O): png.h pngconf.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngerror$(O): png.h pngconf.h
|
pngerror$(O): png.h pngconf.h
|
||||||
|
|||||||
@@ -47,11 +47,14 @@ test: pngtest
|
|||||||
|
|
||||||
install: libpng.a
|
install: libpng.a
|
||||||
-@mkdir $(prefix)/include
|
-@mkdir $(prefix)/include
|
||||||
|
-@mkdir $(prefix)/include/libpng
|
||||||
-@mkdir $(prefix)/lib
|
-@mkdir $(prefix)/lib
|
||||||
cp png.h $(prefix)/include
|
-@rm -f $(prefix)/include/png.h
|
||||||
cp pngconf.h $(prefix)/include
|
-@rm -f $(prefix)/include/pngconf.h
|
||||||
chmod 644 $(prefix)/include/png.h
|
cp png.h $(prefix)/include/libpng
|
||||||
chmod 644 $(prefix)/include/pngconf.h
|
cp pngconf.h $(prefix)/include/libpng
|
||||||
|
chmod 644 $(prefix)/include/libpng/png.h
|
||||||
|
chmod 644 $(prefix)/include/libpng/pngconf.h
|
||||||
cp libpng.a $(prefix)/lib
|
cp libpng.a $(prefix)/lib
|
||||||
chmod 644 $(prefix)/lib/libpng.a
|
chmod 644 $(prefix)/lib/libpng.a
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
# makefile for libpng on Linux ELF with gcc
|
# makefile for libpng.a and libpng10.so on Linux ELF with gcc
|
||||||
# Copyright (C) 1998, 1999 Greg Roelofs
|
# Copyright (C) 1998, 1999, 2002 Greg Roelofs and Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
# For conditions of distribution and use, see copyright notice in png.h
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
LIBNAME = libpng10
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
|
||||||
# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
|
# where "make install" puts libpng.a, libpng10/libpng10.so*,
|
||||||
|
# libpng10/png.h and libpng10/pngconf.h
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
@@ -26,17 +32,13 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
|
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
|
||||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
|
|
||||||
|
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
|
||||||
|
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
|
||||||
|
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
#RANLIB=echo
|
#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.9beta2
|
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(prefix)/lib
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
@@ -51,41 +53,80 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
|||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a libpng.so pngtest
|
all: libpng.a $(LIBNAME).so pngtest
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
libpng.so: libpng.so.$(PNGMAJ)
|
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
||||||
|
|
||||||
libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
|
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
||||||
|
|
||||||
libpng.so.$(PNGVER): $(OBJSDLL)
|
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
|
||||||
$(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
|
$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
|
||||||
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
|
-o $(LIBNAME).so.$(PNGVER) \
|
||||||
|
$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.so
|
pngtest: pngtest.o $(LIBNAME).so
|
||||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
test: pngtest
|
pngtest-static: pngtest.o $(LIBNAME).a
|
||||||
./pngtest
|
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
|
||||||
|
|
||||||
install: libpng.a libpng.so.$(PNGVER)
|
test: pngtest pngtest-static
|
||||||
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
@echo ""
|
||||||
|
@echo " Running pngtest dynamically linked with libpng10.so:"
|
||||||
|
@echo ""
|
||||||
|
./pngtest
|
||||||
|
@echo ""
|
||||||
|
@echo " Running pngtest statically linked with libpng.a:"
|
||||||
|
@echo ""
|
||||||
|
./pngtest-static
|
||||||
|
|
||||||
|
install-headers: png.h pngconf.h
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
|
ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
cp png.h pngconf.h $(INCPATH)
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
|
ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
-@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
|
|
||||||
(cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
|
install-shared: install-headers $(LIBNAME).so.$(PNGVER)
|
||||||
ln -sf libpng.so.$(PNGMAJ) libpng.so)
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.so.2.*
|
||||||
|
cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2; \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.2.$(PNGMIN); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
||||||
|
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-static install-shared
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
|
/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNMAJ)* \
|
||||||
|
pngtest pngout.png
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
||||||
|
|||||||
125
scripts/makefile.macosx
Normal file
125
scripts/makefile.macosx
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
# makefile for libpng, MACOS X
|
||||||
|
# Copyright (C) 2002 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
# Modified by Karin Kosina <kyrah@sim.no> 20011010:
|
||||||
|
# build shared library (*.dylib)
|
||||||
|
# For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
|
||||||
|
# where make install puts libpng.a and png.h
|
||||||
|
prefix=/usr/local
|
||||||
|
|
||||||
|
# Where the zlib library and include files are located
|
||||||
|
#ZLIBLIB=/usr/local/lib
|
||||||
|
#ZLIBINC=/usr/local/include
|
||||||
|
ZLIBLIB=../zlib
|
||||||
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
|
||||||
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
|
||||||
|
LDSHARED=cc -lz -dynamiclib -compatibility_version $(VER) -current_version $(VER)
|
||||||
|
|
||||||
|
PNGMAJ = 0
|
||||||
|
PNGMIN = 1.0.13
|
||||||
|
VER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
LIBNAME=libpng10
|
||||||
|
SHAREDLIB_POSTFIX=dylib
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
|
||||||
|
#RANLIB=echo
|
||||||
|
RANLIB=ranlib
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
all: libpng.a pngtest shared
|
||||||
|
|
||||||
|
shared: $(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX)
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
$(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX): $(OBJS)
|
||||||
|
$(LDSHARED) -o $@ $(OBJS)
|
||||||
|
|
||||||
|
pngtest: pngtest.o libpng.a
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
|
||||||
|
|
||||||
|
install-headers: png.h pngconf.h
|
||||||
|
-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
|
||||||
|
-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
|
||||||
|
cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
|
||||||
|
chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
|
||||||
|
-@/bin/rm -f $(INCPATH)/libpng
|
||||||
|
ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
|
||||||
|
|
||||||
|
install-static: install-headers libpng.a
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
cp libpng.a $(LIBPATH)/$(LIBNAME).a
|
||||||
|
chmod 644 $(LIBPATH)/$(LIBNAME).a
|
||||||
|
-@/bin/rm -f $(LIBPATH)/libpng.a
|
||||||
|
ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
|
||||||
|
|
||||||
|
install-shared: install-headers $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
|
||||||
|
-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.$(SHAREDLIB_POSTFIX)
|
||||||
|
-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(SHAREDLIB_POSTFIX)
|
||||||
|
-@/bin/rm -f libpng.$(SHARED_POSTFIX)
|
||||||
|
-@/bin/rm -f libpng.2.$(SHARED_POSTFIX)
|
||||||
|
-@/bin/rm -f libpng.2.*.$(SHARED_POSTFIX)
|
||||||
|
cp $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) $(LIBPATH)
|
||||||
|
chmod 755 $(LIBPATH)/$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
|
||||||
|
(cd $(LIBPATH); \
|
||||||
|
ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ]
|
||||||
|
libpng.$(SHARED_POSTFIX); \
|
||||||
|
ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ]
|
||||||
|
libpng.2.$(SHARED_POSTFIX); \
|
||||||
|
ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ]
|
||||||
|
libpng.2.$(PNGMIN).$(SHARED_POSTFIX); \
|
||||||
|
ln -sf $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
|
||||||
|
$(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX); \
|
||||||
|
ln -sf $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX) \
|
||||||
|
$(LIBNAME).$(SHAREDLIB_POSTFIX))
|
||||||
|
-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
|
||||||
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
||||||
|
cp libpng.pc $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
chmod 644 $(LIBPATH)/pkgconfig/libpng10.pc
|
||||||
|
|
||||||
|
install: install-shared
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o libpng.a pngtest pngout.png \
|
||||||
|
$(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX) \
|
||||||
|
$(LIBNAME).$(SHAREDLIB_POSTFIX)
|
||||||
|
|
||||||
|
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.h pngconf.h
|
||||||
|
pngerror.o: png.h pngconf.h
|
||||||
|
pngrio.o: png.h pngconf.h
|
||||||
|
pngwio.o: png.h pngconf.h
|
||||||
|
pngmem.o: png.h pngconf.h
|
||||||
|
pngset.o: png.h pngconf.h
|
||||||
|
pngget.o: png.h pngconf.h
|
||||||
|
pngread.o: png.h pngconf.h
|
||||||
|
pngrtran.o: png.h pngconf.h
|
||||||
|
pngrutil.o: png.h pngconf.h
|
||||||
|
pngtest.o: png.h pngconf.h
|
||||||
|
pngtrans.o: png.h pngconf.h
|
||||||
|
pngwrite.o: png.h pngconf.h
|
||||||
|
pngwtran.o: png.h pngconf.h
|
||||||
|
pngwutil.o: png.h pngconf.h
|
||||||
|
pngpread.o: png.h pngconf.h
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user