summaryrefslogtreecommitdiff
path: root/package/libpng
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-01-04 22:21:30 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2014-01-04 22:21:30 +0100
commitbb9efd268326393ca769c38e6385216569e70e52 (patch)
treee3871fe2dcc5134c94d7ebd14c424beb59efa6a6 /package/libpng
parent9df044766604b62242545c325ad2cdb31848057a (diff)
update firefox and dependencies
Diffstat (limited to 'package/libpng')
-rw-r--r--package/libpng/Makefile6
-rw-r--r--package/libpng/patches/libpng-1.6.8-apng.patch (renamed from package/libpng/patches/libpng-1.5.15-apng.patch)612
2 files changed, 321 insertions, 297 deletions
diff --git a/package/libpng/Makefile b/package/libpng/Makefile
index 1d43a4998..ea4c3a1f8 100644
--- a/package/libpng/Makefile
+++ b/package/libpng/Makefile
@@ -4,9 +4,9 @@
include ${TOPDIR}/rules.mk
PKG_NAME:= libpng
-PKG_VERSION:= 1.5.15
-PKG_RELEASE:= 2
-PKG_MD5SUM:= ea24254980fd820964a710e4d2a947c7
+PKG_VERSION:= 1.6.8
+PKG_RELEASE:= 1
+PKG_MD5SUM:= 29b7065906e2551508a0d7eacd19174e
PKG_DESCR:= A library for reading/writing PNG images
PKG_SECTION:= libs
PKG_DEPENDS:= zlib
diff --git a/package/libpng/patches/libpng-1.5.15-apng.patch b/package/libpng/patches/libpng-1.6.8-apng.patch
index b169303e9..02cf32620 100644
--- a/package/libpng/patches/libpng-1.5.15-apng.patch
+++ b/package/libpng/patches/libpng-1.6.8-apng.patch
@@ -1,7 +1,7 @@
-diff -Naru libpng-1.5.15.org/png.h libpng-1.5.15/png.h
---- libpng-1.5.15.org/png.h 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/png.h 2013-04-02 20:39:30.000000000 +0900
-@@ -448,6 +448,10 @@
+diff -Naru libpng-1.6.8.org/png.h libpng-1.6.8/png.h
+--- libpng-1.6.8.org/png.h 2013-12-22 17:03:17.220988502 +0900
++++ libpng-1.6.8/png.h 2013-12-22 17:03:17.287990651 +0900
+@@ -451,6 +451,10 @@
# include "pnglibconf.h"
#endif
@@ -10,9 +10,9 @@ diff -Naru libpng-1.5.15.org/png.h libpng-1.5.15/png.h
+#define PNG_WRITE_APNG_SUPPORTED
+
#ifndef PNG_VERSION_INFO_ONLY
- # ifndef PNG_BUILDING_SYMBOL_TABLE
- /*
-@@ -555,6 +559,17 @@
+ /* Machine specific configuration. */
+ # include "pngconf.h"
+@@ -541,6 +545,17 @@
* See pngconf.h for base types that vary by machine/system
*/
@@ -30,7 +30,7 @@ diff -Naru libpng-1.5.15.org/png.h libpng-1.5.15/png.h
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-@@ -838,6 +853,10 @@
+@@ -861,6 +876,10 @@
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
@@ -41,7 +41,7 @@ diff -Naru libpng-1.5.15.org/png.h libpng-1.5.15/png.h
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
-@@ -883,6 +902,10 @@
+@@ -898,6 +917,10 @@
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
@@ -52,97 +52,97 @@ diff -Naru libpng-1.5.15.org/png.h libpng-1.5.15/png.h
/* The following callback receives png_uint_32 row_number, int pass for the
* png_bytep data of the row. When transforming an interlaced image the
-@@ -2702,6 +2725,74 @@
+@@ -3300,6 +3323,74 @@
/*******************************************************************************
* END OF HARDWARE OPTIONS
******************************************************************************/
+#ifdef PNG_APNG_SUPPORTED
-+PNG_EXPORT(237, png_uint_32, png_get_acTL, (png_structp png_ptr,
++PNG_EXPORT(245, png_uint_32, png_get_acTL, (png_structp png_ptr,
+ png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
+
-+PNG_EXPORT(238, png_uint_32, png_set_acTL, (png_structp png_ptr,
++PNG_EXPORT(246, png_uint_32, png_set_acTL, (png_structp png_ptr,
+ png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
+
-+PNG_EXPORT(239, png_uint_32, png_get_num_frames, (png_structp png_ptr,
++PNG_EXPORT(247, png_uint_32, png_get_num_frames, (png_structp png_ptr,
+ png_infop info_ptr));
+
-+PNG_EXPORT(240, png_uint_32, png_get_num_plays, (png_structp png_ptr,
++PNG_EXPORT(248, png_uint_32, png_get_num_plays, (png_structp png_ptr,
+ png_infop info_ptr));
+
-+PNG_EXPORT(241, png_uint_32, png_get_next_frame_fcTL,
++PNG_EXPORT(249, png_uint_32, png_get_next_frame_fcTL,
+ (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
+ png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
+ png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
+ png_byte *blend_op));
+
-+PNG_EXPORT(242, png_uint_32, png_set_next_frame_fcTL,
++PNG_EXPORT(250, png_uint_32, png_set_next_frame_fcTL,
+ (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
+ png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
+ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
+ png_byte blend_op));
+
-+PNG_EXPORT(243, png_uint_32, png_get_next_frame_width,
++PNG_EXPORT(251, png_uint_32, png_get_next_frame_width,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(244, png_uint_32, png_get_next_frame_height,
++PNG_EXPORT(252, png_uint_32, png_get_next_frame_height,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(245, png_uint_32, png_get_next_frame_x_offset,
++PNG_EXPORT(253, png_uint_32, png_get_next_frame_x_offset,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(246, png_uint_32, png_get_next_frame_y_offset,
++PNG_EXPORT(254, png_uint_32, png_get_next_frame_y_offset,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(247, png_uint_16, png_get_next_frame_delay_num,
++PNG_EXPORT(255, png_uint_16, png_get_next_frame_delay_num,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(248, png_uint_16, png_get_next_frame_delay_den,
++PNG_EXPORT(256, png_uint_16, png_get_next_frame_delay_den,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(249, png_byte, png_get_next_frame_dispose_op,
++PNG_EXPORT(257, png_byte, png_get_next_frame_dispose_op,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(250, png_byte, png_get_next_frame_blend_op,
++PNG_EXPORT(258, png_byte, png_get_next_frame_blend_op,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(251, png_byte, png_get_first_frame_is_hidden,
++PNG_EXPORT(259, png_byte, png_get_first_frame_is_hidden,
+ (png_structp png_ptr, png_infop info_ptr));
-+PNG_EXPORT(252, png_uint_32, png_set_first_frame_is_hidden,
++PNG_EXPORT(260, png_uint_32, png_set_first_frame_is_hidden,
+ (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
+
+#ifdef PNG_READ_APNG_SUPPORTED
-+PNG_EXPORT(253, void, png_read_frame_head, (png_structp png_ptr,
++PNG_EXPORT(261, void, png_read_frame_head, (png_structp png_ptr,
+ png_infop info_ptr));
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-+PNG_EXPORT(254, void, png_set_progressive_frame_fn, (png_structp png_ptr,
++PNG_EXPORT(262, void, png_set_progressive_frame_fn, (png_structp png_ptr,
+ png_progressive_frame_ptr frame_info_fn,
+ png_progressive_frame_ptr frame_end_fn));
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+#endif /* PNG_READ_APNG_SUPPORTED */
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
-+PNG_EXPORT(255, void, png_write_frame_head, (png_structp png_ptr,
++PNG_EXPORT(263, void, png_write_frame_head, (png_structp png_ptr,
+ png_infop info_ptr, png_bytepp row_pointers,
+ png_uint_32 width, png_uint_32 height,
+ png_uint_32 x_offset, png_uint_32 y_offset,
+ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
+ png_byte blend_op));
+
-+PNG_EXPORT(256, void, png_write_frame_tail, (png_structp png_ptr,
++PNG_EXPORT(264, void, png_write_frame_tail, (png_structp png_ptr,
+ png_infop info_ptr));
+#endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* PNG_APNG_SUPPORTED */
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
- * defs
-@@ -2712,7 +2803,11 @@
+ * defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
+@@ -3310,7 +3401,11 @@
* scripts/symbols.def as well.
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
+#ifdef PNG_APNG_SUPPORTED
-+ PNG_EXPORT_LAST_ORDINAL(256);
++ PNG_EXPORT_LAST_ORDINAL(264);
+#else
- PNG_EXPORT_LAST_ORDINAL(236);
+ PNG_EXPORT_LAST_ORDINAL(244);
+#endif /* PNG_APNG_SUPPORTED */
#endif
#ifdef __cplusplus
-diff -Naru libpng-1.5.15.org/pngget.c libpng-1.5.15/pngget.c
---- libpng-1.5.15.org/pngget.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngget.c 2013-04-02 20:39:30.000000000 +0900
-@@ -1140,4 +1140,166 @@
+diff -Naru libpng-1.6.8.org/pngget.c libpng-1.6.8/pngget.c
+--- libpng-1.6.8.org/pngget.c 2013-12-22 17:03:17.220988502 +0900
++++ libpng-1.6.8/pngget.c 2013-12-22 17:03:17.288990684 +0900
+@@ -1174,4 +1174,166 @@
# endif
#endif
@@ -309,10 +309,10 @@ diff -Naru libpng-1.5.15.org/pngget.c libpng-1.5.15/pngget.c
+}
+#endif /* PNG_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
-diff -Naru libpng-1.5.15.org/pnginfo.h libpng-1.5.15/pnginfo.h
---- libpng-1.5.15.org/pnginfo.h 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pnginfo.h 2013-04-02 20:39:30.000000000 +0900
-@@ -265,5 +265,18 @@
+diff -Naru libpng-1.6.8.org/pnginfo.h libpng-1.6.8/pnginfo.h
+--- libpng-1.6.8.org/pnginfo.h 2013-12-22 17:03:17.220988502 +0900
++++ libpng-1.6.8/pnginfo.h 2013-12-22 17:03:17.288990684 +0900
+@@ -256,5 +256,18 @@
png_bytepp row_pointers; /* the image bits */
#endif
@@ -331,10 +331,10 @@ diff -Naru libpng-1.5.15.org/pnginfo.h libpng-1.5.15/pnginfo.h
+
};
#endif /* PNGINFO_H */
-diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
---- libpng-1.5.15.org/pngpread.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngpread.c 2013-04-02 20:39:30.000000000 +0900
-@@ -215,6 +215,109 @@
+diff -Naru libpng-1.6.8.org/pngpread.c libpng-1.6.8/pngpread.c
+--- libpng-1.6.8.org/pngpread.c 2013-12-22 17:03:17.221988534 +0900
++++ libpng-1.6.8/pngpread.c 2013-12-22 17:03:17.288990684 +0900
+@@ -217,6 +217,109 @@
chunk_name = png_ptr->chunk_name;
@@ -443,22 +443,21 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
+
if (chunk_name == png_IDAT)
{
- /* This is here above the if/else case statement below because if the
-@@ -318,6 +421,10 @@
- png_benign_error(png_ptr, "Too many IDATs found");
- }
+ if (png_ptr->mode & PNG_AFTER_IDAT)
+@@ -299,6 +402,9 @@
+ else if (chunk_name == png_IDAT)
+ {
+#ifdef PNG_READ_APNG_SUPPORTED
+ png_have_info(png_ptr, info_ptr);
+#endif
-+
png_ptr->idat_size = png_ptr->push_length;
- png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->process_mode = PNG_READ_IDAT_MODE;
-@@ -551,6 +658,28 @@
-
+ png_push_have_info(png_ptr, info_ptr);
+@@ -529,6 +635,30 @@
+ png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
+ }
#endif
-
+#ifdef PNG_READ_APNG_SUPPORTED
+ else if (chunk_name == png_acTL)
+ {
@@ -467,6 +466,7 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
+ png_push_save_buffer(png_ptr);
+ return;
+ }
++
+ png_handle_acTL(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
@@ -477,14 +477,15 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
+ png_push_save_buffer(png_ptr);
+ return;
+ }
++
+ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
+ }
-+#endif /* PNG_READ_APNG_SUPPORTED */
+
++#endif /* PNG_READ_APNG_SUPPORTED */
+
else
{
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
-@@ -758,7 +887,11 @@
+@@ -731,7 +861,11 @@
png_byte chunk_tag[4];
/* TODO: this code can be commoned up with the same code in push_read */
@@ -496,14 +497,14 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
{
png_push_save_buffer(png_ptr);
return;
-@@ -771,17 +904,64 @@
+@@ -744,17 +878,64 @@
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+#ifdef PNG_READ_APNG_SUPPORTED
+ if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
+ {
-+ if (png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)
++ if (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)
+ {
+ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+ if (png_ptr->frame_end_fn != NULL)
@@ -537,7 +538,7 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
- if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
+ if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
png_error(png_ptr, "Not enough compressed data");
+#ifdef PNG_READ_APNG_SUPPORTED
@@ -561,7 +562,7 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
}
if (png_ptr->idat_size && png_ptr->save_buffer_size)
-@@ -859,6 +1039,15 @@
+@@ -832,6 +1013,15 @@
if (!(buffer_length > 0) || buffer == NULL)
png_error(png_ptr, "No IDAT data (internal error)");
@@ -569,7 +570,7 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
+ /* If the app is not APNG-aware, decode only the first frame */
+ if (!(png_ptr->apng_flags & PNG_APNG_APP) && png_ptr->num_frames_read > 0)
+ {
-+ png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
+ return;
+ }
+#endif
@@ -577,7 +578,7 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
/* This routine must process all the data it has been given
* before returning, calling the row callback as required to
* handle the uncompressed results.
-@@ -1304,6 +1493,18 @@
+@@ -1280,6 +1470,18 @@
png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
}
@@ -594,30 +595,30 @@ diff -Naru libpng-1.5.15.org/pngpread.c libpng-1.5.15/pngpread.c
+#endif
+
png_voidp PNGAPI
- png_get_progressive_ptr(png_const_structp png_ptr)
+ png_get_progressive_ptr(png_const_structrp png_ptr)
{
-diff -Naru libpng-1.5.15.org/pngpriv.h libpng-1.5.15/pngpriv.h
---- libpng-1.5.15.org/pngpriv.h 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngpriv.h 2013-04-02 20:39:30.000000000 +0900
-@@ -461,6 +461,10 @@
- #define PNG_HAVE_PNG_SIGNATURE 0x1000
+diff -Naru libpng-1.6.8.org/pngpriv.h libpng-1.6.8/pngpriv.h
+--- libpng-1.6.8.org/pngpriv.h 2013-12-22 17:03:17.221988534 +0900
++++ libpng-1.6.8/pngpriv.h 2013-12-22 17:03:17.289990716 +0900
+@@ -550,6 +550,10 @@
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
- #define PNG_HAVE_iCCP 0x4000
+ /* 0x4000 (unused) */
+ #define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
+#ifdef PNG_APNG_SUPPORTED
-+#define PNG_HAVE_acTL 0x8000
-+#define PNG_HAVE_fcTL 0x10000
++#define PNG_HAVE_acTL 0x10000
++#define PNG_HAVE_fcTL 0x20000
+#endif
/* Flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001
-@@ -658,6 +662,16 @@
- #define png_tRNS PNG_CHUNK(116, 82, 78, 83)
- #define png_zTXt PNG_CHUNK(122, 84, 88, 116)
+@@ -771,6 +775,16 @@
+ #define png_tRNS PNG_U32(116, 82, 78, 83)
+ #define png_zTXt PNG_U32(122, 84, 88, 116)
+#ifdef PNG_APNG_SUPPORTED
-+#define png_acTL PNG_CHUNK( 97, 99, 84, 76)
-+#define png_fcTL PNG_CHUNK(102, 99, 84, 76)
-+#define png_fdAT PNG_CHUNK(102, 100, 65, 84)
++#define png_acTL PNG_U32( 97, 99, 84, 76)
++#define png_fcTL PNG_U32(102, 99, 84, 76)
++#define png_fdAT PNG_U32(102, 100, 65, 84)
+
+/* For png_struct.apng_flags: */
+#define PNG_FIRST_FRAME_HIDDEN 0x0001
@@ -627,66 +628,68 @@ diff -Naru libpng-1.5.15.org/pngpriv.h libpng-1.5.15/pngpriv.h
/* The following will work on (signed char*) strings, whereas the get_uint_32
* macro will fail on top-bit-set values because of the sign extension.
*/
-@@ -1349,6 +1363,45 @@
- png_bytep row));
+@@ -1583,6 +1597,47 @@
+ */
#endif
+#ifdef PNG_APNG_SUPPORTED
-+PNG_EXTERN void png_ensure_fcTL_is_valid PNGARG((png_structp png_ptr,
++PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
+ png_uint_32 width, png_uint_32 height,
+ png_uint_32 x_offset, png_uint_32 y_offset,
+ png_uint_16 delay_num, png_uint_16 delay_den,
-+ png_byte dispose_op, png_byte blend_op));
++ png_byte dispose_op, png_byte blend_op), PNG_EMPTY);
+
+#ifdef PNG_READ_APNG_SUPPORTED
-+PNG_EXTERN void png_handle_acTL PNGARG((png_structp png_ptr, png_infop info_ptr,
-+ png_uint_32 length));
-+PNG_EXTERN void png_handle_fcTL PNGARG((png_structp png_ptr, png_infop info_ptr,
-+ png_uint_32 length));
-+PNG_EXTERN void png_handle_fdAT PNGARG((png_structp png_ptr, png_infop info_ptr,
-+ png_uint_32 length));
-+PNG_EXTERN void png_have_info PNGARG((png_structp png_ptr, png_infop info_ptr));
-+PNG_EXTERN void png_ensure_sequence_number PNGARG((png_structp png_ptr,
-+ png_uint_32 length));
-+PNG_EXTERN void png_read_reset PNGARG((png_structp png_ptr));
-+PNG_EXTERN void png_read_reinit PNGARG((png_structp png_ptr,
-+ png_infop info_ptr));
++PNG_INTERNAL_FUNCTION(void,png_handle_acTL,(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_handle_fcTL,(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_handle_fdAT,(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_have_info,(png_structp png_ptr, png_infop info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_ensure_sequence_number,(png_structp png_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_reset,(png_structp png_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
++ png_infop info_ptr),PNG_EMPTY);
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-+PNG_EXTERN void png_progressive_read_reset PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),PNG_EMPTY);
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+#endif /* PNG_READ_APNG_SUPPORTED */
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
-+PNG_EXTERN void png_write_acTL PNGARG((png_structp png_ptr,
-+ png_uint_32 num_frames, png_uint_32 num_plays));
-+PNG_EXTERN void png_write_fcTL PNGARG((png_structp png_ptr,
++PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_fcTL,(png_structp png_ptr,
+ png_uint_32 width, png_uint_32 height,
+ png_uint_32 x_offset, png_uint_32 y_offset,
+ png_uint_16 delay_num, png_uint_16 delay_den,
-+ png_byte dispose_op, png_byte blend_op));
-+PNG_EXTERN void png_write_reset PNGARG((png_structp png_ptr));
-+PNG_EXTERN void png_write_reinit PNGARG((png_structp png_ptr,
-+ png_infop info_ptr, png_uint_32 width, png_uint_32 height));
++ png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
++ png_const_bytep data, png_size_t length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
+#endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* PNG_APNG_SUPPORTED */
+
/* Added at libpng version 1.4.0 */
- #ifdef PNG_CHECK_cHRM_SUPPORTED
- PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
-diff -Naru libpng-1.5.15.org/pngread.c libpng-1.5.15/pngread.c
---- libpng-1.5.15.org/pngread.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngread.c 2013-04-02 20:39:30.000000000 +0900
-@@ -240,6 +240,9 @@
- !(png_ptr->mode & PNG_HAVE_PLTE))
- png_error(png_ptr, "Missing PLTE before IDAT");
+ #ifdef PNG_COLORSPACE_SUPPORTED
+ /* These internal functions are for maintaining the colorspace structure within
+diff -Naru libpng-1.6.8.org/pngread.c libpng-1.6.8/pngread.c
+--- libpng-1.6.8.org/pngread.c 2013-12-22 17:03:17.222988566 +0900
++++ libpng-1.6.8/pngread.c 2013-12-22 17:03:17.290990748 +0900
+@@ -158,6 +158,9 @@
+ else if (chunk_name == png_IDAT)
+ {
+#ifdef PNG_READ_APNG_SUPPORTED
+ png_have_info(png_ptr, info_ptr);
+#endif
png_ptr->idat_size = length;
- png_ptr->mode |= PNG_HAVE_IDAT;
break;
-@@ -330,12 +333,90 @@
+ }
+@@ -247,6 +250,17 @@
png_handle_iTXt(png_ptr, info_ptr, length);
#endif
@@ -702,8 +705,9 @@ diff -Naru libpng-1.5.15.org/pngread.c libpng-1.5.15/pngread.c
+#endif
+
else
- png_handle_unknown(png_ptr, info_ptr, length);
- }
+ png_handle_unknown(png_ptr, info_ptr, length,
+ PNG_HANDLE_CHUNK_AS_DEFAULT);
+@@ -254,6 +268,72 @@
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
@@ -723,9 +727,8 @@ diff -Naru libpng-1.5.15.org/pngread.c libpng-1.5.15/pngread.c
+ if (png_ptr->num_frames_read == 0)
+ return;
+
-+ png_crc_finish(png_ptr, 0); /* CRC from last IDAT or fdAT chunk */
-+
+ png_read_reset(png_ptr);
++ png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+ png_ptr->mode &= ~PNG_HAVE_fcTL;
+
+ have_chunk_after_DAT = 0;
@@ -776,68 +779,11 @@ diff -Naru libpng-1.5.15.org/pngread.c libpng-1.5.15/pngread.c
+
/* Optional call to update the users info_ptr structure */
void PNGAPI
- png_read_update_info(png_structp png_ptr, png_infop info_ptr)
-@@ -537,6 +618,38 @@
- {
- if (!(png_ptr->zstream.avail_in))
- {
-+#ifdef PNG_READ_APNG_SUPPORTED
-+ png_uint_32 bytes_to_skip = 0;
-+
-+ while (!png_ptr->idat_size || bytes_to_skip != 0)
-+ {
-+ png_crc_finish(png_ptr, bytes_to_skip);
-+ bytes_to_skip = 0;
-+
-+ png_ptr->idat_size = png_read_chunk_header(png_ptr);
-+ if (png_ptr->num_frames_read == 0)
-+ {
-+ if (png_ptr->chunk_name != png_IDAT)
-+ png_error(png_ptr, "Not enough image data");
-+ }
-+ else
-+ {
-+ if (png_ptr->chunk_name == png_IEND)
-+ png_error(png_ptr, "Not enough image data");
-+ if (png_ptr->chunk_name != png_fdAT)
-+ {
-+ png_warning(png_ptr, "Skipped (ignored) a chunk "
-+ "between APNG chunks");
-+ bytes_to_skip = png_ptr->idat_size;
-+ continue;
-+ }
-+
-+ png_ensure_sequence_number(png_ptr, png_ptr->idat_size);
-+
-+ png_ptr->idat_size -= 4;
-+ }
-+ }
-+#else
- while (!png_ptr->idat_size)
- {
- png_crc_finish(png_ptr, 0);
-@@ -545,6 +658,7 @@
- if (png_ptr->chunk_name != png_IDAT)
- png_error(png_ptr, "Not enough image data");
- }
-+#endif
- png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size;
- png_ptr->zstream.next_in = png_ptr->zbuf;
- if (png_ptr->zbuf_size > png_ptr->idat_size)
-@@ -563,6 +677,9 @@
- png_benign_error(png_ptr, "Extra compressed data");
- png_ptr->mode |= PNG_AFTER_IDAT;
- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
-+#ifdef PNG_READ_APNG_SUPPORTED
-+ png_ptr->num_frames_read++;
-+#endif
- break;
- }
-
-diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
---- libpng-1.5.15.org/pngrutil.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngrutil.c 2013-04-02 20:39:30.000000000 +0900
-@@ -547,6 +547,11 @@
+ png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
+diff -Naru libpng-1.6.8.org/pngrutil.c libpng-1.6.8/pngrutil.c
+--- libpng-1.6.8.org/pngrutil.c 2013-12-22 17:03:17.224988631 +0900
++++ libpng-1.6.8/pngrutil.c 2013-12-22 17:03:17.291990780 +0900
+@@ -826,6 +826,11 @@
filter_type = buf[11];
interlace_type = buf[12];
@@ -849,7 +795,7 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
/* Set internal variables */
png_ptr->width = width;
png_ptr->height = height;
-@@ -2624,6 +2629,179 @@
+@@ -2700,6 +2705,179 @@
}
#endif
@@ -1026,10 +972,68 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
+}
+#endif /* PNG_READ_APNG_SUPPORTED */
+
- /* This function is called when we haven't found a handler for a
- * chunk. If there isn't a problem with the chunk itself (ie bad
- * chunk name, CRC, or a critical chunk), the chunk is silently ignored
-@@ -4114,4 +4292,81 @@
+ #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+ /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
+ static int
+@@ -3956,7 +4134,38 @@
+ {
+ uInt avail_in;
+ png_bytep buffer;
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_uint_32 bytes_to_skip = 0;
++
++ while (png_ptr->idat_size == 0 || bytes_to_skip != 0)
++ {
++ png_crc_finish(png_ptr, bytes_to_skip);
++ bytes_to_skip = 0;
+
++ png_ptr->idat_size = png_read_chunk_header(png_ptr);
++ if (png_ptr->num_frames_read == 0)
++ {
++ if (png_ptr->chunk_name != png_IDAT)
++ png_error(png_ptr, "Not enough image data");
++ }
++ else
++ {
++ if (png_ptr->chunk_name == png_IEND)
++ png_error(png_ptr, "Not enough image data");
++ if (png_ptr->chunk_name != png_fdAT)
++ {
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ bytes_to_skip = png_ptr->idat_size;
++ continue;
++ }
++
++ png_ensure_sequence_number(png_ptr, png_ptr->idat_size);
++
++ png_ptr->idat_size -= 4;
++ }
++ }
++#else
+ while (png_ptr->idat_size == 0)
+ {
+ png_crc_finish(png_ptr, 0);
+@@ -3968,7 +4177,7 @@
+ if (png_ptr->chunk_name != png_IDAT)
+ png_error(png_ptr, "Not enough image data");
+ }
+-
++#endif /* PNG_READ_APNG_SUPPORTED */
+ avail_in = png_ptr->IDAT_read_size;
+
+ if (avail_in > png_ptr->idat_size)
+@@ -4031,6 +4240,9 @@
+
+ png_ptr->mode |= PNG_AFTER_IDAT;
+ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_ptr->num_frames_read++;
++#endif
+
+ if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
+ png_chunk_benign_error(png_ptr, "Extra compressed data");
+@@ -4476,4 +4688,80 @@
png_ptr->flags |= PNG_FLAG_ROW_INIT;
}
@@ -1045,7 +1049,6 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
+ png_ptr->mode &= ~PNG_AFTER_IDAT;
+ png_ptr->row_number = 0;
+ png_ptr->pass = 0;
-+ png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+}
+
+void /* PRIVATE */
@@ -1057,7 +1060,7 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
+ png_ptr->info_rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,
+ png_ptr->width);
+ if (png_ptr->prev_row)
-+ png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
++ memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
+}
+
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
@@ -1069,16 +1072,16 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
-+ const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
++ const int png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
-+ const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
++ const int png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
+
+ /* Start of interlace block in the y direction */
-+ const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
++ const int png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
+
+ /* Offset to next interlace block in the y direction */
-+ const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
++ const int png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
+
+ if (png_ptr->interlaced)
+ {
@@ -1099,7 +1102,7 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
+ png_ptr->num_rows = png_ptr->height;
+ png_ptr->iwidth = png_ptr->width;
+ }
-+ png_ptr->flags &= ~PNG_FLAG_ZLIB_FINISHED;
++ png_ptr->flags &= ~PNG_FLAG_ZSTREAM_ENDED;
+ if (inflateReset(&(png_ptr->zstream)) != Z_OK)
+ png_error(png_ptr, "inflateReset failed");
+ png_ptr->zstream.avail_in = 0;
@@ -1111,13 +1114,13 @@ diff -Naru libpng-1.5.15.org/pngrutil.c libpng-1.5.15/pngrutil.c
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED */
-diff -Naru libpng-1.5.15.org/pngset.c libpng-1.5.15/pngset.c
---- libpng-1.5.15.org/pngset.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngset.c 2013-04-02 20:39:30.000000000 +0900
-@@ -262,6 +262,11 @@
- info_ptr->rowbytes = 0;
- else
- info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
+diff -Naru libpng-1.6.8.org/pngset.c libpng-1.6.8/pngset.c
+--- libpng-1.6.8.org/pngset.c 2013-12-22 17:03:17.224988631 +0900
++++ libpng-1.6.8/pngset.c 2013-12-22 17:03:17.292990812 +0900
+@@ -239,6 +239,11 @@
+ info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
+
+ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
+
+#ifdef PNG_APNG_SUPPORTED
+ /* for non-animated png. this may be overwritten from an acTL chunk later */
@@ -1126,7 +1129,7 @@ diff -Naru libpng-1.5.15.org/pngset.c libpng-1.5.15/pngset.c
}
#ifdef PNG_oFFs_SUPPORTED
-@@ -1048,6 +1053,147 @@
+@@ -1065,6 +1070,147 @@
}
#endif /* PNG_sPLT_SUPPORTED */
@@ -1225,10 +1228,6 @@ diff -Naru libpng-1.5.15.org/pngset.c libpng-1.5.15/pngset.c
+ png_uint_16 delay_num, png_uint_16 delay_den,
+ png_byte dispose_op, png_byte blend_op)
+{
-+ if (width + x_offset > png_ptr->first_frame_width ||
-+ height + y_offset > png_ptr->first_frame_height)
-+ png_error(png_ptr, "dimensions of a frame are greater than"
-+ "the ones in IHDR");
+ if (width > PNG_UINT_31_MAX)
+ png_error(png_ptr, "invalid width in fcTL (> 2^31-1)");
+ if (height > PNG_UINT_31_MAX)
@@ -1237,6 +1236,10 @@ diff -Naru libpng-1.5.15.org/pngset.c libpng-1.5.15/pngset.c
+ png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
+ if (y_offset > PNG_UINT_31_MAX)
+ png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
++ if (width + x_offset > png_ptr->first_frame_width ||
++ height + y_offset > png_ptr->first_frame_height)
++ png_error(png_ptr, "dimensions of a frame are greater than"
++ "the ones in IHDR");
+
+ if (dispose_op != PNG_DISPOSE_OP_NONE &&
+ dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
@@ -1271,13 +1274,13 @@ diff -Naru libpng-1.5.15.org/pngset.c libpng-1.5.15/pngset.c
+}
+#endif /* PNG_APNG_SUPPORTED */
+
- #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
- void PNGAPI
- png_set_unknown_chunks(png_structp png_ptr,
-diff -Naru libpng-1.5.15.org/pngstruct.h libpng-1.5.15/pngstruct.h
---- libpng-1.5.15.org/pngstruct.h 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngstruct.h 2013-04-02 20:39:30.000000000 +0900
-@@ -293,6 +293,27 @@
+ #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+ static png_byte
+ check_location(png_const_structrp png_ptr, int location)
+diff -Naru libpng-1.6.8.org/pngstruct.h libpng-1.6.8/pngstruct.h
+--- libpng-1.6.8.org/pngstruct.h 2013-12-22 17:03:17.224988631 +0900
++++ libpng-1.6.8/pngstruct.h 2013-12-22 17:03:17.292990812 +0900
+@@ -409,6 +409,27 @@
png_byte filter_type;
#endif
@@ -1305,10 +1308,10 @@ diff -Naru libpng-1.5.15.org/pngstruct.h libpng-1.5.15/pngstruct.h
/* New members added in libpng-1.2.0 */
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
-diff -Naru libpng-1.5.15.org/pngtest.c libpng-1.5.15/pngtest.c
---- libpng-1.5.15.org/pngtest.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngtest.c 2013-04-02 20:39:30.000000000 +0900
-@@ -822,6 +822,10 @@
+diff -Naru libpng-1.6.8.org/pngtest.c libpng-1.6.8/pngtest.c
+--- libpng-1.6.8.org/pngtest.c 2013-12-22 17:03:17.224988631 +0900
++++ libpng-1.6.8/pngtest.c 2013-12-22 17:03:17.292990812 +0900
+@@ -840,6 +840,10 @@
png_uint_32 width, height;
int num_pass, pass;
int bit_depth, color_type;
@@ -1319,7 +1322,7 @@ diff -Naru libpng-1.5.15.org/pngtest.c libpng-1.5.15/pngtest.c
row_buf = NULL;
error_parameters.file_name = inname;
-@@ -1271,6 +1275,20 @@
+@@ -1290,6 +1294,20 @@
}
}
#endif
@@ -1340,7 +1343,7 @@ diff -Naru libpng-1.5.15.org/pngtest.c libpng-1.5.15/pngtest.c
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
-@@ -1336,6 +1354,89 @@
+@@ -1355,6 +1373,89 @@
t_misc += (t_stop - t_start);
t_start = t_stop;
#endif
@@ -1430,21 +1433,21 @@ diff -Naru libpng-1.5.15.org/pngtest.c libpng-1.5.15/pngtest.c
for (pass = 0; pass < num_pass; pass++)
{
pngtest_debug1("Writing row data for pass %d", pass);
-diff -Naru libpng-1.5.15.org/pngwrite.c libpng-1.5.15/pngwrite.c
---- libpng-1.5.15.org/pngwrite.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngwrite.c 2013-04-02 20:39:30.000000000 +0900
-@@ -58,6 +58,10 @@
- /* The rest of these check to see if the valid field has the appropriate
- * flag set, and if it does, writes the chunk.
+diff -Naru libpng-1.6.8.org/pngwrite.c libpng-1.6.8/pngwrite.c
+--- libpng-1.6.8.org/pngwrite.c 2013-12-22 17:03:17.225988663 +0900
++++ libpng-1.6.8/pngwrite.c 2013-12-22 17:03:17.310991389 +0900
+@@ -127,6 +127,10 @@
+ * application continues writing the PNG. So check the 'invalid' flag here
+ * too.
*/
+#ifdef PNG_WRITE_APNG_SUPPORTED
+ if (info_ptr->valid & PNG_INFO_acTL)
+ png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
+#endif
- #ifdef PNG_WRITE_gAMA_SUPPORTED
- if (info_ptr->valid & PNG_INFO_gAMA)
- png_write_gAMA_fixed(png_ptr, info_ptr->gamma);
-@@ -310,6 +314,11 @@
+ #ifdef PNG_GAMMA_SUPPORTED
+ # ifdef PNG_WRITE_gAMA_SUPPORTED
+ if (!(info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) &&
+@@ -357,6 +361,11 @@
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
#endif
@@ -1456,11 +1459,10 @@ diff -Naru libpng-1.5.15.org/pngwrite.c libpng-1.5.15/pngwrite.c
/* See if user wants us to write information chunks */
if (info_ptr != NULL)
{
-@@ -1667,4 +1676,42 @@
- PNG_UNUSED(params)
+@@ -1560,6 +1569,43 @@
}
#endif
-+
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
+void PNGAPI
+png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
@@ -1498,11 +1500,13 @@ diff -Naru libpng-1.5.15.org/pngwrite.c libpng-1.5.15/pngwrite.c
+ PNG_UNUSED(info_ptr)
+}
+#endif /* PNG_WRITE_APNG_SUPPORTED */
- #endif /* PNG_WRITE_SUPPORTED */
-diff -Naru libpng-1.5.15.org/pngwutil.c libpng-1.5.15/pngwutil.c
---- libpng-1.5.15.org/pngwutil.c 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/pngwutil.c 2013-04-02 20:39:30.000000000 +0900
-@@ -818,6 +818,11 @@
+
+ #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
+ #ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
+diff -Naru libpng-1.6.8.org/pngwutil.c libpng-1.6.8/pngwutil.c
+--- libpng-1.6.8.org/pngwutil.c 2013-12-22 17:03:17.226988695 +0900
++++ libpng-1.6.8/pngwutil.c 2013-12-22 17:03:17.311991421 +0900
+@@ -898,6 +898,11 @@
/* Write the chunk */
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
@@ -1511,39 +1515,41 @@ diff -Naru libpng-1.5.15.org/pngwutil.c libpng-1.5.15/pngwutil.c
+ png_ptr->first_frame_height = height;
+#endif
+
- /* Initialize zlib with PNG info */
- png_ptr->zstream.zalloc = png_zalloc;
- png_ptr->zstream.zfree = png_zfree;
-@@ -1032,7 +1037,28 @@
- }
- #endif /* PNG_WRITE_OPTIMIZE_CMF_SUPPORTED */
+ if (!(png_ptr->do_filter))
+ {
+ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
+@@ -1076,7 +1081,14 @@
+ optimize_cmf(data, png_image_size(png_ptr));
+ # endif
-+#ifdef PNG_WRITE_APNG_SUPPORTED
-+ if (png_ptr->num_frames_written == 0)
-+#endif
- png_write_complete_chunk(png_ptr, png_IDAT, data, length);
-+#ifdef PNG_WRITE_APNG_SUPPORTED
-+ else
-+ {
-+ png_byte buf[4];
-+
-+ png_write_chunk_header(png_ptr, png_fdAT, 4 + length);
-+
-+ png_save_uint_32(buf, png_ptr->next_seq_num);
-+ png_write_chunk_data(png_ptr, buf, 4);
-+
-+ png_write_chunk_data(png_ptr, data, length);
-+
-+ png_write_chunk_end(png_ptr);
-+
-+ png_ptr->next_seq_num++;
-+ }
-+#endif /* PNG_WRITE_APNG_SUPPORTED */
-+
- png_ptr->mode |= PNG_HAVE_IDAT;
++# ifdef PNG_WRITE_APNG_SUPPORTED
++ if (png_ptr->num_frames_written == 0)
++# endif
+ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++# ifdef PNG_WRITE_APNG_SUPPORTED
++ else
++ png_write_fdAT(png_ptr, data, size);
++# endif /* PNG_WRITE_APNG_SUPPORTED */
+ png_ptr->mode |= PNG_HAVE_IDAT;
- /* Prior to 1.5.4 this code was replicated in every caller (except at the
-@@ -1995,6 +2021,64 @@
+ png_ptr->zstream.next_out = data;
+@@ -1122,7 +1134,15 @@
+ optimize_cmf(data, png_image_size(png_ptr));
+ # endif
+
++# ifdef PNG_WRITE_APNG_SUPPORTED
++ if (png_ptr->num_frames_written == 0)
++# endif
+ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++# ifdef PNG_WRITE_APNG_SUPPORTED
++ else
++ png_write_fdAT(png_ptr, data, size);
++# endif /* PNG_WRITE_APNG_SUPPORTED */
++
+ png_ptr->zstream.avail_out = 0;
+ png_ptr->zstream.next_out = NULL;
+ png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
+@@ -1934,6 +1954,82 @@
}
#endif
@@ -1603,12 +1609,30 @@ diff -Naru libpng-1.5.15.org/pngwutil.c libpng-1.5.15/pngwutil.c
+
+ png_ptr->next_seq_num++;
+}
++
++void /* PRIVATE */
++png_write_fdAT(png_structp png_ptr,
++ png_const_bytep data, png_size_t length)
++{
++ png_byte buf[4];
++
++ png_write_chunk_header(png_ptr, png_fdAT, (png_uint_32)(4 + length));
++
++ png_save_uint_32(buf, png_ptr->next_seq_num);
++ png_write_chunk_data(png_ptr, buf, 4);
++
++ png_write_chunk_data(png_ptr, data, length);
++
++ png_write_chunk_end(png_ptr);
++
++ png_ptr->next_seq_num++;
++}
+#endif /* PNG_WRITE_APNG_SUPPORTED */
+
/* Initializes the row writing capability of libpng */
void /* PRIVATE */
- png_write_start_row(png_structp png_ptr)
-@@ -3174,4 +3258,39 @@
+ png_write_start_row(png_structrp png_ptr)
+@@ -3020,4 +3116,39 @@
}
#endif
}
@@ -1648,30 +1672,30 @@ diff -Naru libpng-1.5.15.org/pngwutil.c libpng-1.5.15/pngwutil.c
+}
+#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */
-diff -Naru libpng-1.5.15.org/scripts/symbols.def libpng-1.5.15/scripts/symbols.def
---- libpng-1.5.15.org/scripts/symbols.def 2013-04-02 20:39:30.000000000 +0900
-+++ libpng-1.5.15/scripts/symbols.def 2013-04-02 20:39:30.000000000 +0900
-@@ -242,3 +242,23 @@
- png_set_check_for_invalid_index @234
- png_get_palette_max @235
- png_set_option @236
-+ png_get_acTL @237
-+ png_set_acTL @238
-+ png_get_num_frames @239
-+ png_get_num_plays @240
-+ png_get_next_frame_fcTL @241
-+ png_set_next_frame_fcTL @242
-+ png_get_next_frame_width @243
-+ png_get_next_frame_height @244
-+ png_get_next_frame_x_offset @245
-+ png_get_next_frame_y_offset @246
-+ png_get_next_frame_delay_num @247
-+ png_get_next_frame_delay_den @248
-+ png_get_next_frame_dispose_op @249
-+ png_get_next_frame_blend_op @250
-+ png_get_first_frame_is_hidden @251
-+ png_set_first_frame_is_hidden @252
-+ png_read_frame_head @253
-+ png_set_progressive_frame_fn @254
-+ png_write_frame_head @255
-+ png_write_frame_tail @256
+diff -Naru libpng-1.6.8.org/scripts/symbols.def libpng-1.6.8/scripts/symbols.def
+--- libpng-1.6.8.org/scripts/symbols.def 2013-12-22 17:03:17.232988887 +0900
++++ libpng-1.6.8/scripts/symbols.def 2013-12-22 17:03:17.317991614 +0900
+@@ -249,3 +249,23 @@
+ png_set_check_for_invalid_index @242
+ png_get_palette_max @243
+ png_set_option @244
++ png_get_acTL @245
++ png_set_acTL @246
++ png_get_num_frames @247
++ png_get_num_plays @248
++ png_get_next_frame_fcTL @249
++ png_set_next_frame_fcTL @250
++ png_get_next_frame_width @251
++ png_get_next_frame_height @252
++ png_get_next_frame_x_offset @253
++ png_get_next_frame_y_offset @254
++ png_get_next_frame_delay_num @255
++ png_get_next_frame_delay_den @256
++ png_get_next_frame_dispose_op @257
++ png_get_next_frame_blend_op @258
++ png_get_first_frame_is_hidden @259
++ png_set_first_frame_is_hidden @260
++ png_read_frame_head @261
++ png_set_progressive_frame_fn @262
++ png_write_frame_head @263
++ png_write_frame_tail @264