summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-09-12 22:46:18 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-09-12 22:46:18 -0500
commite01e79d397a95551e27c2f6f4865e75988fb75c0 (patch)
tree03a161e9318064e8cb8d72d7901ae86499ba3a6e
parentd4099caa9620de29c056f77e1b6468754de97ede (diff)
downloadtde-e01e79d397a95551e27c2f6f4865e75988fb75c0.tar.gz
tde-e01e79d397a95551e27c2f6f4865e75988fb75c0.zip
Fix Qt3 compilation against new libpng versions
-rw-r--r--main/dependencies/qt3/src/kernel/qpngio.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/main/dependencies/qt3/src/kernel/qpngio.cpp b/main/dependencies/qt3/src/kernel/qpngio.cpp
index 95036e817..25ce92753 100644
--- a/main/dependencies/qt3/src/kernel/qpngio.cpp
+++ b/main/dependencies/qt3/src/kernel/qpngio.cpp
@@ -162,7 +162,11 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr, float scr
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 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr, float scr
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 @@ void read_png_image(QImageIO* iio)
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) {