|
|
a72ac9 |
From 56103b05af8a9d67ce158eceab9f7c984b38eabb Mon Sep 17 00:00:00 2001
|
|
|
a72ac9 |
From: Jon Ciesla <limburgher@gmail.com>
|
|
|
a72ac9 |
Date: Fri, 2 Mar 2012 09:39:36 -0600
|
|
|
a72ac9 |
Subject: [PATCH 3/3] libpng fix.
|
|
|
a72ac9 |
|
|
|
a72ac9 |
---
|
|
|
a72ac9 |
input-png.c | 22 ++++++----------------
|
|
|
a72ac9 |
1 file changed, 6 insertions(+), 16 deletions(-)
|
|
|
a72ac9 |
|
|
|
a72ac9 |
diff --git a/input-png.c b/input-png.c
|
|
|
a72ac9 |
index 77b96f1..b631f07 100644
|
|
|
a72ac9 |
--- a/input-png.c
|
|
|
a72ac9 |
+++ b/input-png.c
|
|
|
a72ac9 |
@@ -42,7 +42,7 @@ static png_bytep * read_png(png_structp png_ptr, png_infop info_ptr, at_input_op
|
|
|
a72ac9 |
|
|
|
a72ac9 |
static void handle_warning(png_structp png, const at_string message) {
|
|
|
a72ac9 |
LOG1("PNG warning: %s", message);
|
|
|
a72ac9 |
- at_exception_warning((at_exception_type *)png->error_ptr,
|
|
|
a72ac9 |
+ at_exception_warning((at_exception_type *)png_get_error_ptr(png),
|
|
|
a72ac9 |
message);
|
|
|
a72ac9 |
/* at_exception_fatal((at_exception_type *)at_png->error_ptr,
|
|
|
a72ac9 |
"PNG warning"); */
|
|
|
a72ac9 |
@@ -50,7 +50,7 @@ static void handle_warning(png_structp png, const at_string message) {
|
|
|
a72ac9 |
|
|
|
a72ac9 |
static void handle_error(png_structp png, const at_string message) {
|
|
|
a72ac9 |
LOG1("PNG error: %s", message);
|
|
|
a72ac9 |
- at_exception_fatal((at_exception_type *)png->error_ptr,
|
|
|
a72ac9 |
+ at_exception_fatal((at_exception_type *)png_get_error_ptr(png),
|
|
|
a72ac9 |
message);
|
|
|
a72ac9 |
/* at_exception_fatal((at_exception_type *)at_png->error_ptr,
|
|
|
a72ac9 |
"PNG error"); */
|
|
|
a72ac9 |
@@ -157,8 +157,8 @@ read_png(png_structp png_ptr, png_infop info_ptr, at_input_opts_type * opts)
|
|
|
a72ac9 |
|
|
|
a72ac9 |
png_set_strip_16(png_ptr);
|
|
|
a72ac9 |
png_set_packing(png_ptr);
|
|
|
a72ac9 |
- if ((png_ptr->bit_depth < 8) ||
|
|
|
a72ac9 |
- (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
|
|
|
a72ac9 |
+ if ((png_get_bit_depth(png_ptr, info_ptr) < 8) ||
|
|
|
a72ac9 |
+ (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) ||
|
|
|
a72ac9 |
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
|
|
|
a72ac9 |
png_set_expand(png_ptr);
|
|
|
a72ac9 |
|
|
|
a72ac9 |
@@ -181,20 +181,10 @@ read_png(png_structp png_ptr, png_infop info_ptr, at_input_opts_type * opts)
|
|
|
a72ac9 |
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
|
|
a72ac9 |
} else
|
|
|
a72ac9 |
png_set_strip_alpha(png_ptr);
|
|
|
a72ac9 |
+ png_set_interlace_handling(png_ptr);
|
|
|
a72ac9 |
png_read_update_info(png_ptr, info_ptr);
|
|
|
a72ac9 |
|
|
|
a72ac9 |
-
|
|
|
a72ac9 |
- info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
|
|
a72ac9 |
- info_ptr->height * sizeof(png_bytep));
|
|
|
a72ac9 |
-#ifdef PNG_FREE_ME_SUPPORTED
|
|
|
a72ac9 |
- info_ptr->free_me |= PNG_FREE_ROWS;
|
|
|
a72ac9 |
-#endif
|
|
|
a72ac9 |
- for (row = 0; row < (int)info_ptr->height; row++)
|
|
|
a72ac9 |
- info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
|
|
|
a72ac9 |
- png_get_rowbytes(png_ptr, info_ptr));
|
|
|
a72ac9 |
-
|
|
|
a72ac9 |
- png_read_image(png_ptr, info_ptr->row_pointers);
|
|
|
a72ac9 |
- info_ptr->valid |= PNG_INFO_IDAT;
|
|
|
a72ac9 |
+ png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
|
|
|
a72ac9 |
png_read_end(png_ptr, info_ptr);
|
|
|
a72ac9 |
return png_get_rows(png_ptr, info_ptr);
|
|
|
a72ac9 |
}
|
|
|
a72ac9 |
--
|
|
|
a72ac9 |
1.7.11.2
|
|
|
a72ac9 |
|