public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/kde-sunset:master commit in: x11-libs/qt-meta/files/, x11-libs/qt-meta/
@ 2011-09-30 21:10 Michał Górny
  0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2011-09-30 21:10 UTC (permalink / raw
  To: gentoo-commits

commit:     8ac83bdb7f1ff6563756fc11007b39e685f0e6b1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 30 21:12:49 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep 30 21:12:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/kde-sunset.git;a=commit;h=8ac83bdb

x11-libs/qt-meta: Add libpng 1.5 patch, as requested by Poly-C. Fixes bug #384953.

(Portage version: 2.2.0_alpha60/git/Linux x86_64, signed Manifest commit with key 42B9401D)

---
 x11-libs/qt-meta/ChangeLog                     |    6 +-
 x11-libs/qt-meta/files/qt-3.3.8-libpng14.patch |   42 -----
 x11-libs/qt-meta/files/qt-3.3.8-libpng15.patch |  212 ++++++++++++++++++++++++
 x11-libs/qt-meta/qt-meta-3.3.8b-r2.ebuild      |    4 +-
 4 files changed, 219 insertions(+), 45 deletions(-)

diff --git a/x11-libs/qt-meta/ChangeLog b/x11-libs/qt-meta/ChangeLog
index 1f51c66..5aeda1e 100644
--- a/x11-libs/qt-meta/ChangeLog
+++ b/x11-libs/qt-meta/ChangeLog
@@ -1,7 +1,11 @@
-# ChangeLog for x11-libs/qt
+# ChangeLog for x11-libs/qt-meta
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
 # $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/ChangeLog,v 1.586 2009/08/02 21:54:28 tommy Exp $
 
+  30 Sep 2011; Michał Górny <mgorny@gentoo.org> qt-meta-3.3.8b-r2.ebuild,
+  -files/qt-3.3.8-libpng14.patch, +files/qt-3.3.8-libpng15.patch:
+  Add libpng 1.5 patch, as requested by Poly-C. Fixes bug #384953.
+
   28 Feb 2011; Hanno Boeck <hanno@gentoo.org> qt-3.3.8b-r1.ebuild,
   qt-3.3.8b-r2.ebuild:
   Change dependency from media-libs/jpeg to virtual/jpeg.

diff --git a/x11-libs/qt-meta/files/qt-3.3.8-libpng14.patch b/x11-libs/qt-meta/files/qt-3.3.8-libpng14.patch
deleted file mode 100644
index 8906e6f..0000000
--- a/x11-libs/qt-meta/files/qt-3.3.8-libpng14.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- 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) {

diff --git a/x11-libs/qt-meta/files/qt-3.3.8-libpng15.patch b/x11-libs/qt-meta/files/qt-3.3.8-libpng15.patch
new file mode 100644
index 0000000..e64fea3
--- /dev/null
+++ b/x11-libs/qt-meta/files/qt-3.3.8-libpng15.patch
@@ -0,0 +1,212 @@
+$NetBSD: patch-as,v 1.5 2011/03/25 15:28:26 wiz Exp $
+
+--- src/kernel/qpngio.cpp.orig	2007-02-02 10:01:15.000000000 -0400
++++ src/kernel/qpngio.cpp
+@@ -43,6 +43,7 @@
+ #include "qiodevice.h"
+ 
+ #include <png.h>
++#include <zlib.h>
+ 
+ 
+ #ifdef Q_OS_TEMP
+@@ -123,9 +124,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 = NULL;
++    int info_ptr_num_palette = 0;
++    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 = NULL;
++    int info_ptr_num_trans = 0;
++    png_color_16p info_ptr_trans_color = NULL;
++
++    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 +175,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;
+ 		if (g < ncols) {
+ 		    image.setAlphaBuffer(TRUE);
+ 		    image.setColor(g, image.color(g) & RGB_MASK);
+@@ -168,7 +184,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 +192,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_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 +300,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 +485,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 +507,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 +526,12 @@ bool QPNGImageWriter::writeImage(const Q
+ 		: PNG_COLOR_TYPE_RGB
+ 	    : PNG_COLOR_TYPE_PALETTE, 0, 0, 0);
+ 
++    png_color_8 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 = NULL;
++	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,7 @@ 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
++    unused_data = png_process_data_pause(png, 0);
+ }
+ 
+ #ifdef PNG_USER_CHUNKS_SUPPORTED

diff --git a/x11-libs/qt-meta/qt-meta-3.3.8b-r2.ebuild b/x11-libs/qt-meta/qt-meta-3.3.8b-r2.ebuild
index 233884d..3eabbb0 100644
--- a/x11-libs/qt-meta/qt-meta-3.3.8b-r2.ebuild
+++ b/x11-libs/qt-meta/qt-meta-3.3.8b-r2.ebuild
@@ -134,8 +134,8 @@ src_unpack() {
 	# Fix CJK script rendering, bug 229567
 	epatch "${FILESDIR}"/qt-3.3.8b-cjk-fix.patch
 
-	# Fix libpng-1.4 issues
-	epatch "${FILESDIR}"/qt-3.3.8-libpng14.patch
+	# Fix libpng-1.5 issues
+	epatch "${FILESDIR}"/qt-3.3.8-libpng15.patch
 
 	if use immqt || use immqt-bc ; then
 		epatch ../${IMMQT_P}.diff



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-30 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 21:10 [gentoo-commits] proj/kde-sunset:master commit in: x11-libs/qt-meta/files/, x11-libs/qt-meta/ Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox