summaryrefslogtreecommitdiff
blob: 8906e6f5a8718b02cdf9b8cfda70698655b413e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- qt-x11-free-3.3.8b-x/src/kernel/qpngio.cpp	2008-01-15 20:09:13.000000000 +0100
+++ qt-x11-free-3.3.8b/src/kernel/qpngio.cpp	2010-02-16 00:13:11.000000000 +0100
@@ -162,7 +162,11 @@
 		image.setColor( i, qRgba(c,c,c,0xff) );
 	    }
 	    if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ) {
+#if PNG_LIBPNG_VER_MAJOR>1 || ( PNG_LIBPNG_VER_MAJOR==1 && PNG_LIBPNG_VER_MINOR>=4 )
+		const int g = info_ptr->trans_color.gray;
+#else
 		const int g = info_ptr->trans_values.gray;
+#endif
 		if (g < ncols) {
 		    image.setAlphaBuffer(TRUE);
 		    image.setColor(g, image.color(g) & RGB_MASK);
@@ -190,7 +194,11 @@
 		    info_ptr->palette[i].red,
 		    info_ptr->palette[i].green,
 		    info_ptr->palette[i].blue,
+#if PNG_LIBPNG_VER_MAJOR>1 || ( PNG_LIBPNG_VER_MAJOR==1 && PNG_LIBPNG_VER_MINOR>=4 )
+		    info_ptr->trans_alpha[i]
+#else
 		    info_ptr->trans[i]
+#endif
 		    )
 		);
 		i++;
@@ -324,9 +332,15 @@
 png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)
     if (image.depth()==32 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
 	QRgb trans = 0xFF000000 | qRgb(
+#if PNG_LIBPNG_VER_MAJOR>1 || ( PNG_LIBPNG_VER_MAJOR==1 && PNG_LIBPNG_VER_MINOR>=4 )
+	      (info_ptr->trans_color.red << 8 >> bit_depth)&0xff,
+	      (info_ptr->trans_color.green << 8 >> bit_depth)&0xff,
+	      (info_ptr->trans_color.blue << 8 >> bit_depth)&0xff);
+#else
 	      (info_ptr->trans_values.red << 8 >> bit_depth)&0xff,
 	      (info_ptr->trans_values.green << 8 >> bit_depth)&0xff,
 	      (info_ptr->trans_values.blue << 8 >> bit_depth)&0xff);
+#endif
 	for (uint y=0; y<height; y++) {
 	    for (uint x=0; x<info_ptr->width; x++) {
 		if (((uint**)jt)[y][x] == trans) {