diff options
-rw-r--r-- | x11/qt3-libs/distinfo | 4 | ||||
-rw-r--r-- | x11/qt3-libs/patches/patch-as | 212 |
2 files changed, 206 insertions, 10 deletions
diff --git a/x11/qt3-libs/distinfo b/x11/qt3-libs/distinfo index 690942faf4d..c27d654b6dc 100644 --- a/x11/qt3-libs/distinfo +++ b/x11/qt3-libs/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.53 2010/08/09 13:21:07 tsutsui Exp $ +$NetBSD: distinfo,v 1.54 2011/01/16 12:36:59 tnn Exp $ SHA1 (qt-x11-free-3.3.8.tar.bz2) = 91b192cb8e80679607d24ae35d6e20ed68d149d7 RMD160 (qt-x11-free-3.3.8.tar.bz2) = 7b8e4e35f49014eac4fcfe91b7ec0a45c5569cf4 @@ -21,7 +21,7 @@ SHA1 (patch-ao) = 3aacba05b27314cadab7dceba3c21d65bab608d3 SHA1 (patch-ap) = 5040628324d271abfc662c5a6eeb4f1ecf0d4758 SHA1 (patch-aq) = c17ff8b42901ae9a3cc51c33cffe4cffa64b4e4d SHA1 (patch-ar) = 84c0d7153feabcab6558ba84fbaa723f1c238e40 -SHA1 (patch-as) = 4d173ad8adfe40845653e8309fe2fee7c8ac7897 +SHA1 (patch-as) = b08e3ceabdc14d756e529386954e53e71ee2d299 SHA1 (patch-bb) = b6a15a4b2b7b83b89bd3610cf2e48c242dbce2e5 SHA1 (patch-bc) = d8a84e1b66bf1953b53df57ae81d2c98cce69c41 SHA1 (patch-bd) = a116ecf305ee5b5338bf84cb908d695f3baea830 diff --git a/x11/qt3-libs/patches/patch-as b/x11/qt3-libs/patches/patch-as index 212103a9dc3..a7d7e612c1b 100644 --- a/x11/qt3-libs/patches/patch-as +++ b/x11/qt3-libs/patches/patch-as @@ -1,22 +1,218 @@ -$NetBSD: patch-as,v 1.1 2010/06/13 22:45:50 wiz Exp $ +$NetBSD: patch-as,v 1.2 2011/01/16 12:36:59 tnn Exp $ --- src/kernel/qpngio.cpp.orig 2007-02-02 14:01:15.000000000 +0000 +++ src/kernel/qpngio.cpp -@@ -159,7 +159,7 @@ void setup_qt( QImage& image, png_struct +@@ -123,9 +123,24 @@ void setup_qt( QImage& image, png_struct + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, + 0, 0, 0); + ++ png_colorp info_ptr_palette; ++ int info_ptr_num_palette; ++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) { ++ png_get_PLTE(png_ptr, info_ptr, &info_ptr_palette, &info_ptr_num_palette); ++ } ++ ++ png_bytep info_ptr_trans_alpha; ++ int info_ptr_num_trans; ++ png_color_16p info_ptr_trans_color; ++ ++ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { ++ png_get_tRNS(png_ptr, info_ptr, &info_ptr_trans_alpha, &info_ptr_num_trans, &info_ptr_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 )) +@@ -159,7 +174,7 @@ void setup_qt( QImage& image, png_struct image.setColor( i, qRgba(c,c,c,0xff) ); } if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ) { - const int g = info_ptr->trans_values.gray; -+ const int g = info_ptr->trans_color.gray; ++ const int g = info_ptr_trans_color->gray; if (g < ncols) { image.setAlphaBuffer(TRUE); image.setColor(g, image.color(g) & RGB_MASK); -@@ -187,7 +187,7 @@ void setup_qt( QImage& image, png_struct - info_ptr->palette[i].red, - info_ptr->palette[i].green, - info_ptr->palette[i].blue, +@@ -168,7 +183,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 ) ++ && info_ptr_num_palette <= 256 ) + { + // 1-bit and 8-bit color + if ( bit_depth != 1 ) +@@ -176,28 +191,28 @@ 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, info_ptr_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 < info_ptr_num_trans ) { + image.setColor(i, qRgba( +- info_ptr->palette[i].red, +- info_ptr->palette[i].green, +- info_ptr->palette[i].blue, - info_ptr->trans[i] -+ info_ptr->trans_alpha[i] ++ info_ptr_palette[i].red, ++ info_ptr_palette[i].green, ++ info_ptr_palette[i].blue, ++ info_ptr_trans_alpha[i] ) ); i++; + } + } +- while ( i < info_ptr->num_palette ) { ++ while ( i < info_ptr_num_palette ) { + image.setColor(i, qRgba( +- info_ptr->palette[i].red, +- info_ptr->palette[i].green, +- info_ptr->palette[i].blue, ++ info_ptr_palette[i].red, ++ info_ptr_palette[i].green, ++ info_ptr_palette[i].blue, + 0xff + ) + ); +@@ -284,7 +299,7 @@ void read_png_image(QImageIO* iio) + return; + } + +- if (setjmp(png_ptr->jmpbuf)) { ++ if (setjmp(png_jmpbuf(png_ptr))) { + png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); + iio->setStatus(-4); + return; +@@ -469,7 +484,7 @@ bool QPNGImageWriter::writeImage(const Q + return FALSE; + } + +- if (setjmp(png_ptr->jmpbuf)) { ++ if (setjmp(png_jmpbuf(png_ptr))) { + png_destroy_write_struct(&png_ptr, &info_ptr); + return FALSE; + } +@@ -491,10 +506,16 @@ bool QPNGImageWriter::writeImage(const Q + + png_set_write_fn(png_ptr, (void*)this, qpiw_write_fn, qpiw_flush_fn); + ++#warning XXXtnn not too sure about this ++/* ++according to png.h, channels is only used on read, not writes, so we ++should be able to comment this out. ++ + info_ptr->channels = + (image.depth() == 32) + ? (image.hasAlphaBuffer() ? 4 : 3) + : 1; ++*/ + + png_set_IHDR(png_ptr, info_ptr, image.width(), image.height(), + image.depth() == 1 ? 1 : 8 /* per channel */, +@@ -504,11 +525,13 @@ bool QPNGImageWriter::writeImage(const Q + : PNG_COLOR_TYPE_RGB + : PNG_COLOR_TYPE_PALETTE, 0, 0, 0); + ++ png_color_8p sig_bit; ++ png_get_sBIT(png_ptr, info_ptr, &sig_bit); ++ sig_bit->red = 8; ++ sig_bit->green = 8; ++ sig_bit->blue = 8; ++ png_set_sBIT(png_ptr, info_ptr, sig_bit); + +- //png_set_sBIT(png_ptr, info_ptr, 8); +- info_ptr->sig_bit.red = 8; +- info_ptr->sig_bit.green = 8; +- info_ptr->sig_bit.blue = 8; + + if (image.depth() == 1 && image.bitOrder() == QImage::LittleEndian) + png_set_packswap(png_ptr); +@@ -522,11 +545,14 @@ bool QPNGImageWriter::writeImage(const Q + png_set_PLTE(png_ptr, info_ptr, palette, num_palette); + int* trans = new int[num_palette]; + int num_trans = 0; ++ png_colorp info_ptr_palette; ++ int tmp; ++ png_get_PLTE(png_ptr, info_ptr, &info_ptr_palette, &tmp); + for (int i=0; i<num_palette; i++) { + QRgb rgb=image.color(i); +- info_ptr->palette[i].red = qRed(rgb); +- info_ptr->palette[i].green = qGreen(rgb); +- info_ptr->palette[i].blue = qBlue(rgb); ++ info_ptr_palette[i].red = qRed(rgb); ++ info_ptr_palette[i].green = qGreen(rgb); ++ info_ptr_palette[i].blue = qBlue(rgb); + if (image.hasAlphaBuffer()) { + trans[i] = rgb >> 24; + if (trans[i] < 255) { +@@ -534,6 +560,7 @@ bool QPNGImageWriter::writeImage(const Q + } + } + } ++ png_set_PLTE(png_ptr, info_ptr, info_ptr_palette, num_palette); + if (num_trans) { + copy_trans = new png_byte[num_trans]; + for (int i=0; i<num_trans; i++) +@@ -544,7 +571,10 @@ bool QPNGImageWriter::writeImage(const Q + } + + if ( image.hasAlphaBuffer() ) { +- info_ptr->sig_bit.alpha = 8; ++ png_color_8p sig_bit; ++ png_get_sBIT(png_ptr, info_ptr, &sig_bit); ++ sig_bit->alpha = 8; ++ png_set_sBIT(png_ptr, info_ptr, sig_bit); + } + + // Swap ARGB to RGBA (normal PNG format) before saving on +@@ -1030,7 +1060,7 @@ int QPNGFormat::decode(QImage& img, QIma + return -1; + } + +- if (setjmp((png_ptr)->jmpbuf)) { ++ if (setjmp(png_jmpbuf(png_ptr))) { + png_destroy_read_struct(&png_ptr, &info_ptr, 0); + image = 0; + return -1; +@@ -1057,7 +1087,7 @@ int QPNGFormat::decode(QImage& img, QIma + + if ( !png_ptr ) return 0; + +- if (setjmp(png_ptr->jmpbuf)) { ++ if (setjmp(png_jmpbuf(png_ptr))) { + png_destroy_read_struct(&png_ptr, &info_ptr, 0); + image = 0; + state = MovieStart; +@@ -1117,7 +1147,8 @@ void QPNGFormat::end(png_structp png, pn + consumer->frameDone(QPoint(offx,offy),r); + consumer->end(); + state = FrameStart; +- unused_data = (int)png->buffer_size; // Since libpng doesn't tell us ++#warning XXXtnn don't know how to fix this. ++ unused_data = 0; /* (int)png->buffer_size; // Since libpng doesn't tell us */ + } + + #ifdef PNG_USER_CHUNKS_SUPPORTED +@@ -1232,8 +1263,11 @@ void qInitPngIO() + + void qt_zlib_compression_hack() + { ++#warning XXXtnn unresolved symbols ++/* + compress(0,0,0,0); + uncompress(0,0,0,0); ++*/ + } + + #endif // QT_NO_IMAGEIO_PNG |