diff options
author | Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org> | 2011-12-17 19:37:35 +0000 |
---|---|---|
committer | Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org> | 2011-12-17 19:37:35 +0000 |
commit | 9a5ded73225f079dbd4317d3ea9bc888f7cde89d (patch) | |
tree | dd7997cc92fff9ecc5887e1b6eb829c94f377796 /x11-libs | |
parent | alpha/ia64/s390/sparc stable wrt #393737 (diff) | |
download | gentoo-2-9a5ded73225f079dbd4317d3ea9bc888f7cde89d.tar.gz gentoo-2-9a5ded73225f079dbd4317d3ea9bc888f7cde89d.tar.bz2 gentoo-2-9a5ded73225f079dbd4317d3ea9bc888f7cde89d.zip |
Add patch to fix building against libpng-1.5, bug #393141. Non-maintainer commit, ok'ed by tampakrap on IRC.
(Portage version: 2.2.0_alpha79/cvs/Linux x86_64)
Diffstat (limited to 'x11-libs')
-rw-r--r-- | x11-libs/qt-gui/ChangeLog | 8 | ||||
-rw-r--r-- | x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch | 283 | ||||
-rw-r--r-- | x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild | 4 | ||||
-rw-r--r-- | x11-libs/qt-gui/qt-gui-4.6.3.ebuild | 4 |
4 files changed, 296 insertions, 3 deletions
diff --git a/x11-libs/qt-gui/ChangeLog b/x11-libs/qt-gui/ChangeLog index 5b01cf5cdf5a..050b4c73be92 100644 --- a/x11-libs/qt-gui/ChangeLog +++ b/x11-libs/qt-gui/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for x11-libs/qt-gui # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/ChangeLog,v 1.158 2011/12/03 20:26:41 grobian Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/ChangeLog,v 1.159 2011/12/17 19:37:35 chithanh Exp $ + + 17 Dec 2011; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org> + +files/qt-gui-4.6-libpng-1.5.patch, qt-gui-4.6.3.ebuild, + qt-gui-4.6.3-r2.ebuild: + Add patch to fix building against libpng-1.5, bug #393141. Non-maintainer + commit, ok'ed by tampakrap on IRC. 03 Dec 2011; Fabian Groffen <grobian@gentoo.org> qt-gui-4.7.4-r1.ebuild: Disable ssse3 on Darwin to fix compilation, thanks Paul, bug #367045 diff --git a/x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch b/x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch new file mode 100644 index 000000000000..8c7f2fa908ed --- /dev/null +++ b/x11-libs/qt-gui/files/qt-gui-4.6-libpng-1.5.patch @@ -0,0 +1,283 @@ +From 8a81562af30435f82255830489dca691031a5408 Mon Sep 17 00:00:00 2001 +From: aavit <qt-info@nokia.com> +Date: Tue, 9 Feb 2010 10:32:04 +0100 +Subject: [PATCH] Use libpng API as recommended. Preparation for upgrade to libpng 1.4.0. + +The libpng doc advises against accessing the info_ptr structure +directly, and in 1.4.0 the members are flagged as deprecated, so such +access gives compilation warnings. This patch makes qpnghandler use +the recommended access functions instead. + +Reviewed-by: Trond +--- + src/gui/image/qpnghandler.cpp | 135 +++++++++++++++++++---------------------- + 1 files changed, 62 insertions(+), 73 deletions(-) + +diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp +index d5406cb..bba54b9 100644 +--- a/src/gui/image/qpnghandler.cpp ++++ b/src/gui/image/qpnghandler.cpp +@@ -50,8 +50,13 @@ + #include <qvariant.h> + #include <qvector.h> + ++#ifdef QT_USE_BUNDLED_LIBPNG ++#include <../../3rdparty/libpng/png.h> ++#include <../../3rdparty/libpng/pngconf.h> ++#else + #include <png.h> + #include <pngconf.h> ++#endif + + #ifdef Q_OS_WINCE + #define CALLBACK_CALL_TYPE __cdecl +@@ -162,11 +167,16 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre + png_uint_32 height; + int bit_depth; + int color_type; ++ png_bytep trans_alpha = 0; ++ png_color_16p trans_color_p = 0; ++ int num_trans; ++ png_colorp palette = 0; ++ int num_palette; + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + + 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.size() != QSize(width, height) || image.format() != QImage::Format_Mono) { +@@ -207,20 +217,16 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre + int c = i*255/(ncols-1); + 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_values.gray; +-#else +- const int g = info_ptr->trans_color.gray; +-#endif ++ if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color_p) && trans_color_p) { ++ const int g = trans_color_p->gray; + if (g < ncols) { + image.setColor(g, 0); + } + } + } + } else if (color_type == PNG_COLOR_TYPE_PALETTE +- && png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE) +- && info_ptr->num_palette <= 256) ++ && png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) ++ && num_palette <= 256) + { + // 1-bit and 8-bit color + if (bit_depth != 1) +@@ -233,29 +239,26 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre + if (image.isNull()) + return; + } +- image.setColorCount(info_ptr->num_palette); ++ png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette); ++ image.setColorCount(num_palette); + int i = 0; +- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { +- while (i < info_ptr->num_trans) { ++ if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color_p) && trans_alpha) { ++ while (i < num_trans) { + image.setColor(i, qRgba( +- 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[i] +-#else +- info_ptr->trans_alpha[i] +-#endif ++ palette[i].red, ++ palette[i].green, ++ palette[i].blue, ++ trans_alpha[i] + ) + ); + 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 + ) + ); +@@ -531,33 +534,36 @@ QImage::Format QPngHandlerPrivate::readImageFormat() + QImage::Format format = QImage::Format_Invalid; + png_uint_32 width, height; + int bit_depth, color_type; +- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) { ++ png_colorp palette; ++ int num_palette; ++ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); ++ if (color_type == PNG_COLOR_TYPE_GRAY) { + // Black & White or 8-bit grayscale +- if (info_ptr->bit_depth == 1 && info_ptr->channels == 1) { ++ if (bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1) { + format = QImage::Format_Mono; +- } else if (info_ptr->bit_depth == 16 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { ++ } else if (bit_depth == 16 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { + format = QImage::Format_ARGB32; + } else { + format = QImage::Format_Indexed8; + } +- } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE +- && png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE) +- && info_ptr->num_palette <= 256) ++ } else if (color_type == PNG_COLOR_TYPE_PALETTE ++ && png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) ++ && num_palette <= 256) + { + // 1-bit and 8-bit color +- if (info_ptr->bit_depth != 1) ++ if (bit_depth != 1) + png_set_packing(png_ptr); + png_read_update_info(png_ptr, info_ptr); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + format = bit_depth == 1 ? QImage::Format_Mono : QImage::Format_Indexed8; + } else { + // 32-bit +- if (info_ptr->bit_depth == 16) ++ if (bit_depth == 16) + png_set_strip_16(png_ptr); + + format = QImage::Format_ARGB32; + // Only add filler if no alpha, or we can get 5 channel data. +- if (!(info_ptr->color_type & PNG_COLOR_MASK_ALPHA) ++ if (!(color_type & PNG_COLOR_MASK_ALPHA) + && !png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { + // We want 4 bytes, but it isn't an alpha channel + format = QImage::Format_RGB32; +@@ -648,7 +654,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt + text_ptr[i].text = qstrdup(value.constData()); + text_ptr[i].text_length = 0; + text_ptr[i].itxt_length = value.size(); +- text_ptr[i].lang = "UTF-8"; ++ text_ptr[i].lang = const_cast<char*>("UTF-8"); + text_ptr[i].lang_key = qstrdup(it.key().toUtf8().constData()); + #endif + ++i; +@@ -735,64 +741,51 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image_in, + png_set_compression_level(png_ptr, quality); + } + +- if (gamma != 0.0) { +- png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); +- } +- + png_set_write_fn(png_ptr, (void*)this, qpiw_write_fn, qpiw_flush_fn); + +- info_ptr->channels = +- (image.depth() == 32) +- ? (image.format() == QImage::Format_RGB32 ? 3 : 4) +- : 1; +- + png_set_IHDR(png_ptr, info_ptr, image.width(), image.height(), + image.depth() == 1 ? 1 : 8 /* per channel */, + image.depth() == 32 + ? image.format() == QImage::Format_RGB32 + ? PNG_COLOR_TYPE_RGB + : PNG_COLOR_TYPE_RGB_ALPHA +- : PNG_COLOR_TYPE_PALETTE, 0, 0, 0); ++ : PNG_COLOR_TYPE_PALETTE, 0, 0, 0); // also sets #channels + ++ if (gamma != 0.0) { ++ png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); ++ } + +- //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; ++ png_color_8 sig_bit; ++ sig_bit.red = 8; ++ sig_bit.green = 8; ++ sig_bit.blue = 8; ++ sig_bit.alpha = image.hasAlphaChannel() ? 8 : 0; ++ png_set_sBIT(png_ptr, info_ptr, &sig_bit); + + if (image.format() == QImage::Format_MonoLSB) + png_set_packswap(png_ptr); + +- png_colorp palette = 0; +- png_bytep copy_trans = 0; + if (image.colorCount()) { + // Paletted + int num_palette = image.colorCount(); +- palette = new png_color[num_palette]; +- png_set_PLTE(png_ptr, info_ptr, palette, num_palette); +- int* trans = new int[num_palette]; ++ png_color palette[num_palette]; ++ png_byte trans[num_palette]; + int num_trans = 0; + 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); +- trans[i] = rgb >> 24; ++ QRgb rgba=image.color(i); ++ palette[i].red = qRed(rgba); ++ palette[i].green = qGreen(rgba); ++ palette[i].blue = qBlue(rgba); ++ trans[i] = qAlpha(rgba); + if (trans[i] < 255) { + num_trans = i+1; + } + } ++ png_set_PLTE(png_ptr, info_ptr, palette, num_palette); ++ + if (num_trans) { +- copy_trans = new png_byte[num_trans]; +- for (int i=0; i<num_trans; i++) +- copy_trans[i] = trans[i]; +- png_set_tRNS(png_ptr, info_ptr, copy_trans, num_trans, 0); ++ png_set_tRNS(png_ptr, info_ptr, trans, num_trans, 0); + } +- delete [] trans; +- } +- +- if (image.format() != QImage::Format_RGB32) { +- info_ptr->sig_bit.alpha = 8; + } + + // Swap ARGB to RGBA (normal PNG format) before saving on +@@ -868,11 +861,6 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image_in, + png_write_end(png_ptr, info_ptr); + frames_written++; + +- if (palette) +- delete [] palette; +- if (copy_trans) +- delete [] copy_trans; +- + png_destroy_write_struct(&png_ptr, &info_ptr); + + return true; +@@ -958,7 +946,8 @@ QVariant QPngHandler::option(ImageOption option) const + else if (option == Description) + return d->description; + else if (option == Size) +- return QSize(d->info_ptr->width, d->info_ptr->height); ++ return QSize(png_get_image_width(d->png_ptr, d->info_ptr), ++ png_get_image_height(d->png_ptr, d->info_ptr)); + else if (option == ImageFormat) + return d->readImageFormat(); + return 0; +-- +1.6.1 + diff --git a/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild b/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild index d223bb829cd4..4c3f36fc3fbd 100644 --- a/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild +++ b/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild,v 1.5 2011/11/20 20:23:41 pesa Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/qt-gui-4.6.3-r2.ebuild,v 1.6 2011/12/17 19:37:35 chithanh Exp $ EAPI="2" inherit confutils eutils qt4-build @@ -45,6 +45,8 @@ RDEPEND="${RDEPEND} " PDEPEND="qt3support? ( ~x11-libs/qt-qt3support-${PV}[aqua=,debug=] )" +PATCHES=( "${FILESDIR}/${PN}-4.6-libpng-1.5.patch" ) + pkg_setup() { if ! use qt3support; then ewarn "WARNING: if you need 'qtconfig', you _must_ enable qt3support." diff --git a/x11-libs/qt-gui/qt-gui-4.6.3.ebuild b/x11-libs/qt-gui/qt-gui-4.6.3.ebuild index 6cf8a3f0bde0..8ae24ee3e23e 100644 --- a/x11-libs/qt-gui/qt-gui-4.6.3.ebuild +++ b/x11-libs/qt-gui/qt-gui-4.6.3.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/qt-gui-4.6.3.ebuild,v 1.13 2011/11/20 20:23:41 pesa Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt-gui/qt-gui-4.6.3.ebuild,v 1.14 2011/12/17 19:37:35 chithanh Exp $ EAPI="2" inherit confutils eutils qt4-build @@ -45,6 +45,8 @@ RDEPEND="${RDEPEND} " PDEPEND="qt3support? ( ~x11-libs/qt-qt3support-${PV}[aqua=,debug=] )" +PATCHES=( "${FILESDIR}/${PN}-4.6-libpng-1.5.patch" ) + pkg_setup() { if ! use qt3support; then ewarn "WARNING: if you need 'qtconfig', you _must_ enable qt3support." |