Blame SOURCES/autotrace-0003-libpng-fix.patch

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