$NetBSD: patch-aa,v 1.1 2011/01/19 16:41:04 wiz Exp $

Fix build with png-1.5.

--- ksplash/ksplashx/qpngio.cpp.orig	2009-08-28 16:01:29.000000000 +0000
+++ ksplash/ksplashx/qpngio.cpp
@@ -112,12 +112,19 @@ void setup_qt( QImage& image, png_struct
     png_uint_32 height;
     int bit_depth;
     int color_type;
+    png_bytep trans_alpha;
+    int num_trans;
+    png_color_16p trans_color;
+    png_colorp palette;
+    int num_palette;
     png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
 	0, 0, 0);
+    png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
+    png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
 
     if ( color_type == PNG_COLOR_TYPE_GRAY ) {
 	// Black & White or 8-bit grayscale
-	if ( bit_depth == 1 && info_ptr->channels == 1 ) {
+	if ( bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1 ) {
 	    png_set_invert_mono( png_ptr );
 	    png_read_update_info( png_ptr, info_ptr );
 	    if (!image.create( width, height, 1, 2, QImage::BigEndian ))
@@ -154,7 +161,7 @@ void setup_qt( QImage& image, png_struct
 #if PNG_LIBPNG_VER < 10400
 		const int g = info_ptr->trans_values.gray;
 #else
-		const int g = info_ptr->trans_color.gray;
+		const int g = trans_color->gray;
 #endif
 		if (g < ncols) {
 		    image.setAlphaBuffer(true);
@@ -164,7 +171,7 @@ void setup_qt( QImage& image, png_struct
 	}
     } else if ( color_type == PNG_COLOR_TYPE_PALETTE
      && png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)
-     && info_ptr->num_palette <= 256 )
+     && num_palette <= 256 )
     {
 	// 1-bit and 8-bit color
 	if ( bit_depth != 1 )
@@ -172,32 +179,32 @@ void setup_qt( QImage& image, png_struct
 	png_read_update_info( png_ptr, info_ptr );
 	png_get_IHDR(png_ptr, info_ptr,
 	    &width, &height, &bit_depth, &color_type, 0, 0, 0);
-	if (!image.create(width, height, bit_depth, info_ptr->num_palette,
+	if (!image.create(width, height, bit_depth, num_palette,
 	    QImage::BigEndian))
 	    return;
 	int i = 0;
 	if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ) {
 	    image.setAlphaBuffer( true );
-	    while ( i < info_ptr->num_trans ) {
+	    while ( i < num_trans ) {
 		image.setColor(i, qRgba(
-		    info_ptr->palette[i].red,
-		    info_ptr->palette[i].green,
-		    info_ptr->palette[i].blue,
+		    palette[i].red,
+		    palette[i].green,
+		    palette[i].blue,
 #if PNG_LIBPNG_VER < 10400
 		    info_ptr->trans[i]
 #else
-		    info_ptr->trans_alpha[i]
+		    trans_alpha[i]
 #endif
 		    )
 		);
 		i++;
 	    }
 	}
-	while ( i < info_ptr->num_palette ) {
+	while ( i < num_palette ) {
 	    image.setColor(i, qRgba(
-		info_ptr->palette[i].red,
-		info_ptr->palette[i].green,
-		info_ptr->palette[i].blue,
+		palette[i].red,
+		palette[i].green,
+		palette[i].blue,
 		0xff
 		)
 	    );
@@ -280,7 +287,7 @@ QImage splash_read_png_image(FILE* f)
 	return QImage();
     }
 
-    if (setjmp(png_ptr->jmpbuf)) {
+    if (setjmp(png_jmpbuf(png_ptr))) {
 	png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
 	return QImage();
     }
