OLD | NEW |
1 | 1 |
2 /* pngrutil.c - utilities to read a PNG file | 2 /* pngrutil.c - utilities to read a PNG file |
3 * | 3 * |
4 * Last changed in libpng 1.2.51 [February 6, 2014] | 4 * Last changed in libpng 1.2.54 [November 12, 2015] |
5 * Copyright (c) 1998-2014 Glenn Randers-Pehrson | 5 * Copyright (c) 1998-2015 Glenn Randers-Pehrson |
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
8 * | 8 * |
9 * This code is released under the libpng license. | 9 * This code is released under the libpng license. |
10 * For conditions of distribution and use, see the disclaimer | 10 * For conditions of distribution and use, see the disclaimer |
11 * and license in png.h | 11 * and license in png.h |
12 * | 12 * |
13 * This file contains routines that are only called from within | 13 * This file contains routines that are only called from within |
14 * libpng itself during the course of reading an image. | 14 * libpng itself during the course of reading an image. |
15 */ | 15 */ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 # endif | 50 # endif |
51 #endif | 51 #endif |
52 | 52 |
53 png_uint_32 PNGAPI | 53 png_uint_32 PNGAPI |
54 png_get_uint_31(png_structp png_ptr, png_bytep buf) | 54 png_get_uint_31(png_structp png_ptr, png_bytep buf) |
55 { | 55 { |
56 #ifdef PNG_READ_BIG_ENDIAN_SUPPORTED | 56 #ifdef PNG_READ_BIG_ENDIAN_SUPPORTED |
57 png_uint_32 i = png_get_uint_32(buf); | 57 png_uint_32 i = png_get_uint_32(buf); |
58 #else | 58 #else |
59 /* Avoid an extra function call by inlining the result. */ | 59 /* Avoid an extra function call by inlining the result. */ |
60 png_uint_32 i = ((png_uint_32)(*buf) << 24) + | 60 png_uint_32 i = ((png_uint_32)((*(buf )) & 0xff) << 24) + |
61 ((png_uint_32)(*(buf + 1)) << 16) + | 61 ((png_uint_32)((*(buf + 1)) & 0xff) << 16) + |
62 ((png_uint_32)(*(buf + 2)) << 8) + | 62 ((png_uint_32)((*(buf + 2)) & 0xff) << 8) + |
63 (png_uint_32)(*(buf + 3)); | 63 ((png_uint_32)((*(buf + 3)) & 0xff) ); |
64 #endif | 64 #endif |
65 if (i > PNG_UINT_31_MAX) | 65 if (i > PNG_UINT_31_MAX) |
66 png_error(png_ptr, "PNG unsigned integer out of range."); | 66 png_error(png_ptr, "PNG unsigned integer out of range."); |
67 return (i); | 67 return (i); |
68 } | 68 } |
69 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED | 69 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED |
70 /* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ | 70 /* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ |
71 png_uint_32 PNGAPI | 71 png_uint_32 PNGAPI |
72 png_get_uint_32(png_bytep buf) | 72 png_get_uint_32(png_bytep buf) |
73 { | 73 { |
74 png_uint_32 i = ((png_uint_32)(*buf) << 24) + | 74 png_uint_32 i = ((png_uint_32)((*(buf )) & 0xff) << 24) + |
75 ((png_uint_32)(*(buf + 1)) << 16) + | 75 ((png_uint_32)((*(buf + 1)) & 0xff) << 16) + |
76 ((png_uint_32)(*(buf + 2)) << 8) + | 76 ((png_uint_32)((*(buf + 2)) & 0xff) << 8) + |
77 (png_uint_32)(*(buf + 3)); | 77 ((png_uint_32)((*(buf + 3)) & 0xff) ); |
78 | 78 |
79 return (i); | 79 return (i); |
80 } | 80 } |
81 | 81 |
82 /* Grab a signed 32-bit integer from a buffer in big-endian format. The | 82 /* Grab a signed 32-bit integer from a buffer in big-endian format. The |
83 * data is stored in the PNG file in two's complement format, and it is | 83 * data is stored in the PNG file in two's complement format, and it is |
84 * assumed that the machine format for signed integers is the same. | 84 * assumed that the machine format for signed integers is the same. |
85 */ | 85 */ |
86 png_int_32 PNGAPI | 86 png_int_32 PNGAPI |
87 png_get_int_32(png_bytep buf) | 87 png_get_int_32(png_bytep buf) |
88 { | 88 { |
89 png_int_32 i = ((png_int_32)(*buf) << 24) + | 89 png_int_32 i = ((png_int_32)((*(buf )) & 0xff) << 24) + |
90 ((png_int_32)(*(buf + 1)) << 16) + | 90 ((png_int_32)((*(buf + 1)) & 0xff) << 16) + |
91 ((png_int_32)(*(buf + 2)) << 8) + | 91 ((png_int_32)((*(buf + 2)) & 0xff) << 8) + |
92 (png_int_32)(*(buf + 3)); | 92 ((png_int_32)((*(buf + 3)) & 0xff) ); |
93 | 93 |
94 return (i); | 94 return (i); |
95 } | 95 } |
96 | 96 |
97 /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ | 97 /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ |
98 png_uint_16 PNGAPI | 98 png_uint_16 PNGAPI |
99 png_get_uint_16(png_bytep buf) | 99 png_get_uint_16(png_bytep buf) |
100 { | 100 { |
101 png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + | 101 png_uint_16 i = ((png_uint_16)((*(buf )) & 0xff) << 8) + |
102 (png_uint_16)(*(buf + 1))); | 102 ((png_uint_16)((*(buf + 1)) & 0xff) ); |
103 | 103 |
104 return (i); | 104 return (i); |
105 } | 105 } |
106 #endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */ | 106 #endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */ |
107 | 107 |
108 /* Read the chunk header (length + type name). | 108 /* Read the chunk header (length + type name). |
109 * Put the type name into png_ptr->chunk_name, and return the length. | 109 * Put the type name into png_ptr->chunk_name, and return the length. |
110 */ | 110 */ |
111 png_uint_32 /* PRIVATE */ | 111 png_uint_32 /* PRIVATE */ |
112 png_read_chunk_header(png_structp png_ptr) | 112 png_read_chunk_header(png_structp png_ptr) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 case Z_DATA_ERROR: | 287 case Z_DATA_ERROR: |
288 msg = "Data error in compressed datastream in %s chunk"; | 288 msg = "Data error in compressed datastream in %s chunk"; |
289 break; | 289 break; |
290 default: | 290 default: |
291 msg = "Incomplete compressed datastream in %s chunk"; | 291 msg = "Incomplete compressed datastream in %s chunk"; |
292 break; | 292 break; |
293 } | 293 } |
294 | 294 |
295 png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name); | 295 png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name); |
296 msg = umsg; | 296 msg = umsg; |
| 297 png_warning(png_ptr, msg); |
297 #else | 298 #else |
298 msg = "Damaged compressed datastream in chunk other than IDAT"; | 299 msg = "Damaged compressed datastream in chunk other than IDAT"; |
299 #endif | 300 #endif |
300 } | 301 } |
301 | 302 |
| 303 #ifndef PNG_STDIO_SUPPORTED |
302 png_warning(png_ptr, msg); | 304 png_warning(png_ptr, msg); |
| 305 #endif |
303 } | 306 } |
304 | 307 |
305 /* 0 means an error - notice that this code simple ignores | 308 /* 0 means an error - notice that this code simple ignores |
306 * zero length compressed chunks as a result. | 309 * zero length compressed chunks as a result. |
307 */ | 310 */ |
308 return 0; | 311 return 0; |
309 } | 312 } |
310 } | 313 } |
311 | 314 |
312 /* | 315 /* |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 png_debug1(3, "rowbytes = %lu", png_ptr->rowbytes); | 499 png_debug1(3, "rowbytes = %lu", png_ptr->rowbytes); |
497 png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, | 500 png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, |
498 color_type, interlace_type, compression_type, filter_type); | 501 color_type, interlace_type, compression_type, filter_type); |
499 } | 502 } |
500 | 503 |
501 /* Read and check the palette */ | 504 /* Read and check the palette */ |
502 void /* PRIVATE */ | 505 void /* PRIVATE */ |
503 png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) | 506 png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) |
504 { | 507 { |
505 png_color palette[PNG_MAX_PALETTE_LENGTH]; | 508 png_color palette[PNG_MAX_PALETTE_LENGTH]; |
506 int num, i; | 509 int max_palette_length, num, i; |
507 #ifdef PNG_POINTER_INDEXING_SUPPORTED | 510 #ifdef PNG_POINTER_INDEXING_SUPPORTED |
508 png_colorp pal_ptr; | 511 png_colorp pal_ptr; |
509 #endif | 512 #endif |
510 | 513 |
511 png_debug(1, "in png_handle_PLTE"); | 514 png_debug(1, "in png_handle_PLTE"); |
512 | 515 |
513 if (!(png_ptr->mode & PNG_HAVE_IHDR)) | 516 if (!(png_ptr->mode & PNG_HAVE_IHDR)) |
514 png_error(png_ptr, "Missing IHDR before PLTE"); | 517 png_error(png_ptr, "Missing IHDR before PLTE"); |
515 | 518 |
516 else if (png_ptr->mode & PNG_HAVE_IDAT) | 519 else if (png_ptr->mode & PNG_HAVE_IDAT) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 png_crc_finish(png_ptr, length); | 551 png_crc_finish(png_ptr, length); |
549 return; | 552 return; |
550 } | 553 } |
551 | 554 |
552 else | 555 else |
553 { | 556 { |
554 png_error(png_ptr, "Invalid palette chunk"); | 557 png_error(png_ptr, "Invalid palette chunk"); |
555 } | 558 } |
556 } | 559 } |
557 | 560 |
| 561 /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */ |
558 num = (int)length / 3; | 562 num = (int)length / 3; |
559 | 563 |
| 564 /* If the palette has 256 or fewer entries but is too large for the bit |
| 565 * depth, we don't issue an error, to preserve the behavior of previous |
| 566 * libpng versions. We silently truncate the unused extra palette entries |
| 567 * here. |
| 568 */ |
| 569 if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) |
| 570 max_palette_length = (1 << png_ptr->bit_depth); |
| 571 else |
| 572 max_palette_length = PNG_MAX_PALETTE_LENGTH; |
| 573 |
| 574 if (num > max_palette_length) |
| 575 num = max_palette_length; |
| 576 |
560 #ifdef PNG_POINTER_INDEXING_SUPPORTED | 577 #ifdef PNG_POINTER_INDEXING_SUPPORTED |
561 for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) | 578 for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) |
562 { | 579 { |
563 png_byte buf[3]; | 580 png_byte buf[3]; |
564 | 581 |
565 png_crc_read(png_ptr, buf, 3); | 582 png_crc_read(png_ptr, buf, 3); |
566 pal_ptr->red = buf[0]; | 583 pal_ptr->red = buf[0]; |
567 pal_ptr->green = buf[1]; | 584 pal_ptr->green = buf[1]; |
568 pal_ptr->blue = buf[2]; | 585 pal_ptr->blue = buf[2]; |
569 } | 586 } |
(...skipping 12 matching lines...) Expand all Loading... |
582 | 599 |
583 /* If we actually NEED the PLTE chunk (ie for a paletted image), we do | 600 /* If we actually NEED the PLTE chunk (ie for a paletted image), we do |
584 * whatever the normal CRC configuration tells us. However, if we | 601 * whatever the normal CRC configuration tells us. However, if we |
585 * have an RGB image, the PLTE can be considered ancillary, so | 602 * have an RGB image, the PLTE can be considered ancillary, so |
586 * we will act as though it is. | 603 * we will act as though it is. |
587 */ | 604 */ |
588 #ifndef PNG_READ_OPT_PLTE_SUPPORTED | 605 #ifndef PNG_READ_OPT_PLTE_SUPPORTED |
589 if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) | 606 if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) |
590 #endif | 607 #endif |
591 { | 608 { |
592 png_crc_finish(png_ptr, 0); | 609 png_crc_finish(png_ptr, (int) length - num * 3); |
593 } | 610 } |
594 #ifndef PNG_READ_OPT_PLTE_SUPPORTED | 611 #ifndef PNG_READ_OPT_PLTE_SUPPORTED |
595 else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */ | 612 else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */ |
596 { | 613 { |
597 /* If we don't want to use the data from an ancillary chunk, | 614 /* If we don't want to use the data from an ancillary chunk, |
598 we have two options: an error abort, or a warning and we | 615 we have two options: an error abort, or a warning and we |
599 ignore the data in this chunk (which should be OK, since | 616 ignore the data in this chunk (which should be OK, since |
600 it's considered ancillary for a RGB or RGBA image). */ | 617 it's considered ancillary for a RGB or RGBA image). */ |
601 if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE)) | 618 if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE)) |
602 { | 619 { |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 if ( prefix_length > data_length || profile_length < 4) | 1140 if ( prefix_length > data_length || profile_length < 4) |
1124 { | 1141 { |
1125 png_free(png_ptr, png_ptr->chunkdata); | 1142 png_free(png_ptr, png_ptr->chunkdata); |
1126 png_ptr->chunkdata = NULL; | 1143 png_ptr->chunkdata = NULL; |
1127 png_warning(png_ptr, "Profile size field missing from iCCP chunk"); | 1144 png_warning(png_ptr, "Profile size field missing from iCCP chunk"); |
1128 return; | 1145 return; |
1129 } | 1146 } |
1130 | 1147 |
1131 /* Check the profile_size recorded in the first 32 bits of the ICC profile */ | 1148 /* Check the profile_size recorded in the first 32 bits of the ICC profile */ |
1132 pC = (png_bytep)(png_ptr->chunkdata + prefix_length); | 1149 pC = (png_bytep)(png_ptr->chunkdata + prefix_length); |
1133 profile_size = ((*(pC ))<<24) | | 1150 profile_size = ((png_uint_32) (*(pC )<<24)) | |
1134 ((*(pC + 1))<<16) | | 1151 ((png_uint_32) (*(pC + 1)<<16)) | |
1135 ((*(pC + 2))<< 8) | | 1152 ((png_uint_32) (*(pC + 2)<< 8)) | |
1136 ((*(pC + 3)) ); | 1153 ((png_uint_32) (*(pC + 3) )); |
1137 | 1154 |
1138 if (profile_size < profile_length) | 1155 if (profile_size < profile_length) |
1139 profile_length = profile_size; | 1156 profile_length = profile_size; |
1140 | 1157 |
1141 if (profile_size > profile_length) | 1158 if (profile_size > profile_length) |
1142 { | 1159 { |
1143 png_free(png_ptr, png_ptr->chunkdata); | 1160 png_free(png_ptr, png_ptr->chunkdata); |
1144 png_ptr->chunkdata = NULL; | 1161 png_ptr->chunkdata = NULL; |
1145 png_warning(png_ptr, "Ignoring truncated iCCP profile."); | 1162 png_warning(png_ptr, "Ignoring truncated iCCP profile."); |
1146 return; | 1163 return; |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 */ | 2724 */ |
2708 void /* PRIVATE */ | 2725 void /* PRIVATE */ |
2709 png_do_read_interlace(png_structp png_ptr) | 2726 png_do_read_interlace(png_structp png_ptr) |
2710 { | 2727 { |
2711 png_row_infop row_info = &(png_ptr->row_info); | 2728 png_row_infop row_info = &(png_ptr->row_info); |
2712 png_bytep row = png_ptr->row_buf + 1; | 2729 png_bytep row = png_ptr->row_buf + 1; |
2713 int pass = png_ptr->pass; | 2730 int pass = png_ptr->pass; |
2714 png_uint_32 transformations = png_ptr->transformations; | 2731 png_uint_32 transformations = png_ptr->transformations; |
2715 /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ | 2732 /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ |
2716 /* Offset to next interlace block */ | 2733 /* Offset to next interlace block */ |
| 2734 #ifndef PNG_USE_GLOBAL_ARRAYS |
2717 PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; | 2735 PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; |
| 2736 #endif |
2718 | 2737 |
2719 png_debug(1, "in png_do_read_interlace"); | 2738 png_debug(1, "in png_do_read_interlace"); |
2720 if (row != NULL && row_info != NULL) | 2739 if (row != NULL && row_info != NULL) |
2721 { | 2740 { |
2722 png_uint_32 final_width; | 2741 png_uint_32 final_width; |
2723 | 2742 |
2724 final_width = row_info->width * png_pass_inc[pass]; | 2743 final_width = row_info->width * png_pass_inc[pass]; |
2725 | 2744 |
2726 switch (row_info->pixel_depth) | 2745 switch (row_info->pixel_depth) |
2727 { | 2746 { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 *row = 0; | 3066 *row = 0; |
3048 break; | 3067 break; |
3049 } | 3068 } |
3050 } | 3069 } |
3051 | 3070 |
3052 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED | 3071 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED |
3053 void /* PRIVATE */ | 3072 void /* PRIVATE */ |
3054 png_read_finish_row(png_structp png_ptr) | 3073 png_read_finish_row(png_structp png_ptr) |
3055 { | 3074 { |
3056 #ifdef PNG_READ_INTERLACING_SUPPORTED | 3075 #ifdef PNG_READ_INTERLACING_SUPPORTED |
| 3076 #ifndef PNG_USE_GLOBAL_ARRAYS |
3057 /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ | 3077 /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ |
3058 | 3078 |
3059 /* Start of interlace block */ | 3079 /* Start of interlace block */ |
3060 PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; | 3080 PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; |
3061 | 3081 |
3062 /* Offset to next interlace block */ | 3082 /* Offset to next interlace block */ |
3063 PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; | 3083 PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; |
3064 | 3084 |
3065 /* Start of interlace block in the y direction */ | 3085 /* Start of interlace block in the y direction */ |
3066 PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; | 3086 PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; |
3067 | 3087 |
3068 /* Offset to next interlace block in the y direction */ | 3088 /* Offset to next interlace block in the y direction */ |
3069 PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; | 3089 PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; |
| 3090 #endif |
3070 #endif /* PNG_READ_INTERLACING_SUPPORTED */ | 3091 #endif /* PNG_READ_INTERLACING_SUPPORTED */ |
3071 | 3092 |
3072 png_debug(1, "in png_read_finish_row"); | 3093 png_debug(1, "in png_read_finish_row"); |
3073 png_ptr->row_number++; | 3094 png_ptr->row_number++; |
3074 if (png_ptr->row_number < png_ptr->num_rows) | 3095 if (png_ptr->row_number < png_ptr->num_rows) |
3075 return; | 3096 return; |
3076 | 3097 |
3077 #ifdef PNG_READ_INTERLACING_SUPPORTED | 3098 #ifdef PNG_READ_INTERLACING_SUPPORTED |
3078 if (png_ptr->interlaced) | 3099 if (png_ptr->interlaced) |
3079 { | 3100 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3175 inflateReset(&png_ptr->zstream); | 3196 inflateReset(&png_ptr->zstream); |
3176 | 3197 |
3177 png_ptr->mode |= PNG_AFTER_IDAT; | 3198 png_ptr->mode |= PNG_AFTER_IDAT; |
3178 } | 3199 } |
3179 #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ | 3200 #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ |
3180 | 3201 |
3181 void /* PRIVATE */ | 3202 void /* PRIVATE */ |
3182 png_read_start_row(png_structp png_ptr) | 3203 png_read_start_row(png_structp png_ptr) |
3183 { | 3204 { |
3184 #ifdef PNG_READ_INTERLACING_SUPPORTED | 3205 #ifdef PNG_READ_INTERLACING_SUPPORTED |
| 3206 #ifndef PNG_USE_GLOBAL_ARRAYS |
3185 /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ | 3207 /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ |
3186 | 3208 |
3187 /* Start of interlace block */ | 3209 /* Start of interlace block */ |
3188 PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; | 3210 PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; |
3189 | 3211 |
3190 /* Offset to next interlace block */ | 3212 /* Offset to next interlace block */ |
3191 PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; | 3213 PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; |
3192 | 3214 |
3193 /* Start of interlace block in the y direction */ | 3215 /* Start of interlace block in the y direction */ |
3194 PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; | 3216 PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; |
3195 | 3217 |
3196 /* Offset to next interlace block in the y direction */ | 3218 /* Offset to next interlace block in the y direction */ |
3197 PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; | 3219 PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; |
3198 #endif | 3220 #endif |
| 3221 #endif |
3199 | 3222 |
3200 int max_pixel_depth; | 3223 int max_pixel_depth; |
3201 png_size_t row_bytes; | 3224 png_size_t row_bytes; |
3202 | 3225 |
3203 png_debug(1, "in png_read_start_row"); | 3226 png_debug(1, "in png_read_start_row"); |
3204 png_ptr->zstream.avail_in = 0; | 3227 png_ptr->zstream.avail_in = 0; |
3205 png_init_read_transformations(png_ptr); | 3228 png_init_read_transformations(png_ptr); |
3206 #ifdef PNG_READ_INTERLACING_SUPPORTED | 3229 #ifdef PNG_READ_INTERLACING_SUPPORTED |
3207 if (png_ptr->interlaced) | 3230 if (png_ptr->interlaced) |
3208 { | 3231 { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3377 png_debug1(3, "height = %lu,", png_ptr->height); | 3400 png_debug1(3, "height = %lu,", png_ptr->height); |
3378 png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); | 3401 png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); |
3379 png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); | 3402 png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); |
3380 png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); | 3403 png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); |
3381 png_debug1(3, "irowbytes = %lu", | 3404 png_debug1(3, "irowbytes = %lu", |
3382 PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); | 3405 PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); |
3383 | 3406 |
3384 png_ptr->flags |= PNG_FLAG_ROW_INIT; | 3407 png_ptr->flags |= PNG_FLAG_ROW_INIT; |
3385 } | 3408 } |
3386 #endif /* PNG_READ_SUPPORTED */ | 3409 #endif /* PNG_READ_SUPPORTED */ |
OLD | NEW |