]>
Commit | Line | Data |
---|---|---|
f1049f72 JB |
1 | From 56103b05af8a9d67ce158eceab9f7c984b38eabb Mon Sep 17 00:00:00 2001 |
2 | From: Jon Ciesla <limburgher@gmail.com> | |
3 | Date: Fri, 2 Mar 2012 09:39:36 -0600 | |
4 | Subject: [PATCH 3/3] libpng fix. | |
5 | ||
6 | --- | |
7 | input-png.c | 22 ++++++---------------- | |
8 | 1 file changed, 6 insertions(+), 16 deletions(-) | |
9 | ||
10 | diff --git a/input-png.c b/input-png.c | |
11 | index 77b96f1..b631f07 100644 | |
12 | --- a/input-png.c | |
13 | +++ b/input-png.c | |
14 | @@ -42,17 +42,17 @@ static png_bytep * read_png(png_structp png_ptr, png_infop info_ptr, at_input_op | |
1c82da14 JB |
15 | |
16 | static void handle_warning(png_structp png, const at_string message) { | |
17 | LOG1("PNG warning: %s", message); | |
18 | - at_exception_warning((at_exception_type *)png->error_ptr, | |
19 | + at_exception_warning((at_exception_type *)png_get_error_ptr(png), | |
20 | message); | |
21 | - /* at_exception_fatal((at_exception_type *)at_png->error_ptr, | |
22 | + /* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png), | |
23 | "PNG warning"); */ | |
24 | } | |
25 | ||
26 | static void handle_error(png_structp png, const at_string message) { | |
27 | LOG1("PNG error: %s", message); | |
28 | - at_exception_fatal((at_exception_type *)png->error_ptr, | |
29 | + at_exception_fatal((at_exception_type *)png_get_error_ptr(png), | |
30 | message); | |
31 | - /* at_exception_fatal((at_exception_type *)at_png->error_ptr, | |
32 | + /* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png), | |
33 | "PNG error"); */ | |
34 | ||
35 | } | |
f1049f72 | 36 | @@ -157,8 +157,8 @@ read_png(png_structp png_ptr, png_infop info_ptr, at_input_opts_type * opts) |
1c82da14 JB |
37 | |
38 | png_set_strip_16(png_ptr); | |
39 | png_set_packing(png_ptr); | |
40 | - if ((png_ptr->bit_depth < 8) || | |
41 | - (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) || | |
42 | + if ((png_get_bit_depth(png_ptr, info_ptr) < 8) || | |
43 | + (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) || | |
44 | (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) | |
45 | png_set_expand(png_ptr); | |
46 | ||
f1049f72 JB |
47 | @@ -181,20 +181,10 @@ read_png(png_structp png_ptr, png_infop info_ptr, at_input_opts_type * opts) |
48 | PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); | |
49 | } else | |
50 | png_set_strip_alpha(png_ptr); | |
51 | + png_set_interlace_handling(png_ptr); | |
1c82da14 JB |
52 | png_read_update_info(png_ptr, info_ptr); |
53 | ||
f1049f72 | 54 | - |
1c82da14 JB |
55 | - info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, |
56 | - info_ptr->height * sizeof(png_bytep)); | |
f1049f72 JB |
57 | -#ifdef PNG_FREE_ME_SUPPORTED |
58 | - info_ptr->free_me |= PNG_FREE_ROWS; | |
59 | -#endif | |
1c82da14 JB |
60 | - for (row = 0; row < (int)info_ptr->height; row++) |
61 | - info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, | |
f1049f72 JB |
62 | - png_get_rowbytes(png_ptr, info_ptr)); |
63 | - | |
1c82da14 JB |
64 | - png_read_image(png_ptr, info_ptr->row_pointers); |
65 | - info_ptr->valid |= PNG_INFO_IDAT; | |
f1049f72 | 66 | + png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); |
1c82da14 JB |
67 | png_read_end(png_ptr, info_ptr); |
68 | return png_get_rows(png_ptr, info_ptr); | |
69 | } | |
f1049f72 JB |
70 | -- |
71 | 1.7.11.2 | |
72 |