Lines Matching refs:png_ptr
29 if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
30 { png_push_save_buffer(png_ptr); return; }
32 if (png_ptr->buffer_size < N) \
33 { png_push_save_buffer(png_ptr); return; }
36 png_process_data(png_structrp png_ptr, png_inforp info_ptr, in png_process_data() argument
39 if (png_ptr == NULL || info_ptr == NULL) in png_process_data()
42 png_push_restore_buffer(png_ptr, buffer, buffer_size); in png_process_data()
44 while (png_ptr->buffer_size) in png_process_data()
46 png_process_some_data(png_ptr, info_ptr); in png_process_data()
51 png_process_data_pause(png_structrp png_ptr, int save) in png_process_data_pause() argument
53 if (png_ptr != NULL) in png_process_data_pause()
59 png_push_save_buffer(png_ptr); in png_process_data_pause()
63 png_size_t remaining = png_ptr->buffer_size; in png_process_data_pause()
64 png_ptr->buffer_size = 0; in png_process_data_pause()
69 if (png_ptr->save_buffer_size < remaining) in png_process_data_pause()
70 return remaining - png_ptr->save_buffer_size; in png_process_data_pause()
78 png_process_data_skip(png_structrp png_ptr) in png_process_data_skip() argument
85 png_app_warning(png_ptr, in png_process_data_skip()
94 png_process_some_data(png_structrp png_ptr, png_inforp info_ptr) in png_process_some_data() argument
96 if (png_ptr == NULL) in png_process_some_data()
99 switch (png_ptr->process_mode) in png_process_some_data()
103 png_push_read_sig(png_ptr, info_ptr); in png_process_some_data()
109 png_push_read_chunk(png_ptr, info_ptr); in png_process_some_data()
115 png_push_read_IDAT(png_ptr); in png_process_some_data()
121 png_ptr->buffer_size = 0; in png_process_some_data()
134 png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr) in png_push_read_sig() argument
136 png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */ in png_push_read_sig()
139 if (png_ptr->buffer_size < num_to_check) in png_push_read_sig()
141 num_to_check = png_ptr->buffer_size; in png_push_read_sig()
144 png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]), in png_push_read_sig()
146 png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check); in png_push_read_sig()
152 png_error(png_ptr, "Not a PNG file"); in png_push_read_sig()
155 png_error(png_ptr, "PNG file corrupted by ASCII conversion"); in png_push_read_sig()
159 if (png_ptr->sig_bytes >= 8) in png_push_read_sig()
161 png_ptr->process_mode = PNG_READ_CHUNK_MODE; in png_push_read_sig()
167 png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) in png_push_read_chunk() argument
180 if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0) in png_push_read_chunk()
186 png_push_fill_buffer(png_ptr, chunk_length, 4); in png_push_read_chunk()
187 png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); in png_push_read_chunk()
188 png_reset_crc(png_ptr); in png_push_read_chunk()
189 png_crc_read(png_ptr, chunk_tag, 4); in png_push_read_chunk()
190 png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); in png_push_read_chunk()
191 png_check_chunk_name(png_ptr, png_ptr->chunk_name); in png_push_read_chunk()
192 png_check_chunk_length(png_ptr, png_ptr->push_length); in png_push_read_chunk()
193 png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; in png_push_read_chunk()
196 chunk_name = png_ptr->chunk_name; in png_push_read_chunk()
200 if ((png_ptr->mode & PNG_AFTER_IDAT) != 0) in png_push_read_chunk()
201 png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; in png_push_read_chunk()
207 if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) in png_push_read_chunk()
208 png_error(png_ptr, "Missing IHDR before IDAT"); in png_push_read_chunk()
210 else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && in png_push_read_chunk()
211 (png_ptr->mode & PNG_HAVE_PLTE) == 0) in png_push_read_chunk()
212 png_error(png_ptr, "Missing PLTE before IDAT"); in png_push_read_chunk()
214 png_ptr->process_mode = PNG_READ_IDAT_MODE; in png_push_read_chunk()
216 if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) in png_push_read_chunk()
217 if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0) in png_push_read_chunk()
218 if (png_ptr->push_length == 0) in png_push_read_chunk()
221 png_ptr->mode |= PNG_HAVE_IDAT; in png_push_read_chunk()
223 if ((png_ptr->mode & PNG_AFTER_IDAT) != 0) in png_push_read_chunk()
224 png_benign_error(png_ptr, "Too many IDATs found"); in png_push_read_chunk()
229 if (png_ptr->push_length != 13) in png_push_read_chunk()
230 png_error(png_ptr, "Invalid IHDR length"); in png_push_read_chunk()
233 png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
239 png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
241 png_ptr->process_mode = PNG_READ_DONE_MODE; in png_push_read_chunk()
242 png_push_have_end(png_ptr, info_ptr); in png_push_read_chunk()
246 else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0) in png_push_read_chunk()
249 png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep); in png_push_read_chunk()
252 png_ptr->mode |= PNG_HAVE_PLTE; in png_push_read_chunk()
259 png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
264 png_ptr->idat_size = png_ptr->push_length; in png_push_read_chunk()
265 png_ptr->process_mode = PNG_READ_IDAT_MODE; in png_push_read_chunk()
266 png_push_have_info(png_ptr, info_ptr); in png_push_read_chunk()
267 png_ptr->zstream.avail_out = in png_push_read_chunk()
268 (uInt) PNG_ROWBYTES(png_ptr->pixel_depth, in png_push_read_chunk()
269 png_ptr->iwidth) + 1; in png_push_read_chunk()
270 png_ptr->zstream.next_out = png_ptr->row_buf; in png_push_read_chunk()
275 else if (png_ptr->chunk_name == png_gAMA) in png_push_read_chunk()
278 png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
283 else if (png_ptr->chunk_name == png_sBIT) in png_push_read_chunk()
286 png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
291 else if (png_ptr->chunk_name == png_cHRM) in png_push_read_chunk()
294 png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
302 png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
307 else if (png_ptr->chunk_name == png_iCCP) in png_push_read_chunk()
310 png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
318 png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
326 png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
334 png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
342 png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
350 png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
358 png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
366 png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
374 png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
382 png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
390 png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
398 png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
406 png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); in png_push_read_chunk()
413 png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, in png_push_read_chunk()
417 png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; in png_push_read_chunk()
421 png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) in png_push_fill_buffer() argument
425 if (png_ptr == NULL) in png_push_fill_buffer()
429 if (png_ptr->save_buffer_size != 0) in png_push_fill_buffer()
433 if (length < png_ptr->save_buffer_size) in png_push_fill_buffer()
437 save_size = png_ptr->save_buffer_size; in png_push_fill_buffer()
439 memcpy(ptr, png_ptr->save_buffer_ptr, save_size); in png_push_fill_buffer()
442 png_ptr->buffer_size -= save_size; in png_push_fill_buffer()
443 png_ptr->save_buffer_size -= save_size; in png_push_fill_buffer()
444 png_ptr->save_buffer_ptr += save_size; in png_push_fill_buffer()
446 if (length != 0 && png_ptr->current_buffer_size != 0) in png_push_fill_buffer()
450 if (length < png_ptr->current_buffer_size) in png_push_fill_buffer()
454 save_size = png_ptr->current_buffer_size; in png_push_fill_buffer()
456 memcpy(ptr, png_ptr->current_buffer_ptr, save_size); in png_push_fill_buffer()
457 png_ptr->buffer_size -= save_size; in png_push_fill_buffer()
458 png_ptr->current_buffer_size -= save_size; in png_push_fill_buffer()
459 png_ptr->current_buffer_ptr += save_size; in png_push_fill_buffer()
464 png_push_save_buffer(png_structrp png_ptr) in png_push_save_buffer() argument
466 if (png_ptr->save_buffer_size != 0) in png_push_save_buffer()
468 if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) in png_push_save_buffer()
474 istop = png_ptr->save_buffer_size; in png_push_save_buffer()
475 for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; in png_push_save_buffer()
482 if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > in png_push_save_buffer()
483 png_ptr->save_buffer_max) in png_push_save_buffer()
488 if (png_ptr->save_buffer_size > PNG_SIZE_MAX - in png_push_save_buffer()
489 (png_ptr->current_buffer_size + 256)) in png_push_save_buffer()
491 png_error(png_ptr, "Potential overflow of save_buffer"); in png_push_save_buffer()
494 new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; in png_push_save_buffer()
495 old_buffer = png_ptr->save_buffer; in png_push_save_buffer()
496 png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr, in png_push_save_buffer()
499 if (png_ptr->save_buffer == NULL) in png_push_save_buffer()
501 png_free(png_ptr, old_buffer); in png_push_save_buffer()
502 png_error(png_ptr, "Insufficient memory for save_buffer"); in png_push_save_buffer()
506 memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); in png_push_save_buffer()
507 else if (png_ptr->save_buffer_size) in png_push_save_buffer()
508 png_error(png_ptr, "save_buffer error"); in png_push_save_buffer()
509 png_free(png_ptr, old_buffer); in png_push_save_buffer()
510 png_ptr->save_buffer_max = new_max; in png_push_save_buffer()
512 if (png_ptr->current_buffer_size) in png_push_save_buffer()
514 memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size, in png_push_save_buffer()
515 png_ptr->current_buffer_ptr, png_ptr->current_buffer_size); in png_push_save_buffer()
516 png_ptr->save_buffer_size += png_ptr->current_buffer_size; in png_push_save_buffer()
517 png_ptr->current_buffer_size = 0; in png_push_save_buffer()
519 png_ptr->save_buffer_ptr = png_ptr->save_buffer; in png_push_save_buffer()
520 png_ptr->buffer_size = 0; in png_push_save_buffer()
524 png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer, in png_push_restore_buffer() argument
527 png_ptr->current_buffer = buffer; in png_push_restore_buffer()
528 png_ptr->current_buffer_size = buffer_length; in png_push_restore_buffer()
529 png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; in png_push_restore_buffer()
530 png_ptr->current_buffer_ptr = png_ptr->current_buffer; in png_push_restore_buffer()
534 png_push_read_IDAT(png_structrp png_ptr) in png_push_read_IDAT() argument
536 if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0) in png_push_read_IDAT()
543 png_push_fill_buffer(png_ptr, chunk_length, 4); in png_push_read_IDAT()
544 png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); in png_push_read_IDAT()
545 png_reset_crc(png_ptr); in png_push_read_IDAT()
546 png_crc_read(png_ptr, chunk_tag, 4); in png_push_read_IDAT()
547 png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); in png_push_read_IDAT()
548 png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; in png_push_read_IDAT()
550 if (png_ptr->chunk_name != png_IDAT) in png_push_read_IDAT()
552 png_ptr->process_mode = PNG_READ_CHUNK_MODE; in png_push_read_IDAT()
554 if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0) in png_push_read_IDAT()
555 png_error(png_ptr, "Not enough compressed data"); in png_push_read_IDAT()
560 png_ptr->idat_size = png_ptr->push_length; in png_push_read_IDAT()
563 if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0) in png_push_read_IDAT()
565 png_size_t save_size = png_ptr->save_buffer_size; in png_push_read_IDAT()
566 png_uint_32 idat_size = png_ptr->idat_size; in png_push_read_IDAT()
580 png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); in png_push_read_IDAT()
582 png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size); in png_push_read_IDAT()
584 png_ptr->idat_size -= idat_size; in png_push_read_IDAT()
585 png_ptr->buffer_size -= save_size; in png_push_read_IDAT()
586 png_ptr->save_buffer_size -= save_size; in png_push_read_IDAT()
587 png_ptr->save_buffer_ptr += save_size; in png_push_read_IDAT()
590 if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0) in png_push_read_IDAT()
592 png_size_t save_size = png_ptr->current_buffer_size; in png_push_read_IDAT()
593 png_uint_32 idat_size = png_ptr->idat_size; in png_push_read_IDAT()
606 png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); in png_push_read_IDAT()
608 png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size); in png_push_read_IDAT()
610 png_ptr->idat_size -= idat_size; in png_push_read_IDAT()
611 png_ptr->buffer_size -= save_size; in png_push_read_IDAT()
612 png_ptr->current_buffer_size -= save_size; in png_push_read_IDAT()
613 png_ptr->current_buffer_ptr += save_size; in png_push_read_IDAT()
616 if (png_ptr->idat_size == 0) in png_push_read_IDAT()
619 png_crc_finish(png_ptr, 0); in png_push_read_IDAT()
620 png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; in png_push_read_IDAT()
621 png_ptr->mode |= PNG_AFTER_IDAT; in png_push_read_IDAT()
622 png_ptr->zowner = 0; in png_push_read_IDAT()
627 png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, in png_process_IDAT_data() argument
632 png_error(png_ptr, "No IDAT data (internal error)"); in png_process_IDAT_data()
638 png_ptr->zstream.next_in = buffer; in png_process_IDAT_data()
640 png_ptr->zstream.avail_in = (uInt)buffer_length; in png_process_IDAT_data()
645 while (png_ptr->zstream.avail_in > 0 && in png_process_IDAT_data()
646 (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0) in png_process_IDAT_data()
655 if (!(png_ptr->zstream.avail_out > 0)) in png_process_IDAT_data()
658 png_ptr->zstream.avail_out = (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth, in png_process_IDAT_data()
659 png_ptr->iwidth) + 1); in png_process_IDAT_data()
661 png_ptr->zstream.next_out = png_ptr->row_buf; in png_process_IDAT_data()
671 ret = PNG_INFLATE(png_ptr, Z_SYNC_FLUSH); in png_process_IDAT_data()
677 png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; in png_process_IDAT_data()
678 png_ptr->zowner = 0; in png_process_IDAT_data()
683 if (png_ptr->row_number >= png_ptr->num_rows || in png_process_IDAT_data()
684 png_ptr->pass > 6) in png_process_IDAT_data()
685 png_warning(png_ptr, "Truncated compressed data in IDAT"); in png_process_IDAT_data()
690 png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch"); in png_process_IDAT_data()
692 png_error(png_ptr, "Decompression error in IDAT"); in png_process_IDAT_data()
700 if (png_ptr->zstream.next_out != png_ptr->row_buf) in png_process_IDAT_data()
706 if (png_ptr->row_number >= png_ptr->num_rows || in png_process_IDAT_data()
707 png_ptr->pass > 6) in png_process_IDAT_data()
710 png_warning(png_ptr, "Extra compressed data in IDAT"); in png_process_IDAT_data()
711 png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; in png_process_IDAT_data()
712 png_ptr->zowner = 0; in png_process_IDAT_data()
721 if (png_ptr->zstream.avail_out == 0) in png_process_IDAT_data()
722 png_push_process_row(png_ptr); in png_process_IDAT_data()
727 png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; in png_process_IDAT_data()
734 if (png_ptr->zstream.avail_in > 0) in png_process_IDAT_data()
735 png_warning(png_ptr, "Extra compression data in IDAT"); in png_process_IDAT_data()
739 png_push_process_row(png_structrp png_ptr) in png_push_process_row() argument
744 row_info.width = png_ptr->iwidth; /* NOTE: width of current interlaced row */ in png_push_process_row()
745 row_info.color_type = png_ptr->color_type; in png_push_process_row()
746 row_info.bit_depth = png_ptr->bit_depth; in png_push_process_row()
747 row_info.channels = png_ptr->channels; in png_push_process_row()
748 row_info.pixel_depth = png_ptr->pixel_depth; in png_push_process_row()
751 if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) in png_push_process_row()
753 if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST) in png_push_process_row()
754 png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1, in png_push_process_row()
755 png_ptr->prev_row + 1, png_ptr->row_buf[0]); in png_push_process_row()
757 png_error(png_ptr, "bad adaptive filter value"); in png_push_process_row()
765 memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1); in png_push_process_row()
768 if (png_ptr->transformations != 0) in png_push_process_row()
769 png_do_read_transformations(png_ptr, &row_info); in png_push_process_row()
773 if (png_ptr->transformed_pixel_depth == 0) in png_push_process_row()
775 png_ptr->transformed_pixel_depth = row_info.pixel_depth; in png_push_process_row()
776 if (row_info.pixel_depth > png_ptr->maximum_pixel_depth) in png_push_process_row()
777 png_error(png_ptr, "progressive row overflow"); in png_push_process_row()
780 else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth) in png_push_process_row()
781 png_error(png_ptr, "internal progressive row size calculation error"); in png_push_process_row()
786 if (png_ptr->interlaced != 0 && in png_push_process_row()
787 (png_ptr->transformations & PNG_INTERLACE) != 0) in png_push_process_row()
789 if (png_ptr->pass < 6) in png_push_process_row()
790 png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, in png_push_process_row()
791 png_ptr->transformations); in png_push_process_row()
793 switch (png_ptr->pass) in png_push_process_row()
798 for (i = 0; i < 8 && png_ptr->pass == 0; i++) in png_push_process_row()
800 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
801 png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */ in png_push_process_row()
804 if (png_ptr->pass == 2) /* Pass 1 might be empty */ in png_push_process_row()
806 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
808 png_push_have_row(png_ptr, NULL); in png_push_process_row()
809 png_read_push_finish_row(png_ptr); in png_push_process_row()
813 if (png_ptr->pass == 4 && png_ptr->height <= 4) in png_push_process_row()
815 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
817 png_push_have_row(png_ptr, NULL); in png_push_process_row()
818 png_read_push_finish_row(png_ptr); in png_push_process_row()
822 if (png_ptr->pass == 6 && png_ptr->height <= 4) in png_push_process_row()
824 png_push_have_row(png_ptr, NULL); in png_push_process_row()
825 png_read_push_finish_row(png_ptr); in png_push_process_row()
834 for (i = 0; i < 8 && png_ptr->pass == 1; i++) in png_push_process_row()
836 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
837 png_read_push_finish_row(png_ptr); in png_push_process_row()
840 if (png_ptr->pass == 2) /* Skip top 4 generated rows */ in png_push_process_row()
842 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
844 png_push_have_row(png_ptr, NULL); in png_push_process_row()
845 png_read_push_finish_row(png_ptr); in png_push_process_row()
856 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
858 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
859 png_read_push_finish_row(png_ptr); in png_push_process_row()
862 for (i = 0; i < 4 && png_ptr->pass == 2; i++) in png_push_process_row()
864 png_push_have_row(png_ptr, NULL); in png_push_process_row()
865 png_read_push_finish_row(png_ptr); in png_push_process_row()
868 if (png_ptr->pass == 4) /* Pass 3 might be empty */ in png_push_process_row()
870 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
872 png_push_have_row(png_ptr, NULL); in png_push_process_row()
873 png_read_push_finish_row(png_ptr); in png_push_process_row()
884 for (i = 0; i < 4 && png_ptr->pass == 3; i++) in png_push_process_row()
886 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
887 png_read_push_finish_row(png_ptr); in png_push_process_row()
890 if (png_ptr->pass == 4) /* Skip top two generated rows */ in png_push_process_row()
892 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
894 png_push_have_row(png_ptr, NULL); in png_push_process_row()
895 png_read_push_finish_row(png_ptr); in png_push_process_row()
906 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
908 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
909 png_read_push_finish_row(png_ptr); in png_push_process_row()
912 for (i = 0; i < 2 && png_ptr->pass == 4; i++) in png_push_process_row()
914 png_push_have_row(png_ptr, NULL); in png_push_process_row()
915 png_read_push_finish_row(png_ptr); in png_push_process_row()
918 if (png_ptr->pass == 6) /* Pass 5 might be empty */ in png_push_process_row()
920 png_push_have_row(png_ptr, NULL); in png_push_process_row()
921 png_read_push_finish_row(png_ptr); in png_push_process_row()
931 for (i = 0; i < 2 && png_ptr->pass == 5; i++) in png_push_process_row()
933 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
934 png_read_push_finish_row(png_ptr); in png_push_process_row()
937 if (png_ptr->pass == 6) /* Skip top generated row */ in png_push_process_row()
939 png_push_have_row(png_ptr, NULL); in png_push_process_row()
940 png_read_push_finish_row(png_ptr); in png_push_process_row()
949 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
950 png_read_push_finish_row(png_ptr); in png_push_process_row()
952 if (png_ptr->pass != 6) in png_push_process_row()
955 png_push_have_row(png_ptr, NULL); in png_push_process_row()
956 png_read_push_finish_row(png_ptr); in png_push_process_row()
963 png_push_have_row(png_ptr, png_ptr->row_buf + 1); in png_push_process_row()
964 png_read_push_finish_row(png_ptr); in png_push_process_row()
969 png_read_push_finish_row(png_structrp png_ptr) in png_read_push_finish_row() argument
992 png_ptr->row_number++; in png_read_push_finish_row()
993 if (png_ptr->row_number < png_ptr->num_rows) in png_read_push_finish_row()
997 if (png_ptr->interlaced != 0) in png_read_push_finish_row()
999 png_ptr->row_number = 0; in png_read_push_finish_row()
1000 memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1); in png_read_push_finish_row()
1004 png_ptr->pass++; in png_read_push_finish_row()
1005 if ((png_ptr->pass == 1 && png_ptr->width < 5) || in png_read_push_finish_row()
1006 (png_ptr->pass == 3 && png_ptr->width < 3) || in png_read_push_finish_row()
1007 (png_ptr->pass == 5 && png_ptr->width < 2)) in png_read_push_finish_row()
1008 png_ptr->pass++; in png_read_push_finish_row()
1010 if (png_ptr->pass > 7) in png_read_push_finish_row()
1011 png_ptr->pass--; in png_read_push_finish_row()
1013 if (png_ptr->pass >= 7) in png_read_push_finish_row()
1016 png_ptr->iwidth = (png_ptr->width + in png_read_push_finish_row()
1017 png_pass_inc[png_ptr->pass] - 1 - in png_read_push_finish_row()
1018 png_pass_start[png_ptr->pass]) / in png_read_push_finish_row()
1019 png_pass_inc[png_ptr->pass]; in png_read_push_finish_row()
1021 if ((png_ptr->transformations & PNG_INTERLACE) != 0) in png_read_push_finish_row()
1024 png_ptr->num_rows = (png_ptr->height + in png_read_push_finish_row()
1025 png_pass_yinc[png_ptr->pass] - 1 - in png_read_push_finish_row()
1026 png_pass_ystart[png_ptr->pass]) / in png_read_push_finish_row()
1027 png_pass_yinc[png_ptr->pass]; in png_read_push_finish_row()
1029 } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); in png_read_push_finish_row()
1035 png_push_have_info(png_structrp png_ptr, png_inforp info_ptr) in png_push_have_info() argument
1037 if (png_ptr->info_fn != NULL) in png_push_have_info()
1038 (*(png_ptr->info_fn))(png_ptr, info_ptr); in png_push_have_info()
1042 png_push_have_end(png_structrp png_ptr, png_inforp info_ptr) in png_push_have_end() argument
1044 if (png_ptr->end_fn != NULL) in png_push_have_end()
1045 (*(png_ptr->end_fn))(png_ptr, info_ptr); in png_push_have_end()
1049 png_push_have_row(png_structrp png_ptr, png_bytep row) in png_push_have_row() argument
1051 if (png_ptr->row_fn != NULL) in png_push_have_row()
1052 (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, in png_push_have_row()
1053 (int)png_ptr->pass); in png_push_have_row()
1058 png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, in png_progressive_combine_row() argument
1061 if (png_ptr == NULL) in png_progressive_combine_row()
1069 png_combine_row(png_ptr, old_row, 1/*blocky display*/); in png_progressive_combine_row()
1074 png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr, in png_set_progressive_read_fn() argument
1078 if (png_ptr == NULL) in png_set_progressive_read_fn()
1081 png_ptr->info_fn = info_fn; in png_set_progressive_read_fn()
1082 png_ptr->row_fn = row_fn; in png_set_progressive_read_fn()
1083 png_ptr->end_fn = end_fn; in png_set_progressive_read_fn()
1085 png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); in png_set_progressive_read_fn()
1089 png_get_progressive_ptr(png_const_structrp png_ptr) in png_get_progressive_ptr() argument
1091 if (png_ptr == NULL) in png_get_progressive_ptr()
1094 return png_ptr->io_ptr; in png_get_progressive_ptr()