• Home
  • Raw
  • Download

Lines Matching refs:png_ptr

26 png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)  in png_write_info_before_PLTE()  argument
29 if (png_ptr == NULL || info_ptr == NULL) in png_write_info_before_PLTE()
31 if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) in png_write_info_before_PLTE()
33 png_write_sig(png_ptr); /* write PNG signature */ in png_write_info_before_PLTE()
35 if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) in png_write_info_before_PLTE()
37 png_warning(png_ptr,"MNG features are not allowed in a PNG datastream"); in png_write_info_before_PLTE()
38 png_ptr->mng_features_permitted=0; in png_write_info_before_PLTE()
42 png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height, in png_write_info_before_PLTE()
56 png_write_gAMA(png_ptr, info_ptr->gamma); in png_write_info_before_PLTE()
59 png_write_gAMA_fixed(png_ptr, info_ptr->int_gamma); in png_write_info_before_PLTE()
66 png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent); in png_write_info_before_PLTE()
70 png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE, in png_write_info_before_PLTE()
75 png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type); in png_write_info_before_PLTE()
81 png_write_cHRM(png_ptr, in png_write_info_before_PLTE()
88 png_write_cHRM_fixed(png_ptr, in png_write_info_before_PLTE()
108 int keep=png_handle_as_unknown(png_ptr, up->name); in png_write_info_before_PLTE()
113 (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) in png_write_info_before_PLTE()
115 png_write_chunk(png_ptr, up->name, up->data, up->size); in png_write_info_before_PLTE()
120 png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE; in png_write_info_before_PLTE()
125 png_write_info(png_structp png_ptr, png_infop info_ptr) in png_write_info() argument
133 if (png_ptr == NULL || info_ptr == NULL) in png_write_info()
136 png_write_info_before_PLTE(png_ptr, info_ptr); in png_write_info()
139 png_write_PLTE(png_ptr, info_ptr->palette, in png_write_info()
142 png_error(png_ptr, "Valid palette required for paletted images"); in png_write_info()
149 if ((png_ptr->transformations & PNG_INVERT_ALPHA) && in png_write_info()
157 png_write_tRNS(png_ptr, info_ptr->trans, &(info_ptr->trans_values), in png_write_info()
163 png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); in png_write_info()
167 png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); in png_write_info()
171 png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset, in png_write_info()
176 png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0, in png_write_info()
183 png_write_sCAL(png_ptr, (int)info_ptr->scal_unit, in png_write_info()
187 png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit, in png_write_info()
190 png_warning(png_ptr, in png_write_info()
197 png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit, in png_write_info()
203 png_write_tIME(png_ptr, &(info_ptr->mod_time)); in png_write_info()
204 png_ptr->mode |= PNG_WROTE_tIME; in png_write_info()
210 png_write_sPLT(png_ptr, info_ptr->splt_palettes + i); in png_write_info()
223 png_write_iTXt(png_ptr, in png_write_info()
230 png_warning(png_ptr, "Unable to write international text"); in png_write_info()
240 png_write_zTXt(png_ptr, info_ptr->text[i].key, in png_write_info()
244 png_warning(png_ptr, "Unable to write compressed text"); in png_write_info()
253 png_write_tEXt(png_ptr, info_ptr->text[i].key, in png_write_info()
257 png_warning(png_ptr, "Unable to write uncompressed text"); in png_write_info()
275 int keep=png_handle_as_unknown(png_ptr, up->name); in png_write_info()
280 (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) in png_write_info()
282 png_write_chunk(png_ptr, up->name, up->data, up->size); in png_write_info()
295 png_write_end(png_structp png_ptr, png_infop info_ptr) in png_write_end() argument
298 if (png_ptr == NULL) in png_write_end()
300 if (!(png_ptr->mode & PNG_HAVE_IDAT)) in png_write_end()
301 png_error(png_ptr, "No IDATs written into file"); in png_write_end()
312 !(png_ptr->mode & PNG_WROTE_tIME)) in png_write_end()
313 png_write_tIME(png_ptr, &(info_ptr->mod_time)); in png_write_end()
326 png_write_iTXt(png_ptr, in png_write_end()
333 png_warning(png_ptr, "Unable to write international text"); in png_write_end()
342 png_write_zTXt(png_ptr, info_ptr->text[i].key, in png_write_end()
346 png_warning(png_ptr, "Unable to write compressed text"); in png_write_end()
355 png_write_tEXt(png_ptr, info_ptr->text[i].key, in png_write_end()
358 png_warning(png_ptr, "Unable to write uncompressed text"); in png_write_end()
377 int keep=png_handle_as_unknown(png_ptr, up->name); in png_write_end()
381 (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) in png_write_end()
383 png_write_chunk(png_ptr, up->name, up->data, up->size); in png_write_end()
390 png_ptr->mode |= PNG_AFTER_IDAT; in png_write_end()
393 png_write_IEND(png_ptr); in png_write_end()
440 png_structp png_ptr; in png_create_write_struct_2() local
449 png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, in png_create_write_struct_2()
452 png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); in png_create_write_struct_2()
454 if (png_ptr == NULL) in png_create_write_struct_2()
460 png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ in png_create_write_struct_2()
467 png_ptr->user_width_max=PNG_USER_WIDTH_MAX; in png_create_write_struct_2()
468 png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; in png_create_write_struct_2()
475 if (setjmp(png_ptr->jmpbuf)) in png_create_write_struct_2()
478 png_free(png_ptr, png_ptr->zbuf); in png_create_write_struct_2()
479 png_ptr->zbuf=NULL; in png_create_write_struct_2()
480 png_destroy_struct(png_ptr); in png_create_write_struct_2()
484 png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); in png_create_write_struct_2()
489 png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); in png_create_write_struct_2()
491 png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); in png_create_write_struct_2()
497 png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; in png_create_write_struct_2()
500 if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) in png_create_write_struct_2()
518 png_warning(png_ptr, msg); in png_create_write_struct_2()
523 png_warning(png_ptr, msg); in png_create_write_struct_2()
526 png_ptr->flags=0; in png_create_write_struct_2()
528 png_error(png_ptr, in png_create_write_struct_2()
534 png_ptr->zbuf_size = PNG_ZBUF_SIZE; in png_create_write_struct_2()
535 png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, in png_create_write_struct_2()
536 (png_uint_32)png_ptr->zbuf_size); in png_create_write_struct_2()
538 png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, in png_create_write_struct_2()
542 png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, in png_create_write_struct_2()
553 png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); in png_create_write_struct_2()
555 if (setjmp(png_ptr->jmpbuf)) in png_create_write_struct_2()
559 return (png_ptr); in png_create_write_struct_2()
567 png_write_init(png_structp png_ptr) in png_write_init() argument
570 png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0); in png_write_init()
574 png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, in png_write_init_2() argument
578 if(png_ptr == NULL) return; in png_write_init_2()
584 png_ptr->warning_fn=NULL; in png_write_init_2()
590 png_warning(png_ptr, msg); in png_write_init_2()
595 png_warning(png_ptr, msg); in png_write_init_2()
600 png_ptr->error_fn=NULL; in png_write_init_2()
602 png_ptr->flags=0; in png_write_init_2()
604 png_error(png_ptr, in png_write_init_2()
609 png_ptr->error_fn=NULL; in png_write_init_2()
611 png_ptr->flags=0; in png_write_init_2()
613 png_error(png_ptr, in png_write_init_2()
616 png_write_init_3(&png_ptr, user_png_ver, png_struct_size); in png_write_init_2()
625 png_structp png_ptr=*ptr_ptr; in png_write_init_3() local
632 if (png_ptr == NULL) in png_write_init_3()
640 png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; in png_write_init_3()
642 png_ptr->warning_fn=NULL; in png_write_init_3()
643 png_warning(png_ptr, in png_write_init_3()
654 png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); in png_write_init_3()
659 png_destroy_struct(png_ptr); in png_write_init_3()
660 png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); in png_write_init_3()
661 *ptr_ptr = png_ptr; in png_write_init_3()
665 png_memset(png_ptr, 0, png_sizeof (png_struct)); in png_write_init_3()
669 png_ptr->user_width_max=PNG_USER_WIDTH_MAX; in png_write_init_3()
670 png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; in png_write_init_3()
676 png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ in png_write_init_3()
683 png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); in png_write_init_3()
686 png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, in png_write_init_3()
690 png_ptr->zbuf_size = PNG_ZBUF_SIZE; in png_write_init_3()
691 png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, in png_write_init_3()
692 (png_uint_32)png_ptr->zbuf_size); in png_write_init_3()
695 png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, in png_write_init_3()
706 png_write_rows(png_structp png_ptr, png_bytepp row, in png_write_rows() argument
714 if (png_ptr == NULL) in png_write_rows()
720 png_write_row(png_ptr, *rp); in png_write_rows()
728 png_write_image(png_structp png_ptr, png_bytepp image) in png_write_image() argument
734 if (png_ptr == NULL) in png_write_image()
741 num_pass = png_set_interlace_handling(png_ptr); in png_write_image()
749 for (i = 0, rp = image; i < png_ptr->height; i++, rp++) in png_write_image()
751 png_write_row(png_ptr, *rp); in png_write_image()
758 png_write_row(png_structp png_ptr, png_bytep row) in png_write_row() argument
760 if (png_ptr == NULL) in png_write_row()
763 png_ptr->row_number, png_ptr->pass); in png_write_row()
766 if (png_ptr->row_number == 0 && png_ptr->pass == 0) in png_write_row()
769 if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) in png_write_row()
770 png_error(png_ptr, in png_write_row()
775 if (png_ptr->transformations & PNG_INVERT_MONO) in png_write_row()
776 png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined."); in png_write_row()
779 if (png_ptr->transformations & PNG_FILLER) in png_write_row()
780 png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined."); in png_write_row()
783 if (png_ptr->transformations & PNG_PACKSWAP) in png_write_row()
784 png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined."); in png_write_row()
787 if (png_ptr->transformations & PNG_PACK) in png_write_row()
788 png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined."); in png_write_row()
791 if (png_ptr->transformations & PNG_SHIFT) in png_write_row()
792 png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined."); in png_write_row()
795 if (png_ptr->transformations & PNG_BGR) in png_write_row()
796 png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined."); in png_write_row()
799 if (png_ptr->transformations & PNG_SWAP_BYTES) in png_write_row()
800 png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined."); in png_write_row()
803 png_write_start_row(png_ptr); in png_write_row()
808 if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) in png_write_row()
810 switch (png_ptr->pass) in png_write_row()
813 if (png_ptr->row_number & 0x07) in png_write_row()
815 png_write_finish_row(png_ptr); in png_write_row()
820 if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) in png_write_row()
822 png_write_finish_row(png_ptr); in png_write_row()
827 if ((png_ptr->row_number & 0x07) != 4) in png_write_row()
829 png_write_finish_row(png_ptr); in png_write_row()
834 if ((png_ptr->row_number & 0x03) || png_ptr->width < 3) in png_write_row()
836 png_write_finish_row(png_ptr); in png_write_row()
841 if ((png_ptr->row_number & 0x03) != 2) in png_write_row()
843 png_write_finish_row(png_ptr); in png_write_row()
848 if ((png_ptr->row_number & 0x01) || png_ptr->width < 2) in png_write_row()
850 png_write_finish_row(png_ptr); in png_write_row()
855 if (!(png_ptr->row_number & 0x01)) in png_write_row()
857 png_write_finish_row(png_ptr); in png_write_row()
866 png_ptr->row_info.color_type = png_ptr->color_type; in png_write_row()
867 png_ptr->row_info.width = png_ptr->usr_width; in png_write_row()
868 png_ptr->row_info.channels = png_ptr->usr_channels; in png_write_row()
869 png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth; in png_write_row()
870 png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * in png_write_row()
871 png_ptr->row_info.channels); in png_write_row()
873 png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, in png_write_row()
874 png_ptr->row_info.width); in png_write_row()
876 png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type); in png_write_row()
877 png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width); in png_write_row()
878 png_debug1(3, "row_info->channels = %d\n", png_ptr->row_info.channels); in png_write_row()
879 png_debug1(3, "row_info->bit_depth = %d\n", png_ptr->row_info.bit_depth); in png_write_row()
880 png_debug1(3, "row_info->pixel_depth = %d\n", png_ptr->row_info.pixel_depth); in png_write_row()
881 png_debug1(3, "row_info->rowbytes = %lu\n", png_ptr->row_info.rowbytes); in png_write_row()
884 png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row, in png_write_row()
885 png_ptr->row_info.rowbytes); in png_write_row()
889 if (png_ptr->interlaced && png_ptr->pass < 6 && in png_write_row()
890 (png_ptr->transformations & PNG_INTERLACE)) in png_write_row()
892 png_do_write_interlace(&(png_ptr->row_info), in png_write_row()
893 png_ptr->row_buf + 1, png_ptr->pass); in png_write_row()
895 if (!(png_ptr->row_info.width)) in png_write_row()
897 png_write_finish_row(png_ptr); in png_write_row()
904 if (png_ptr->transformations) in png_write_row()
905 png_do_write_transformations(png_ptr); in png_write_row()
917 if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && in png_write_row()
918 (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) in png_write_row()
921 png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); in png_write_row()
926 png_write_find_filter(png_ptr, &(png_ptr->row_info)); in png_write_row()
928 if (png_ptr->write_row_fn != NULL) in png_write_row()
929 (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); in png_write_row()
935 png_set_flush(png_structp png_ptr, int nrows) in png_set_flush() argument
938 if (png_ptr == NULL) in png_set_flush()
940 png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); in png_set_flush()
945 png_write_flush(png_structp png_ptr) in png_write_flush() argument
950 if (png_ptr == NULL) in png_write_flush()
953 if (png_ptr->row_number >= png_ptr->num_rows) in png_write_flush()
961 ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH); in png_write_flush()
967 if (png_ptr->zstream.msg != NULL) in png_write_flush()
968 png_error(png_ptr, png_ptr->zstream.msg); in png_write_flush()
970 png_error(png_ptr, "zlib error"); in png_write_flush()
973 if (!(png_ptr->zstream.avail_out)) in png_write_flush()
976 png_write_IDAT(png_ptr, png_ptr->zbuf, in png_write_flush()
977 png_ptr->zbuf_size); in png_write_flush()
978 png_ptr->zstream.next_out = png_ptr->zbuf; in png_write_flush()
979 png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; in png_write_flush()
985 if (png_ptr->zbuf_size != png_ptr->zstream.avail_out) in png_write_flush()
988 png_write_IDAT(png_ptr, png_ptr->zbuf, in png_write_flush()
989 png_ptr->zbuf_size - png_ptr->zstream.avail_out); in png_write_flush()
990 png_ptr->zstream.next_out = png_ptr->zbuf; in png_write_flush()
991 png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; in png_write_flush()
993 png_ptr->flush_rows = 0; in png_write_flush()
994 png_flush(png_ptr); in png_write_flush()
1002 png_structp png_ptr = NULL; in png_destroy_write_struct() local
1012 png_ptr = *png_ptr_ptr; in png_destroy_write_struct()
1014 free_fn = png_ptr->free_fn; in png_destroy_write_struct()
1015 mem_ptr = png_ptr->mem_ptr; in png_destroy_write_struct()
1024 png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); in png_destroy_write_struct()
1027 if (png_ptr->num_chunk_list) in png_destroy_write_struct()
1029 png_free(png_ptr, png_ptr->chunk_list); in png_destroy_write_struct()
1030 png_ptr->chunk_list=NULL; in png_destroy_write_struct()
1031 png_ptr->num_chunk_list=0; in png_destroy_write_struct()
1044 if (png_ptr != NULL) in png_destroy_write_struct()
1046 png_write_destroy(png_ptr); in png_destroy_write_struct()
1048 png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, in png_destroy_write_struct()
1051 png_destroy_struct((png_voidp)png_ptr); in png_destroy_write_struct()
1060 png_write_destroy(png_structp png_ptr) in png_write_destroy() argument
1074 deflateEnd(&png_ptr->zstream); in png_write_destroy()
1077 png_free(png_ptr, png_ptr->zbuf); in png_write_destroy()
1078 png_free(png_ptr, png_ptr->row_buf); in png_write_destroy()
1079 png_free(png_ptr, png_ptr->prev_row); in png_write_destroy()
1080 png_free(png_ptr, png_ptr->sub_row); in png_write_destroy()
1081 png_free(png_ptr, png_ptr->up_row); in png_write_destroy()
1082 png_free(png_ptr, png_ptr->avg_row); in png_write_destroy()
1083 png_free(png_ptr, png_ptr->paeth_row); in png_write_destroy()
1086 png_free(png_ptr, png_ptr->time_buffer); in png_write_destroy()
1090 png_free(png_ptr, png_ptr->prev_filters); in png_write_destroy()
1091 png_free(png_ptr, png_ptr->filter_weights); in png_write_destroy()
1092 png_free(png_ptr, png_ptr->inv_filter_weights); in png_write_destroy()
1093 png_free(png_ptr, png_ptr->filter_costs); in png_write_destroy()
1094 png_free(png_ptr, png_ptr->inv_filter_costs); in png_write_destroy()
1099 png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); in png_write_destroy()
1102 error_fn = png_ptr->error_fn; in png_write_destroy()
1103 warning_fn = png_ptr->warning_fn; in png_write_destroy()
1104 error_ptr = png_ptr->error_ptr; in png_write_destroy()
1106 free_fn = png_ptr->free_fn; in png_write_destroy()
1109 png_memset(png_ptr, 0, png_sizeof (png_struct)); in png_write_destroy()
1111 png_ptr->error_fn = error_fn; in png_write_destroy()
1112 png_ptr->warning_fn = warning_fn; in png_write_destroy()
1113 png_ptr->error_ptr = error_ptr; in png_write_destroy()
1115 png_ptr->free_fn = free_fn; in png_write_destroy()
1119 png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); in png_write_destroy()
1125 png_set_filter(png_structp png_ptr, int method, int filters) in png_set_filter() argument
1128 if (png_ptr == NULL) in png_set_filter()
1131 if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && in png_set_filter()
1142 case 7: png_warning(png_ptr, "Unknown row filter for method 0"); in png_set_filter()
1145 png_ptr->do_filter=PNG_FILTER_NONE; break; in png_set_filter()
1148 png_ptr->do_filter=PNG_FILTER_SUB; break; in png_set_filter()
1150 png_ptr->do_filter=PNG_FILTER_UP; break; in png_set_filter()
1152 png_ptr->do_filter=PNG_FILTER_AVG; break; in png_set_filter()
1154 png_ptr->do_filter=PNG_FILTER_PAETH; break; in png_set_filter()
1155 default: png_ptr->do_filter = (png_byte)filters; break; in png_set_filter()
1157 default: png_warning(png_ptr, "Unknown row filter for method 0"); in png_set_filter()
1170 if (png_ptr->row_buf != NULL) in png_set_filter()
1173 if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) in png_set_filter()
1175 png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, in png_set_filter()
1176 (png_ptr->rowbytes + 1)); in png_set_filter()
1177 png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; in png_set_filter()
1180 if ((png_ptr->do_filter & PNG_FILTER_UP) && png_ptr->up_row == NULL) in png_set_filter()
1182 if (png_ptr->prev_row == NULL) in png_set_filter()
1184 png_warning(png_ptr, "Can't add Up filter after starting"); in png_set_filter()
1185 png_ptr->do_filter &= ~PNG_FILTER_UP; in png_set_filter()
1189 png_ptr->up_row = (png_bytep)png_malloc(png_ptr, in png_set_filter()
1190 (png_ptr->rowbytes + 1)); in png_set_filter()
1191 png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; in png_set_filter()
1195 if ((png_ptr->do_filter & PNG_FILTER_AVG) && png_ptr->avg_row == NULL) in png_set_filter()
1197 if (png_ptr->prev_row == NULL) in png_set_filter()
1199 png_warning(png_ptr, "Can't add Average filter after starting"); in png_set_filter()
1200 png_ptr->do_filter &= ~PNG_FILTER_AVG; in png_set_filter()
1204 png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, in png_set_filter()
1205 (png_ptr->rowbytes + 1)); in png_set_filter()
1206 png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; in png_set_filter()
1210 if ((png_ptr->do_filter & PNG_FILTER_PAETH) && in png_set_filter()
1211 png_ptr->paeth_row == NULL) in png_set_filter()
1213 if (png_ptr->prev_row == NULL) in png_set_filter()
1215 png_warning(png_ptr, "Can't add Paeth filter after starting"); in png_set_filter()
1216 png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH); in png_set_filter()
1220 png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr, in png_set_filter()
1221 (png_ptr->rowbytes + 1)); in png_set_filter()
1222 png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; in png_set_filter()
1226 if (png_ptr->do_filter == PNG_NO_FILTERS) in png_set_filter()
1228 png_ptr->do_filter = PNG_FILTER_NONE; in png_set_filter()
1232 png_error(png_ptr, "Unknown custom filter method"); in png_set_filter()
1244 png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, in png_set_filter_heuristics() argument
1251 if (png_ptr == NULL) in png_set_filter_heuristics()
1255 png_warning(png_ptr, "Unknown filter heuristic method"); in png_set_filter_heuristics()
1270 png_ptr->num_prev_filters = (png_byte)num_weights; in png_set_filter_heuristics()
1271 png_ptr->heuristic_method = (png_byte)heuristic_method; in png_set_filter_heuristics()
1275 if (png_ptr->prev_filters == NULL) in png_set_filter_heuristics()
1277 png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr, in png_set_filter_heuristics()
1283 png_ptr->prev_filters[i] = 255; in png_set_filter_heuristics()
1287 if (png_ptr->filter_weights == NULL) in png_set_filter_heuristics()
1289 png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr, in png_set_filter_heuristics()
1292 png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr, in png_set_filter_heuristics()
1296 png_ptr->inv_filter_weights[i] = in png_set_filter_heuristics()
1297 png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; in png_set_filter_heuristics()
1305 png_ptr->inv_filter_weights[i] = in png_set_filter_heuristics()
1306 png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; in png_set_filter_heuristics()
1310 png_ptr->inv_filter_weights[i] = in png_set_filter_heuristics()
1312 png_ptr->filter_weights[i] = in png_set_filter_heuristics()
1321 if (png_ptr->filter_costs == NULL) in png_set_filter_heuristics()
1323 png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr, in png_set_filter_heuristics()
1326 png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr, in png_set_filter_heuristics()
1331 png_ptr->inv_filter_costs[i] = in png_set_filter_heuristics()
1332 png_ptr->filter_costs[i] = PNG_COST_FACTOR; in png_set_filter_heuristics()
1347 png_ptr->inv_filter_costs[i] = in png_set_filter_heuristics()
1348 png_ptr->filter_costs[i] = PNG_COST_FACTOR; in png_set_filter_heuristics()
1352 png_ptr->inv_filter_costs[i] = in png_set_filter_heuristics()
1354 png_ptr->filter_costs[i] = in png_set_filter_heuristics()
1362 png_set_compression_level(png_structp png_ptr, int level) in png_set_compression_level() argument
1365 if (png_ptr == NULL) in png_set_compression_level()
1367 png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL; in png_set_compression_level()
1368 png_ptr->zlib_level = level; in png_set_compression_level()
1372 png_set_compression_mem_level(png_structp png_ptr, int mem_level) in png_set_compression_mem_level() argument
1375 if (png_ptr == NULL) in png_set_compression_mem_level()
1377 png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL; in png_set_compression_mem_level()
1378 png_ptr->zlib_mem_level = mem_level; in png_set_compression_mem_level()
1382 png_set_compression_strategy(png_structp png_ptr, int strategy) in png_set_compression_strategy() argument
1385 if (png_ptr == NULL) in png_set_compression_strategy()
1387 png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY; in png_set_compression_strategy()
1388 png_ptr->zlib_strategy = strategy; in png_set_compression_strategy()
1392 png_set_compression_window_bits(png_structp png_ptr, int window_bits) in png_set_compression_window_bits() argument
1394 if (png_ptr == NULL) in png_set_compression_window_bits()
1397 png_warning(png_ptr, "Only compression windows <= 32k supported by PNG"); in png_set_compression_window_bits()
1399 png_warning(png_ptr, "Only compression windows >= 256 supported by PNG"); in png_set_compression_window_bits()
1404 png_warning(png_ptr, "Compression window is being reset to 512"); in png_set_compression_window_bits()
1408 png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS; in png_set_compression_window_bits()
1409 png_ptr->zlib_window_bits = window_bits; in png_set_compression_window_bits()
1413 png_set_compression_method(png_structp png_ptr, int method) in png_set_compression_method() argument
1416 if (png_ptr == NULL) in png_set_compression_method()
1419 png_warning(png_ptr, "Only compression method 8 is supported by PNG"); in png_set_compression_method()
1420 png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_METHOD; in png_set_compression_method()
1421 png_ptr->zlib_method = method; in png_set_compression_method()
1425 png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) in png_set_write_status_fn() argument
1427 if (png_ptr == NULL) in png_set_write_status_fn()
1429 png_ptr->write_row_fn = write_row_fn; in png_set_write_status_fn()
1434 png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr in png_set_write_user_transform_fn() argument
1438 if (png_ptr == NULL) in png_set_write_user_transform_fn()
1440 png_ptr->transformations |= PNG_USER_TRANSFORM; in png_set_write_user_transform_fn()
1441 png_ptr->write_user_transform_fn = write_user_transform_fn; in png_set_write_user_transform_fn()
1448 png_write_png(png_structp png_ptr, png_infop info_ptr, in png_write_png() argument
1451 if (png_ptr == NULL || info_ptr == NULL) in png_write_png()
1456 png_set_invert_alpha(png_ptr); in png_write_png()
1460 png_write_info(png_ptr, info_ptr); in png_write_png()
1467 png_set_invert_mono(png_ptr); in png_write_png()
1476 png_set_shift(png_ptr, &info_ptr->sig_bit); in png_write_png()
1482 png_set_packing(png_ptr); in png_write_png()
1488 png_set_swap_alpha(png_ptr); in png_write_png()
1496 png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); in png_write_png()
1502 png_set_bgr(png_ptr); in png_write_png()
1508 png_set_swap(png_ptr); in png_write_png()
1514 png_set_packswap(png_ptr); in png_write_png()
1521 png_write_image(png_ptr, info_ptr->row_pointers); in png_write_png()
1524 png_write_end(png_ptr, info_ptr); in png_write_png()