mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from pngcrush-1.4.0.tar
This commit is contained in:
12
png.c
12
png.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* libpng version 1.0.5v - March 11, 2000
|
||||
* libpng version 1.0.6a - March 23, 2000
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@@ -14,14 +14,14 @@
|
||||
#include "png.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_0_5v Your_png_h_is_not_version_1_0_5v;
|
||||
typedef version_1_0_6a Your_png_h_is_not_version_1_0_6a;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
|
||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||
char png_libpng_ver[12] = "1.0.5v";
|
||||
char png_libpng_ver[12] = "1.0.6a";
|
||||
|
||||
/* png_sig was changed to a function in version 1.0.5c */
|
||||
/* Place to hold the signature string for a PNG file. */
|
||||
@@ -545,7 +545,7 @@ png_charp
|
||||
png_get_copyright(png_structp png_ptr)
|
||||
{
|
||||
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
||||
return ("\n libpng version 1.0.5v - March 11, 2000\n\
|
||||
return ("\n libpng version 1.0.6a - March 23, 2000\n\
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
|
||||
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n");
|
||||
@@ -563,8 +563,8 @@ png_get_libpng_ver(png_structp png_ptr)
|
||||
{
|
||||
/* Version of *.c files used when building libpng */
|
||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||
return("1.0.5v");
|
||||
return("1.0.5v");
|
||||
return("1.0.6a");
|
||||
return("1.0.6a");
|
||||
}
|
||||
|
||||
png_charp
|
||||
|
||||
136
png.h
136
png.h
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.0.5v - March 11, 2000
|
||||
* libpng version 1.0.6a - March 23, 2000
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@@ -9,63 +9,9 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.89c, May 1996: Guy Schalnat
|
||||
* libpng versions 0.90, December 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.0.5v - March 11, 2000: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.0.6a - March 23, 2000: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 11, 2000
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.0.5v are Y2K compliant. It is my belief that earlier
|
||||
* versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
* that will hold years up to 65535. The other two hold the date in text
|
||||
* format, and will hold years up to 9999.
|
||||
*
|
||||
* The integer is
|
||||
* "png_uint_16 year" in png_time_struct.
|
||||
*
|
||||
* The strings are
|
||||
* "png_charp time_buffer" in png_struct and
|
||||
* "near_time_buffer", which is a local character string in png.c.
|
||||
*
|
||||
* There are seven time-related functions:
|
||||
* png.c: png_convert_to_rfc_1123() in png.c
|
||||
* (formerly png_convert_to_rfc_1152() in error)
|
||||
* png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
|
||||
* png_convert_from_time_t() in pngwrite.c
|
||||
* png_get_tIME() in pngget.c
|
||||
* png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||
* png_set_tIME() in pngset.c
|
||||
* png_write_tIME() in pngwutil.c, called in pngwrite.c
|
||||
*
|
||||
* All handle dates properly in a Y2K environment. The
|
||||
* png_convert_from_time_t() function calls gmtime() to convert from system
|
||||
* clock time, which returns (year - 1900), which we properly convert to
|
||||
* the full 4-digit year. There is a possibility that applications using
|
||||
* libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||
* function, or that they are incorrectly passing only a 2-digit year
|
||||
* instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||
* but this is not under our control. The libpng documentation has always
|
||||
* stated that it works with 4-digit years, and the APIs have been
|
||||
* documented as such.
|
||||
*
|
||||
* The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||
* integer to hold the year, and can hold years as large as 65535.
|
||||
*
|
||||
* zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||
* no date-related code.
|
||||
*
|
||||
* Glenn Randers-Pehrson
|
||||
* libpng maintainer
|
||||
* PNG Development Group
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
*
|
||||
* Due to various miscommunications, unforeseen code incompatibilities
|
||||
@@ -99,8 +45,9 @@
|
||||
* 1.0.5 1.0.5 10005 2.1.0.5
|
||||
* 1.0.5a-d 1.0.5a-d 10006 2.1.0.5a-d
|
||||
* 1.0.5e-r 1.0.5e-r 10100 2.1.0.5e-r (not compatible)
|
||||
* 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (compatible)
|
||||
* 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-w (compatible)
|
||||
* 1.0.6 1.0.6 10006 2.1.0.6
|
||||
* 1.0.6a 1.0.6a 10007 2.1.0.6a
|
||||
* 1.3.0 1.3.0 10300 3.1.3.0
|
||||
*
|
||||
* Henceforth the source version will match the shared-library minor
|
||||
@@ -125,7 +72,7 @@
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
* (libpng versions 0.90, December 1996, through 0.96, May 1997)
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
* (libpng versions 0.97, January 1998, through 1.0.5v, March 11, 2000)
|
||||
* (libpng versions 0.97, January 1998, through 1.0.6a, March 23, 2000)
|
||||
*
|
||||
* For the purposes of this copyright and license, "Contributing Authors"
|
||||
* is defined as the following set of individuals:
|
||||
@@ -196,6 +143,62 @@
|
||||
* Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 23, 2000
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.0.6a are Y2K compliant. It is my belief that earlier
|
||||
* versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
* that will hold years up to 65535. The other two hold the date in text
|
||||
* format, and will hold years up to 9999.
|
||||
*
|
||||
* The integer is
|
||||
* "png_uint_16 year" in png_time_struct.
|
||||
*
|
||||
* The strings are
|
||||
* "png_charp time_buffer" in png_struct and
|
||||
* "near_time_buffer", which is a local character string in png.c.
|
||||
*
|
||||
* There are seven time-related functions:
|
||||
* png.c: png_convert_to_rfc_1123() in png.c
|
||||
* (formerly png_convert_to_rfc_1152() in error)
|
||||
* png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
|
||||
* png_convert_from_time_t() in pngwrite.c
|
||||
* png_get_tIME() in pngget.c
|
||||
* png_handle_tIME() in pngrutil.c, called in pngread.c
|
||||
* png_set_tIME() in pngset.c
|
||||
* png_write_tIME() in pngwutil.c, called in pngwrite.c
|
||||
*
|
||||
* All handle dates properly in a Y2K environment. The
|
||||
* png_convert_from_time_t() function calls gmtime() to convert from system
|
||||
* clock time, which returns (year - 1900), which we properly convert to
|
||||
* the full 4-digit year. There is a possibility that applications using
|
||||
* libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
|
||||
* function, or that they are incorrectly passing only a 2-digit year
|
||||
* instead of "year - 1900" into the png_convert_from_struct_tm() function,
|
||||
* but this is not under our control. The libpng documentation has always
|
||||
* stated that it works with 4-digit years, and the APIs have been
|
||||
* documented as such.
|
||||
*
|
||||
* The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
|
||||
* integer to hold the year, and can hold years as large as 65535.
|
||||
*
|
||||
* zlib, upon which libpng depends, is also Y2K compliant. It contains
|
||||
* no date-related code.
|
||||
*
|
||||
* Glenn Randers-Pehrson
|
||||
* libpng maintainer
|
||||
* PNG Development Group
|
||||
*/
|
||||
|
||||
#ifndef _PNG_H
|
||||
#define _PNG_H
|
||||
|
||||
@@ -228,14 +231,14 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.0.5v"
|
||||
#define PNG_LIBPNG_VER_STRING "1.0.6a"
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=bugfix */
|
||||
#define PNG_LIBPNG_VER 10006 /* 1.0.6 */
|
||||
#define PNG_LIBPNG_VER 10007 /* 1.0.7 */
|
||||
|
||||
/* Note to maintainer: update this number in scripts/pngdef.pas as well */
|
||||
|
||||
@@ -649,13 +652,12 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
double scal_pixel_width; /* width of one pixel */
|
||||
double scal_pixel_height; /* height of one pixel */
|
||||
#else
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_charp scal_s_width; /* string containing height */
|
||||
png_charp scal_s_height; /* string containing width */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* storage for unknown chunks that the library doesn't recognize. */
|
||||
@@ -1054,9 +1056,9 @@ struct png_struct_def
|
||||
};
|
||||
|
||||
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
|
||||
and png.h are both at * version 1.0.5v
|
||||
and png.h are both at * version 1.0.6a
|
||||
*/
|
||||
typedef png_structp version_1_0_5v;
|
||||
typedef png_structp version_1_0_6a;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@@ -2029,7 +2031,7 @@ extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)
|
||||
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
|
||||
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.0.5v - March 11, 2000 (header)\n"
|
||||
" libpng version 1.0.6a - March 23, 2000 (header)\n"
|
||||
|
||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
/* With these routines we avoid an integer divide, which will be slower on
|
||||
@@ -2302,7 +2304,7 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
|
||||
defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED)
|
||||
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
|
||||
int comp_type, png_charp chunkdata, png_size_t chunklength,
|
||||
png_size_t prefix_size));
|
||||
png_size_t prefix_length, png_size_t *data_length));
|
||||
#endif
|
||||
|
||||
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
|
||||
@@ -2466,7 +2468,7 @@ PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
|
||||
#endif
|
||||
|
||||
#if defined(PNG_WRITE_sCAL_SUPPORTED)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
|
||||
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
|
||||
int unit, double width, double height));
|
||||
#else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1999, 2000 Glenn Randers-Pehrson
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
24
pngcrush.c
24
pngcrush.c
@@ -15,7 +15,7 @@
|
||||
* occasionally creating Linux executables.
|
||||
*/
|
||||
|
||||
#define PNGCRUSH_VERSION "1.3.6"
|
||||
#define PNGCRUSH_VERSION "1.4.0"
|
||||
|
||||
/*
|
||||
* COPYRIGHT NOTICE, DISCLAIMER, AND LICENSE:
|
||||
@@ -29,8 +29,8 @@
|
||||
* exemplary, or consequential damages, which may result from the use of
|
||||
* the pngcrush program, even if advised of the possibility of such damage.
|
||||
*
|
||||
* Permission is hereby granted to use, copy, modify, and distribute this
|
||||
* source code, or portions hereof, for any purpose, without fee, subject
|
||||
* Permission is hereby granted to anyone to use, copy, modify, and distribute
|
||||
* this source code, or portions hereof, for any purpose, without fee, subject
|
||||
* to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this source code must not be misrepresented.
|
||||
@@ -44,12 +44,12 @@
|
||||
|
||||
/* To do:
|
||||
*
|
||||
* Version 1.3.*: check for unused alpha channel and ok-to-reduce-depth.
|
||||
* Version 1.4.*: check for unused alpha channel and ok-to-reduce-depth.
|
||||
* Rearrange palette to put most-used color first and transparent color
|
||||
* second (see ImageMagick 5.1.1 and later).
|
||||
* Finish pplt (partial palette) feature.
|
||||
*
|
||||
* Version 1.3.*: Use an alternate write function for the trial passes, that
|
||||
* Version 1.4.*: Use an alternate write function for the trial passes, that
|
||||
* simply counts bytes rather than actually writing to a file, to save wear
|
||||
* and tear on disk drives.
|
||||
*
|
||||
@@ -63,6 +63,8 @@
|
||||
*
|
||||
* Change log:
|
||||
*
|
||||
* Version 1.4.0 (built with libpng-1.0.6 + libpng-1.0.6-patch-a)
|
||||
*
|
||||
* Version 1.3.6 (built with libpng-1.0.5v)
|
||||
*
|
||||
* RGB to Grayscale conversion is more accurate (15-bit instead of 8-bit)
|
||||
@@ -1907,7 +1909,8 @@ main(int argc, char *argv[])
|
||||
#if !defined(PNG_tIME_SUPPORTED)
|
||||
PNG_tIME;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* PNG_USE_LOCAL_ARRAYS */
|
||||
|
||||
png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_IF_SAFE,
|
||||
(png_bytep)NULL, 0);
|
||||
#if !defined(PNG_cHRM_SUPPORTED)
|
||||
@@ -1938,7 +1941,8 @@ main(int argc, char *argv[])
|
||||
png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_ALWAYS,
|
||||
(png_bytep)png_tIME, 1);
|
||||
#endif
|
||||
#else /* !PNG_UINT_IHDR */
|
||||
|
||||
#else /* PNG_UINT_IHDR */
|
||||
|
||||
#if !defined(PNG_cHRM_SUPPORTED) || !defined(PNG_hIST_SUPPORTED) || \
|
||||
!defined(PNG_iCCP_SUPPORTED) || !defined(PNG_sCAL_SUPPORTED) || \
|
||||
@@ -1985,7 +1989,7 @@ main(int argc, char *argv[])
|
||||
png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_ALWAYS,
|
||||
chunk_name, 1);
|
||||
#endif
|
||||
#endif /* !PNG_UINT_IHDR */
|
||||
#endif /* PNG_UINT_IHDR */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2065,7 +2069,7 @@ main(int argc, char *argv[])
|
||||
if(verbose > 0 && first_trial)
|
||||
fprintf(STDERR, " Adding an alpha channel.\n");
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
png_set_filler(read_ptr, (png_uint_32)65535, PNG_FILLER_AFTER);
|
||||
png_set_filler(read_ptr, (png_uint_32)65535L, PNG_FILLER_AFTER);
|
||||
#endif
|
||||
need_expand = 1;
|
||||
}
|
||||
@@ -2230,7 +2234,7 @@ main(int argc, char *argv[])
|
||||
else if(intent >= 0)
|
||||
{
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
if(file_gamma > 45000L && file_gamma < 46000L)
|
||||
if(file_gamma >= 45000L && file_gamma <= 46000L)
|
||||
{
|
||||
things_have_changed=1;
|
||||
if(first_trial)
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
/* Special defines for pngcrush, mostly just to reduce the size of the
|
||||
static executable. */
|
||||
|
||||
#ifndef PNGCRUSH_H
|
||||
#define PNGCRUSH_H
|
||||
|
||||
#define PNG_NO_READ_cHRM
|
||||
#define PNG_NO_WRITE_cHRM
|
||||
#define PNG_NO_READ_hIST
|
||||
@@ -41,3 +44,4 @@
|
||||
#ifndef PNG_ZBUF_SIZE
|
||||
# define PNG_ZBUF_SIZE 524288 /* increases the IDAT size */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
179
pnggccrd.c
179
pnggccrd.c
@@ -6,7 +6,7 @@
|
||||
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
|
||||
* for Intel's performance analysis of the MMX vs. non-MMX code.
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998, Intel Corporation
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
@@ -25,14 +25,15 @@
|
||||
* is required to assemble the newer MMX instructions such as movq.
|
||||
* For djgpp, see
|
||||
*
|
||||
* ftp://ftp.cdrom.com/pub/simtelnet/gnu/djgpp/v2gnu/bnu281b.zip
|
||||
* ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu281b.zip
|
||||
*
|
||||
* (or a later version in the same directory). For Linux, check your
|
||||
* distribution's web site(s) or try these links:
|
||||
*
|
||||
* http://rufus.w3.org/linux/RPM/binutils.html
|
||||
* http://www.debian.org/Packages/stable/devel/binutils.html
|
||||
* ftp://ftp.cdrom.com/pub/linux/slackware/slakware/d1/binutils.tgz
|
||||
* ftp://ftp.slackware.com/pub/linux/slackware/slackware/slakware/d1/
|
||||
* binutils.tgz
|
||||
*
|
||||
* For other platforms, see the main GNU site:
|
||||
*
|
||||
@@ -40,85 +41,92 @@
|
||||
*
|
||||
* Version 2.5.2l.15 is definitely too old...
|
||||
*/
|
||||
#if 0
|
||||
// GRR NOTES
|
||||
//
|
||||
// 19991006:
|
||||
// - fixed sign error in post-MMX cleanup code (16- & 32-bit cases)
|
||||
//
|
||||
// 19991007:
|
||||
// - additional optimizations (possible or definite):
|
||||
// x [DONE] write MMX code for 64-bit case (pixel_bytes == 8) [not tested]
|
||||
// - write MMX code for 48-bit case (pixel_bytes == 6)
|
||||
// - figure out what's up with 24-bit case (pixel_bytes == 3):
|
||||
// why subtract 8 from width_mmx in the pass 4/5 case?
|
||||
// (only width_mmx case)
|
||||
// x [DONE] replace pixel_bytes within each block with the true
|
||||
// constant value (or are compilers smart enough to do that?)
|
||||
// - rewrite all MMX interlacing code so it's aligned with
|
||||
// the *beginning* of the row buffer, not the end. This
|
||||
// would not only allow one to eliminate half of the memory
|
||||
// writes for odd passes (i.e., pass == odd), it may also
|
||||
// eliminate some unaligned-data-access exceptions (assuming
|
||||
// there's a penalty for not aligning 64-bit accesses on
|
||||
// 64-bit boundaries). The only catch is that the "leftover"
|
||||
// pixel(s) at the end of the row would have to be saved,
|
||||
// but there are enough unused MMX registers in every case,
|
||||
// so this is not a problem. A further benefit is that the
|
||||
// post-MMX cleanup code (C code) in at least some of the
|
||||
// cases could be done within the assembler block.
|
||||
// x [DONE] the "v3 v2 v1 v0 v7 v6 v5 v4" comments are confusing,
|
||||
// inconsistent, and don't match the MMX Programmer's Reference
|
||||
// Manual conventions anyway. They should be changed to
|
||||
// "b7 b6 b5 b4 b3 b2 b1 b0," where b0 indicates the byte that
|
||||
// was lowest in memory (e.g., corresponding to a left pixel)
|
||||
// and b7 is the byte that was highest (e.g., a right pixel).
|
||||
//
|
||||
// 19991016:
|
||||
// - Brennan's Guide notwithstanding, gcc under Linux does *not*
|
||||
// want globals prefixed by underscores when referencing them--
|
||||
// i.e., if the variable is const4, then refer to it as const4,
|
||||
// not _const4. This seems to be a djgpp-specific requirement.
|
||||
// Also, such variables apparently *must* be declared outside
|
||||
// of functions; neither static nor automatic variables work if
|
||||
// defined within the scope of a single function, but both
|
||||
// static and truly global (multi-module) variables work fine.
|
||||
//
|
||||
// 19991023:
|
||||
// - fixed png_combine_row() non-MMX replication bug (odd passes only?)
|
||||
// - switched from string-concatenation-with-macros to cleaner method of
|
||||
// renaming global variables for djgpp--i.e., always use prefixes in
|
||||
// inlined assembler code (== strings) and conditionally rename the
|
||||
// variables, not the other way around. Hence _const4, _mask8_0, etc.
|
||||
//
|
||||
// 19991024:
|
||||
// - fixed mmxsupport()/png_do_interlace() first-row bug
|
||||
// This one was severely weird: even though mmxsupport() doesn't touch
|
||||
// ebx (where "row" pointer was stored), it nevertheless managed to zero
|
||||
// the register (even in static/non-fPIC code--see below), which in turn
|
||||
// caused png_do_interlace() to return prematurely on the first row of
|
||||
// interlaced images (i.e., without expanding the interlaced pixels).
|
||||
// Inspection of the generated assembly code didn't turn up any clues,
|
||||
// although it did point at a minor optimization (i.e., get rid of
|
||||
// mmx_supported_local variable and just use eax). Possibly the CPUID
|
||||
// instruction is more destructive than it looks? (Not yet checked.)
|
||||
// - "info gcc" was next to useless, so compared fPIC and non-fPIC assembly
|
||||
// listings... Apparently register spillage has to do with ebx, since
|
||||
// it's used to index the global offset table. Commenting it out of the
|
||||
// input-reg lists in png_combine_row() eliminated compiler barfage, so
|
||||
// ifdef'd with __PIC__ macro: if defined, use a global for unmask
|
||||
//
|
||||
// 19991107:
|
||||
// - verified CPUID clobberage: 12-char string constant ("GenuineIntel",
|
||||
// "AuthenticAMD", etc.) placed in EBX:ECX:EDX. Still need to polish.
|
||||
//
|
||||
// 19991120:
|
||||
// - made "diff" variable (now "_dif") global to simplify conversion of
|
||||
// filtering routines (running out of regs, sigh). "diff" is still used
|
||||
// in interlacing routines, however.
|
||||
// - fixed up both versions of mmxsupport() (ORIG_THAT_USED_TO_CLOBBER_EBX
|
||||
// macro determines which is used); original not yet tested.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GRR NOTES
|
||||
* =========
|
||||
*
|
||||
* 19991006:
|
||||
* - fixed sign error in post-MMX cleanup code (16- & 32-bit cases)
|
||||
*
|
||||
* 19991007:
|
||||
* - additional optimizations (possible or definite):
|
||||
* x [DONE] write MMX code for 64-bit case (pixel_bytes == 8) [not tested]
|
||||
* - write MMX code for 48-bit case (pixel_bytes == 6)
|
||||
* - figure out what's up with 24-bit case (pixel_bytes == 3):
|
||||
* why subtract 8 from width_mmx in the pass 4/5 case?
|
||||
* (only width_mmx case)
|
||||
* x [DONE] replace pixel_bytes within each block with the true
|
||||
* constant value (or are compilers smart enough to do that?)
|
||||
* - rewrite all MMX interlacing code so it's aligned with
|
||||
* the *beginning* of the row buffer, not the end. This
|
||||
* would not only allow one to eliminate half of the memory
|
||||
* writes for odd passes (i.e., pass == odd), it may also
|
||||
* eliminate some unaligned-data-access exceptions (assuming
|
||||
* there's a penalty for not aligning 64-bit accesses on
|
||||
* 64-bit boundaries). The only catch is that the "leftover"
|
||||
* pixel(s) at the end of the row would have to be saved,
|
||||
* but there are enough unused MMX registers in every case,
|
||||
* so this is not a problem. A further benefit is that the
|
||||
* post-MMX cleanup code (C code) in at least some of the
|
||||
* cases could be done within the assembler block.
|
||||
* x [DONE] the "v3 v2 v1 v0 v7 v6 v5 v4" comments are confusing,
|
||||
* inconsistent, and don't match the MMX Programmer's Reference
|
||||
* Manual conventions anyway. They should be changed to
|
||||
* "b7 b6 b5 b4 b3 b2 b1 b0," where b0 indicates the byte that
|
||||
* was lowest in memory (e.g., corresponding to a left pixel)
|
||||
* and b7 is the byte that was highest (e.g., a right pixel).
|
||||
*
|
||||
* 19991016:
|
||||
* - Brennan's Guide notwithstanding, gcc under Linux does *not*
|
||||
* want globals prefixed by underscores when referencing them--
|
||||
* i.e., if the variable is const4, then refer to it as const4,
|
||||
* not _const4. This seems to be a djgpp-specific requirement.
|
||||
* Also, such variables apparently *must* be declared outside
|
||||
* of functions; neither static nor automatic variables work if
|
||||
* defined within the scope of a single function, but both
|
||||
* static and truly global (multi-module) variables work fine.
|
||||
*
|
||||
* 19991023:
|
||||
* - fixed png_combine_row() non-MMX replication bug (odd passes only?)
|
||||
* - switched from string-concatenation-with-macros to cleaner method of
|
||||
* renaming global variables for djgpp--i.e., always use prefixes in
|
||||
* inlined assembler code (== strings) and conditionally rename the
|
||||
* variables, not the other way around. Hence _const4, _mask8_0, etc.
|
||||
*
|
||||
* 19991024:
|
||||
* - fixed mmxsupport()/png_do_interlace() first-row bug
|
||||
* This one was severely weird: even though mmxsupport() doesn't touch
|
||||
* ebx (where "row" pointer was stored), it nevertheless managed to zero
|
||||
* the register (even in static/non-fPIC code--see below), which in turn
|
||||
* caused png_do_interlace() to return prematurely on the first row of
|
||||
* interlaced images (i.e., without expanding the interlaced pixels).
|
||||
* Inspection of the generated assembly code didn't turn up any clues,
|
||||
* although it did point at a minor optimization (i.e., get rid of
|
||||
* mmx_supported_local variable and just use eax). Possibly the CPUID
|
||||
* instruction is more destructive than it looks? (Not yet checked.)
|
||||
* - "info gcc" was next to useless, so compared fPIC and non-fPIC assembly
|
||||
* listings... Apparently register spillage has to do with ebx, since
|
||||
* it's used to index the global offset table. Commenting it out of the
|
||||
* input-reg lists in png_combine_row() eliminated compiler barfage, so
|
||||
* ifdef'd with __PIC__ macro: if defined, use a global for unmask
|
||||
*
|
||||
* 19991107:
|
||||
* - verified CPUID clobberage: 12-char string constant ("GenuineIntel",
|
||||
* "AuthenticAMD", etc.) placed in EBX:ECX:EDX. Still need to polish.
|
||||
*
|
||||
* 19991120:
|
||||
* - made "diff" variable (now "_dif") global to simplify conversion of
|
||||
* filtering routines (running out of regs, sigh). "diff" is still used
|
||||
* in interlacing routines, however.
|
||||
* - fixed up both versions of mmxsupport() (ORIG_THAT_USED_TO_CLOBBER_EBX
|
||||
* macro determines which is used); original not yet tested.
|
||||
*
|
||||
* 20000319:
|
||||
* - fixed a register-name typo in png_do_read_interlace(), default (MMX) case,
|
||||
* pass == 4 or 5, that caused visible corruption of interlaced images
|
||||
*/
|
||||
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
@@ -1524,17 +1532,20 @@ fflush(stderr);
|
||||
width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes
|
||||
if (width_mmx)
|
||||
{
|
||||
// png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
// sptr points at last pixel in pre-expanded row
|
||||
// dp points at last pixel position in expanded row
|
||||
__asm__ (
|
||||
"subl $3, %%esi \n\t"
|
||||
"subl $9, %%edi \n\t"
|
||||
// (png_pass_inc[pass] - 1)*pixel_bytes
|
||||
// (png_pass_inc[pass] + 1)*pixel_bytes
|
||||
|
||||
".loop3_pass4: \n\t"
|
||||
"movq (%%esi), %%mm0 \n\t" // x x 5 4 3 2 1 0
|
||||
"movq %%mm0, %%mm1 \n\t" // x x 5 4 3 2 1 0
|
||||
"movq %%mm0, %%mm2 \n\t" // x x 5 4 3 2 1 0
|
||||
"psllq $24, %%mm0 \n\t" // 4 3 2 1 0 z z z
|
||||
"pand _const4, %%mm0 \n\t" // z z z z z 2 1 0
|
||||
"pand _const4, %%mm1 \n\t" // z z z z z 2 1 0
|
||||
"psrlq $24, %%mm2 \n\t" // z z z x x 5 4 3
|
||||
"por %%mm1, %%mm0 \n\t" // 4 3 2 1 0 2 1 0
|
||||
"movq %%mm2, %%mm3 \n\t" // z z z x x 5 4 3
|
||||
|
||||
2
pngget.c
2
pngget.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
2
pngmem.c
2
pngmem.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
@@ -641,7 +641,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
* not called png_set_interlace_handling(), the display_row buffer will
|
||||
* be ignored, so pass NULL to it.
|
||||
*
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.5v.
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6a.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -690,7 +690,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
||||
* only call this function once. If you desire to have an image for
|
||||
* each pass of a interlaced image, use png_read_rows() instead.
|
||||
*
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.5v.
|
||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6a.
|
||||
*/
|
||||
void
|
||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||
|
||||
2
pngrio.c
2
pngrio.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
29
pngrutil.c
29
pngrutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 25, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
@@ -143,7 +143,7 @@ png_crc_error(png_structp png_ptr)
|
||||
*/
|
||||
png_charp png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
png_charp chunkdata, png_size_t chunklength,
|
||||
png_size_t prefix_size)
|
||||
png_size_t prefix_size, png_size_t *newlength)
|
||||
{
|
||||
static char msg[] = "Error decoding compressed text";
|
||||
png_charp text = NULL;
|
||||
@@ -161,9 +161,7 @@ png_charp png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
|
||||
while (png_ptr->zstream.avail_in)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
||||
int ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||
{
|
||||
if (png_ptr->zstream.msg != NULL)
|
||||
@@ -229,6 +227,7 @@ png_charp png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
|
||||
png_free(png_ptr, chunkdata);
|
||||
chunkdata = text;
|
||||
*newlength=text_size;
|
||||
}
|
||||
else /* if (comp_type >= PNG_TEXT_COMPRESSION_LAST) */
|
||||
{
|
||||
@@ -891,7 +890,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_byte compression_type;
|
||||
png_charp profile;
|
||||
png_uint_32 skip = 0;
|
||||
png_size_t slength, prefix_length;
|
||||
png_size_t slength, prefix_length, data_length;
|
||||
|
||||
png_debug(1, "in png_handle_iCCP\n");
|
||||
|
||||
@@ -953,10 +952,10 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
prefix_length = profile - chunkdata;
|
||||
chunkdata = png_decompress_chunk(png_ptr, compression_type, chunkdata,
|
||||
slength, prefix_length);
|
||||
slength, prefix_length, &data_length);
|
||||
|
||||
png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type,
|
||||
chunkdata + prefix_length, png_strlen(chunkdata + prefix_length));
|
||||
chunkdata + prefix_length, data_length);
|
||||
png_free(png_ptr, chunkdata);
|
||||
}
|
||||
#endif /* PNG_READ_iCCP_SUPPORTED */
|
||||
@@ -1724,7 +1723,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_charp chunkdata;
|
||||
png_charp text;
|
||||
int comp_type;
|
||||
png_size_t slength, prefix_len;
|
||||
png_size_t slength, prefix_len, data_len;
|
||||
|
||||
png_debug(1, "in png_handle_zTXt\n");
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||
@@ -1772,7 +1771,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
prefix_len = text - chunkdata;
|
||||
|
||||
chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata,
|
||||
(png_size_t)length, prefix_len);
|
||||
(png_size_t)length, prefix_len, &data_len);
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
text_ptr->compression = comp_type;
|
||||
@@ -1780,7 +1779,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
text_ptr->key = chunkdata;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->text = chunkdata + prefix_len;
|
||||
text_ptr->text_length = png_strlen(text);
|
||||
text_ptr->text_length = data_len;
|
||||
text_ptr->itxt_length = 0;
|
||||
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
@@ -1800,7 +1799,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_charp key, lang, text, lang_key;
|
||||
int comp_flag;
|
||||
int comp_type = 0;
|
||||
png_size_t slength, prefix_len;
|
||||
png_size_t slength, prefix_len, data_len;
|
||||
|
||||
png_debug(1, "in png_handle_iTXt\n");
|
||||
|
||||
@@ -1864,7 +1863,9 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
key=chunkdata;
|
||||
if (comp_flag)
|
||||
chunkdata = png_decompress_chunk(png_ptr, comp_type, chunkdata,
|
||||
(size_t)length, prefix_len);
|
||||
(size_t)length, prefix_len, &data_len);
|
||||
else
|
||||
data_len=png_strlen(chunkdata + prefix_len);
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||
text_ptr->compression = (int)comp_flag + 1;
|
||||
text_ptr->lang_key = chunkdata+(lang_key-key);
|
||||
@@ -1872,7 +1873,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
text_ptr->key = chunkdata;
|
||||
text_ptr->text = chunkdata + prefix_len;
|
||||
text_ptr->text_length = 0;
|
||||
text_ptr->itxt_length = png_strlen(text_ptr->text);
|
||||
text_ptr->itxt_length = data_len;
|
||||
|
||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
|
||||
2
pngset.c
2
pngset.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998, Intel Corporation
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
|
||||
2
pngwio.c
2
pngwio.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
@@ -165,13 +165,16 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
||||
#endif
|
||||
#if defined(PNG_WRITE_sCAL_SUPPORTED)
|
||||
if (info_ptr->valid & PNG_INFO_sCAL)
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
|
||||
png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
|
||||
info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
|
||||
#else
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit,
|
||||
info_ptr->scal_s_width, info_ptr->scal_s_height);
|
||||
#else
|
||||
png_warning(png_ptr,
|
||||
"png_write_sCAL not supported; sCAL chunk not written.\n");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
|
||||
14
pngwutil.c
14
pngwutil.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* libpng 1.0.5v - March 11, 2000
|
||||
* libpng 1.0.6a - March 23, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
@@ -795,7 +795,9 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
|
||||
white_x + white_y > 1.0)
|
||||
{
|
||||
png_warning(png_ptr, "Invalid cHRM white point specified");
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
printf("white_x=%f, white_y=%f\n",white_x, white_y);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
itemp = (png_uint_32)(white_x * 100000.0 + 0.5);
|
||||
@@ -856,7 +858,9 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
|
||||
if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L)
|
||||
{
|
||||
png_warning(png_ptr, "Invalid fixed cHRM white point specified");
|
||||
#if !defined(PNG_NO_STDIO)
|
||||
printf("white_x=%ld, white_y=%ld\n",white_x, white_y);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
png_save_uint_32(buf, white_x);
|
||||
@@ -1381,7 +1385,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
|
||||
#if defined(PNG_WRITE_sCAL_SUPPORTED)
|
||||
/* write the sCAL chunk */
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
|
||||
void
|
||||
png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
|
||||
{
|
||||
@@ -1417,10 +1421,10 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
|
||||
png_size_t total_len;
|
||||
char wbuf[32], hbuf[32];
|
||||
|
||||
png_debug(1, "in png_write_sCAL\n");
|
||||
png_debug(1, "in png_write_sCAL_s\n");
|
||||
|
||||
sprintf(wbuf, "%s", width);
|
||||
sprintf(hbuf, "%s", height);
|
||||
strcpy(wbuf,(const char *)width);
|
||||
strcpy(hbuf,(const char *)height);
|
||||
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
||||
|
||||
png_debug1(3, "sCAL total length = %d\n", total_len);
|
||||
|
||||
Reference in New Issue
Block a user