Mercurial > emacs
comparison src/image.c @ 63684:c95dbbf82d19
(fn_png_init_io): Don't define it.
(init_png_functions) [HAVE_NTGUI]: Don't initialize fn_png_init_io.
(png_read_from_file): New function, based on png_read_from_memory.
(png_load): Use it, instead of fn_png_init_io.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Thu, 23 Jun 2005 07:48:13 +0000 |
parents | ccf928f0383c |
children | a8fa7c632ee4 b7da78284d4c |
comparison
equal
deleted
inserted
replaced
63683:9560f6365236 | 63684:c95dbbf82d19 |
---|---|
5629 DEF_IMGLIB_FN (png_check_sig); | 5629 DEF_IMGLIB_FN (png_check_sig); |
5630 DEF_IMGLIB_FN (png_create_read_struct); | 5630 DEF_IMGLIB_FN (png_create_read_struct); |
5631 DEF_IMGLIB_FN (png_create_info_struct); | 5631 DEF_IMGLIB_FN (png_create_info_struct); |
5632 DEF_IMGLIB_FN (png_destroy_read_struct); | 5632 DEF_IMGLIB_FN (png_destroy_read_struct); |
5633 DEF_IMGLIB_FN (png_set_read_fn); | 5633 DEF_IMGLIB_FN (png_set_read_fn); |
5634 DEF_IMGLIB_FN (png_init_io); | |
5635 DEF_IMGLIB_FN (png_set_sig_bytes); | 5634 DEF_IMGLIB_FN (png_set_sig_bytes); |
5636 DEF_IMGLIB_FN (png_read_info); | 5635 DEF_IMGLIB_FN (png_read_info); |
5637 DEF_IMGLIB_FN (png_get_IHDR); | 5636 DEF_IMGLIB_FN (png_get_IHDR); |
5638 DEF_IMGLIB_FN (png_get_valid); | 5637 DEF_IMGLIB_FN (png_get_valid); |
5639 DEF_IMGLIB_FN (png_set_strip_16); | 5638 DEF_IMGLIB_FN (png_set_strip_16); |
5661 LOAD_IMGLIB_FN (library, png_check_sig); | 5660 LOAD_IMGLIB_FN (library, png_check_sig); |
5662 LOAD_IMGLIB_FN (library, png_create_read_struct); | 5661 LOAD_IMGLIB_FN (library, png_create_read_struct); |
5663 LOAD_IMGLIB_FN (library, png_create_info_struct); | 5662 LOAD_IMGLIB_FN (library, png_create_info_struct); |
5664 LOAD_IMGLIB_FN (library, png_destroy_read_struct); | 5663 LOAD_IMGLIB_FN (library, png_destroy_read_struct); |
5665 LOAD_IMGLIB_FN (library, png_set_read_fn); | 5664 LOAD_IMGLIB_FN (library, png_set_read_fn); |
5666 LOAD_IMGLIB_FN (library, png_init_io); | |
5667 LOAD_IMGLIB_FN (library, png_set_sig_bytes); | 5665 LOAD_IMGLIB_FN (library, png_set_sig_bytes); |
5668 LOAD_IMGLIB_FN (library, png_read_info); | 5666 LOAD_IMGLIB_FN (library, png_read_info); |
5669 LOAD_IMGLIB_FN (library, png_get_IHDR); | 5667 LOAD_IMGLIB_FN (library, png_get_IHDR); |
5670 LOAD_IMGLIB_FN (library, png_get_valid); | 5668 LOAD_IMGLIB_FN (library, png_get_valid); |
5671 LOAD_IMGLIB_FN (library, png_set_strip_16); | 5669 LOAD_IMGLIB_FN (library, png_set_strip_16); |
5687 #define fn_png_check_sig png_check_sig | 5685 #define fn_png_check_sig png_check_sig |
5688 #define fn_png_create_read_struct png_create_read_struct | 5686 #define fn_png_create_read_struct png_create_read_struct |
5689 #define fn_png_create_info_struct png_create_info_struct | 5687 #define fn_png_create_info_struct png_create_info_struct |
5690 #define fn_png_destroy_read_struct png_destroy_read_struct | 5688 #define fn_png_destroy_read_struct png_destroy_read_struct |
5691 #define fn_png_set_read_fn png_set_read_fn | 5689 #define fn_png_set_read_fn png_set_read_fn |
5692 #define fn_png_init_io png_init_io | |
5693 #define fn_png_set_sig_bytes png_set_sig_bytes | 5690 #define fn_png_set_sig_bytes png_set_sig_bytes |
5694 #define fn_png_read_info png_read_info | 5691 #define fn_png_read_info png_read_info |
5695 #define fn_png_get_IHDR png_get_IHDR | 5692 #define fn_png_get_IHDR png_get_IHDR |
5696 #define fn_png_get_valid png_get_valid | 5693 #define fn_png_get_valid png_get_valid |
5697 #define fn_png_set_strip_16 png_set_strip_16 | 5694 #define fn_png_set_strip_16 png_set_strip_16 |
5757 if (length > tbr->len - tbr->index) | 5754 if (length > tbr->len - tbr->index) |
5758 fn_png_error (png_ptr, "Read error"); | 5755 fn_png_error (png_ptr, "Read error"); |
5759 | 5756 |
5760 bcopy (tbr->bytes + tbr->index, data, length); | 5757 bcopy (tbr->bytes + tbr->index, data, length); |
5761 tbr->index = tbr->index + length; | 5758 tbr->index = tbr->index + length; |
5759 } | |
5760 | |
5761 | |
5762 /* Function set as reader function when reading PNG image from a file. | |
5763 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH | |
5764 bytes from the input to DATA. */ | |
5765 | |
5766 static void | |
5767 png_read_from_file (png_ptr, data, length) | |
5768 png_structp png_ptr; | |
5769 png_bytep data; | |
5770 png_size_t length; | |
5771 { | |
5772 FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr); | |
5773 | |
5774 if (fread (data, 1, length, fp) < length) | |
5775 fn_png_error (png_ptr, "Read error"); | |
5762 } | 5776 } |
5763 | 5777 |
5764 | 5778 |
5765 /* Load PNG image IMG for use on frame F. Value is non-zero if | 5779 /* Load PNG image IMG for use on frame F. Value is non-zero if |
5766 successful. */ | 5780 successful. */ |
5893 | 5907 |
5894 /* Read image info. */ | 5908 /* Read image info. */ |
5895 if (!NILP (specified_data)) | 5909 if (!NILP (specified_data)) |
5896 fn_png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory); | 5910 fn_png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory); |
5897 else | 5911 else |
5898 fn_png_init_io (png_ptr, fp); | 5912 fn_png_set_read_fn (png_ptr, (void *) fp, png_read_from_file); |
5899 | 5913 |
5900 fn_png_set_sig_bytes (png_ptr, sizeof sig); | 5914 fn_png_set_sig_bytes (png_ptr, sizeof sig); |
5901 fn_png_read_info (png_ptr, info_ptr); | 5915 fn_png_read_info (png_ptr, info_ptr); |
5902 fn_png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, | 5916 fn_png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
5903 &interlace_type, NULL, NULL); | 5917 &interlace_type, NULL, NULL); |