0fbea02
--- input-png.c.orig	2012-03-02 09:30:00.958350697 -0600
0fbea02
+++ input-png.c	2012-03-02 09:32:50.728927667 -0600
0fbea02
@@ -42,7 +42,7 @@
0fbea02
 
0fbea02
 static void handle_warning(png_structp png, const at_string message) {
0fbea02
         LOG1("PNG warning: %s", message);
0fbea02
-	at_exception_warning((at_exception_type *)png->error_ptr,
0fbea02
+	at_exception_warning((at_exception_type *)png_get_error_ptr(png),
0fbea02
 			     message);
0fbea02
 	/* at_exception_fatal((at_exception_type *)at_png->error_ptr,
0fbea02
 	   "PNG warning"); */
0fbea02
@@ -50,7 +50,7 @@
0fbea02
 
0fbea02
 static void handle_error(png_structp png, const at_string message) {
0fbea02
 	LOG1("PNG error: %s", message);
0fbea02
-	at_exception_fatal((at_exception_type *)png->error_ptr,
0fbea02
+	at_exception_fatal((at_exception_type *)png_get_error_ptr(png),
0fbea02
 			   message);
0fbea02
 	/* at_exception_fatal((at_exception_type *)at_png->error_ptr,
0fbea02
 	   "PNG error"); */
0fbea02
@@ -157,8 +157,8 @@
0fbea02
 
0fbea02
 	png_set_strip_16(png_ptr);
0fbea02
 	png_set_packing(png_ptr);
0fbea02
-	if ((png_ptr->bit_depth < 8) ||
0fbea02
-	    (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
0fbea02
+	if ((png_get_bit_depth(png_ptr, info_ptr) < 8) ||
0fbea02
+	    (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) ||
0fbea02
 	    (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
0fbea02
 		png_set_expand(png_ptr);
0fbea02
 
0fbea02
@@ -181,20 +181,10 @@
0fbea02
 				   PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
0fbea02
 	} else
0fbea02
 		png_set_strip_alpha(png_ptr);
0fbea02
+	png_set_interlace_handling(png_ptr);
0fbea02
 	png_read_update_info(png_ptr, info_ptr);
0fbea02
 
0fbea02
-
0fbea02
-	info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
0fbea02
-							info_ptr->height * sizeof(png_bytep));
0fbea02
-#ifdef PNG_FREE_ME_SUPPORTED
0fbea02
-	info_ptr->free_me |= PNG_FREE_ROWS;
0fbea02
-#endif
0fbea02
-	for (row = 0; row < (int)info_ptr->height; row++)
0fbea02
-		info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
0fbea02
-								    png_get_rowbytes(png_ptr, info_ptr));
0fbea02
-	
0fbea02
-	png_read_image(png_ptr, info_ptr->row_pointers);
0fbea02
-	info_ptr->valid |= PNG_INFO_IDAT;
0fbea02
+	png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
0fbea02
 	png_read_end(png_ptr, info_ptr);
0fbea02
 	return png_get_rows(png_ptr, info_ptr);
0fbea02
 }