wok-next annotate libpng/stuff/patches/libpng-1.6.35-apng.patch @ rev 21072

Update Xorg packages
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Dec 20 17:55:43 2018 +0200 (2018-12-20)
parents libpng16/stuff/patches/libpng-1.6.35-apng.patch@e7a485521d6a
children
rev   line source
al@20905 1 diff -Naru libpng-1.6.35.org/png.h libpng-1.6.35/png.h
al@20905 2 --- libpng-1.6.35.org/png.h 2018-07-21 19:16:37.185142931 +0900
al@20905 3 +++ libpng-1.6.35/png.h 2018-07-21 19:16:16.327364638 +0900
al@20905 4 @@ -361,6 +361,10 @@
al@20905 5 # include "pnglibconf.h"
al@20905 6 #endif
al@20905 7
al@20905 8 +#define PNG_APNG_SUPPORTED
al@20905 9 +#define PNG_READ_APNG_SUPPORTED
al@20905 10 +#define PNG_WRITE_APNG_SUPPORTED
al@20905 11 +
al@20905 12 #ifndef PNG_VERSION_INFO_ONLY
al@20905 13 /* Machine specific configuration. */
al@20905 14 # include "pngconf.h"
al@20905 15 @@ -456,6 +460,17 @@
al@20905 16 * See pngconf.h for base types that vary by machine/system
al@20905 17 */
al@20905 18
al@20905 19 +#ifdef PNG_APNG_SUPPORTED
al@20905 20 +/* dispose_op flags from inside fcTL */
al@20905 21 +#define PNG_DISPOSE_OP_NONE 0x00U
al@20905 22 +#define PNG_DISPOSE_OP_BACKGROUND 0x01U
al@20905 23 +#define PNG_DISPOSE_OP_PREVIOUS 0x02U
al@20905 24 +
al@20905 25 +/* blend_op flags from inside fcTL */
al@20905 26 +#define PNG_BLEND_OP_SOURCE 0x00U
al@20905 27 +#define PNG_BLEND_OP_OVER 0x01U
al@20905 28 +#endif /* PNG_APNG_SUPPORTED */
al@20905 29 +
al@20905 30 /* This triggers a compiler error in png.c, if png.c and png.h
al@20905 31 * do not agree upon the version number.
al@20905 32 */
al@20905 33 @@ -777,6 +792,10 @@
al@20905 34 #define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
al@20905 35 #define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
al@20905 36 #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
al@20905 37 +#ifdef PNG_APNG_SUPPORTED
al@20905 38 +#define PNG_INFO_acTL 0x20000U
al@20905 39 +#define PNG_INFO_fcTL 0x40000U
al@20905 40 +#endif
al@20905 41
al@20905 42 /* This is used for the transformation routines, as some of them
al@20905 43 * change these values for the row. It also should enable using
al@20905 44 @@ -814,6 +833,10 @@
al@20905 45 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
al@20905 46 typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
al@20905 47 typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
al@20905 48 +#ifdef PNG_APNG_SUPPORTED
al@20905 49 +typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
al@20905 50 + png_uint_32));
al@20905 51 +#endif
al@20905 52
al@20905 53 /* The following callback receives png_uint_32 row_number, int pass for the
al@20905 54 * png_bytep data of the row. When transforming an interlaced image the
al@20905 55 @@ -3257,6 +3280,74 @@
al@20905 56 /*******************************************************************************
al@20905 57 * END OF HARDWARE AND SOFTWARE OPTIONS
al@20905 58 ******************************************************************************/
al@20905 59 +#ifdef PNG_APNG_SUPPORTED
al@20905 60 +PNG_EXPORT(250, png_uint_32, png_get_acTL, (png_structp png_ptr,
al@20905 61 + png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
al@20905 62 +
al@20905 63 +PNG_EXPORT(251, png_uint_32, png_set_acTL, (png_structp png_ptr,
al@20905 64 + png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
al@20905 65 +
al@20905 66 +PNG_EXPORT(252, png_uint_32, png_get_num_frames, (png_structp png_ptr,
al@20905 67 + png_infop info_ptr));
al@20905 68 +
al@20905 69 +PNG_EXPORT(253, png_uint_32, png_get_num_plays, (png_structp png_ptr,
al@20905 70 + png_infop info_ptr));
al@20905 71 +
al@20905 72 +PNG_EXPORT(254, png_uint_32, png_get_next_frame_fcTL,
al@20905 73 + (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
al@20905 74 + png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
al@20905 75 + png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
al@20905 76 + png_byte *blend_op));
al@20905 77 +
al@20905 78 +PNG_EXPORT(255, png_uint_32, png_set_next_frame_fcTL,
al@20905 79 + (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
al@20905 80 + png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 81 + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
al@20905 82 + png_byte blend_op));
al@20905 83 +
al@20905 84 +PNG_EXPORT(256, png_uint_32, png_get_next_frame_width,
al@20905 85 + (png_structp png_ptr, png_infop info_ptr));
al@20905 86 +PNG_EXPORT(257, png_uint_32, png_get_next_frame_height,
al@20905 87 + (png_structp png_ptr, png_infop info_ptr));
al@20905 88 +PNG_EXPORT(258, png_uint_32, png_get_next_frame_x_offset,
al@20905 89 + (png_structp png_ptr, png_infop info_ptr));
al@20905 90 +PNG_EXPORT(259, png_uint_32, png_get_next_frame_y_offset,
al@20905 91 + (png_structp png_ptr, png_infop info_ptr));
al@20905 92 +PNG_EXPORT(260, png_uint_16, png_get_next_frame_delay_num,
al@20905 93 + (png_structp png_ptr, png_infop info_ptr));
al@20905 94 +PNG_EXPORT(261, png_uint_16, png_get_next_frame_delay_den,
al@20905 95 + (png_structp png_ptr, png_infop info_ptr));
al@20905 96 +PNG_EXPORT(262, png_byte, png_get_next_frame_dispose_op,
al@20905 97 + (png_structp png_ptr, png_infop info_ptr));
al@20905 98 +PNG_EXPORT(263, png_byte, png_get_next_frame_blend_op,
al@20905 99 + (png_structp png_ptr, png_infop info_ptr));
al@20905 100 +PNG_EXPORT(264, png_byte, png_get_first_frame_is_hidden,
al@20905 101 + (png_structp png_ptr, png_infop info_ptr));
al@20905 102 +PNG_EXPORT(265, png_uint_32, png_set_first_frame_is_hidden,
al@20905 103 + (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
al@20905 104 +
al@20905 105 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 106 +PNG_EXPORT(266, void, png_read_frame_head, (png_structp png_ptr,
al@20905 107 + png_infop info_ptr));
al@20905 108 +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
al@20905 109 +PNG_EXPORT(267, void, png_set_progressive_frame_fn, (png_structp png_ptr,
al@20905 110 + png_progressive_frame_ptr frame_info_fn,
al@20905 111 + png_progressive_frame_ptr frame_end_fn));
al@20905 112 +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
al@20905 113 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 114 +
al@20905 115 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 116 +PNG_EXPORT(268, void, png_write_frame_head, (png_structp png_ptr,
al@20905 117 + png_infop info_ptr, png_bytepp row_pointers,
al@20905 118 + png_uint_32 width, png_uint_32 height,
al@20905 119 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 120 + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
al@20905 121 + png_byte blend_op));
al@20905 122 +
al@20905 123 +PNG_EXPORT(269, void, png_write_frame_tail, (png_structp png_ptr,
al@20905 124 + png_infop info_ptr));
al@20905 125 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 126 +#endif /* PNG_APNG_SUPPORTED */
al@20905 127
al@20905 128 /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
al@20905 129 * defs, and in scripts/symbols.def.
al@20905 130 @@ -3266,7 +3357,11 @@
al@20905 131 * one to use is one more than this.)
al@20905 132 */
al@20905 133 #ifdef PNG_EXPORT_LAST_ORDINAL
al@20905 134 +#ifdef PNG_APNG_SUPPORTED
al@20905 135 + PNG_EXPORT_LAST_ORDINAL(269);
al@20905 136 +#else
al@20905 137 PNG_EXPORT_LAST_ORDINAL(249);
al@20905 138 +#endif /* PNG_APNG_SUPPORTED */
al@20905 139 #endif
al@20905 140
al@20905 141 #ifdef __cplusplus
al@20905 142 diff -Naru libpng-1.6.35.org/pngget.c libpng-1.6.35/pngget.c
al@20905 143 --- libpng-1.6.35.org/pngget.c 2018-07-21 19:16:37.185142931 +0900
al@20905 144 +++ libpng-1.6.35/pngget.c 2018-07-21 19:16:16.229356281 +0900
al@20905 145 @@ -1246,4 +1246,166 @@
al@20905 146 # endif
al@20905 147 #endif
al@20905 148
al@20905 149 +#ifdef PNG_APNG_SUPPORTED
al@20905 150 +png_uint_32 PNGAPI
al@20905 151 +png_get_acTL(png_structp png_ptr, png_infop info_ptr,
al@20905 152 + png_uint_32 *num_frames, png_uint_32 *num_plays)
al@20905 153 +{
al@20905 154 + png_debug1(1, "in %s retrieval function", "acTL");
al@20905 155 +
al@20905 156 + if (png_ptr != NULL && info_ptr != NULL &&
al@20905 157 + (info_ptr->valid & PNG_INFO_acTL) &&
al@20905 158 + num_frames != NULL && num_plays != NULL)
al@20905 159 + {
al@20905 160 + *num_frames = info_ptr->num_frames;
al@20905 161 + *num_plays = info_ptr->num_plays;
al@20905 162 + return (1);
al@20905 163 + }
al@20905 164 +
al@20905 165 + return (0);
al@20905 166 +}
al@20905 167 +
al@20905 168 +png_uint_32 PNGAPI
al@20905 169 +png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
al@20905 170 +{
al@20905 171 + png_debug(1, "in png_get_num_frames()");
al@20905 172 +
al@20905 173 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 174 + return (info_ptr->num_frames);
al@20905 175 + return (0);
al@20905 176 +}
al@20905 177 +
al@20905 178 +png_uint_32 PNGAPI
al@20905 179 +png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
al@20905 180 +{
al@20905 181 + png_debug(1, "in png_get_num_plays()");
al@20905 182 +
al@20905 183 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 184 + return (info_ptr->num_plays);
al@20905 185 + return (0);
al@20905 186 +}
al@20905 187 +
al@20905 188 +png_uint_32 PNGAPI
al@20905 189 +png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
al@20905 190 + png_uint_32 *width, png_uint_32 *height,
al@20905 191 + png_uint_32 *x_offset, png_uint_32 *y_offset,
al@20905 192 + png_uint_16 *delay_num, png_uint_16 *delay_den,
al@20905 193 + png_byte *dispose_op, png_byte *blend_op)
al@20905 194 +{
al@20905 195 + png_debug1(1, "in %s retrieval function", "fcTL");
al@20905 196 +
al@20905 197 + if (png_ptr != NULL && info_ptr != NULL &&
al@20905 198 + (info_ptr->valid & PNG_INFO_fcTL) &&
al@20905 199 + width != NULL && height != NULL &&
al@20905 200 + x_offset != NULL && y_offset != NULL &&
al@20905 201 + delay_num != NULL && delay_den != NULL &&
al@20905 202 + dispose_op != NULL && blend_op != NULL)
al@20905 203 + {
al@20905 204 + *width = info_ptr->next_frame_width;
al@20905 205 + *height = info_ptr->next_frame_height;
al@20905 206 + *x_offset = info_ptr->next_frame_x_offset;
al@20905 207 + *y_offset = info_ptr->next_frame_y_offset;
al@20905 208 + *delay_num = info_ptr->next_frame_delay_num;
al@20905 209 + *delay_den = info_ptr->next_frame_delay_den;
al@20905 210 + *dispose_op = info_ptr->next_frame_dispose_op;
al@20905 211 + *blend_op = info_ptr->next_frame_blend_op;
al@20905 212 + return (1);
al@20905 213 + }
al@20905 214 +
al@20905 215 + return (0);
al@20905 216 +}
al@20905 217 +
al@20905 218 +png_uint_32 PNGAPI
al@20905 219 +png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
al@20905 220 +{
al@20905 221 + png_debug(1, "in png_get_next_frame_width()");
al@20905 222 +
al@20905 223 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 224 + return (info_ptr->next_frame_width);
al@20905 225 + return (0);
al@20905 226 +}
al@20905 227 +
al@20905 228 +png_uint_32 PNGAPI
al@20905 229 +png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
al@20905 230 +{
al@20905 231 + png_debug(1, "in png_get_next_frame_height()");
al@20905 232 +
al@20905 233 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 234 + return (info_ptr->next_frame_height);
al@20905 235 + return (0);
al@20905 236 +}
al@20905 237 +
al@20905 238 +png_uint_32 PNGAPI
al@20905 239 +png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
al@20905 240 +{
al@20905 241 + png_debug(1, "in png_get_next_frame_x_offset()");
al@20905 242 +
al@20905 243 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 244 + return (info_ptr->next_frame_x_offset);
al@20905 245 + return (0);
al@20905 246 +}
al@20905 247 +
al@20905 248 +png_uint_32 PNGAPI
al@20905 249 +png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
al@20905 250 +{
al@20905 251 + png_debug(1, "in png_get_next_frame_y_offset()");
al@20905 252 +
al@20905 253 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 254 + return (info_ptr->next_frame_y_offset);
al@20905 255 + return (0);
al@20905 256 +}
al@20905 257 +
al@20905 258 +png_uint_16 PNGAPI
al@20905 259 +png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
al@20905 260 +{
al@20905 261 + png_debug(1, "in png_get_next_frame_delay_num()");
al@20905 262 +
al@20905 263 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 264 + return (info_ptr->next_frame_delay_num);
al@20905 265 + return (0);
al@20905 266 +}
al@20905 267 +
al@20905 268 +png_uint_16 PNGAPI
al@20905 269 +png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
al@20905 270 +{
al@20905 271 + png_debug(1, "in png_get_next_frame_delay_den()");
al@20905 272 +
al@20905 273 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 274 + return (info_ptr->next_frame_delay_den);
al@20905 275 + return (0);
al@20905 276 +}
al@20905 277 +
al@20905 278 +png_byte PNGAPI
al@20905 279 +png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
al@20905 280 +{
al@20905 281 + png_debug(1, "in png_get_next_frame_dispose_op()");
al@20905 282 +
al@20905 283 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 284 + return (info_ptr->next_frame_dispose_op);
al@20905 285 + return (0);
al@20905 286 +}
al@20905 287 +
al@20905 288 +png_byte PNGAPI
al@20905 289 +png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
al@20905 290 +{
al@20905 291 + png_debug(1, "in png_get_next_frame_blend_op()");
al@20905 292 +
al@20905 293 + if (png_ptr != NULL && info_ptr != NULL)
al@20905 294 + return (info_ptr->next_frame_blend_op);
al@20905 295 + return (0);
al@20905 296 +}
al@20905 297 +
al@20905 298 +png_byte PNGAPI
al@20905 299 +png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
al@20905 300 +{
al@20905 301 + png_debug(1, "in png_first_frame_is_hidden()");
al@20905 302 +
al@20905 303 + if (png_ptr != NULL)
al@20905 304 + return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
al@20905 305 +
al@20905 306 + PNG_UNUSED(info_ptr)
al@20905 307 +
al@20905 308 + return 0;
al@20905 309 +}
al@20905 310 +#endif /* PNG_APNG_SUPPORTED */
al@20905 311 #endif /* READ || WRITE */
al@20905 312 diff -Naru libpng-1.6.35.org/pnginfo.h libpng-1.6.35/pnginfo.h
al@20905 313 --- libpng-1.6.35.org/pnginfo.h 2018-07-21 19:16:37.185142931 +0900
al@20905 314 +++ libpng-1.6.35/pnginfo.h 2018-07-21 19:16:16.228356197 +0900
al@20905 315 @@ -263,5 +263,18 @@
al@20905 316 png_bytepp row_pointers; /* the image bits */
al@20905 317 #endif
al@20905 318
al@20905 319 +#ifdef PNG_APNG_SUPPORTED
al@20905 320 + png_uint_32 num_frames; /* including default image */
al@20905 321 + png_uint_32 num_plays;
al@20905 322 + png_uint_32 next_frame_width;
al@20905 323 + png_uint_32 next_frame_height;
al@20905 324 + png_uint_32 next_frame_x_offset;
al@20905 325 + png_uint_32 next_frame_y_offset;
al@20905 326 + png_uint_16 next_frame_delay_num;
al@20905 327 + png_uint_16 next_frame_delay_den;
al@20905 328 + png_byte next_frame_dispose_op;
al@20905 329 + png_byte next_frame_blend_op;
al@20905 330 +#endif
al@20905 331 +
al@20905 332 };
al@20905 333 #endif /* PNGINFO_H */
al@20905 334 diff -Naru libpng-1.6.35.org/pngpread.c libpng-1.6.35/pngpread.c
al@20905 335 --- libpng-1.6.35.org/pngpread.c 2018-07-21 19:16:37.185142931 +0900
al@20905 336 +++ libpng-1.6.35/pngpread.c 2018-07-21 19:16:16.228356197 +0900
al@20905 337 @@ -195,6 +195,106 @@
al@20905 338
al@20905 339 chunk_name = png_ptr->chunk_name;
al@20905 340
al@20905 341 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 342 + if (png_ptr->num_frames_read > 0 &&
al@20905 343 + png_ptr->num_frames_read < info_ptr->num_frames)
al@20905 344 + {
al@20905 345 + if (chunk_name == png_IDAT)
al@20905 346 + {
al@20905 347 + /* Discard trailing IDATs for the first frame */
al@20905 348 + if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1)
al@20905 349 + png_error(png_ptr, "out of place IDAT");
al@20905 350 +
al@20905 351 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 352 + {
al@20905 353 + png_push_save_buffer(png_ptr);
al@20905 354 + return;
al@20905 355 + }
al@20905 356 +
al@20905 357 + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
al@20905 358 + return;
al@20905 359 + }
al@20905 360 + else if (chunk_name == png_fdAT)
al@20905 361 + {
al@20905 362 + if (png_ptr->buffer_size < 4)
al@20905 363 + {
al@20905 364 + png_push_save_buffer(png_ptr);
al@20905 365 + return;
al@20905 366 + }
al@20905 367 +
al@20905 368 + png_ensure_sequence_number(png_ptr, 4);
al@20905 369 +
al@20905 370 + if (!(png_ptr->mode & PNG_HAVE_fcTL))
al@20905 371 + {
al@20905 372 + /* Discard trailing fdATs for frames other than the first */
al@20905 373 + if (png_ptr->num_frames_read < 2)
al@20905 374 + png_error(png_ptr, "out of place fdAT");
al@20905 375 +
al@20905 376 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 377 + {
al@20905 378 + png_push_save_buffer(png_ptr);
al@20905 379 + return;
al@20905 380 + }
al@20905 381 +
al@20905 382 + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
al@20905 383 + return;
al@20905 384 + }
al@20905 385 +
al@20905 386 + else
al@20905 387 + {
al@20905 388 + /* frame data follows */
al@20905 389 + png_ptr->idat_size = png_ptr->push_length - 4;
al@20905 390 + png_ptr->mode |= PNG_HAVE_IDAT;
al@20905 391 + png_ptr->process_mode = PNG_READ_IDAT_MODE;
al@20905 392 +
al@20905 393 + return;
al@20905 394 + }
al@20905 395 + }
al@20905 396 +
al@20905 397 + else if (chunk_name == png_fcTL)
al@20905 398 + {
al@20905 399 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 400 + {
al@20905 401 + png_push_save_buffer(png_ptr);
al@20905 402 + return;
al@20905 403 + }
al@20905 404 +
al@20905 405 + png_read_reset(png_ptr);
al@20905 406 + png_ptr->mode &= ~PNG_HAVE_fcTL;
al@20905 407 +
al@20905 408 + png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
al@20905 409 +
al@20905 410 + if (!(png_ptr->mode & PNG_HAVE_fcTL))
al@20905 411 + png_error(png_ptr, "missing required fcTL chunk");
al@20905 412 +
al@20905 413 + png_read_reinit(png_ptr, info_ptr);
al@20905 414 + png_progressive_read_reset(png_ptr);
al@20905 415 +
al@20905 416 + if (png_ptr->frame_info_fn != NULL)
al@20905 417 + (*(png_ptr->frame_info_fn))(png_ptr, png_ptr->num_frames_read);
al@20905 418 +
al@20905 419 + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
al@20905 420 +
al@20905 421 + return;
al@20905 422 + }
al@20905 423 +
al@20905 424 + else
al@20905 425 + {
al@20905 426 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 427 + {
al@20905 428 + png_push_save_buffer(png_ptr);
al@20905 429 + return;
al@20905 430 + }
al@20905 431 + png_warning(png_ptr, "Skipped (ignored) a chunk "
al@20905 432 + "between APNG chunks");
al@20905 433 + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
al@20905 434 + return;
al@20905 435 + }
al@20905 436 +
al@20905 437 + return;
al@20905 438 + }
al@20905 439 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 440 +
al@20905 441 if (chunk_name == png_IDAT)
al@20905 442 {
al@20905 443 if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
al@20905 444 @@ -261,6 +361,9 @@
al@20905 445
al@20905 446 else if (chunk_name == png_IDAT)
al@20905 447 {
al@20905 448 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 449 + png_have_info(png_ptr, info_ptr);
al@20905 450 +#endif
al@20905 451 png_ptr->idat_size = png_ptr->push_length;
al@20905 452 png_ptr->process_mode = PNG_READ_IDAT_MODE;
al@20905 453 png_push_have_info(png_ptr, info_ptr);
al@20905 454 @@ -406,6 +509,30 @@
al@20905 455 png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
al@20905 456 }
al@20905 457 #endif
al@20905 458 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 459 + else if (chunk_name == png_acTL)
al@20905 460 + {
al@20905 461 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 462 + {
al@20905 463 + png_push_save_buffer(png_ptr);
al@20905 464 + return;
al@20905 465 + }
al@20905 466 +
al@20905 467 + png_handle_acTL(png_ptr, info_ptr, png_ptr->push_length);
al@20905 468 + }
al@20905 469 +
al@20905 470 + else if (chunk_name == png_fcTL)
al@20905 471 + {
al@20905 472 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 473 + {
al@20905 474 + png_push_save_buffer(png_ptr);
al@20905 475 + return;
al@20905 476 + }
al@20905 477 +
al@20905 478 + png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
al@20905 479 + }
al@20905 480 +
al@20905 481 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 482
al@20905 483 else
al@20905 484 {
al@20905 485 @@ -539,7 +666,11 @@
al@20905 486 png_byte chunk_tag[4];
al@20905 487
al@20905 488 /* TODO: this code can be commoned up with the same code in push_read */
al@20905 489 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 490 + PNG_PUSH_SAVE_BUFFER_IF_LT(12)
al@20905 491 +#else
al@20905 492 PNG_PUSH_SAVE_BUFFER_IF_LT(8)
al@20905 493 +#endif
al@20905 494 png_push_fill_buffer(png_ptr, chunk_length, 4);
al@20905 495 png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
al@20905 496 png_reset_crc(png_ptr);
al@20905 497 @@ -547,17 +678,64 @@
al@20905 498 png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
al@20905 499 png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
al@20905 500
al@20905 501 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 502 + if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
al@20905 503 + {
al@20905 504 + if (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)
al@20905 505 + {
al@20905 506 + png_ptr->process_mode = PNG_READ_CHUNK_MODE;
al@20905 507 + if (png_ptr->frame_end_fn != NULL)
al@20905 508 + (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
al@20905 509 + png_ptr->num_frames_read++;
al@20905 510 + return;
al@20905 511 + }
al@20905 512 + else
al@20905 513 + {
al@20905 514 + if (png_ptr->chunk_name == png_IEND)
al@20905 515 + png_error(png_ptr, "Not enough image data");
al@20905 516 + if (png_ptr->push_length + 4 > png_ptr->buffer_size)
al@20905 517 + {
al@20905 518 + png_push_save_buffer(png_ptr);
al@20905 519 + return;
al@20905 520 + }
al@20905 521 + png_warning(png_ptr, "Skipping (ignoring) a chunk between "
al@20905 522 + "APNG chunks");
al@20905 523 + png_crc_finish(png_ptr, png_ptr->push_length);
al@20905 524 + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
al@20905 525 + return;
al@20905 526 + }
al@20905 527 + }
al@20905 528 + else
al@20905 529 +#endif
al@20905 530 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 531 + if (png_ptr->chunk_name != png_IDAT && png_ptr->num_frames_read == 0)
al@20905 532 +#else
al@20905 533 if (png_ptr->chunk_name != png_IDAT)
al@20905 534 +#endif
al@20905 535 {
al@20905 536 png_ptr->process_mode = PNG_READ_CHUNK_MODE;
al@20905 537
al@20905 538 if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
al@20905 539 png_error(png_ptr, "Not enough compressed data");
al@20905 540
al@20905 541 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 542 + if (png_ptr->frame_end_fn != NULL)
al@20905 543 + (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
al@20905 544 + png_ptr->num_frames_read++;
al@20905 545 +#endif
al@20905 546 +
al@20905 547 return;
al@20905 548 }
al@20905 549
al@20905 550 png_ptr->idat_size = png_ptr->push_length;
al@20905 551 +
al@20905 552 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 553 + if (png_ptr->num_frames_read > 0)
al@20905 554 + {
al@20905 555 + png_ensure_sequence_number(png_ptr, 4);
al@20905 556 + png_ptr->idat_size -= 4;
al@20905 557 + }
al@20905 558 +#endif
al@20905 559 }
al@20905 560
al@20905 561 if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
al@20905 562 @@ -631,6 +809,15 @@
al@20905 563 if (!(buffer_length > 0) || buffer == NULL)
al@20905 564 png_error(png_ptr, "No IDAT data (internal error)");
al@20905 565
al@20905 566 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 567 + /* If the app is not APNG-aware, decode only the first frame */
al@20905 568 + if (!(png_ptr->apng_flags & PNG_APNG_APP) && png_ptr->num_frames_read > 0)
al@20905 569 + {
al@20905 570 + png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
al@20905 571 + return;
al@20905 572 + }
al@20905 573 +#endif
al@20905 574 +
al@20905 575 /* This routine must process all the data it has been given
al@20905 576 * before returning, calling the row callback as required to
al@20905 577 * handle the uncompressed results.
al@20905 578 @@ -1085,6 +1272,18 @@
al@20905 579 png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
al@20905 580 }
al@20905 581
al@20905 582 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 583 +void PNGAPI
al@20905 584 +png_set_progressive_frame_fn(png_structp png_ptr,
al@20905 585 + png_progressive_frame_ptr frame_info_fn,
al@20905 586 + png_progressive_frame_ptr frame_end_fn)
al@20905 587 +{
al@20905 588 + png_ptr->frame_info_fn = frame_info_fn;
al@20905 589 + png_ptr->frame_end_fn = frame_end_fn;
al@20905 590 + png_ptr->apng_flags |= PNG_APNG_APP;
al@20905 591 +}
al@20905 592 +#endif
al@20905 593 +
al@20905 594 png_voidp PNGAPI
al@20905 595 png_get_progressive_ptr(png_const_structrp png_ptr)
al@20905 596 {
al@20905 597 diff -Naru libpng-1.6.35.org/pngpriv.h libpng-1.6.35/pngpriv.h
al@20905 598 --- libpng-1.6.35.org/pngpriv.h 2018-07-21 19:16:37.185142931 +0900
al@20905 599 +++ libpng-1.6.35/pngpriv.h 2018-07-21 19:16:16.226356026 +0900
al@20905 600 @@ -634,6 +634,10 @@
al@20905 601 #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
al@20905 602 /* 0x4000U (unused) */
al@20905 603 #define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
al@20905 604 +#ifdef PNG_APNG_SUPPORTED
al@20905 605 +#define PNG_HAVE_acTL 0x10000U
al@20905 606 +#define PNG_HAVE_fcTL 0x20000U
al@20905 607 +#endif
al@20905 608
al@20905 609 /* Flags for the transformations the PNG library does on the image data */
al@20905 610 #define PNG_BGR 0x0001U
al@20905 611 @@ -870,6 +874,16 @@
al@20905 612 #define png_tRNS PNG_U32(116, 82, 78, 83)
al@20905 613 #define png_zTXt PNG_U32(122, 84, 88, 116)
al@20905 614
al@20905 615 +#ifdef PNG_APNG_SUPPORTED
al@20905 616 +#define png_acTL PNG_U32( 97, 99, 84, 76)
al@20905 617 +#define png_fcTL PNG_U32(102, 99, 84, 76)
al@20905 618 +#define png_fdAT PNG_U32(102, 100, 65, 84)
al@20905 619 +
al@20905 620 +/* For png_struct.apng_flags: */
al@20905 621 +#define PNG_FIRST_FRAME_HIDDEN 0x0001U
al@20905 622 +#define PNG_APNG_APP 0x0002U
al@20905 623 +#endif
al@20905 624 +
al@20905 625 /* The following will work on (signed char*) strings, whereas the get_uint_32
al@20905 626 * macro will fail on top-bit-set values because of the sign extension.
al@20905 627 */
al@20905 628 @@ -1641,6 +1655,47 @@
al@20905 629 */
al@20905 630 #endif
al@20905 631
al@20905 632 +#ifdef PNG_APNG_SUPPORTED
al@20905 633 +PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
al@20905 634 + png_uint_32 width, png_uint_32 height,
al@20905 635 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 636 + png_uint_16 delay_num, png_uint_16 delay_den,
al@20905 637 + png_byte dispose_op, png_byte blend_op), PNG_EMPTY);
al@20905 638 +
al@20905 639 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 640 +PNG_INTERNAL_FUNCTION(void,png_handle_acTL,(png_structp png_ptr, png_infop info_ptr,
al@20905 641 + png_uint_32 length),PNG_EMPTY);
al@20905 642 +PNG_INTERNAL_FUNCTION(void,png_handle_fcTL,(png_structp png_ptr, png_infop info_ptr,
al@20905 643 + png_uint_32 length),PNG_EMPTY);
al@20905 644 +PNG_INTERNAL_FUNCTION(void,png_handle_fdAT,(png_structp png_ptr, png_infop info_ptr,
al@20905 645 + png_uint_32 length),PNG_EMPTY);
al@20905 646 +PNG_INTERNAL_FUNCTION(void,png_have_info,(png_structp png_ptr, png_infop info_ptr),PNG_EMPTY);
al@20905 647 +PNG_INTERNAL_FUNCTION(void,png_ensure_sequence_number,(png_structp png_ptr,
al@20905 648 + png_uint_32 length),PNG_EMPTY);
al@20905 649 +PNG_INTERNAL_FUNCTION(void,png_read_reset,(png_structp png_ptr),PNG_EMPTY);
al@20905 650 +PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
al@20905 651 + png_infop info_ptr),PNG_EMPTY);
al@20905 652 +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
al@20905 653 +PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),PNG_EMPTY);
al@20905 654 +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
al@20905 655 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 656 +
al@20905 657 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 658 +PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
al@20905 659 + png_uint_32 num_frames, png_uint_32 num_plays),PNG_EMPTY);
al@20905 660 +PNG_INTERNAL_FUNCTION(void,png_write_fcTL,(png_structp png_ptr,
al@20905 661 + png_uint_32 width, png_uint_32 height,
al@20905 662 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 663 + png_uint_16 delay_num, png_uint_16 delay_den,
al@20905 664 + png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
al@20905 665 +PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
al@20905 666 + png_const_bytep data, png_size_t length),PNG_EMPTY);
al@20905 667 +PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
al@20905 668 +PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
al@20905 669 + png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
al@20905 670 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 671 +#endif /* PNG_APNG_SUPPORTED */
al@20905 672 +
al@20905 673 /* Added at libpng version 1.4.0 */
al@20905 674 #ifdef PNG_COLORSPACE_SUPPORTED
al@20905 675 /* These internal functions are for maintaining the colorspace structure within
al@20905 676 diff -Naru libpng-1.6.35.org/pngread.c libpng-1.6.35/pngread.c
al@20905 677 --- libpng-1.6.35.org/pngread.c 2018-07-21 19:16:37.186143016 +0900
al@20905 678 +++ libpng-1.6.35/pngread.c 2018-07-21 19:16:16.224355855 +0900
al@20905 679 @@ -161,6 +161,9 @@
al@20905 680
al@20905 681 else if (chunk_name == png_IDAT)
al@20905 682 {
al@20905 683 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 684 + png_have_info(png_ptr, info_ptr);
al@20905 685 +#endif
al@20905 686 png_ptr->idat_size = length;
al@20905 687 break;
al@20905 688 }
al@20905 689 @@ -255,6 +258,17 @@
al@20905 690 png_handle_iTXt(png_ptr, info_ptr, length);
al@20905 691 #endif
al@20905 692
al@20905 693 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 694 + else if (chunk_name == png_acTL)
al@20905 695 + png_handle_acTL(png_ptr, info_ptr, length);
al@20905 696 +
al@20905 697 + else if (chunk_name == png_fcTL)
al@20905 698 + png_handle_fcTL(png_ptr, info_ptr, length);
al@20905 699 +
al@20905 700 + else if (chunk_name == png_fdAT)
al@20905 701 + png_handle_fdAT(png_ptr, info_ptr, length);
al@20905 702 +#endif
al@20905 703 +
al@20905 704 else
al@20905 705 png_handle_unknown(png_ptr, info_ptr, length,
al@20905 706 PNG_HANDLE_CHUNK_AS_DEFAULT);
al@20905 707 @@ -262,6 +276,72 @@
al@20905 708 }
al@20905 709 #endif /* SEQUENTIAL_READ */
al@20905 710
al@20905 711 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 712 +void PNGAPI
al@20905 713 +png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
al@20905 714 +{
al@20905 715 + png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
al@20905 716 +
al@20905 717 + png_debug(0, "Reading frame head");
al@20905 718 +
al@20905 719 + if (!(png_ptr->mode & PNG_HAVE_acTL))
al@20905 720 + png_error(png_ptr, "attempt to png_read_frame_head() but "
al@20905 721 + "no acTL present");
al@20905 722 +
al@20905 723 + /* do nothing for the main IDAT */
al@20905 724 + if (png_ptr->num_frames_read == 0)
al@20905 725 + return;
al@20905 726 +
al@20905 727 + png_read_reset(png_ptr);
al@20905 728 + png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
al@20905 729 + png_ptr->mode &= ~PNG_HAVE_fcTL;
al@20905 730 +
al@20905 731 + have_chunk_after_DAT = 0;
al@20905 732 + for (;;)
al@20905 733 + {
al@20905 734 + png_uint_32 length = png_read_chunk_header(png_ptr);
al@20905 735 +
al@20905 736 + if (png_ptr->chunk_name == png_IDAT)
al@20905 737 + {
al@20905 738 + /* discard trailing IDATs for the first frame */
al@20905 739 + if (have_chunk_after_DAT || png_ptr->num_frames_read > 1)
al@20905 740 + png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
al@20905 741 + png_crc_finish(png_ptr, length);
al@20905 742 + }
al@20905 743 +
al@20905 744 + else if (png_ptr->chunk_name == png_fcTL)
al@20905 745 + {
al@20905 746 + png_handle_fcTL(png_ptr, info_ptr, length);
al@20905 747 + have_chunk_after_DAT = 1;
al@20905 748 + }
al@20905 749 +
al@20905 750 + else if (png_ptr->chunk_name == png_fdAT)
al@20905 751 + {
al@20905 752 + png_ensure_sequence_number(png_ptr, length);
al@20905 753 +
al@20905 754 + /* discard trailing fdATs for frames other than the first */
al@20905 755 + if (!have_chunk_after_DAT && png_ptr->num_frames_read > 1)
al@20905 756 + png_crc_finish(png_ptr, length - 4);
al@20905 757 + else if(png_ptr->mode & PNG_HAVE_fcTL)
al@20905 758 + {
al@20905 759 + png_ptr->idat_size = length - 4;
al@20905 760 + png_ptr->mode |= PNG_HAVE_IDAT;
al@20905 761 +
al@20905 762 + break;
al@20905 763 + }
al@20905 764 + else
al@20905 765 + png_error(png_ptr, "png_read_frame_head(): out of place fdAT");
al@20905 766 + }
al@20905 767 + else
al@20905 768 + {
al@20905 769 + png_warning(png_ptr, "Skipped (ignored) a chunk "
al@20905 770 + "between APNG chunks");
al@20905 771 + png_crc_finish(png_ptr, length);
al@20905 772 + }
al@20905 773 + }
al@20905 774 +}
al@20905 775 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 776 +
al@20905 777 /* Optional call to update the users info_ptr structure */
al@20905 778 void PNGAPI
al@20905 779 png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
al@20905 780 diff -Naru libpng-1.6.35.org/pngrutil.c libpng-1.6.35/pngrutil.c
al@20905 781 --- libpng-1.6.35.org/pngrutil.c 2018-07-21 19:16:37.187143101 +0900
al@20905 782 +++ libpng-1.6.35/pngrutil.c 2018-07-21 19:16:16.220355514 +0900
al@20905 783 @@ -865,6 +865,11 @@
al@20905 784 filter_type = buf[11];
al@20905 785 interlace_type = buf[12];
al@20905 786
al@20905 787 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 788 + png_ptr->first_frame_width = width;
al@20905 789 + png_ptr->first_frame_height = height;
al@20905 790 +#endif
al@20905 791 +
al@20905 792 /* Set internal variables */
al@20905 793 png_ptr->width = width;
al@20905 794 png_ptr->height = height;
al@20905 795 @@ -2858,6 +2863,179 @@
al@20905 796 }
al@20905 797 #endif
al@20905 798
al@20905 799 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 800 +void /* PRIVATE */
al@20905 801 +png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
al@20905 802 +{
al@20905 803 + png_byte data[8];
al@20905 804 + png_uint_32 num_frames;
al@20905 805 + png_uint_32 num_plays;
al@20905 806 + png_uint_32 didSet;
al@20905 807 +
al@20905 808 + png_debug(1, "in png_handle_acTL");
al@20905 809 +
al@20905 810 + if (!(png_ptr->mode & PNG_HAVE_IHDR))
al@20905 811 + {
al@20905 812 + png_error(png_ptr, "Missing IHDR before acTL");
al@20905 813 + }
al@20905 814 + else if (png_ptr->mode & PNG_HAVE_IDAT)
al@20905 815 + {
al@20905 816 + png_warning(png_ptr, "Invalid acTL after IDAT skipped");
al@20905 817 + png_crc_finish(png_ptr, length);
al@20905 818 + return;
al@20905 819 + }
al@20905 820 + else if (png_ptr->mode & PNG_HAVE_acTL)
al@20905 821 + {
al@20905 822 + png_warning(png_ptr, "Duplicate acTL skipped");
al@20905 823 + png_crc_finish(png_ptr, length);
al@20905 824 + return;
al@20905 825 + }
al@20905 826 + else if (length != 8)
al@20905 827 + {
al@20905 828 + png_warning(png_ptr, "acTL with invalid length skipped");
al@20905 829 + png_crc_finish(png_ptr, length);
al@20905 830 + return;
al@20905 831 + }
al@20905 832 +
al@20905 833 + png_crc_read(png_ptr, data, 8);
al@20905 834 + png_crc_finish(png_ptr, 0);
al@20905 835 +
al@20905 836 + num_frames = png_get_uint_31(png_ptr, data);
al@20905 837 + num_plays = png_get_uint_31(png_ptr, data + 4);
al@20905 838 +
al@20905 839 + /* the set function will do error checking on num_frames */
al@20905 840 + didSet = png_set_acTL(png_ptr, info_ptr, num_frames, num_plays);
al@20905 841 + if(didSet)
al@20905 842 + png_ptr->mode |= PNG_HAVE_acTL;
al@20905 843 +}
al@20905 844 +
al@20905 845 +void /* PRIVATE */
al@20905 846 +png_handle_fcTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
al@20905 847 +{
al@20905 848 + png_byte data[22];
al@20905 849 + png_uint_32 width;
al@20905 850 + png_uint_32 height;
al@20905 851 + png_uint_32 x_offset;
al@20905 852 + png_uint_32 y_offset;
al@20905 853 + png_uint_16 delay_num;
al@20905 854 + png_uint_16 delay_den;
al@20905 855 + png_byte dispose_op;
al@20905 856 + png_byte blend_op;
al@20905 857 +
al@20905 858 + png_debug(1, "in png_handle_fcTL");
al@20905 859 +
al@20905 860 + png_ensure_sequence_number(png_ptr, length);
al@20905 861 +
al@20905 862 + if (!(png_ptr->mode & PNG_HAVE_IHDR))
al@20905 863 + {
al@20905 864 + png_error(png_ptr, "Missing IHDR before fcTL");
al@20905 865 + }
al@20905 866 + else if (png_ptr->mode & PNG_HAVE_IDAT)
al@20905 867 + {
al@20905 868 + /* for any frames other then the first this message may be misleading,
al@20905 869 + * but correct. PNG_HAVE_IDAT is unset before the frame head is read
al@20905 870 + * i can't think of a better message */
al@20905 871 + png_warning(png_ptr, "Invalid fcTL after IDAT skipped");
al@20905 872 + png_crc_finish(png_ptr, length-4);
al@20905 873 + return;
al@20905 874 + }
al@20905 875 + else if (png_ptr->mode & PNG_HAVE_fcTL)
al@20905 876 + {
al@20905 877 + png_warning(png_ptr, "Duplicate fcTL within one frame skipped");
al@20905 878 + png_crc_finish(png_ptr, length-4);
al@20905 879 + return;
al@20905 880 + }
al@20905 881 + else if (length != 26)
al@20905 882 + {
al@20905 883 + png_warning(png_ptr, "fcTL with invalid length skipped");
al@20905 884 + png_crc_finish(png_ptr, length-4);
al@20905 885 + return;
al@20905 886 + }
al@20905 887 +
al@20905 888 + png_crc_read(png_ptr, data, 22);
al@20905 889 + png_crc_finish(png_ptr, 0);
al@20905 890 +
al@20905 891 + width = png_get_uint_31(png_ptr, data);
al@20905 892 + height = png_get_uint_31(png_ptr, data + 4);
al@20905 893 + x_offset = png_get_uint_31(png_ptr, data + 8);
al@20905 894 + y_offset = png_get_uint_31(png_ptr, data + 12);
al@20905 895 + delay_num = png_get_uint_16(data + 16);
al@20905 896 + delay_den = png_get_uint_16(data + 18);
al@20905 897 + dispose_op = data[20];
al@20905 898 + blend_op = data[21];
al@20905 899 +
al@20905 900 + if (png_ptr->num_frames_read == 0 && (x_offset != 0 || y_offset != 0))
al@20905 901 + {
al@20905 902 + png_warning(png_ptr, "fcTL for the first frame must have zero offset");
al@20905 903 + return;
al@20905 904 + }
al@20905 905 +
al@20905 906 + if (info_ptr != NULL)
al@20905 907 + {
al@20905 908 + if (png_ptr->num_frames_read == 0 &&
al@20905 909 + (width != info_ptr->width || height != info_ptr->height))
al@20905 910 + {
al@20905 911 + png_warning(png_ptr, "size in first frame's fcTL must match "
al@20905 912 + "the size in IHDR");
al@20905 913 + return;
al@20905 914 + }
al@20905 915 +
al@20905 916 + /* The set function will do more error checking */
al@20905 917 + png_set_next_frame_fcTL(png_ptr, info_ptr, width, height,
al@20905 918 + x_offset, y_offset, delay_num, delay_den,
al@20905 919 + dispose_op, blend_op);
al@20905 920 +
al@20905 921 + png_read_reinit(png_ptr, info_ptr);
al@20905 922 +
al@20905 923 + png_ptr->mode |= PNG_HAVE_fcTL;
al@20905 924 + }
al@20905 925 +}
al@20905 926 +
al@20905 927 +void /* PRIVATE */
al@20905 928 +png_have_info(png_structp png_ptr, png_infop info_ptr)
al@20905 929 +{
al@20905 930 + if((info_ptr->valid & PNG_INFO_acTL) && !(info_ptr->valid & PNG_INFO_fcTL))
al@20905 931 + {
al@20905 932 + png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
al@20905 933 + info_ptr->num_frames++;
al@20905 934 + }
al@20905 935 +}
al@20905 936 +
al@20905 937 +void /* PRIVATE */
al@20905 938 +png_handle_fdAT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
al@20905 939 +{
al@20905 940 + png_ensure_sequence_number(png_ptr, length);
al@20905 941 +
al@20905 942 + /* This function is only called from png_read_end(), png_read_info(),
al@20905 943 + * and png_push_read_chunk() which means that:
al@20905 944 + * - the user doesn't want to read this frame
al@20905 945 + * - or this is an out-of-place fdAT
al@20905 946 + * in either case it is safe to ignore the chunk with a warning */
al@20905 947 + png_warning(png_ptr, "ignoring fdAT chunk");
al@20905 948 + png_crc_finish(png_ptr, length - 4);
al@20905 949 + PNG_UNUSED(info_ptr)
al@20905 950 +}
al@20905 951 +
al@20905 952 +void /* PRIVATE */
al@20905 953 +png_ensure_sequence_number(png_structp png_ptr, png_uint_32 length)
al@20905 954 +{
al@20905 955 + png_byte data[4];
al@20905 956 + png_uint_32 sequence_number;
al@20905 957 +
al@20905 958 + if (length < 4)
al@20905 959 + png_error(png_ptr, "invalid fcTL or fdAT chunk found");
al@20905 960 +
al@20905 961 + png_crc_read(png_ptr, data, 4);
al@20905 962 + sequence_number = png_get_uint_31(png_ptr, data);
al@20905 963 +
al@20905 964 + if (sequence_number != png_ptr->next_seq_num)
al@20905 965 + png_error(png_ptr, "fcTL or fdAT chunk with out-of-order sequence "
al@20905 966 + "number found");
al@20905 967 +
al@20905 968 + png_ptr->next_seq_num++;
al@20905 969 +}
al@20905 970 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 971 +
al@20905 972 #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
al@20905 973 /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
al@20905 974 static int
al@20905 975 @@ -4166,7 +4344,38 @@
al@20905 976 {
al@20905 977 uInt avail_in;
al@20905 978 png_bytep buffer;
al@20905 979 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 980 + png_uint_32 bytes_to_skip = 0;
al@20905 981 +
al@20905 982 + while (png_ptr->idat_size == 0 || bytes_to_skip != 0)
al@20905 983 + {
al@20905 984 + png_crc_finish(png_ptr, bytes_to_skip);
al@20905 985 + bytes_to_skip = 0;
al@20905 986
al@20905 987 + png_ptr->idat_size = png_read_chunk_header(png_ptr);
al@20905 988 + if (png_ptr->num_frames_read == 0)
al@20905 989 + {
al@20905 990 + if (png_ptr->chunk_name != png_IDAT)
al@20905 991 + png_error(png_ptr, "Not enough image data");
al@20905 992 + }
al@20905 993 + else
al@20905 994 + {
al@20905 995 + if (png_ptr->chunk_name == png_IEND)
al@20905 996 + png_error(png_ptr, "Not enough image data");
al@20905 997 + if (png_ptr->chunk_name != png_fdAT)
al@20905 998 + {
al@20905 999 + png_warning(png_ptr, "Skipped (ignored) a chunk "
al@20905 1000 + "between APNG chunks");
al@20905 1001 + bytes_to_skip = png_ptr->idat_size;
al@20905 1002 + continue;
al@20905 1003 + }
al@20905 1004 +
al@20905 1005 + png_ensure_sequence_number(png_ptr, png_ptr->idat_size);
al@20905 1006 +
al@20905 1007 + png_ptr->idat_size -= 4;
al@20905 1008 + }
al@20905 1009 + }
al@20905 1010 +#else
al@20905 1011 while (png_ptr->idat_size == 0)
al@20905 1012 {
al@20905 1013 png_crc_finish(png_ptr, 0);
al@20905 1014 @@ -4178,7 +4387,7 @@
al@20905 1015 if (png_ptr->chunk_name != png_IDAT)
al@20905 1016 png_error(png_ptr, "Not enough image data");
al@20905 1017 }
al@20905 1018 -
al@20905 1019 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 1020 avail_in = png_ptr->IDAT_read_size;
al@20905 1021
al@20905 1022 if (avail_in > png_ptr->idat_size)
al@20905 1023 @@ -4241,6 +4450,9 @@
al@20905 1024
al@20905 1025 png_ptr->mode |= PNG_AFTER_IDAT;
al@20905 1026 png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
al@20905 1027 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 1028 + png_ptr->num_frames_read++;
al@20905 1029 +#endif
al@20905 1030
al@20905 1031 if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
al@20905 1032 png_chunk_benign_error(png_ptr, "Extra compressed data");
al@20905 1033 @@ -4679,4 +4891,80 @@
al@20905 1034
al@20905 1035 png_ptr->flags |= PNG_FLAG_ROW_INIT;
al@20905 1036 }
al@20905 1037 +
al@20905 1038 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 1039 +/* This function is to be called after the main IDAT set has been read and
al@20905 1040 + * before a new IDAT is read. It resets some parts of png_ptr
al@20905 1041 + * to make them usable by the read functions again */
al@20905 1042 +void /* PRIVATE */
al@20905 1043 +png_read_reset(png_structp png_ptr)
al@20905 1044 +{
al@20905 1045 + png_ptr->mode &= ~PNG_HAVE_IDAT;
al@20905 1046 + png_ptr->mode &= ~PNG_AFTER_IDAT;
al@20905 1047 + png_ptr->row_number = 0;
al@20905 1048 + png_ptr->pass = 0;
al@20905 1049 +}
al@20905 1050 +
al@20905 1051 +void /* PRIVATE */
al@20905 1052 +png_read_reinit(png_structp png_ptr, png_infop info_ptr)
al@20905 1053 +{
al@20905 1054 + png_ptr->width = info_ptr->next_frame_width;
al@20905 1055 + png_ptr->height = info_ptr->next_frame_height;
al@20905 1056 + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width);
al@20905 1057 + png_ptr->info_rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,
al@20905 1058 + png_ptr->width);
al@20905 1059 + if (png_ptr->prev_row)
al@20905 1060 + memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
al@20905 1061 +}
al@20905 1062 +
al@20905 1063 +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
al@20905 1064 +/* same as png_read_reset() but for the progressive reader */
al@20905 1065 +void /* PRIVATE */
al@20905 1066 +png_progressive_read_reset(png_structp png_ptr)
al@20905 1067 +{
al@20905 1068 +#ifdef PNG_READ_INTERLACING_SUPPORTED
al@20905 1069 + /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
al@20905 1070 +
al@20905 1071 + /* Start of interlace block */
al@20905 1072 + const int png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
al@20905 1073 +
al@20905 1074 + /* Offset to next interlace block */
al@20905 1075 + const int png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
al@20905 1076 +
al@20905 1077 + /* Start of interlace block in the y direction */
al@20905 1078 + const int png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
al@20905 1079 +
al@20905 1080 + /* Offset to next interlace block in the y direction */
al@20905 1081 + const int png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
al@20905 1082 +
al@20905 1083 + if (png_ptr->interlaced)
al@20905 1084 + {
al@20905 1085 + if (!(png_ptr->transformations & PNG_INTERLACE))
al@20905 1086 + png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
al@20905 1087 + png_pass_ystart[0]) / png_pass_yinc[0];
al@20905 1088 + else
al@20905 1089 + png_ptr->num_rows = png_ptr->height;
al@20905 1090 +
al@20905 1091 + png_ptr->iwidth = (png_ptr->width +
al@20905 1092 + png_pass_inc[png_ptr->pass] - 1 -
al@20905 1093 + png_pass_start[png_ptr->pass]) /
al@20905 1094 + png_pass_inc[png_ptr->pass];
al@20905 1095 + }
al@20905 1096 + else
al@20905 1097 +#endif /* PNG_READ_INTERLACING_SUPPORTED */
al@20905 1098 + {
al@20905 1099 + png_ptr->num_rows = png_ptr->height;
al@20905 1100 + png_ptr->iwidth = png_ptr->width;
al@20905 1101 + }
al@20905 1102 + png_ptr->flags &= ~PNG_FLAG_ZSTREAM_ENDED;
al@20905 1103 + if (inflateReset(&(png_ptr->zstream)) != Z_OK)
al@20905 1104 + png_error(png_ptr, "inflateReset failed");
al@20905 1105 + png_ptr->zstream.avail_in = 0;
al@20905 1106 + png_ptr->zstream.next_in = 0;
al@20905 1107 + png_ptr->zstream.next_out = png_ptr->row_buf;
al@20905 1108 + png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
al@20905 1109 + png_ptr->iwidth) + 1;
al@20905 1110 +}
al@20905 1111 +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
al@20905 1112 +#endif /* PNG_READ_APNG_SUPPORTED */
al@20905 1113 #endif /* READ */
al@20905 1114 diff -Naru libpng-1.6.35.org/pngset.c libpng-1.6.35/pngset.c
al@20905 1115 --- libpng-1.6.35.org/pngset.c 2018-07-21 19:16:37.188143186 +0900
al@20905 1116 +++ libpng-1.6.35/pngset.c 2018-07-21 19:16:16.256358584 +0900
al@20905 1117 @@ -288,6 +288,11 @@
al@20905 1118 info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
al@20905 1119
al@20905 1120 info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
al@20905 1121 +
al@20905 1122 +#ifdef PNG_APNG_SUPPORTED
al@20905 1123 + /* for non-animated png. this may be overwritten from an acTL chunk later */
al@20905 1124 + info_ptr->num_frames = 1;
al@20905 1125 +#endif
al@20905 1126 }
al@20905 1127
al@20905 1128 #ifdef PNG_oFFs_SUPPORTED
al@20905 1129 @@ -1158,6 +1163,147 @@
al@20905 1130 }
al@20905 1131 #endif /* sPLT */
al@20905 1132
al@20905 1133 +#ifdef PNG_APNG_SUPPORTED
al@20905 1134 +png_uint_32 PNGAPI
al@20905 1135 +png_set_acTL(png_structp png_ptr, png_infop info_ptr,
al@20905 1136 + png_uint_32 num_frames, png_uint_32 num_plays)
al@20905 1137 +{
al@20905 1138 + png_debug1(1, "in %s storage function", "acTL");
al@20905 1139 +
al@20905 1140 + if (png_ptr == NULL || info_ptr == NULL)
al@20905 1141 + {
al@20905 1142 + png_warning(png_ptr,
al@20905 1143 + "Call to png_set_acTL() with NULL png_ptr "
al@20905 1144 + "or info_ptr ignored");
al@20905 1145 + return (0);
al@20905 1146 + }
al@20905 1147 + if (num_frames == 0)
al@20905 1148 + {
al@20905 1149 + png_warning(png_ptr,
al@20905 1150 + "Ignoring attempt to set acTL with num_frames zero");
al@20905 1151 + return (0);
al@20905 1152 + }
al@20905 1153 + if (num_frames > PNG_UINT_31_MAX)
al@20905 1154 + {
al@20905 1155 + png_warning(png_ptr,
al@20905 1156 + "Ignoring attempt to set acTL with num_frames > 2^31-1");
al@20905 1157 + return (0);
al@20905 1158 + }
al@20905 1159 + if (num_plays > PNG_UINT_31_MAX)
al@20905 1160 + {
al@20905 1161 + png_warning(png_ptr,
al@20905 1162 + "Ignoring attempt to set acTL with num_plays "
al@20905 1163 + "> 2^31-1");
al@20905 1164 + return (0);
al@20905 1165 + }
al@20905 1166 +
al@20905 1167 + info_ptr->num_frames = num_frames;
al@20905 1168 + info_ptr->num_plays = num_plays;
al@20905 1169 +
al@20905 1170 + info_ptr->valid |= PNG_INFO_acTL;
al@20905 1171 +
al@20905 1172 + return (1);
al@20905 1173 +}
al@20905 1174 +
al@20905 1175 +/* delay_num and delay_den can hold any 16-bit values including zero */
al@20905 1176 +png_uint_32 PNGAPI
al@20905 1177 +png_set_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
al@20905 1178 + png_uint_32 width, png_uint_32 height,
al@20905 1179 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 1180 + png_uint_16 delay_num, png_uint_16 delay_den,
al@20905 1181 + png_byte dispose_op, png_byte blend_op)
al@20905 1182 +{
al@20905 1183 + png_debug1(1, "in %s storage function", "fcTL");
al@20905 1184 +
al@20905 1185 + if (png_ptr == NULL || info_ptr == NULL)
al@20905 1186 + {
al@20905 1187 + png_warning(png_ptr,
al@20905 1188 + "Call to png_set_fcTL() with NULL png_ptr or info_ptr "
al@20905 1189 + "ignored");
al@20905 1190 + return (0);
al@20905 1191 + }
al@20905 1192 +
al@20905 1193 + png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
al@20905 1194 + delay_num, delay_den, dispose_op, blend_op);
al@20905 1195 +
al@20905 1196 + if (blend_op == PNG_BLEND_OP_OVER)
al@20905 1197 + {
al@20905 1198 + if (!(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) &&
al@20905 1199 + !(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
al@20905 1200 + {
al@20905 1201 + png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
al@20905 1202 + "and wasteful for opaque images, ignored");
al@20905 1203 + blend_op = PNG_BLEND_OP_SOURCE;
al@20905 1204 + }
al@20905 1205 + }
al@20905 1206 +
al@20905 1207 + info_ptr->next_frame_width = width;
al@20905 1208 + info_ptr->next_frame_height = height;
al@20905 1209 + info_ptr->next_frame_x_offset = x_offset;
al@20905 1210 + info_ptr->next_frame_y_offset = y_offset;
al@20905 1211 + info_ptr->next_frame_delay_num = delay_num;
al@20905 1212 + info_ptr->next_frame_delay_den = delay_den;
al@20905 1213 + info_ptr->next_frame_dispose_op = dispose_op;
al@20905 1214 + info_ptr->next_frame_blend_op = blend_op;
al@20905 1215 +
al@20905 1216 + info_ptr->valid |= PNG_INFO_fcTL;
al@20905 1217 +
al@20905 1218 + return (1);
al@20905 1219 +}
al@20905 1220 +
al@20905 1221 +void /* PRIVATE */
al@20905 1222 +png_ensure_fcTL_is_valid(png_structp png_ptr,
al@20905 1223 + png_uint_32 width, png_uint_32 height,
al@20905 1224 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 1225 + png_uint_16 delay_num, png_uint_16 delay_den,
al@20905 1226 + png_byte dispose_op, png_byte blend_op)
al@20905 1227 +{
al@20905 1228 + if (width == 0 || width > PNG_UINT_31_MAX)
al@20905 1229 + png_error(png_ptr, "invalid width in fcTL (> 2^31-1)");
al@20905 1230 + if (height == 0 || height > PNG_UINT_31_MAX)
al@20905 1231 + png_error(png_ptr, "invalid height in fcTL (> 2^31-1)");
al@20905 1232 + if (x_offset > PNG_UINT_31_MAX)
al@20905 1233 + png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
al@20905 1234 + if (y_offset > PNG_UINT_31_MAX)
al@20905 1235 + png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
al@20905 1236 + if (width + x_offset > png_ptr->first_frame_width ||
al@20905 1237 + height + y_offset > png_ptr->first_frame_height)
al@20905 1238 + png_error(png_ptr, "dimensions of a frame are greater than"
al@20905 1239 + "the ones in IHDR");
al@20905 1240 +
al@20905 1241 + if (dispose_op != PNG_DISPOSE_OP_NONE &&
al@20905 1242 + dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
al@20905 1243 + dispose_op != PNG_DISPOSE_OP_PREVIOUS)
al@20905 1244 + png_error(png_ptr, "invalid dispose_op in fcTL");
al@20905 1245 +
al@20905 1246 + if (blend_op != PNG_BLEND_OP_SOURCE &&
al@20905 1247 + blend_op != PNG_BLEND_OP_OVER)
al@20905 1248 + png_error(png_ptr, "invalid blend_op in fcTL");
al@20905 1249 +
al@20905 1250 + PNG_UNUSED(delay_num)
al@20905 1251 + PNG_UNUSED(delay_den)
al@20905 1252 +}
al@20905 1253 +
al@20905 1254 +png_uint_32 PNGAPI
al@20905 1255 +png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
al@20905 1256 + png_byte is_hidden)
al@20905 1257 +{
al@20905 1258 + png_debug(1, "in png_first_frame_is_hidden()");
al@20905 1259 +
al@20905 1260 + if (png_ptr == NULL)
al@20905 1261 + return 0;
al@20905 1262 +
al@20905 1263 + if (is_hidden)
al@20905 1264 + png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
al@20905 1265 + else
al@20905 1266 + png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
al@20905 1267 +
al@20905 1268 + PNG_UNUSED(info_ptr)
al@20905 1269 +
al@20905 1270 + return 1;
al@20905 1271 +}
al@20905 1272 +#endif /* PNG_APNG_SUPPORTED */
al@20905 1273 +
al@20905 1274 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
al@20905 1275 static png_byte
al@20905 1276 check_location(png_const_structrp png_ptr, int location)
al@20905 1277 diff -Naru libpng-1.6.35.org/pngstruct.h libpng-1.6.35/pngstruct.h
al@20905 1278 --- libpng-1.6.35.org/pngstruct.h 2018-07-21 19:16:37.188143186 +0900
al@20905 1279 +++ libpng-1.6.35/pngstruct.h 2018-07-21 19:16:16.214355003 +0900
al@20905 1280 @@ -403,6 +403,27 @@
al@20905 1281 png_byte filter_type;
al@20905 1282 #endif
al@20905 1283
al@20905 1284 +#ifdef PNG_APNG_SUPPORTED
al@20905 1285 + png_uint_32 apng_flags;
al@20905 1286 + png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */
al@20905 1287 + png_uint_32 first_frame_width;
al@20905 1288 + png_uint_32 first_frame_height;
al@20905 1289 +
al@20905 1290 +#ifdef PNG_READ_APNG_SUPPORTED
al@20905 1291 + png_uint_32 num_frames_read; /* incremented after all image data of */
al@20905 1292 + /* a frame is read */
al@20905 1293 +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
al@20905 1294 + png_progressive_frame_ptr frame_info_fn; /* frame info read callback */
al@20905 1295 + png_progressive_frame_ptr frame_end_fn; /* frame data read callback */
al@20905 1296 +#endif
al@20905 1297 +#endif
al@20905 1298 +
al@20905 1299 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1300 + png_uint_32 num_frames_to_write;
al@20905 1301 + png_uint_32 num_frames_written;
al@20905 1302 +#endif
al@20905 1303 +#endif /* PNG_APNG_SUPPORTED */
al@20905 1304 +
al@20905 1305 /* New members added in libpng-1.2.0 */
al@20905 1306
al@20905 1307 /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
al@20905 1308 diff -Naru libpng-1.6.35.org/pngtest.c libpng-1.6.35/pngtest.c
al@20905 1309 --- libpng-1.6.35.org/pngtest.c 2018-07-21 19:16:37.188143186 +0900
al@20905 1310 +++ libpng-1.6.35/pngtest.c 2018-07-21 19:16:16.213354917 +0900
al@20905 1311 @@ -875,6 +875,10 @@
al@20905 1312 volatile int num_passes;
al@20905 1313 int pass;
al@20905 1314 int bit_depth, color_type;
al@20905 1315 +#ifdef PNG_APNG_SUPPORTED
al@20905 1316 + png_uint_32 num_frames;
al@20905 1317 + png_uint_32 num_plays;
al@20905 1318 +#endif
al@20905 1319
al@20905 1320 row_buf = NULL;
al@20905 1321 error_parameters.file_name = inname;
al@20905 1322 @@ -1381,6 +1385,22 @@
al@20905 1323 }
al@20905 1324 }
al@20905 1325 #endif
al@20905 1326 +
al@20905 1327 +#ifdef PNG_APNG_SUPPORTED
al@20905 1328 + if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_acTL))
al@20905 1329 + {
al@20905 1330 + if (png_get_acTL(read_ptr, read_info_ptr, &num_frames, &num_plays))
al@20905 1331 + {
al@20905 1332 + png_byte is_hidden;
al@20905 1333 + pngtest_debug2("Handling acTL chunks (frames %ld, plays %ld)",
al@20905 1334 + num_frames, num_plays);
al@20905 1335 + png_set_acTL(write_ptr, write_info_ptr, num_frames, num_plays);
al@20905 1336 + is_hidden = png_get_first_frame_is_hidden(read_ptr, read_info_ptr);
al@20905 1337 + png_set_first_frame_is_hidden(write_ptr, write_info_ptr, is_hidden);
al@20905 1338 + }
al@20905 1339 + }
al@20905 1340 +#endif
al@20905 1341 +
al@20905 1342 #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
al@20905 1343 {
al@20905 1344 png_unknown_chunkp unknowns;
al@20905 1345 @@ -1461,6 +1481,110 @@
al@20905 1346 t_misc += (t_stop - t_start);
al@20905 1347 t_start = t_stop;
al@20905 1348 #endif
al@20905 1349 +#ifdef PNG_APNG_SUPPORTED
al@20905 1350 + if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_acTL))
al@20905 1351 + {
al@20905 1352 + png_uint_32 frame;
al@20905 1353 + for (frame = 0; frame < num_frames; frame++)
al@20905 1354 + {
al@20905 1355 + png_uint_32 frame_width;
al@20905 1356 + png_uint_32 frame_height;
al@20905 1357 + png_uint_32 x_offset;
al@20905 1358 + png_uint_32 y_offset;
al@20905 1359 + png_uint_16 delay_num;
al@20905 1360 + png_uint_16 delay_den;
al@20905 1361 + png_byte dispose_op;
al@20905 1362 + png_byte blend_op;
al@20905 1363 + png_read_frame_head(read_ptr, read_info_ptr);
al@20905 1364 + if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_fcTL))
al@20905 1365 + {
al@20905 1366 + png_get_next_frame_fcTL(read_ptr, read_info_ptr,
al@20905 1367 + &frame_width, &frame_height,
al@20905 1368 + &x_offset, &y_offset,
al@20905 1369 + &delay_num, &delay_den,
al@20905 1370 + &dispose_op, &blend_op);
al@20905 1371 + }
al@20905 1372 + else
al@20905 1373 + {
al@20905 1374 + frame_width = width;
al@20905 1375 + frame_height = height;
al@20905 1376 + x_offset = 0;
al@20905 1377 + y_offset = 0;
al@20905 1378 + delay_num = 1;
al@20905 1379 + delay_den = 1;
al@20905 1380 + dispose_op = PNG_DISPOSE_OP_NONE;
al@20905 1381 + blend_op = PNG_BLEND_OP_SOURCE;
al@20905 1382 + }
al@20905 1383 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1384 + png_write_frame_head(write_ptr, write_info_ptr, (png_bytepp)&row_buf,
al@20905 1385 + frame_width, frame_height,
al@20905 1386 + x_offset, y_offset,
al@20905 1387 + delay_num, delay_den,
al@20905 1388 + dispose_op, blend_op);
al@20905 1389 +#endif
al@20905 1390 + for (pass = 0; pass < num_passes; pass++)
al@20905 1391 + {
al@20905 1392 +# ifdef calc_pass_height
al@20905 1393 + png_uint_32 pass_height;
al@20905 1394 +
al@20905 1395 + if (num_passes == 7) /* interlaced */
al@20905 1396 + {
al@20905 1397 + if (PNG_PASS_COLS(frame_width, pass) > 0)
al@20905 1398 + pass_height = PNG_PASS_ROWS(frame_height, pass);
al@20905 1399 +
al@20905 1400 + else
al@20905 1401 + pass_height = 0;
al@20905 1402 + }
al@20905 1403 +
al@20905 1404 + else /* not interlaced */
al@20905 1405 + pass_height = frame_height;
al@20905 1406 +# else
al@20905 1407 +# define pass_height frame_height
al@20905 1408 +# endif
al@20905 1409 +
al@20905 1410 + pngtest_debug1("Writing row data for pass %d", pass);
al@20905 1411 + for (y = 0; y < pass_height; y++)
al@20905 1412 + {
al@20905 1413 +#ifndef SINGLE_ROWBUF_ALLOC
al@20905 1414 + pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
al@20905 1415 +
al@20905 1416 + row_buf = (png_bytep)png_malloc(read_ptr,
al@20905 1417 + png_get_rowbytes(read_ptr, read_info_ptr));
al@20905 1418 +
al@20905 1419 + pngtest_debug2("\t0x%08lx (%lu bytes)", (unsigned long)row_buf,
al@20905 1420 + (unsigned long)png_get_rowbytes(read_ptr, read_info_ptr));
al@20905 1421 +
al@20905 1422 +#endif /* !SINGLE_ROWBUF_ALLOC */
al@20905 1423 + png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
al@20905 1424 +
al@20905 1425 +#ifdef PNG_WRITE_SUPPORTED
al@20905 1426 +#ifdef PNGTEST_TIMING
al@20905 1427 + t_stop = (float)clock();
al@20905 1428 + t_decode += (t_stop - t_start);
al@20905 1429 + t_start = t_stop;
al@20905 1430 +#endif
al@20905 1431 + png_write_rows(write_ptr, (png_bytepp)&row_buf, 1);
al@20905 1432 +#ifdef PNGTEST_TIMING
al@20905 1433 + t_stop = (float)clock();
al@20905 1434 + t_encode += (t_stop - t_start);
al@20905 1435 + t_start = t_stop;
al@20905 1436 +#endif
al@20905 1437 +#endif /* PNG_WRITE_SUPPORTED */
al@20905 1438 +
al@20905 1439 +#ifndef SINGLE_ROWBUF_ALLOC
al@20905 1440 + pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
al@20905 1441 + png_free(read_ptr, row_buf);
al@20905 1442 + row_buf = NULL;
al@20905 1443 +#endif /* !SINGLE_ROWBUF_ALLOC */
al@20905 1444 + }
al@20905 1445 + }
al@20905 1446 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1447 + png_write_frame_tail(write_ptr, write_info_ptr);
al@20905 1448 +#endif
al@20905 1449 + }
al@20905 1450 + }
al@20905 1451 + else
al@20905 1452 +#endif
al@20905 1453 for (pass = 0; pass < num_passes; pass++)
al@20905 1454 {
al@20905 1455 # ifdef calc_pass_height
al@20905 1456 diff -Naru libpng-1.6.35.org/pngwrite.c libpng-1.6.35/pngwrite.c
al@20905 1457 --- libpng-1.6.35.org/pngwrite.c 2018-07-21 19:16:37.188143186 +0900
al@20905 1458 +++ libpng-1.6.35/pngwrite.c 2018-07-21 19:16:16.211354747 +0900
al@20905 1459 @@ -128,6 +128,10 @@
al@20905 1460 * the application continues writing the PNG. So check the 'invalid'
al@20905 1461 * flag here too.
al@20905 1462 */
al@20905 1463 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1464 + if (info_ptr->valid & PNG_INFO_acTL)
al@20905 1465 + png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
al@20905 1466 +#endif
al@20905 1467 #ifdef PNG_GAMMA_SUPPORTED
al@20905 1468 # ifdef PNG_WRITE_gAMA_SUPPORTED
al@20905 1469 if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
al@20905 1470 @@ -370,6 +374,11 @@
al@20905 1471 png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
al@20905 1472 #endif
al@20905 1473
al@20905 1474 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1475 + if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
al@20905 1476 + png_error(png_ptr, "Not enough frames written");
al@20905 1477 +#endif
al@20905 1478 +
al@20905 1479 /* See if user wants us to write information chunks */
al@20905 1480 if (info_ptr != NULL)
al@20905 1481 {
al@20905 1482 @@ -1461,6 +1470,43 @@
al@20905 1483 }
al@20905 1484 #endif
al@20905 1485
al@20905 1486 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1487 +void PNGAPI
al@20905 1488 +png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
al@20905 1489 + png_bytepp row_pointers, png_uint_32 width, png_uint_32 height,
al@20905 1490 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 1491 + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
al@20905 1492 + png_byte blend_op)
al@20905 1493 +{
al@20905 1494 + png_debug(1, "in png_write_frame_head");
al@20905 1495 +
al@20905 1496 + /* there is a chance this has been set after png_write_info was called,
al@20905 1497 + * so it would be set but not written. is there a way to be sure? */
al@20905 1498 + if (!(info_ptr->valid & PNG_INFO_acTL))
al@20905 1499 + png_error(png_ptr, "png_write_frame_head(): acTL not set");
al@20905 1500 +
al@20905 1501 + png_write_reset(png_ptr);
al@20905 1502 +
al@20905 1503 + png_write_reinit(png_ptr, info_ptr, width, height);
al@20905 1504 +
al@20905 1505 + if ( !(png_ptr->num_frames_written == 0 &&
al@20905 1506 + (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) )
al@20905 1507 + png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
al@20905 1508 + delay_num, delay_den, dispose_op, blend_op);
al@20905 1509 +
al@20905 1510 + PNG_UNUSED(row_pointers)
al@20905 1511 +}
al@20905 1512 +
al@20905 1513 +void PNGAPI
al@20905 1514 +png_write_frame_tail(png_structp png_ptr, png_infop info_ptr)
al@20905 1515 +{
al@20905 1516 + png_debug(1, "in png_write_frame_tail");
al@20905 1517 +
al@20905 1518 + png_ptr->num_frames_written++;
al@20905 1519 +
al@20905 1520 + PNG_UNUSED(info_ptr)
al@20905 1521 +}
al@20905 1522 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 1523
al@20905 1524 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
al@20905 1525 /* Initialize the write structure - general purpose utility. */
al@20905 1526 diff -Naru libpng-1.6.35.org/pngwutil.c libpng-1.6.35/pngwutil.c
al@20905 1527 --- libpng-1.6.35.org/pngwutil.c 2018-07-21 19:16:37.189143271 +0900
al@20905 1528 +++ libpng-1.6.35/pngwutil.c 2018-07-21 19:16:16.303362592 +0900
al@20905 1529 @@ -821,6 +821,11 @@
al@20905 1530 /* Write the chunk */
al@20905 1531 png_write_complete_chunk(png_ptr, png_IHDR, buf, 13);
al@20905 1532
al@20905 1533 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1534 + png_ptr->first_frame_width = width;
al@20905 1535 + png_ptr->first_frame_height = height;
al@20905 1536 +#endif
al@20905 1537 +
al@20905 1538 if ((png_ptr->do_filter) == PNG_NO_FILTERS)
al@20905 1539 {
al@20905 1540 if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
al@20905 1541 @@ -1002,8 +1007,17 @@
al@20905 1542 optimize_cmf(data, png_image_size(png_ptr));
al@20905 1543 #endif
al@20905 1544
al@20905 1545 - if (size > 0)
al@20905 1546 - png_write_complete_chunk(png_ptr, png_IDAT, data, size);
al@20905 1547 + if (size > 0)
al@20905 1548 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1549 + {
al@20905 1550 + if (png_ptr->num_frames_written == 0)
al@20905 1551 +#endif
al@20905 1552 + png_write_complete_chunk(png_ptr, png_IDAT, data, size);
al@20905 1553 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1554 + else
al@20905 1555 + png_write_fdAT(png_ptr, data, size);
al@20905 1556 + }
al@20905 1557 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 1558 png_ptr->mode |= PNG_HAVE_IDAT;
al@20905 1559
al@20905 1560 png_ptr->zstream.next_out = data;
al@20905 1561 @@ -1050,7 +1064,17 @@
al@20905 1562 #endif
al@20905 1563
al@20905 1564 if (size > 0)
al@20905 1565 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1566 + {
al@20905 1567 + if (png_ptr->num_frames_written == 0)
al@20905 1568 +#endif
al@20905 1569 png_write_complete_chunk(png_ptr, png_IDAT, data, size);
al@20905 1570 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1571 + else
al@20905 1572 + png_write_fdAT(png_ptr, data, size);
al@20905 1573 + }
al@20905 1574 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 1575 +
al@20905 1576 png_ptr->zstream.avail_out = 0;
al@20905 1577 png_ptr->zstream.next_out = NULL;
al@20905 1578 png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
al@20905 1579 @@ -1885,6 +1909,82 @@
al@20905 1580 }
al@20905 1581 #endif
al@20905 1582
al@20905 1583 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1584 +void /* PRIVATE */
al@20905 1585 +png_write_acTL(png_structp png_ptr,
al@20905 1586 + png_uint_32 num_frames, png_uint_32 num_plays)
al@20905 1587 +{
al@20905 1588 + png_byte buf[8];
al@20905 1589 +
al@20905 1590 + png_debug(1, "in png_write_acTL");
al@20905 1591 +
al@20905 1592 + png_ptr->num_frames_to_write = num_frames;
al@20905 1593 +
al@20905 1594 + if (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN)
al@20905 1595 + num_frames--;
al@20905 1596 +
al@20905 1597 + png_save_uint_32(buf, num_frames);
al@20905 1598 + png_save_uint_32(buf + 4, num_plays);
al@20905 1599 +
al@20905 1600 + png_write_complete_chunk(png_ptr, png_acTL, buf, (png_size_t)8);
al@20905 1601 +}
al@20905 1602 +
al@20905 1603 +void /* PRIVATE */
al@20905 1604 +png_write_fcTL(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
al@20905 1605 + png_uint_32 x_offset, png_uint_32 y_offset,
al@20905 1606 + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
al@20905 1607 + png_byte blend_op)
al@20905 1608 +{
al@20905 1609 + png_byte buf[26];
al@20905 1610 +
al@20905 1611 + png_debug(1, "in png_write_fcTL");
al@20905 1612 +
al@20905 1613 + if (png_ptr->num_frames_written == 0 && (x_offset != 0 || y_offset != 0))
al@20905 1614 + png_error(png_ptr, "x and/or y offset for the first frame aren't 0");
al@20905 1615 + if (png_ptr->num_frames_written == 0 &&
al@20905 1616 + (width != png_ptr->first_frame_width ||
al@20905 1617 + height != png_ptr->first_frame_height))
al@20905 1618 + png_error(png_ptr, "width and/or height in the first frame's fcTL "
al@20905 1619 + "don't match the ones in IHDR");
al@20905 1620 +
al@20905 1621 + /* more error checking */
al@20905 1622 + png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
al@20905 1623 + delay_num, delay_den, dispose_op, blend_op);
al@20905 1624 +
al@20905 1625 + png_save_uint_32(buf, png_ptr->next_seq_num);
al@20905 1626 + png_save_uint_32(buf + 4, width);
al@20905 1627 + png_save_uint_32(buf + 8, height);
al@20905 1628 + png_save_uint_32(buf + 12, x_offset);
al@20905 1629 + png_save_uint_32(buf + 16, y_offset);
al@20905 1630 + png_save_uint_16(buf + 20, delay_num);
al@20905 1631 + png_save_uint_16(buf + 22, delay_den);
al@20905 1632 + buf[24] = dispose_op;
al@20905 1633 + buf[25] = blend_op;
al@20905 1634 +
al@20905 1635 + png_write_complete_chunk(png_ptr, png_fcTL, buf, (png_size_t)26);
al@20905 1636 +
al@20905 1637 + png_ptr->next_seq_num++;
al@20905 1638 +}
al@20905 1639 +
al@20905 1640 +void /* PRIVATE */
al@20905 1641 +png_write_fdAT(png_structp png_ptr,
al@20905 1642 + png_const_bytep data, png_size_t length)
al@20905 1643 +{
al@20905 1644 + png_byte buf[4];
al@20905 1645 +
al@20905 1646 + png_write_chunk_header(png_ptr, png_fdAT, (png_uint_32)(4 + length));
al@20905 1647 +
al@20905 1648 + png_save_uint_32(buf, png_ptr->next_seq_num);
al@20905 1649 + png_write_chunk_data(png_ptr, buf, 4);
al@20905 1650 +
al@20905 1651 + png_write_chunk_data(png_ptr, data, length);
al@20905 1652 +
al@20905 1653 + png_write_chunk_end(png_ptr);
al@20905 1654 +
al@20905 1655 + png_ptr->next_seq_num++;
al@20905 1656 +}
al@20905 1657 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 1658 +
al@20905 1659 /* Initializes the row writing capability of libpng */
al@20905 1660 void /* PRIVATE */
al@20905 1661 png_write_start_row(png_structrp png_ptr)
al@20905 1662 @@ -2778,4 +2878,39 @@
al@20905 1663 }
al@20905 1664 #endif /* WRITE_FLUSH */
al@20905 1665 }
al@20905 1666 +
al@20905 1667 +#ifdef PNG_WRITE_APNG_SUPPORTED
al@20905 1668 +void /* PRIVATE */
al@20905 1669 +png_write_reset(png_structp png_ptr)
al@20905 1670 +{
al@20905 1671 + png_ptr->row_number = 0;
al@20905 1672 + png_ptr->pass = 0;
al@20905 1673 + png_ptr->mode &= ~PNG_HAVE_IDAT;
al@20905 1674 +}
al@20905 1675 +
al@20905 1676 +void /* PRIVATE */
al@20905 1677 +png_write_reinit(png_structp png_ptr, png_infop info_ptr,
al@20905 1678 + png_uint_32 width, png_uint_32 height)
al@20905 1679 +{
al@20905 1680 + if (png_ptr->num_frames_written == 0 &&
al@20905 1681 + (width != png_ptr->first_frame_width ||
al@20905 1682 + height != png_ptr->first_frame_height))
al@20905 1683 + png_error(png_ptr, "width and/or height in the first frame's fcTL "
al@20905 1684 + "don't match the ones in IHDR");
al@20905 1685 + if (width > png_ptr->first_frame_width ||
al@20905 1686 + height > png_ptr->first_frame_height)
al@20905 1687 + png_error(png_ptr, "width and/or height for a frame greater than"
al@20905 1688 + "the ones in IHDR");
al@20905 1689 +
al@20905 1690 + png_set_IHDR(png_ptr, info_ptr, width, height,
al@20905 1691 + info_ptr->bit_depth, info_ptr->color_type,
al@20905 1692 + info_ptr->interlace_type, info_ptr->compression_type,
al@20905 1693 + info_ptr->filter_type);
al@20905 1694 +
al@20905 1695 + png_ptr->width = width;
al@20905 1696 + png_ptr->height = height;
al@20905 1697 + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
al@20905 1698 + png_ptr->usr_width = png_ptr->width;
al@20905 1699 +}
al@20905 1700 +#endif /* PNG_WRITE_APNG_SUPPORTED */
al@20905 1701 #endif /* WRITE */
al@20905 1702 diff -Naru libpng-1.6.35.org/scripts/symbols.def libpng-1.6.35/scripts/symbols.def
al@20905 1703 --- libpng-1.6.35.org/scripts/symbols.def 2018-07-21 19:16:37.192143527 +0900
al@20905 1704 +++ libpng-1.6.35/scripts/symbols.def 2018-07-21 19:16:16.206354321 +0900
al@20905 1705 @@ -254,3 +254,23 @@
al@20905 1706 png_set_eXIf @247
al@20905 1707 png_get_eXIf_1 @248
al@20905 1708 png_set_eXIf_1 @249
al@20905 1709 + png_get_acTL @250
al@20905 1710 + png_set_acTL @251
al@20905 1711 + png_get_num_frames @252
al@20905 1712 + png_get_num_plays @253
al@20905 1713 + png_get_next_frame_fcTL @254
al@20905 1714 + png_set_next_frame_fcTL @255
al@20905 1715 + png_get_next_frame_width @256
al@20905 1716 + png_get_next_frame_height @257
al@20905 1717 + png_get_next_frame_x_offset @258
al@20905 1718 + png_get_next_frame_y_offset @259
al@20905 1719 + png_get_next_frame_delay_num @260
al@20905 1720 + png_get_next_frame_delay_den @261
al@20905 1721 + png_get_next_frame_dispose_op @262
al@20905 1722 + png_get_next_frame_blend_op @263
al@20905 1723 + png_get_first_frame_is_hidden @264
al@20905 1724 + png_set_first_frame_is_hidden @265
al@20905 1725 + png_read_frame_head @266
al@20905 1726 + png_set_progressive_frame_fn @267
al@20905 1727 + png_write_frame_head @268
al@20905 1728 + png_write_frame_tail @269