Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
1d963612
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
1 年多 前同步成功
通知
4
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Libpng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1d963612
编写于
5月 02, 1998
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Imported from libpng-1.0.1b.tar
上级
896239be
变更
29
展开全部
隐藏空白更改
内联
并排
Showing
29 changed file
with
839 addition
and
712 deletion
+839
-712
ANNOUNCE
ANNOUNCE
+25
-15
CHANGES
CHANGES
+10
-1
KNOWNBUG
KNOWNBUG
+20
-0
libpng.3
libpng.3
+3
-3
libpng.txt
libpng.txt
+1
-1
libpngpf.3
libpngpf.3
+1
-1
png.5
png.5
+1
-1
png.c
png.c
+3
-3
png.h
png.h
+64
-23
pngconf.h
pngconf.h
+2
-2
pngerror.c
pngerror.c
+2
-2
pngget.c
pngget.c
+2
-2
pngmem.c
pngmem.c
+2
-2
pngpread.c
pngpread.c
+2
-2
pngread.c
pngread.c
+68
-27
pngrio.c
pngrio.c
+2
-2
pngrtran.c
pngrtran.c
+197
-235
pngrutil.c
pngrutil.c
+102
-174
pngset.c
pngset.c
+2
-2
pngtest.c
pngtest.c
+2
-2
pngtrans.c
pngtrans.c
+27
-27
pngwio.c
pngwio.c
+2
-2
pngwrite.c
pngwrite.c
+32
-2
pngwtran.c
pngwtran.c
+47
-49
pngwutil.c
pngwutil.c
+119
-128
scripts/makefile.lnx
scripts/makefile.lnx
+2
-2
scripts/makefile.s2x
scripts/makefile.s2x
+1
-1
scripts/makefile.sco
scripts/makefile.sco
+97
-0
scripts/makefile.sgi
scripts/makefile.sgi
+1
-1
未找到文件。
ANNOUNCE
浏览文件 @
1d963612
Libpng 1.0.1
a April 21
, 1998
Libpng 1.0.1
b May 2
, 1998
This is not intended to be a public release. It will be replaced
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
within a few weeks by a public version or by another test version.
Changes since the last release:
Changes since the last
public
release:
Optimized Paeth calculations by replacing abs() function calls with intrinsics
libpng-1.0.1a:
plus other loop optimizations. Improves avg decoding speed by about 20 percent.
Optimized Paeth calculations by replacing abs() function calls with intrinsics
Commented out i386istic "align" compiler flags in makefile.lnx.
plus other loop optimizations. Improves avg decoding speed by about 20 percent.
Reduced the default warning level in some makefiles, to make them consistent.
Commented out i386istic "align" compiler flags in makefile.lnx.
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
Reduced the default warning level in some makefiles, to make them consistent.
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
Removed references to IJG and JPEG in the ansi2knr.c copyright statement.
Added grayscale and 16-bit capability to png_do_read_filler().
Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation.
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
Added grayscale and 16-bit capability to png_do_read_filler().
too large when writing an image with bit_depth < 8 (Bob Dellaca).
Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes
Corrected some bugs in the experimental weighted filtering heuristics.
too large when writing an image with bit_depth < 8 (Bob Dellaca).
Moved a misplaced pngrutil code block that truncates tRNS if it has more
Corrected some bugs in the experimental weighted filtering heuristics.
than num_palette entries -- test was done before num_palette was defined.
Moved a misplaced pngrutil code block that truncates tRNS if it has more
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
than num_palette entries -- test was done before num_palette was defined.
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
libpng-1.0.1b:
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
Relocated the png_composite macros from pngrtran.c to png.h (Greg).
Added makefile.sco (contributed by Mike Hopkirk).
Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a.
Fixed a bug in pngrtran.c that would set channels=5 under some circumstances.
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
More work on loop optimization which may help when compiled with C++ compilers.
Added warnings when people try to use transforms they've defined out.
Send comments/corrections/commendations to
Send comments/corrections/commendations to
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
png-implement@dworkin.wustl.edu or to randeg@alumni.rpi.edu
...
...
CHANGES
浏览文件 @
1d963612
...
@@ -300,4 +300,13 @@ version 1.0.1a [April 21, 1998]
...
@@ -300,4 +300,13 @@ version 1.0.1a [April 21, 1998]
Moved a misplaced pngrutil code block that truncates tRNS if it has more
Moved a misplaced pngrutil code block that truncates tRNS if it has more
than num_palette entries -- test was done before num_palette was defined.
than num_palette entries -- test was done before num_palette was defined.
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins).
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen)
Changed compiler flags in makefile.wat for better optimization (Pawel Mrochen).
version 1.0.1b [May 2, 1998]
Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg).
Relocated the png_composite macros from pngrtran.c to png.h (Greg).
Added makefile.sco (contributed by Mike Hopkirk).
Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a.
Fixed a bug in pngrtran.c that would set channels=5 under some circumstances.
More work on the Paeth-filtering, achieving imperceptible speedup (A Kleinert).
More work on loop optimization which may help when compiled with C++ compilers.
Added warnings when people try to use transforms they've defined out.
KNOWNBUG
浏览文件 @
1d963612
...
@@ -111,3 +111,23 @@ Known bugs and suggested enhancements in libpng-1.0.1
...
@@ -111,3 +111,23 @@ Known bugs and suggested enhancements in libpng-1.0.1
The "ptime->date % 31" is wrong, should be "ptime->date % 32".
The "ptime->date % 31" is wrong, should be "ptime->date % 32".
STATUS: Fixed in libpng-1.0.1a
STATUS: Fixed in libpng-1.0.1a
11. April 21, 1998 -- ENHANCEMENT -- relocation of composite macros
png_composite() and png_composite_16() relocated to png.h
STATUS: Done in libpng-1.0.1b
12. April 22, 1998 -- ENHANCEMENT -- makefile.sco
Mike Hopkirk contributed a makefile for SCO osr5 and sco UW7
STATUS: Added to libpng-1.0.1b distribution
13: April 30, 1998 -- ENHANCEMENT -- warnings
When people define out some of the read transformations and then
try to use them, the request is silently ignored. It was suggested
that a warning be issued in such cases.
STATUS: Done in libpng-1.0.1b
libpng.3
浏览文件 @
1d963612
.TH LIBPNG 3 "
April 21
, 1998"
.TH LIBPNG 3 "
May 2
, 1998"
.SH NAME
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
libpng \- Portable Network Graphics (PNG) Reference Library
.SH SYNOPSIS
.SH SYNOPSIS
...
@@ -396,7 +396,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
...
@@ -396,7 +396,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1
a April 21
, 1998
libpng version 1.0.1
b May 2
, 1998
Updated and distributed by Glenn Randers-Pehrson
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
Copyright (c) 1998, Glenn Randers-Pehrson
...
@@ -2372,7 +2372,7 @@ possible without all of you.
...
@@ -2372,7 +2372,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.1
a April 21
, 1998:
Libpng version 1.0.1
b May 2
, 1998:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
Currently maintained by Glenn Randers-Pehrson (randeg@alumni.rpi.edu).
...
...
libpng.txt
浏览文件 @
1d963612
libpng.txt - A description on how to use and modify libpng
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.1
a April 21
, 1998
libpng version 1.0.1
b May 2
, 1998
Updated and distributed by Glenn Randers-Pehrson
Updated and distributed by Glenn Randers-Pehrson
<randeg@alumni.rpi.edu>
<randeg@alumni.rpi.edu>
Copyright (c) 1998, Glenn Randers-Pehrson
Copyright (c) 1998, Glenn Randers-Pehrson
...
...
libpngpf.3
浏览文件 @
1d963612
.TH LIBPNGPF 3 "
April 21
, 1998"
.TH LIBPNGPF 3 "
May 2
, 1998"
.SH NAME
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library
libpng \- Portable Network Graphics (PNG) Reference Library
(private functions)
(private functions)
...
...
png.5
浏览文件 @
1d963612
.TH PNG 5 "
April 21
, 1998"
.TH PNG 5 "
May 2
, 1998"
.SH NAME
.SH NAME
png \- Portable Network Graphics (PNG) format
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
.SH DESCRIPTION
...
...
png.c
浏览文件 @
1d963612
/* png.c - location for general purpose libpng functions
/* png.c - location for general purpose libpng functions
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
#define PNG_INTERNAL
#define PNG_INTERNAL
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
/* Version information for C files. This had better match the version
/* Version information for C files. This had better match the version
* string defined in png.h.
* string defined in png.h.
*/
*/
char
png_libpng_ver
[
12
]
=
"1.0.1
a
"
;
char
png_libpng_ver
[
12
]
=
"1.0.1
b
"
;
/* Place to hold the signature string for a PNG file. */
/* Place to hold the signature string for a PNG file. */
png_byte
FARDATA
png_sig
[
8
]
=
{
137
,
80
,
78
,
71
,
13
,
10
,
26
,
10
};
png_byte
FARDATA
png_sig
[
8
]
=
{
137
,
80
,
78
,
71
,
13
,
10
,
26
,
10
};
...
...
png.h
浏览文件 @
1d963612
/* png.h - header file for PNG reference library
/* png.h - header file for PNG reference library
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson
* Copyright (c) 1998 Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* Note about libpng version numbers:
* Note about libpng version numbers:
*
*
...
@@ -18,30 +18,31 @@
...
@@ -18,30 +18,31 @@
*
*
* source png.h png.h shared-lib
* source png.h png.h shared-lib
* version string int version
* version string int version
* ------- ------ ------ ----------
* ------- ------ ----- ----------
* 0.89c ("1.0 beta 3") 0.89 89 1.0.89
* 0.89c ("1.0 beta 3") 0.89 89 1.0.89
* 0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90]
* 0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90]
* 0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95]
* 0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95]
* 0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96]
* 0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96]
* 0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97]
* 0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97]
* 0.97c 0.97 97 2.0.97
* 0.97c 0.97 97 2.0.97
* 0.98 0.98 98 2.0.98
* 0.98 0.98 98 2.0.98
* 0.99 0.99 98 2.0.99
* 0.99 0.99 98 2.0.99
* 0.99a-m 0.99 99 2.0.99
* 0.99a-m 0.99 99 2.0.99
* 1.00 1.00 100 2.1.0 [int should be 10000]
* 1.00 1.00 100 2.1.0 [int should be 10000]
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
* 1.0.0 1.0.0 100 2.1.0 [int should be 10000]
* 1.0.1 1.0.1 10001 2.1.0
* 1.0.1 1.0.1 10001 2.1.0
* 1.0.1a 1.0.1a 10002 2.1.0
* 1.0.1a 1.0.1a 10002 2.1.0
* 1.0.1b 1.0.1b 10002 2.1.0
*
*
* Henceforth the source version will match the shared-library minor
* Henceforth the source version will match the shared-library minor
* and patch numbers; the shared-library major version number will be
* and patch numbers; the shared-library major version number will be
* used for changes in backward compatibility, as it is intended.
* used for changes in backward compatibility, as it is intended.
The
*
The PNG_PNGLIB_VER macro, which is not used within libpng but
*
PNG_PNGLIB_VER macro, which is not used within libpng but is available
*
is available for applications, is an unsigned integer of the form
*
for applications, is an unsigned integer of the form xyyzz corresponding
*
xyyzz corresponding
to the source version x.y.z (leading zeros in y and z).
* to the source version x.y.z (leading zeros in y and z).
*
*
* See libpng.txt or libpng.3 for more information. The PNG specification
is
* See libpng.txt or libpng.3 for more information. The PNG specification
* 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>
*
*
* Contributing Authors:
* Contributing Authors:
...
@@ -118,7 +119,7 @@ extern "C" {
...
@@ -118,7 +119,7 @@ extern "C" {
*/
*/
/* Version information for png.h - this should match the version in png.c */
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.1
a
"
#define PNG_LIBPNG_VER_STRING "1.0.1
b
"
/* 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.
...
@@ -1443,6 +1444,45 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
...
@@ -1443,6 +1444,45 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#define png_debug2(l, m, p1, p2)
#define png_debug2(l, m, p1, p2)
#endif
/* (PNG_DEBUG > 0) */
#endif
/* (PNG_DEBUG > 0) */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines, we avoid an integer divide, which will be slower on
* many machines. However, it does take more operations than the corresponding
* divide method, so it may be slower on some RISC systems. There are two
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
*
* Note that the rounding factors are NOT supposed to be the same! 128 and
* 32768 are correct for the NODIV code; 127 and 32767 are correct for the
* standard method.
*
* [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
*/
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
# define png_composite(composite, fg, alpha, bg) \
{ png_uint_16 temp = ((png_uint_16)(fg) * (png_uint_16)(alpha) + \
(png_uint_16)(bg)*(png_uint_16)(255 - \
(png_uint_16)(alpha)) + (png_uint_16)128); \
(composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
# define png_composite_16(composite, fg, alpha, bg) \
{ png_uint_32 temp = ((png_uint_32)(fg) * (png_uint_32)(alpha) + \
(png_uint_32)(bg)*(png_uint_32)(65535L - \
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
#else
/* standard method using integer division */
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
# define png_composite(composite, fg, alpha, bg) \
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
(png_uint_16)127) / 255)
# define png_composite_16(composite, fg, alpha, bg) \
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
(png_uint_32)32767) / (png_uint_32)65535L)
#endif
/* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
/* These next functions are used internally in the code. They generally
/* These next functions are used internally in the code. They generally
* shouldn't be used unless you are writing code to add or replace some
* shouldn't be used unless you are writing code to add or replace some
* functionality in libpng. More information about most functions can
* functionality in libpng. More information about most functions can
...
@@ -1525,6 +1565,7 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
...
@@ -1525,6 +1565,7 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#define PNG_FLAG_FREE_HIST 0x4000
#define PNG_FLAG_FREE_HIST 0x4000
#define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000L
#define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000L
#define PNG_FLAG_WROTE_tIME 0x10000L
#define PNG_FLAG_WROTE_tIME 0x10000L
#define PNG_FLAG_BACKGROUND_IS_GRAY 0x20000L
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
PNG_FLAG_CRC_ANCILLARY_NOWARN)
...
...
pngconf.h
浏览文件 @
1d963612
/* pngconf.h - machine configurable file for libpng
/* pngconf.h - machine configurable file for libpng
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
/* Any machine specific code is near the front of this file, so if you
/* Any machine specific code is near the front of this file, so if you
...
...
pngerror.c
浏览文件 @
1d963612
/* pngerror.c - stub functions for i/o and memory allocation
/* pngerror.c - stub functions for i/o and memory allocation
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This file provides a location for all error handling. Users which
* This file provides a location for all error handling. Users which
* need special error handling are expected to write replacement functions
* need special error handling are expected to write replacement functions
...
...
pngget.c
浏览文件 @
1d963612
/* pngget.c - retrieval of values from info struct
/* pngget.c - retrieval of values from info struct
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
#define PNG_INTERNAL
#define PNG_INTERNAL
...
...
pngmem.c
浏览文件 @
1d963612
/* pngmem.c - stub functions for memory allocation
/* pngmem.c - stub functions for memory allocation
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This file provides a location for all memory allocation. Users who
* This file provides a location for all memory allocation. Users who
* need special memory handling are expected to modify the code in this file
* need special memory handling are expected to modify the code in this file
...
...
pngpread.c
浏览文件 @
1d963612
/* pngpread.c - read a png file in push mode
/* pngpread.c - read a png file in push mode
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
#define PNG_INTERNAL
#define PNG_INTERNAL
...
...
pngread.c
浏览文件 @
1d963612
/* pngread.c - read a PNG file
/* pngread.c - read a PNG file
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This file contains routines that an application calls directly to
* This file contains routines that an application calls directly to
* read a PNG file or stream.
* read a PNG file or stream.
...
@@ -279,6 +279,38 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
...
@@ -279,6 +279,38 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
/* save jump buffer and error functions */
/* save jump buffer and error functions */
if
(
!
(
png_ptr
->
flags
&
PNG_FLAG_ROW_INIT
))
if
(
!
(
png_ptr
->
flags
&
PNG_FLAG_ROW_INIT
))
png_read_start_row
(
png_ptr
);
png_read_start_row
(
png_ptr
);
if
(
png_ptr
->
row_number
==
0
&&
png_ptr
->
pass
==
0
)
{
/* check for transforms that have been set but were defined out */
#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_INVERT_MONO
)
png_warning
(
png_ptr
,
"PNG_READ_INVERT_SUPPORTED is not defined."
);
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_FILLER
)
png_warning
(
png_ptr
,
"PNG_READ_FILLER_SUPPORTED is not defined."
);
#endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && !defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
png_warning
(
png_ptr
,
"PNG_READ_PACKSWAP_SUPPORTED is not defined."
);
#endif
#if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACK
)
png_warning
(
png_ptr
,
"PNG_READ_PACK_SUPPORTED is not defined."
);
#endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_SHIFT
)
png_warning
(
png_ptr
,
"PNG_READ_SHIFT_SUPPORTED is not defined."
);
#endif
#if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_BGR
)
png_warning
(
png_ptr
,
"PNG_READ_BGR_SUPPORTED is not defined."
);
#endif
#if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_SWAP_BYTES
)
png_warning
(
png_ptr
,
"PNG_READ_SWAP_SUPPORTED is not defined."
);
#endif
}
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* if interlaced and we do not need a new row, combine row and return */
/* if interlaced and we do not need a new row, combine row and return */
...
@@ -488,25 +520,34 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
...
@@ -488,25 +520,34 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
/* save jump buffer and error functions */
/* save jump buffer and error functions */
rp
=
row
;
rp
=
row
;
dp
=
display_row
;
dp
=
display_row
;
for
(
i
=
0
;
i
<
num_rows
;
i
++
)
if
(
rp
!=
NULL
&&
dp
!=
NULL
)
{
for
(
i
=
0
;
i
<
num_rows
;
i
++
)
png_bytep
rptr
;
{
png_bytep
dptr
;
png_bytep
rptr
=
*
rp
++
;
png_bytep
dptr
=
*
dp
++
;
if
(
rp
!=
NULL
)
rptr
=
*
rp
;
png_read_row
(
png_ptr
,
rptr
,
dptr
);
else
}
rptr
=
NULL
;
else
if
(
dp
!=
NULL
)
for
(
i
=
0
;
i
<
num_rows
;
i
++
)
dptr
=
*
dp
;
{
else
png_bytep
rptr
;
dptr
=
NULL
;
png_bytep
dptr
;
png_read_row
(
png_ptr
,
rptr
,
dptr
);
if
(
row
!=
NULL
)
if
(
rp
!=
NULL
)
rp
++
;
rptr
=
*
rp
;
if
(
display_row
!=
NULL
)
else
dp
++
;
rptr
=
NULL
;
}
if
(
dp
!=
NULL
)
dptr
=
*
dp
;
else
dptr
=
NULL
;
png_read_row
(
png_ptr
,
rptr
,
dptr
);
if
(
row
!=
NULL
)
rp
++
;
if
(
display_row
!=
NULL
)
dp
++
;
}
}
}
/* Read the entire image. If the image has an alpha channel or a tRNS
/* Read the entire image. If the image has an alpha channel or a tRNS
...
@@ -729,8 +770,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
...
@@ -729,8 +770,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
#if defined(PNG_READ_GAMMA_SUPPORTED)
#if defined(PNG_READ_GAMMA_SUPPORTED)
if
(
png_ptr
->
gamma_16_table
!=
NULL
)
if
(
png_ptr
->
gamma_16_table
!=
NULL
)
{
{
int
i
,
istop
;
int
i
;
istop
=
(
1
<<
(
8
-
png_ptr
->
gamma_shift
));
i
nt
i
stop
=
(
1
<<
(
8
-
png_ptr
->
gamma_shift
));
for
(
i
=
0
;
i
<
istop
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_free
(
png_ptr
,
png_ptr
->
gamma_16_table
[
i
]);
png_free
(
png_ptr
,
png_ptr
->
gamma_16_table
[
i
]);
...
@@ -741,8 +782,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
...
@@ -741,8 +782,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free
(
png_ptr
,
png_ptr
->
gamma_16_table
);
png_free
(
png_ptr
,
png_ptr
->
gamma_16_table
);
if
(
png_ptr
->
gamma_16_from_1
!=
NULL
)
if
(
png_ptr
->
gamma_16_from_1
!=
NULL
)
{
{
int
i
,
istop
;
int
i
;
istop
=
(
1
<<
(
8
-
png_ptr
->
gamma_shift
));
i
nt
i
stop
=
(
1
<<
(
8
-
png_ptr
->
gamma_shift
));
for
(
i
=
0
;
i
<
istop
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_free
(
png_ptr
,
png_ptr
->
gamma_16_from_1
[
i
]);
png_free
(
png_ptr
,
png_ptr
->
gamma_16_from_1
[
i
]);
...
@@ -751,8 +792,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
...
@@ -751,8 +792,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free
(
png_ptr
,
png_ptr
->
gamma_16_from_1
);
png_free
(
png_ptr
,
png_ptr
->
gamma_16_from_1
);
if
(
png_ptr
->
gamma_16_to_1
!=
NULL
)
if
(
png_ptr
->
gamma_16_to_1
!=
NULL
)
{
{
int
i
,
istop
;
int
i
;
istop
=
(
1
<<
(
8
-
png_ptr
->
gamma_shift
));
i
nt
i
stop
=
(
1
<<
(
8
-
png_ptr
->
gamma_shift
));
for
(
i
=
0
;
i
<
istop
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_free
(
png_ptr
,
png_ptr
->
gamma_16_to_1
[
i
]);
png_free
(
png_ptr
,
png_ptr
->
gamma_16_to_1
[
i
]);
...
...
pngrio.c
浏览文件 @
1d963612
/* pngrio.c - functions for data input
/* pngrio.c - functions for data input
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This file provides a location for all input. Users which need
* This file provides a location for all input. Users which need
* special handling are expected to write a function which has the same
* special handling are expected to write a function which has the same
...
...
pngrtran.c
浏览文件 @
1d963612
此差异已折叠。
点击以展开。
pngrutil.c
浏览文件 @
1d963612
/* pngrutil.c - utilities to read a PNG file
/* pngrutil.c - utilities to read a PNG file
*
*
*
libpng 1.0.1a
*
1.0.1b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This file contains routines which are only called from within
* This file contains routines which are only called from within
* libpng itself during the course of reading an image.
* libpng itself during the course of reading an image.
...
@@ -20,9 +20,7 @@
...
@@ -20,9 +20,7 @@
png_uint_32
png_uint_32
png_get_uint_32
(
png_bytep
buf
)
png_get_uint_32
(
png_bytep
buf
)
{
{
png_uint_32
i
;
png_uint_32
i
=
((
png_uint_32
)(
*
buf
)
<<
24
)
+
i
=
((
png_uint_32
)(
*
buf
)
<<
24
)
+
((
png_uint_32
)(
*
(
buf
+
1
))
<<
16
)
+
((
png_uint_32
)(
*
(
buf
+
1
))
<<
16
)
+
((
png_uint_32
)(
*
(
buf
+
2
))
<<
8
)
+
((
png_uint_32
)(
*
(
buf
+
2
))
<<
8
)
+
(
png_uint_32
)(
*
(
buf
+
3
));
(
png_uint_32
)(
*
(
buf
+
3
));
...
@@ -37,9 +35,7 @@ png_get_uint_32(png_bytep buf)
...
@@ -37,9 +35,7 @@ png_get_uint_32(png_bytep buf)
png_int_32
png_int_32
png_get_int_32
(
png_bytep
buf
)
png_get_int_32
(
png_bytep
buf
)
{
{
png_int_32
i
;
png_int_32
i
=
((
png_int_32
)(
*
buf
)
<<
24
)
+
i
=
((
png_int_32
)(
*
buf
)
<<
24
)
+
((
png_int_32
)(
*
(
buf
+
1
))
<<
16
)
+
((
png_int_32
)(
*
(
buf
+
1
))
<<
16
)
+
((
png_int_32
)(
*
(
buf
+
2
))
<<
8
)
+
((
png_int_32
)(
*
(
buf
+
2
))
<<
8
)
+
(
png_int_32
)(
*
(
buf
+
3
));
(
png_int_32
)(
*
(
buf
+
3
));
...
@@ -52,9 +48,7 @@ png_get_int_32(png_bytep buf)
...
@@ -52,9 +48,7 @@ png_get_int_32(png_bytep buf)
png_uint_16
png_uint_16
png_get_uint_16
(
png_bytep
buf
)
png_get_uint_16
(
png_bytep
buf
)
{
{
png_uint_16
i
;
png_uint_16
i
=
(
png_uint_16
)(((
png_uint_16
)(
*
buf
)
<<
8
)
+
i
=
(
png_uint_16
)(((
png_uint_16
)(
*
buf
)
<<
8
)
+
(
png_uint_16
)(
*
(
buf
+
1
)));
(
png_uint_16
)(
*
(
buf
+
1
)));
return
(
i
);
return
(
i
);
...
@@ -76,16 +70,16 @@ png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
...
@@ -76,16 +70,16 @@ png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
int
int
png_crc_finish
(
png_structp
png_ptr
,
png_uint_32
skip
)
png_crc_finish
(
png_structp
png_ptr
,
png_uint_32
skip
)
{
{
png_uint_32
i
,
istop
;
png_size_t
i
;
png_size_t
istop
=
png_ptr
->
zbuf_size
;
istop
=
(
png_uint_32
)
png_ptr
->
zbuf_size
;
for
(
i
=
skip
;
i
>
istop
;
i
-=
istop
)
for
(
i
=
skip
;
i
>
istop
;
i
-=
istop
)
{
{
png_crc_read
(
png_ptr
,
png_ptr
->
zbuf
,
png_ptr
->
zbuf_size
);
png_crc_read
(
png_ptr
,
png_ptr
->
zbuf
,
png_ptr
->
zbuf_size
);
}
}
if
(
i
)
if
(
i
)
{
{
png_crc_read
(
png_ptr
,
png_ptr
->
zbuf
,
(
png_size_t
)
i
);
png_crc_read
(
png_ptr
,
png_ptr
->
zbuf
,
i
);
}
}
if
(
png_crc_error
(
png_ptr
))
if
(
png_crc_error
(
png_ptr
))
...
@@ -1500,16 +1494,14 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1500,16 +1494,14 @@ png_combine_row(png_structp png_ptr, png_bytep row,
{
{
case
1
:
case
1
:
{
{
png_bytep
sp
;
png_bytep
sp
=
png_ptr
->
row_buf
+
1
;
png_bytep
dp
;
png_bytep
dp
=
row
;
int
s_inc
,
s_start
,
s_end
;
int
s_inc
,
s_start
,
s_end
;
int
m
;
int
m
=
0x80
;
int
shift
;
int
shift
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
png_ptr
->
width
;
sp
=
png_ptr
->
row_buf
+
1
;
dp
=
row
;
m
=
0x80
;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
{
{
...
@@ -1527,8 +1519,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1527,8 +1519,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
shift
=
s_start
;
shift
=
s_start
;
istop
=
png_ptr
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
m
&
mask
)
if
(
m
&
mask
)
{
{
...
@@ -1557,17 +1548,15 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1557,17 +1548,15 @@ png_combine_row(png_structp png_ptr, png_bytep row,
}
}
case
2
:
case
2
:
{
{
png_bytep
sp
;
png_bytep
sp
=
png_ptr
->
row_buf
+
1
;
png_bytep
dp
;
png_bytep
dp
=
row
;
int
s_start
,
s_end
,
s_inc
;
int
s_start
,
s_end
,
s_inc
;
int
m
;
int
m
=
0x80
;
int
shift
;
int
shift
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
png_ptr
->
width
;
int
value
;
int
value
;
sp
=
png_ptr
->
row_buf
+
1
;
dp
=
row
;
m
=
0x80
;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
{
{
...
@@ -1585,8 +1574,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1585,8 +1574,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
shift
=
s_start
;
shift
=
s_start
;
istop
=
png_ptr
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
m
&
mask
)
if
(
m
&
mask
)
{
{
...
@@ -1612,17 +1600,15 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1612,17 +1600,15 @@ png_combine_row(png_structp png_ptr, png_bytep row,
}
}
case
4
:
case
4
:
{
{
png_bytep
sp
;
png_bytep
sp
=
png_ptr
->
row_buf
+
1
;
png_bytep
dp
;
png_bytep
dp
=
row
;
int
s_start
,
s_end
,
s_inc
;
int
s_start
,
s_end
,
s_inc
;
int
m
;
int
m
=
0x80
;
int
shift
;
int
shift
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
png_ptr
->
width
;
int
value
;
int
value
;
sp
=
png_ptr
->
row_buf
+
1
;
dp
=
row
;
m
=
0x80
;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
{
{
...
@@ -1639,8 +1625,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1639,8 +1625,7 @@ png_combine_row(png_structp png_ptr, png_bytep row,
}
}
shift
=
s_start
;
shift
=
s_start
;
istop
=
png_ptr
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
m
&
mask
)
if
(
m
&
mask
)
{
{
...
@@ -1666,19 +1651,15 @@ png_combine_row(png_structp png_ptr, png_bytep row,
...
@@ -1666,19 +1651,15 @@ png_combine_row(png_structp png_ptr, png_bytep row,
}
}
default:
default:
{
{
png_bytep
sp
;
png_bytep
sp
=
png_ptr
->
row_buf
+
1
;
png_bytep
dp
;
png_bytep
dp
=
row
;
png_size_t
pixel_bytes
;
png_size_t
pixel_bytes
=
(
png_ptr
->
row_info
.
pixel_depth
>>
3
);
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_byte
m
;
png_uint_32
row_width
=
png_ptr
->
width
;
png_byte
m
=
0x80
;
pixel_bytes
=
(
png_ptr
->
row_info
.
pixel_depth
>>
3
);
sp
=
png_ptr
->
row_buf
+
1
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
dp
=
row
;
m
=
0x80
;
istop
=
png_ptr
->
width
;
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
m
&
mask
)
if
(
m
&
mask
)
{
{
...
@@ -1715,15 +1696,15 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1715,15 +1696,15 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
{
case
1
:
case
1
:
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
=
row
+
(
png_size_t
)((
row_info
->
width
-
1
)
>>
3
);
png_bytep
dp
=
row
+
(
png_size_t
)((
final_width
-
1
)
>>
3
);
int
sshift
,
dshift
;
int
sshift
,
dshift
;
int
s_start
,
s_end
,
s_inc
;
int
s_start
,
s_end
,
s_inc
;
int
jstop
=
png_pass_inc
[
pass
];
png_byte
v
;
png_byte
v
;
png_uint_32
i
;
png_uint_32
i
;
int
j
,
jstop
;
int
j
;
sp
=
row
+
(
png_size_t
)((
row_info
->
width
-
1
)
>>
3
);
dp
=
row
+
(
png_size_t
)((
final_width
-
1
)
>>
3
);
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
transformations
&
PNG_PACKSWAP
)
if
(
transformations
&
PNG_PACKSWAP
)
{
{
...
@@ -1743,7 +1724,6 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1743,7 +1724,6 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc
=
1
;
s_inc
=
1
;
}
}
jstop
=
png_pass_inc
[
pass
];
for
(
i
=
row_info
->
width
;
i
;
i
--
)
for
(
i
=
row_info
->
width
;
i
;
i
--
)
{
{
v
=
(
png_byte
)((
*
sp
>>
sshift
)
&
0x1
);
v
=
(
png_byte
)((
*
sp
>>
sshift
)
&
0x1
);
...
@@ -1771,14 +1751,13 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1771,14 +1751,13 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
}
case
2
:
case
2
:
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
=
row
+
(
png_uint_32
)((
row_info
->
width
-
1
)
>>
2
);
png_bytep
dp
=
row
+
(
png_uint_32
)((
final_width
-
1
)
>>
2
);
int
sshift
,
dshift
;
int
sshift
,
dshift
;
int
s_start
,
s_end
,
s_inc
;
int
s_start
,
s_end
,
s_inc
;
int
jstop
=
png_pass_inc
[
pass
];
png_uint_32
i
;
png_uint_32
i
;
int
jstop
;
sp
=
row
+
(
png_uint_32
)((
row_info
->
width
-
1
)
>>
2
);
dp
=
row
+
(
png_uint_32
)((
final_width
-
1
)
>>
2
);
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
transformations
&
PNG_PACKSWAP
)
if
(
transformations
&
PNG_PACKSWAP
)
{
{
...
@@ -1798,7 +1777,6 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1798,7 +1777,6 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc
=
2
;
s_inc
=
2
;
}
}
jstop
=
png_pass_inc
[
pass
];
for
(
i
=
row_info
->
width
;
i
;
i
--
)
for
(
i
=
row_info
->
width
;
i
;
i
--
)
{
{
png_byte
v
;
png_byte
v
;
...
@@ -1829,14 +1807,13 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1829,14 +1807,13 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
}
case
4
:
case
4
:
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
=
row
+
(
png_size_t
)((
row_info
->
width
-
1
)
>>
1
);
png_bytep
dp
=
row
+
(
png_size_t
)((
final_width
-
1
)
>>
1
);
int
sshift
,
dshift
;
int
sshift
,
dshift
;
int
s_start
,
s_end
,
s_inc
;
int
s_start
,
s_end
,
s_inc
;
png_uint_32
i
;
png_uint_32
i
;
int
jstop
;
int
jstop
=
png_pass_inc
[
pass
]
;
sp
=
row
+
(
png_size_t
)((
row_info
->
width
-
1
)
>>
1
);
dp
=
row
+
(
png_size_t
)((
final_width
-
1
)
>>
1
);
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
transformations
&
PNG_PACKSWAP
)
if
(
transformations
&
PNG_PACKSWAP
)
{
{
...
@@ -1856,13 +1833,11 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1856,13 +1833,11 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
s_inc
=
4
;
s_inc
=
4
;
}
}
jstop
=
png_pass_inc
[
pass
];
for
(
i
=
row_info
->
width
;
i
;
i
--
)
for
(
i
=
row_info
->
width
;
i
;
i
--
)
{
{
png_byte
v
;
png_byte
v
=
(
png_byte
)((
*
sp
>>
sshift
)
&
0xf
)
;
int
j
;
int
j
;
v
=
(
png_byte
)((
*
sp
>>
sshift
)
&
0xf
);
for
(
j
=
0
;
j
<
jstop
;
j
++
)
for
(
j
=
0
;
j
<
jstop
;
j
++
)
{
{
*
dp
&=
(
png_byte
)((
0xf0f
>>
(
4
-
dshift
))
&
0xff
);
*
dp
&=
(
png_byte
)((
0xf0f
>>
(
4
-
dshift
))
&
0xff
);
...
@@ -1887,16 +1862,12 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
...
@@ -1887,16 +1862,12 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
}
default:
default:
{
{
png_bytep
sp
,
dp
;
png_size_t
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
png_bytep
sp
=
row
+
(
png_size_t
)(
row_info
->
width
-
1
)
*
pixel_bytes
;
png_bytep
dp
=
row
+
(
png_size_t
)(
final_width
-
1
)
*
pixel_bytes
;
int
jstop
=
png_pass_inc
[
pass
];
png_uint_32
i
;
png_uint_32
i
;
int
jstop
;
png_size_t
pixel_bytes
;
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
sp
=
row
+
(
png_size_t
)(
row_info
->
width
-
1
)
*
pixel_bytes
;
dp
=
row
+
(
png_size_t
)(
final_width
-
1
)
*
pixel_bytes
;
jstop
=
png_pass_inc
[
pass
];
for
(
i
=
row_info
->
width
;
i
;
i
--
)
for
(
i
=
row_info
->
width
;
i
;
i
--
)
{
{
png_byte
v
[
8
];
png_byte
v
[
8
];
...
@@ -1935,95 +1906,87 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
...
@@ -1935,95 +1906,87 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
break
;
break
;
case
PNG_FILTER_VALUE_SUB
:
case
PNG_FILTER_VALUE_SUB
:
{
{
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
bpp
;
png_uint_32
istop
=
row_info
->
rowbytes
;
png_bytep
rp
;
png_uint_32
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
png_bytep
lp
;
png_bytep
rp
=
row
+
bpp
;
png_bytep
lp
=
row
;
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
for
(
i
=
bpp
;
i
<
istop
;
i
++
)
istop
=
row_info
->
rowbytes
;
for
(
i
=
(
png_uint_32
)
bpp
,
rp
=
row
+
bpp
,
lp
=
row
;
i
<
istop
;
i
++
,
rp
++
,
lp
++
)
{
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
lp
))
&
0xff
);
*
rp
++
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
lp
++
))
&
0xff
);
}
}
break
;
break
;
}
}
case
PNG_FILTER_VALUE_UP
:
case
PNG_FILTER_VALUE_UP
:
{
{
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_bytep
rp
;
png_uint_32
istop
=
row_info
->
rowbytes
;
png_bytep
pp
;
png_bytep
rp
=
row
;
png_bytep
pp
=
prev_row
;
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
;
i
<
istop
;
i
++
)
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
)
{
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
))
&
0xff
);
*
rp
++
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
++
))
&
0xff
);
}
}
break
;
break
;
}
}
case
PNG_FILTER_VALUE_AVG
:
case
PNG_FILTER_VALUE_AVG
:
{
{
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
bpp
;
png_bytep
rp
=
row
;
png_bytep
rp
;
png_bytep
pp
=
prev_row
;
png_bytep
pp
;
png_bytep
lp
=
row
;
png_bytep
lp
;
png_uint_32
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
png_uint_32
istop
=
row_info
->
rowbytes
;
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
for
(
i
=
0
;
i
<
bpp
;
i
++
)
istop
=
(
png_uint_32
)
bpp
;
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
)
{
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
*
rp
++
=
(
png_byte
)(((
int
)(
*
rp
)
+
((
int
)(
*
pp
)
/
2
))
&
0xff
);
((
int
)(
*
pp
++
)
/
2
))
&
0xff
);
}
}
istop
=
row_info
->
rowbytes
;
for
(
lp
=
row
;
i
<
istop
;
i
++
)
for
(
lp
=
row
;
i
<
istop
;
i
++
,
rp
++
,
lp
++
,
pp
++
)
{
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
*
rp
++
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
+
*
lp
)
/
2
)
&
0xff
);
(
int
)(
*
pp
++
+
*
lp
++
)
/
2
)
&
0xff
);
}
}
break
;
break
;
}
}
case
PNG_FILTER_VALUE_PAETH
:
case
PNG_FILTER_VALUE_PAETH
:
{
{
int
bpp
;
png_uint_32
i
;
png_uint_32
i
,
istop
;
png_bytep
rp
=
row
;
png_bytep
rp
;
png_bytep
pp
=
prev_row
;
png_bytep
pp
;
png_bytep
lp
=
row
;
png_bytep
lp
;
png_bytep
cp
=
prev_row
;
png_bytep
cp
;
png_uint_32
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
png_uint_32
istop
=
row_info
->
rowbytes
;
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
#ifndef PNG_SLOW_PAETH
for
(
i
=
0
;
i
<
bpp
;
i
++
)
istop
=
bpp
;
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
)
{
{
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
))
&
0xff
);
*
rp
++
=
(
png_byte
)(((
int
)(
*
rp
)
+
(
int
)(
*
pp
++
))
&
0xff
);
}
}
istop
=
row_info
->
rowbytes
;
for
(
;
i
<
istop
;
i
++
)
/* use leftover i,rp,pp */
for
(
lp
=
row
,
cp
=
prev_row
;
i
<
istop
;
/* use leftover i,rp,pp */
i
++
,
rp
++
,
pp
++
,
lp
++
,
cp
++
)
{
{
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
a
=
*
lp
;
a
=
*
lp
++
;
b
=
*
pp
;
b
=
*
pp
++
;
c
=
*
cp
;
c
=
*
cp
++
;
p
=
b
-
c
;
pc
=
a
-
c
;
p
=
a
+
b
-
c
;
#ifdef PNG_USE_ABS
#ifdef PNG_USE_ABS
pa
=
abs
(
p
-
a
);
pa
=
abs
(
p
);
pb
=
abs
(
p
-
b
);
pb
=
abs
(
p
c
);
pc
=
abs
(
p
-
c
);
pc
=
abs
(
p
+
p
c
);
#else
#else
pa
=
p
>
a
?
p
-
a
:
a
-
p
;
pa
=
p
<
0
?
-
p
:
p
;
pb
=
p
>
b
?
p
-
b
:
b
-
p
;
pb
=
p
c
<
0
?
-
pc
:
pc
;
pc
=
p
>
c
?
p
-
c
:
c
-
p
;
pc
=
(
p
+
pc
)
<
0
?
-
(
p
+
pc
)
:
p
+
pc
;
#endif
#endif
/*
/*
...
@@ -2037,40 +2000,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
...
@@ -2037,40 +2000,8 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
p
=
(
pa
<=
pb
&&
pa
<=
pc
)
?
a
:
(
pb
<=
pc
)
?
b
:
c
;
p
=
(
pa
<=
pb
&&
pa
<=
pc
)
?
a
:
(
pb
<=
pc
)
?
b
:
c
;
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
p
)
&
0xff
);
*
rp
++
=
(
png_byte
)(((
int
)(
*
rp
)
+
p
)
&
0xff
);
}
#else
/* PNG_SLOW_PAETH */
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
,
lp
=
row
-
bpp
,
cp
=
prev_row
-
bpp
,
istop
=
row_info
->
rowbytes
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
cp
++
)
{
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
b
=
*
pp
;
if
(
i
>=
(
png_uint_32
)
bpp
)
{
c
=
*
cp
;
a
=
*
lp
;
}
else
{
a
=
c
=
0
;
}
p
=
a
+
b
-
c
;
pa
=
abs
(
p
-
a
);
pb
=
abs
(
p
-
b
);
pc
=
abs
(
p
-
c
);
if
(
pa
<=
pb
&&
pa
<=
pc
)
p
=
a
;
else
if
(
pb
<=
pc
)
p
=
b
;
else
p
=
c
;
*
rp
=
(
png_byte
)(((
int
)(
*
rp
)
+
p
)
&
0xff
);
}
}
#endif
/* PNG_SLOW_PAETH */
break
;
break
;
}
}
default:
default:
...
@@ -2094,11 +2025,10 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
...
@@ -2094,11 +2025,10 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
case
PNG_FILTER_VALUE_SUB
:
case
PNG_FILTER_VALUE_SUB
:
{
{
png_uint_32
i
;
png_uint_32
i
;
int
bpp
;
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
png_bytep
rp
;
png_bytep
rp
;
png_bytep
lp
;
png_bytep
lp
;
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
for
(
i
=
(
png_uint_32
)
bpp
,
rp
=
row
+
bpp
,
lp
=
row
;
for
(
i
=
(
png_uint_32
)
bpp
,
rp
=
row
+
bpp
,
lp
=
row
;
i
<
row_info
->
rowbytes
;
i
++
,
rp
++
,
lp
++
)
i
<
row_info
->
rowbytes
;
i
++
,
rp
++
,
lp
++
)
{
{
...
@@ -2122,12 +2052,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
...
@@ -2122,12 +2052,11 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
case
PNG_FILTER_VALUE_AVG
:
case
PNG_FILTER_VALUE_AVG
:
{
{
png_uint_32
i
;
png_uint_32
i
;
int
bpp
;
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
png_bytep
rp
;
png_bytep
rp
;
png_bytep
pp
;
png_bytep
pp
;
png_bytep
lp
;
png_bytep
lp
;
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
;
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
;
i
<
(
png_uint_32
)
bpp
;
i
++
,
rp
++
,
pp
++
)
i
<
(
png_uint_32
)
bpp
;
i
++
,
rp
++
,
pp
++
)
{
{
...
@@ -2143,14 +2072,13 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
...
@@ -2143,14 +2072,13 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
}
}
case
PNG_FILTER_VALUE_PAETH
:
case
PNG_FILTER_VALUE_PAETH
:
{
{
int
bpp
;
int
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
png_uint_32
i
;
png_uint_32
i
;
png_bytep
rp
;
png_bytep
rp
;
png_bytep
pp
;
png_bytep
pp
;
png_bytep
lp
;
png_bytep
lp
;
png_bytep
cp
;
png_bytep
cp
;
bpp
=
(
row_info
->
pixel_depth
+
7
)
/
8
;
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
,
for
(
i
=
0
,
rp
=
row
,
pp
=
prev_row
,
lp
=
row
-
bpp
,
cp
=
prev_row
-
bpp
;
lp
=
row
-
bpp
,
cp
=
prev_row
-
bpp
;
i
<
row_info
->
rowbytes
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
cp
++
)
i
<
row_info
->
rowbytes
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
cp
++
)
...
...
pngset.c
浏览文件 @
1d963612
/* pngset.c - storage of image information into info struct
/* pngset.c - storage of image information into info struct
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* The functions here are used during reads to store data from the file
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data
* into the info struct, and during writes to store application data
...
...
pngtest.c
浏览文件 @
1d963612
/* pngtest.c - a simple test program to test libpng
/* pngtest.c - a simple test program to test libpng
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This program reads in a PNG image, writes it out again, and then
* This program reads in a PNG image, writes it out again, and then
* compares the two files. If the files are identical, this shows that
* compares the two files. If the files are identical, this shows that
...
...
pngtrans.c
浏览文件 @
1d963612
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
#define PNG_INTERNAL
#define PNG_INTERNAL
...
@@ -142,12 +142,13 @@ png_do_invert(png_row_infop row_info, png_bytep row)
...
@@ -142,12 +142,13 @@ png_do_invert(png_row_infop row_info, png_bytep row)
#endif
#endif
row_info
->
color_type
==
PNG_COLOR_TYPE_GRAY
)
row_info
->
color_type
==
PNG_COLOR_TYPE_GRAY
)
{
{
png_bytep
rp
;
png_bytep
rp
=
row
;
png_uint_32
i
;
png_uint_32
i
;
png_uint_32
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
,
rp
=
row
;
i
<
row_info
->
rowbytes
;
i
++
,
rp
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
*
rp
=
(
png_byte
)(
~
(
*
rp
));
*
rp
++
=
(
png_byte
)(
~
(
*
rp
));
}
}
}
}
}
}
...
@@ -165,12 +166,11 @@ png_do_swap(png_row_infop row_info, png_bytep row)
...
@@ -165,12 +166,11 @@ png_do_swap(png_row_infop row_info, png_bytep row)
#endif
#endif
row_info
->
bit_depth
==
16
)
row_info
->
bit_depth
==
16
)
{
{
png_bytep
rp
;
png_bytep
rp
=
row
;
png_uint_32
i
;
png_uint_32
i
;
png_uint_32
istop
=
row_info
->
width
*
row_info
->
channels
;
for
(
i
=
0
,
rp
=
row
;
for
(
i
=
0
;
i
<
istop
;
i
++
,
rp
+=
2
)
i
<
row_info
->
width
*
row_info
->
channels
;
i
++
,
rp
+=
2
)
{
{
png_byte
t
=
*
rp
;
png_byte
t
=
*
rp
;
*
rp
=
*
(
rp
+
1
);
*
rp
=
*
(
rp
+
1
);
...
@@ -333,7 +333,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -333,7 +333,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
*/
*/
png_bytep
sp
=
row
;
png_bytep
sp
=
row
;
png_bytep
dp
=
row
;
png_bytep
dp
=
row
;
png_uint_32
width
=
row_info
->
width
;
png_uint_32
row_
width
=
row_info
->
width
;
png_uint_32
i
;
png_uint_32
i
;
if
(
row_info
->
channels
==
4
)
if
(
row_info
->
channels
==
4
)
...
@@ -344,7 +344,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -344,7 +344,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
if
(
flags
&
PNG_FLAG_FILLER_AFTER
)
if
(
flags
&
PNG_FLAG_FILLER_AFTER
)
{
{
dp
+=
3
;
sp
+=
4
;
dp
+=
3
;
sp
+=
4
;
for
(
i
=
1
;
i
<
width
;
i
++
)
for
(
i
=
1
;
i
<
row_
width
;
i
++
)
{
{
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
...
@@ -355,7 +355,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -355,7 +355,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
/* This converts from XRGB or ARGB to RGB */
/* This converts from XRGB or ARGB to RGB */
else
else
{
{
for
(
i
=
0
;
i
<
width
;
i
++
)
for
(
i
=
0
;
i
<
row_
width
;
i
++
)
{
{
sp
++
;
sp
++
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
...
@@ -364,7 +364,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -364,7 +364,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
}
}
}
}
row_info
->
pixel_depth
=
24
;
row_info
->
pixel_depth
=
24
;
row_info
->
rowbytes
=
width
*
3
;
row_info
->
rowbytes
=
row_
width
*
3
;
}
}
else
/* if (row_info->bit_depth == 16) */
else
/* if (row_info->bit_depth == 16) */
{
{
...
@@ -372,7 +372,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -372,7 +372,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{
{
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
sp
+=
8
;
dp
+=
6
;
sp
+=
8
;
dp
+=
6
;
for
(
i
=
1
;
i
<
width
;
i
++
)
for
(
i
=
1
;
i
<
row_
width
;
i
++
)
{
{
/* This could be (although memcpy is probably slower):
/* This could be (although memcpy is probably slower):
png_memcpy(dp, sp, 6);
png_memcpy(dp, sp, 6);
...
@@ -391,7 +391,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -391,7 +391,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
else
else
{
{
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
for
(
i
=
0
;
i
<
width
;
i
++
)
for
(
i
=
0
;
i
<
row_
width
;
i
++
)
{
{
/* This could be (although memcpy is probably slower):
/* This could be (although memcpy is probably slower):
png_memcpy(dp, sp, 6);
png_memcpy(dp, sp, 6);
...
@@ -408,7 +408,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -408,7 +408,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
}
}
}
}
row_info
->
pixel_depth
=
48
;
row_info
->
pixel_depth
=
48
;
row_info
->
rowbytes
=
width
*
6
;
row_info
->
rowbytes
=
row_
width
*
6
;
}
}
row_info
->
channels
=
3
;
row_info
->
channels
=
3
;
row_info
->
color_type
&=
~
PNG_COLOR_MASK_ALPHA
;
row_info
->
color_type
&=
~
PNG_COLOR_MASK_ALPHA
;
...
@@ -424,7 +424,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -424,7 +424,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
/* This converts from GX or GA to G */
/* This converts from GX or GA to G */
if
(
flags
&
PNG_FLAG_FILLER_AFTER
)
if
(
flags
&
PNG_FLAG_FILLER_AFTER
)
{
{
for
(
i
=
0
;
i
<
width
;
i
++
)
for
(
i
=
0
;
i
<
row_
width
;
i
++
)
{
{
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
sp
++
;
sp
++
;
...
@@ -433,14 +433,14 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -433,14 +433,14 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
/* This converts from XG or AG to G */
/* This converts from XG or AG to G */
else
else
{
{
for
(
i
=
0
;
i
<
width
;
i
++
)
for
(
i
=
0
;
i
<
row_
width
;
i
++
)
{
{
sp
++
;
sp
++
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
}
}
}
}
row_info
->
pixel_depth
=
8
;
row_info
->
pixel_depth
=
8
;
row_info
->
rowbytes
=
width
;
row_info
->
rowbytes
=
row_
width
;
}
}
else
/* if (row_info->bit_depth == 16) */
else
/* if (row_info->bit_depth == 16) */
{
{
...
@@ -448,7 +448,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -448,7 +448,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{
{
/* This converts from GGXX or GGAA to GG */
/* This converts from GGXX or GGAA to GG */
sp
+=
4
;
dp
+=
2
;
sp
+=
4
;
dp
+=
2
;
for
(
i
=
1
;
i
<
width
;
i
++
)
for
(
i
=
1
;
i
<
row_
width
;
i
++
)
{
{
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
...
@@ -458,7 +458,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -458,7 +458,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
else
else
{
{
/* This converts from XXGG or AAGG to GG */
/* This converts from XXGG or AAGG to GG */
for
(
i
=
0
;
i
<
width
;
i
++
)
for
(
i
=
0
;
i
<
row_
width
;
i
++
)
{
{
sp
+=
2
;
sp
+=
2
;
*
dp
++
=
*
sp
++
;
*
dp
++
=
*
sp
++
;
...
@@ -466,7 +466,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
...
@@ -466,7 +466,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
}
}
}
}
row_info
->
pixel_depth
=
16
;
row_info
->
pixel_depth
=
16
;
row_info
->
rowbytes
=
width
*
2
;
row_info
->
rowbytes
=
row_
width
*
2
;
}
}
row_info
->
channels
=
1
;
row_info
->
channels
=
1
;
row_info
->
color_type
&=
~
PNG_COLOR_MASK_ALPHA
;
row_info
->
color_type
&=
~
PNG_COLOR_MASK_ALPHA
;
...
@@ -487,7 +487,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
...
@@ -487,7 +487,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
#endif
#endif
(
row_info
->
color_type
&
PNG_COLOR_MASK_COLOR
))
(
row_info
->
color_type
&
PNG_COLOR_MASK_COLOR
))
{
{
png_uint_32
width
=
row_info
->
width
;
png_uint_32
row_
width
=
row_info
->
width
;
if
(
row_info
->
bit_depth
==
8
)
if
(
row_info
->
bit_depth
==
8
)
{
{
if
(
row_info
->
color_type
==
PNG_COLOR_TYPE_RGB
)
if
(
row_info
->
color_type
==
PNG_COLOR_TYPE_RGB
)
...
@@ -495,7 +495,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
...
@@ -495,7 +495,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
png_bytep
rp
;
png_bytep
rp
;
png_uint_32
i
;
png_uint_32
i
;
for
(
i
=
0
,
rp
=
row
;
i
<
width
;
i
++
,
rp
+=
3
)
for
(
i
=
0
,
rp
=
row
;
i
<
row_
width
;
i
++
,
rp
+=
3
)
{
{
png_byte
save
=
*
rp
;
png_byte
save
=
*
rp
;
*
rp
=
*
(
rp
+
2
);
*
rp
=
*
(
rp
+
2
);
...
@@ -507,7 +507,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
...
@@ -507,7 +507,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
png_bytep
rp
;
png_bytep
rp
;
png_uint_32
i
;
png_uint_32
i
;
for
(
i
=
0
,
rp
=
row
;
i
<
width
;
i
++
,
rp
+=
4
)
for
(
i
=
0
,
rp
=
row
;
i
<
row_
width
;
i
++
,
rp
+=
4
)
{
{
png_byte
save
=
*
rp
;
png_byte
save
=
*
rp
;
*
rp
=
*
(
rp
+
2
);
*
rp
=
*
(
rp
+
2
);
...
@@ -522,7 +522,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
...
@@ -522,7 +522,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
png_bytep
rp
;
png_bytep
rp
;
png_uint_32
i
;
png_uint_32
i
;
for
(
i
=
0
,
rp
=
row
;
i
<
width
;
i
++
,
rp
+=
6
)
for
(
i
=
0
,
rp
=
row
;
i
<
row_
width
;
i
++
,
rp
+=
6
)
{
{
png_byte
save
=
*
rp
;
png_byte
save
=
*
rp
;
*
rp
=
*
(
rp
+
4
);
*
rp
=
*
(
rp
+
4
);
...
@@ -537,7 +537,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
...
@@ -537,7 +537,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
png_bytep
rp
;
png_bytep
rp
;
png_uint_32
i
;
png_uint_32
i
;
for
(
i
=
0
,
rp
=
row
;
i
<
width
;
i
++
,
rp
+=
8
)
for
(
i
=
0
,
rp
=
row
;
i
<
row_
width
;
i
++
,
rp
+=
8
)
{
{
png_byte
save
=
*
rp
;
png_byte
save
=
*
rp
;
*
rp
=
*
(
rp
+
4
);
*
rp
=
*
(
rp
+
4
);
...
...
pngwio.c
浏览文件 @
1d963612
/* pngwio.c - functions for data output
/* pngwio.c - functions for data output
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*
*
* This file provides a location for all output. Users which need
* This file provides a location for all output. Users which need
* special handling are expected to write functions which have the same
* special handling are expected to write functions which have the same
...
...
pngwrite.c
浏览文件 @
1d963612
/* pngwrite.c - general routines to write a PNG file
/* pngwrite.c - general routines to write a PNG file
*
*
* libpng 1.0.1
a
* libpng 1.0.1
b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
/* get internal access to png.h */
/* get internal access to png.h */
...
@@ -422,6 +422,36 @@ png_write_row(png_structp png_ptr, png_bytep row)
...
@@ -422,6 +422,36 @@ 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
)
{
{
/* check for transforms that have been set but were defined out */
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_INVERT_MONO
)
png_warning
(
png_ptr
,
"PNG_WRITE_INVERT_SUPPORTED is not defined."
);
#endif
#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_FILLER
)
png_warning
(
png_ptr
,
"PNG_WRITE_FILLER_SUPPORTED is not defined."
);
#endif
#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACKSWAP
)
png_warning
(
png_ptr
,
"PNG_WRITE_PACKSWAP_SUPPORTED is not defined."
);
#endif
#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_PACK
)
png_warning
(
png_ptr
,
"PNG_WRITE_PACK_SUPPORTED is not defined."
);
#endif
#if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_SHIFT
)
png_warning
(
png_ptr
,
"PNG_WRITE_SHIFT_SUPPORTED is not defined."
);
#endif
#if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_BGR
)
png_warning
(
png_ptr
,
"PNG_WRITE_BGR_SUPPORTED is not defined."
);
#endif
#if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED)
if
(
png_ptr
->
transformations
&
PNG_SWAP_BYTES
)
png_warning
(
png_ptr
,
"PNG_WRITE_SWAP_SUPPORTED is not defined."
);
#endif
png_write_start_row
(
png_ptr
);
png_write_start_row
(
png_ptr
);
}
}
...
...
pngwtran.c
浏览文件 @
1d963612
/* 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.1a
*
1.0.1b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
#define PNG_INTERNAL
#define PNG_INTERNAL
...
@@ -96,15 +96,15 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
...
@@ -96,15 +96,15 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
int
mask
,
v
;
int
mask
,
v
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
sp
=
row
;
sp
=
row
;
dp
=
row
;
dp
=
row
;
mask
=
0x80
;
mask
=
0x80
;
v
=
0
;
v
=
0
;
istop
=
row_info
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
*
sp
!=
0
)
if
(
*
sp
!=
0
)
v
|=
mask
;
v
|=
mask
;
...
@@ -127,14 +127,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
...
@@ -127,14 +127,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
int
shift
,
v
;
int
shift
,
v
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
sp
=
row
;
sp
=
row
;
dp
=
row
;
dp
=
row
;
shift
=
6
;
shift
=
6
;
v
=
0
;
v
=
0
;
istop
=
row_info
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_byte
value
;
png_byte
value
;
...
@@ -159,14 +159,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
...
@@ -159,14 +159,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
int
shift
,
v
;
int
shift
,
v
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
sp
=
row
;
sp
=
row
;
dp
=
row
;
dp
=
row
;
shift
=
4
;
shift
=
4
;
v
=
0
;
v
=
0
;
istop
=
row_info
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_byte
value
;
png_byte
value
;
...
@@ -218,7 +218,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
...
@@ -218,7 +218,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
row_info
->
color_type
!=
PNG_COLOR_TYPE_PALETTE
)
row_info
->
color_type
!=
PNG_COLOR_TYPE_PALETTE
)
{
{
int
shift_start
[
4
],
shift_dec
[
4
];
int
shift_start
[
4
],
shift_dec
[
4
];
png_uint_32
channels
;
int
channels
;
channels
=
0
;
channels
=
0
;
if
(
row_info
->
color_type
&
PNG_COLOR_MASK_COLOR
)
if
(
row_info
->
color_type
&
PNG_COLOR_MASK_COLOR
)
...
@@ -249,9 +249,10 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
...
@@ -249,9 +249,10 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
/* with low row depths, could only be grayscale, so one channel */
/* with low row depths, could only be grayscale, so one channel */
if
(
row_info
->
bit_depth
<
8
)
if
(
row_info
->
bit_depth
<
8
)
{
{
png_bytep
bp
;
png_bytep
bp
=
row
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_byte
mask
;
png_byte
mask
;
png_uint_32
row_bytes
=
row_info
->
rowbytes
;
if
(
bit_depth
->
gray
==
1
&&
row_info
->
bit_depth
==
2
)
if
(
bit_depth
->
gray
==
1
&&
row_info
->
bit_depth
==
2
)
mask
=
0x55
;
mask
=
0x55
;
...
@@ -260,8 +261,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
...
@@ -260,8 +261,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
else
else
mask
=
0xff
;
mask
=
0xff
;
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
;
i
<
row_bytes
;
i
++
,
bp
++
)
for
(
bp
=
row
,
i
=
0
;
i
<
istop
;
i
++
,
bp
++
)
{
{
png_uint_16
v
;
png_uint_16
v
;
int
j
;
int
j
;
...
@@ -279,13 +279,13 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
...
@@ -279,13 +279,13 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
}
}
else
if
(
row_info
->
bit_depth
==
8
)
else
if
(
row_info
->
bit_depth
==
8
)
{
{
png_bytep
bp
;
png_bytep
bp
=
row
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
;
i
<
row_width
;
i
++
)
for
(
bp
=
row
,
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_uint_32
c
;
int
c
;
for
(
c
=
0
;
c
<
channels
;
c
++
,
bp
++
)
for
(
c
=
0
;
c
<
channels
;
c
++
,
bp
++
)
{
{
...
@@ -307,12 +307,12 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
...
@@ -307,12 +307,12 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
else
else
{
{
png_bytep
bp
;
png_bytep
bp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
bp
=
row
,
i
=
0
;
i
<
row_width
;
i
++
)
for
(
bp
=
row
,
i
=
0
;
i
<
istop
;
i
++
)
{
{
png_uint_32
c
;
int
c
;
for
(
c
=
0
;
c
<
channels
;
c
++
,
bp
+=
2
)
for
(
c
=
0
;
c
<
channels
;
c
++
,
bp
+=
2
)
{
{
...
@@ -352,10 +352,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
...
@@ -352,10 +352,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
if
(
row_info
->
bit_depth
==
8
)
if
(
row_info
->
bit_depth
==
8
)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
png_byte
save
=
*
(
sp
++
);
png_byte
save
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
...
@@ -368,10 +367,10 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
...
@@ -368,10 +367,10 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
else
else
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
png_byte
save
[
2
];
png_byte
save
[
2
];
save
[
0
]
=
*
(
sp
++
);
save
[
0
]
=
*
(
sp
++
);
...
@@ -394,9 +393,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
...
@@ -394,9 +393,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
png_byte
save
=
*
(
sp
++
);
png_byte
save
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
...
@@ -408,9 +407,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
...
@@ -408,9 +407,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
png_byte
save
[
2
];
png_byte
save
[
2
];
save
[
0
]
=
*
(
sp
++
);
save
[
0
]
=
*
(
sp
++
);
...
@@ -441,10 +440,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
...
@@ -441,10 +440,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
if
(
row_info
->
bit_depth
==
8
)
if
(
row_info
->
bit_depth
==
8
)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
...
@@ -456,10 +454,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
...
@@ -456,10 +454,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
else
else
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
...
@@ -478,10 +476,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
...
@@ -478,10 +476,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
if
(
row_info
->
bit_depth
==
8
)
if
(
row_info
->
bit_depth
==
8
)
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
255
-
*
(
sp
++
);
*
(
dp
++
)
=
255
-
*
(
sp
++
);
...
@@ -491,10 +489,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
...
@@ -491,10 +489,10 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
else
else
{
{
png_bytep
sp
,
dp
;
png_bytep
sp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
istop
=
row_info
->
width
;
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
row_width
;
i
++
)
for
(
i
=
0
,
sp
=
dp
=
row
;
i
<
istop
;
i
++
)
{
{
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
*
(
dp
++
)
=
*
(
sp
++
);
...
...
pngwutil.c
浏览文件 @
1d963612
/* pngwutil.c - utilities to write a PNG file
/* pngwutil.c - utilities to write a PNG file
*
*
*
libpng 1.0.1a
*
1.0.1b
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* Copyright (c) 1998, Glenn Randers-Pehrson
*
April 21
, 1998
*
May 2
, 1998
*/
*/
#define PNG_INTERNAL
#define PNG_INTERNAL
...
@@ -1251,13 +1251,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
...
@@ -1251,13 +1251,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
int
shift
;
int
shift
;
int
d
;
int
d
;
int
value
;
int
value
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
dp
=
row
;
dp
=
row
;
d
=
0
;
d
=
0
;
shift
=
7
;
shift
=
7
;
istop
=
row_info
->
width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
row_width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
istop
;
i
+=
png_pass_inc
[
pass
])
i
+=
png_pass_inc
[
pass
])
{
{
sp
=
row
+
(
png_size_t
)(
i
>>
3
);
sp
=
row
+
(
png_size_t
)(
i
>>
3
);
...
@@ -1285,13 +1285,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
...
@@ -1285,13 +1285,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
int
shift
;
int
shift
;
int
d
;
int
d
;
int
value
;
int
value
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
dp
=
row
;
dp
=
row
;
shift
=
6
;
shift
=
6
;
d
=
0
;
d
=
0
;
istop
=
row_info
->
width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
row_width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
istop
;
i
+=
png_pass_inc
[
pass
])
i
+=
png_pass_inc
[
pass
])
{
{
sp
=
row
+
(
png_size_t
)(
i
>>
2
);
sp
=
row
+
(
png_size_t
)(
i
>>
2
);
...
@@ -1318,13 +1318,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
...
@@ -1318,13 +1318,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
int
shift
;
int
shift
;
int
d
;
int
d
;
int
value
;
int
value
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
dp
=
row
;
dp
=
row
;
shift
=
4
;
shift
=
4
;
d
=
0
;
d
=
0
;
istop
=
row_info
->
width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
row_width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
istop
;
i
+=
png_pass_inc
[
pass
])
i
+=
png_pass_inc
[
pass
])
{
{
sp
=
row
+
(
png_size_t
)(
i
>>
1
);
sp
=
row
+
(
png_size_t
)(
i
>>
1
);
...
@@ -1348,7 +1348,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
...
@@ -1348,7 +1348,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
{
{
png_bytep
sp
;
png_bytep
sp
;
png_bytep
dp
;
png_bytep
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
png_uint_32
row_width
=
row_info
->
width
;
png_size_t
pixel_bytes
;
png_size_t
pixel_bytes
;
/* start at the beginning */
/* start at the beginning */
...
@@ -1357,8 +1358,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
...
@@ -1357,8 +1358,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
/* loop through the row, only looking at the pixels that
/* loop through the row, only looking at the pixels that
matter */
matter */
istop
=
row_info
->
width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
row_width
;
for
(
i
=
png_pass_start
[
pass
];
i
<
istop
;
i
+=
png_pass_inc
[
pass
])
i
+=
png_pass_inc
[
pass
])
{
{
/* find out where the original pixel is */
/* find out where the original pixel is */
...
@@ -1397,6 +1397,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1397,6 +1397,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_bytep
prev_row
,
best_row
,
row_buf
;
png_bytep
prev_row
,
best_row
,
row_buf
;
png_uint_32
mins
,
bpp
;
png_uint_32
mins
,
bpp
;
png_byte
filter_to_do
=
png_ptr
->
do_filter
;
png_byte
filter_to_do
=
png_ptr
->
do_filter
;
png_uint_32
row_bytes
=
row_info
->
rowbytes
;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
int
num_p_filters
=
(
int
)
png_ptr
->
num_prev_filters
;
#endif
png_debug
(
1
,
"in png_write_find_filter
\n
"
);
png_debug
(
1
,
"in png_write_find_filter
\n
"
);
/* find out how many bytes offset each pixel is */
/* find out how many bytes offset each pixel is */
...
@@ -1427,11 +1431,11 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1427,11 +1431,11 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
{
png_bytep
rp
;
png_bytep
rp
;
png_uint_32
sum
=
0
;
png_uint_32
sum
=
0
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
j
;
int
v
;
int
v
;
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
,
rp
=
row_buf
+
1
;
i
<
row_bytes
;
i
++
,
rp
++
)
for
(
i
=
0
,
rp
=
row_buf
+
1
;
i
<
istop
;
i
++
,
rp
++
)
{
{
v
=
*
rp
;
v
=
*
rp
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
...
@@ -1445,14 +1449,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1445,14 +1449,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
/* Gives us some footroom */
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
/* Gives us some footroom */
/* Reduce the sum if we match any of the previous rows */
/* Reduce the sum if we match any of the previous rows */
istop
=
(
png_uint_32
)
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_NONE
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_NONE
)
{
{
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
i
])
>>
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
i
])
>>
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1480,14 +1483,14 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1480,14 +1483,14 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
/* it's the only filter so no testing is needed */
/* it's the only filter so no testing is needed */
{
{
png_bytep
rp
,
lp
,
dp
;
png_bytep
rp
,
lp
,
dp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
j
;
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
sub_row
+
1
;
i
<
bpp
;
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
sub_row
+
1
;
i
<
bpp
;
i
++
,
rp
++
,
dp
++
)
i
++
,
rp
++
,
dp
++
)
{
{
*
dp
=
*
rp
;
*
dp
=
*
rp
;
}
}
istop
=
row_info
->
rowbytes
;
for
(
lp
=
row_buf
+
1
;
i
<
row_bytes
;
for
(
lp
=
row_buf
+
1
;
i
<
istop
;
i
++
,
rp
++
,
lp
++
,
dp
++
)
i
++
,
rp
++
,
lp
++
,
dp
++
)
{
{
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
lp
)
&
0xff
);
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
lp
)
&
0xff
);
...
@@ -1499,7 +1502,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1499,7 +1502,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
{
png_bytep
rp
,
dp
,
lp
;
png_bytep
rp
,
dp
,
lp
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
j
;
int
v
;
int
v
;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
...
@@ -1513,14 +1517,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1513,14 +1517,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
lmlo
=
lmins
&
PNG_LOMASK
;
lmlo
=
lmins
&
PNG_LOMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
(
png_uint_32
)
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_SUB
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_SUB
)
{
{
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1562,14 +1565,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1562,14 +1565,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sumlo
=
sum
&
PNG_LOMASK
;
sumlo
=
sum
&
PNG_LOMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
(
png_uint_32
)
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_SUB
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_SUB
)
{
{
sumlo
=
(
sumlo
*
png_ptr
->
inv_filter_weights
[
i
])
>>
sumlo
=
(
sumlo
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
sumhi
=
(
sumhi
*
png_ptr
->
inv_filter_weights
[
i
])
>>
sumhi
=
(
sumhi
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1597,11 +1599,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1597,11 +1599,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
if
(
filter_to_do
==
PNG_FILTER_UP
)
if
(
filter_to_do
==
PNG_FILTER_UP
)
{
{
png_bytep
rp
,
dp
,
pp
;
png_bytep
rp
,
dp
,
pp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
up_row
+
1
,
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
up_row
+
1
,
pp
=
prev_row
+
1
;
i
<
istop
;
pp
=
prev_row
+
1
;
i
<
row_bytes
;
i
++
,
rp
++
,
pp
++
,
dp
++
)
i
++
,
rp
++
,
pp
++
,
dp
++
)
{
{
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
pp
)
&
0xff
);
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
pp
)
&
0xff
);
...
@@ -1613,7 +1614,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1613,7 +1614,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
{
png_bytep
rp
,
dp
,
pp
;
png_bytep
rp
,
dp
,
pp
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
j
;
int
v
;
int
v
;
...
@@ -1624,14 +1626,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1624,14 +1626,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
lmlo
=
lmins
&
PNG_LOMASK
;
lmlo
=
lmins
&
PNG_LOMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
(
png_uint_32
)
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_UP
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_UP
)
{
{
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1648,12 +1649,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1648,12 +1649,10 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
}
}
#endif
#endif
istop
=
row_info
->
rowbytes
;
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
up_row
+
1
,
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
up_row
+
1
,
pp
=
prev_row
+
1
;
i
<
istop
;
pp
=
prev_row
+
1
;
i
<
row_bytes
;
i
++
)
i
++
,
rp
++
,
pp
++
,
dp
++
)
{
{
v
=
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
pp
)
&
0xff
);
v
=
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
(
int
)
*
pp
++
)
&
0xff
);
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
...
@@ -1668,14 +1667,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1668,14 +1667,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sumlo
=
sum
&
PNG_LOMASK
;
sumlo
=
sum
&
PNG_LOMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
(
png_uint_32
)
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_UP
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_UP
)
{
{
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
i
])
>>
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
i
])
>>
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1703,16 +1701,16 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1703,16 +1701,16 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
if
(
filter_to_do
==
PNG_FILTER_AVG
)
if
(
filter_to_do
==
PNG_FILTER_AVG
)
{
{
png_bytep
rp
,
dp
,
pp
,
lp
;
png_bytep
rp
,
dp
,
pp
,
lp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
avg_row
+
1
,
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
avg_row
+
1
,
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
,
rp
++
,
pp
++
,
dp
++
)
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
)
{
{
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
((
int
)
*
pp
/
2
))
&
0xff
);
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
((
int
)
*
pp
++
/
2
))
&
0xff
);
}
}
istop
=
row_info
->
rowbytes
;
for
(
lp
=
row_buf
+
1
;
i
<
row_bytes
;
i
++
)
for
(
lp
=
row_buf
+
1
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
dp
++
)
{
{
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(((
int
)
*
pp
+
(
int
)
*
lp
)
/
2
))
&
0xff
);
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
(((
int
)
*
pp
++
+
(
int
)
*
lp
++
)
/
2
))
&
0xff
);
}
}
best_row
=
png_ptr
->
avg_row
;
best_row
=
png_ptr
->
avg_row
;
}
}
...
@@ -1721,7 +1719,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1721,7 +1719,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
{
png_bytep
rp
,
dp
,
pp
,
lp
;
png_bytep
rp
,
dp
,
pp
,
lp
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
j
;
int
v
;
int
v
;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
...
@@ -1731,14 +1730,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1731,14 +1730,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
lmlo
=
lmins
&
PNG_LOMASK
;
lmlo
=
lmins
&
PNG_LOMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
(
png_uint_32
)
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_AVG
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_AVG
)
{
{
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1756,16 +1754,16 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1756,16 +1754,16 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#endif
#endif
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
avg_row
+
1
,
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
avg_row
+
1
,
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
,
rp
++
,
pp
++
,
dp
++
)
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
)
{
{
v
=
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
((
int
)
*
pp
/
2
))
&
0xff
);
v
=
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
((
int
)
*
pp
++
/
2
))
&
0xff
);
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
}
}
istop
=
row_info
->
rowbytes
;
for
(
lp
=
row_buf
+
1
;
i
<
row_bytes
;
i
++
)
for
(
lp
=
row_buf
+
1
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
dp
++
)
{
{
v
=
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(((
int
)
*
pp
+
(
int
)
*
lp
)
/
2
))
&
0xff
);
v
=
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
(((
int
)
*
pp
++
+
(
int
)
*
lp
++
)
/
2
))
&
0xff
);
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
...
@@ -1780,14 +1778,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1780,14 +1778,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sumlo
=
sum
&
PNG_LOMASK
;
sumlo
=
sum
&
PNG_LOMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_NONE
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_NONE
)
{
{
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
i
])
>>
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
i
])
>>
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1815,38 +1812,37 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1815,38 +1812,37 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
if
(
filter_to_do
==
PNG_FILTER_PAETH
)
if
(
filter_to_do
==
PNG_FILTER_PAETH
)
{
{
png_bytep
rp
,
dp
,
pp
,
cp
,
lp
;
png_bytep
rp
,
dp
,
pp
,
cp
,
lp
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
paeth_row
+
1
,
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
paeth_row
+
1
,
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
,
rp
++
,
pp
++
,
dp
++
)
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
)
{
{
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
pp
)
&
0xff
);
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
(
int
)
*
pp
++
)
&
0xff
);
}
}
istop
=
row_info
->
rowbytes
;
for
(
lp
=
row_buf
+
1
,
cp
=
prev_row
+
1
;
i
<
row_bytes
;
i
++
)
for
(
lp
=
row_buf
+
1
,
cp
=
prev_row
+
1
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
dp
++
,
cp
++
)
{
{
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
b
=
*
pp
;
b
=
*
pp
++
;
c
=
*
cp
;
c
=
*
cp
++
;
a
=
*
lp
;
a
=
*
lp
++
;
p
=
a
+
b
-
c
;
p
=
b
-
c
;
pc
=
a
-
c
;
#ifdef PNG_USE_ABS
#ifdef PNG_USE_ABS
pa
=
abs
(
p
-
a
);
pa
=
abs
(
p
);
pb
=
abs
(
p
-
b
);
pb
=
abs
(
p
c
);
pc
=
abs
(
p
-
c
);
pc
=
abs
(
p
+
p
c
);
#else
#else
pa
=
p
>
a
?
p
-
a
:
a
-
p
;
pa
=
p
<
0
?
-
p
:
p
;
pb
=
p
>
b
?
p
-
b
:
b
-
p
;
pb
=
p
c
<
0
?
-
pc
:
pc
;
pc
=
p
>
c
?
p
-
c
:
c
-
p
;
pc
=
(
p
+
pc
)
<
0
?
-
(
p
+
pc
)
:
p
+
pc
;
#endif
#endif
p
=
(
pa
<=
pb
&&
pa
<=
pc
)
?
a
:
(
pb
<=
pc
)
?
b
:
c
;
p
=
(
pa
<=
pb
&&
pa
<=
pc
)
?
a
:
(
pb
<=
pc
)
?
b
:
c
;
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
p
)
&
0xff
);
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
p
)
&
0xff
);
}
}
best_row
=
png_ptr
->
paeth_row
;
best_row
=
png_ptr
->
paeth_row
;
}
}
...
@@ -1855,7 +1851,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1855,7 +1851,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
{
png_bytep
rp
,
dp
,
pp
,
cp
,
lp
;
png_bytep
rp
,
dp
,
pp
,
cp
,
lp
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
sum
=
0
,
lmins
=
mins
;
png_uint_32
i
,
istop
;
png_uint_32
i
;
int
j
;
int
v
;
int
v
;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
...
@@ -1865,14 +1862,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1865,14 +1862,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
lmlo
=
lmins
&
PNG_LOMASK
;
lmlo
=
lmins
&
PNG_LOMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
lmhi
=
(
lmins
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_PAETH
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_PAETH
)
{
{
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmlo
=
(
lmlo
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
i
])
>>
lmhi
=
(
lmhi
*
png_ptr
->
inv_filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1890,38 +1886,36 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1890,38 +1886,36 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
#endif
#endif
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
paeth_row
+
1
,
for
(
i
=
0
,
rp
=
row_buf
+
1
,
dp
=
png_ptr
->
paeth_row
+
1
,
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
,
rp
++
,
pp
++
,
dp
++
)
pp
=
prev_row
+
1
;
i
<
bpp
;
i
++
)
{
{
v
=
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
(
int
)
*
pp
)
&
0xff
);
v
=
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
(
int
)
*
pp
++
)
&
0xff
);
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
}
}
istop
=
row_info
->
rowbytes
;
for
(
lp
=
row_buf
+
1
,
cp
=
prev_row
+
1
;
i
<
row_bytes
;
i
++
)
for
(
lp
=
row_buf
+
1
,
cp
=
prev_row
+
1
;
i
<
istop
;
i
++
,
rp
++
,
pp
++
,
lp
++
,
dp
++
,
cp
++
)
{
{
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
int
a
,
b
,
c
,
pa
,
pb
,
pc
,
p
;
b
=
*
pp
;
b
=
*
pp
++
;
c
=
*
cp
;
c
=
*
cp
++
;
a
=
*
lp
;
a
=
*
lp
++
;
p
=
a
+
b
-
c
;
#ifndef PNG_SLOW_PAETH
#ifndef PNG_SLOW_PAETH
p
=
b
-
c
;
pc
=
a
-
c
;
#ifdef PNG_USE_ABS
#ifdef PNG_USE_ABS
pa
=
abs
(
p
-
a
);
pa
=
abs
(
p
);
pb
=
abs
(
p
-
b
);
pb
=
abs
(
p
c
);
pc
=
abs
(
p
-
c
);
pc
=
abs
(
p
+
p
c
);
#else
#else
pa
=
p
>
a
?
p
-
a
:
a
-
p
;
pa
=
p
<
0
?
-
p
:
p
;
pb
=
p
>
b
?
p
-
b
:
b
-
p
;
pb
=
p
c
<
0
?
-
pc
:
pc
;
pc
=
p
>
c
?
p
-
c
:
c
-
p
;
pc
=
(
p
+
pc
)
<
0
?
-
(
p
+
pc
)
:
p
+
pc
;
#endif
#endif
p
=
(
pa
<=
pb
&&
pa
<=
pc
)
?
a
:
(
pb
<=
pc
)
?
b
:
c
;
p
=
(
pa
<=
pb
&&
pa
<=
pc
)
?
a
:
(
pb
<=
pc
)
?
b
:
c
;
#else
/* PNG_SLOW_PAETH */
#else
/* PNG_SLOW_PAETH */
p
=
a
+
b
-
c
;
pa
=
abs
(
p
-
a
);
pa
=
abs
(
p
-
a
);
pb
=
abs
(
p
-
b
);
pb
=
abs
(
p
-
b
);
pc
=
abs
(
p
-
c
);
pc
=
abs
(
p
-
c
);
...
@@ -1933,7 +1927,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1933,7 +1927,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
p
=
c
;
p
=
c
;
#endif
/* PNG_SLOW_PAETH */
#endif
/* PNG_SLOW_PAETH */
v
=
*
dp
=
(
png_byte
)(((
int
)
*
rp
-
p
)
&
0xff
);
v
=
*
dp
++
=
(
png_byte
)(((
int
)
*
rp
++
-
p
)
&
0xff
);
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
sum
+=
(
v
<
128
)
?
v
:
256
-
v
;
...
@@ -1948,14 +1942,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1948,14 +1942,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sumlo
=
sum
&
PNG_LOMASK
;
sumlo
=
sum
&
PNG_LOMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
sumhi
=
(
sum
>>
PNG_HISHIFT
)
&
PNG_HIMASK
;
istop
=
png_ptr
->
num_prev_filters
;
for
(
j
=
0
;
j
<
num_p_filters
;
j
++
)
for
(
i
=
0
;
i
<
istop
;
i
++
)
{
{
if
(
png_ptr
->
prev_filters
[
i
]
==
PNG_FILTER_VALUE_PAETH
)
if
(
png_ptr
->
prev_filters
[
j
]
==
PNG_FILTER_VALUE_PAETH
)
{
{
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
i
])
>>
sumlo
=
(
sumlo
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
i
])
>>
sumhi
=
(
sumhi
*
png_ptr
->
filter_weights
[
j
])
>>
PNG_WEIGHT_SHIFT
;
PNG_WEIGHT_SHIFT
;
}
}
}
}
...
@@ -1986,14 +1979,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
...
@@ -1986,14 +1979,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
/* Save the type of filter we picked this time for future calculations */
/* Save the type of filter we picked this time for future calculations */
if
(
png_ptr
->
num_prev_filters
>
0
)
if
(
png_ptr
->
num_prev_filters
>
0
)
{
{
int
i
,
istop
;
int
j
;
for
(
j
=
1
;
j
<
num_p_filters
;
j
++
)
istop
=
(
int
)
png_ptr
->
num_prev_filters
;
for
(
i
=
1
;
i
<
istop
;
i
++
)
{
{
png_ptr
->
prev_filters
[
i
]
=
png_ptr
->
prev_filters
[
i
-
1
];
png_ptr
->
prev_filters
[
j
]
=
png_ptr
->
prev_filters
[
j
-
1
];
}
}
png_ptr
->
prev_filters
[
i
]
=
best_row
[
0
];
png_ptr
->
prev_filters
[
j
]
=
best_row
[
0
];
}
}
#endif
#endif
}
}
...
...
scripts/makefile.lnx
浏览文件 @
1d963612
...
@@ -20,7 +20,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
...
@@ -20,7 +20,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wstrict-prototypes
-Wmissing-prototypes
#-Wconversion
-Wstrict-prototypes
-Wmissing-prototypes
#-Wconversion
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)
-lpng
-lz
-lm
RANLIB
=
ranlib
RANLIB
=
ranlib
...
@@ -29,7 +29,7 @@ RANLIB=ranlib
...
@@ -29,7 +29,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.1
a
PNGMIN
=
1.0.1
b
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
# where make install puts libpng.a, libpng.so*, and png.h
...
...
scripts/makefile.s2x
浏览文件 @
1d963612
...
@@ -29,7 +29,7 @@ RANLIB=echo
...
@@ -29,7 +29,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.1
a
PNGMIN
=
1.0.1
b
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
# where make install puts libpng.a, libpng.so*, and png.h
...
...
scripts/makefile.sco
0 → 100644
浏览文件 @
1d963612
# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
# Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1998 Greg Roelofs
# For conditions of distribution and use, see copyright notice in png.h
CC
=
cc
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB
=
../zlib
ZLIBINC
=
../zlib
CFLAGS
=
-dy
-belf
-I
$(ZLIBINC)
-O3
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
#RANLIB=ranlib
RANLIB
=
echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ
=
2
PNGMIN
=
1.0.1b
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h
prefix
=
/usr/local
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 libpng.so pngtest
libpng.a
:
$(OBJS)
ar rc
$@
$(OBJS)
$(RANLIB)
$@
libpng.so
:
libpng.so.$(PNGMAJ)
ln
-sf
libpng.so.
$(PNGMAJ)
libpng.so
libpng.so.$(PNGMAJ)
:
libpng.so.$(PNGVER)
ln
-sf
libpng.so.
$(PNGVER)
libpng.so.
$(PNGMAJ)
libpng.so.$(PNGVER)
:
$(OBJSDLL)
$(CC)
-G
-Wl
,-h,libpng.so.
$(PNGMAJ)
-o
libpng.so.
$(PNGVER)
\
$(OBJSDLL)
pngtest
:
pngtest.o libpng.so
LD_RUN_PATH
=
.:
$(ZLIBLIB)
$(CC)
-o
pngtest
$(CFLAGS)
pngtest.o
$(LDFLAGS)
test
:
pngtest
./pngtest
install
:
libpng.a libpng.so.$(PNGVER)
-
@mkdir
$(INCPATH)
$(LIBPATH)
cp
png.h pngconf.h
$(INCPATH)
chmod
644
$(INCPATH)
/png.h
$(INCPATH)
/pngconf.h
cp
libpng.a libpng.so.
$(PNGVER)
$(LIBPATH)
chmod
755
$(LIBPATH)
/libpng.so.
$(PNGVER)
-
@/bin/rm
-f
$(LIBPATH)
/libpng.so.
$(PNGMAJ)
$(LIBPATH)
/libpng.so
(
cd
$(LIBPATH)
;
ln
-sf
libpng.so.
$(PNGVER)
libpng.so.
$(PNGMAJ)
;
\
ln
-sf
libpng.so.
$(PNGMAJ)
libpng.so
)
clean
:
/bin/rm
-f
*
.o libpng.a libpng.so
*
pngtest pngout.png
# 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
scripts/makefile.sgi
浏览文件 @
1d963612
...
@@ -11,7 +11,7 @@ ZLIBINC=../zlib
...
@@ -11,7 +11,7 @@ ZLIBINC=../zlib
CC
=
cc
CC
=
cc
WARNMORE
=
-fullwarn
WARNMORE
=
-fullwarn
CFLAGS
=
-I
$(ZLIBINC)
-O
#
$(WARNMORE)
-g
-DPNG_DEBUG
=
5
CFLAGS
=
-I
$(ZLIBINC)
-O
$(WARNMORE)
#
-g -DPNG_DEBUG=5
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
RANLIB
=
echo
RANLIB
=
echo
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录