# HG changeset patch
# User Vin Shelton <acs@xemacs.org>
# Date 1342078132 14400
# Node ID bcefd94fa6513d48f4dc8519f633b2df66b553bc
# Parent  2cf343fcb482fa6644675f3174c3c0712c53c074
Support libpng-1.5.10

diff -r 2cf343fcb482fa6644675f3174c3c0712c53c074 -r bcefd94fa6513d48f4dc8519f633b2df66b553bc src/glyphs-eimage.c
--- a/src/glyphs-eimage.c	Sun Jan 08 17:05:56 2012 -0500
+++ b/src/glyphs-eimage.c	Thu Jul 12 03:28:52 2012 -0400
@@ -937,8 +937,8 @@
   {
     int y, padding;
     unsigned char **row_pointers;
-    height = info_ptr->height;
-    width = info_ptr->width;
+    height = png_get_image_height(png_ptr, info_ptr);
+    width = png_get_image_width(png_ptr, info_ptr);
 
     /* Wow, allocate all the memory.  Truly, exciting.
        Well, yes, there's excitement to be had.  It turns out that libpng
@@ -999,19 +999,19 @@
     /* Now that we're using EImage, ask for 8bit RGB triples for any type
        of image*/
     /* convert palette images to full RGB */
-    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE)
       png_set_expand (png_ptr);
     /* send grayscale images to RGB too */
-    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
-        info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
+       png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
       png_set_gray_to_rgb (png_ptr);
     /* tell libpng to strip 16 bit depth files down to 8 bits */
-    if (info_ptr->bit_depth == 16)
+    if (png_get_bit_depth(png_ptr, info_ptr) == 16)
       png_set_strip_16 (png_ptr);
     /* if the image is < 8 bits, pad it out */
-    if (info_ptr->bit_depth < 8)
+    if (png_get_bit_depth(png_ptr, info_ptr) < 8)
       {
-	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
+       if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
 	  png_set_expand (png_ptr);
 	else
 	  png_set_packing (png_ptr);
@@ -1021,7 +1021,7 @@
        png_read_update_info ensures the alpha flag is set when one of
        the transforms above causes an alpha channel to be generated */
     png_read_update_info (png_ptr, info_ptr);
-    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
+    if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA)
       png_set_strip_alpha (png_ptr);
 
     png_read_image (png_ptr, row_pointers);
@@ -1036,17 +1036,22 @@
      * from lisp anyway. - WMP
      */
     {
-      int i;
+      int i, num_text = 0;
+      png_textp text_ptr = NULL;
 
-      for (i = 0 ; i < info_ptr->num_text ; i++)
+      if (png_get_text (png_ptr, info_ptr, &text_ptr, &num_text) > 0)
 	{
-	  /* How paranoid do I have to be about no trailing NULLs, and
-	     using (int)info_ptr->text[i].text_length, and strncpy and a temp
-	     string somewhere? */
+	  for (i = 0 ; i < num_text ; i++)
+	    {
 
-	  warn_when_safe (Qpng, Qinfo, "%s - %s",
-			  info_ptr->text[i].key,
-			  info_ptr->text[i].text);
+	      /* How paranoid do I have to be about no trailing NULLs, and
+		 using (int)info_ptr->text[i].text_length, and strncpy and a temp
+		 string somewhere? */
+
+	      warn_when_safe (Qpng, Qinfo, "%s - %s",
+			      text_ptr[i].key, text_ptr[i].text);
+	    }
+
 	}
     }
 #endif
