summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-22 14:11:02 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-09-22 14:16:27 (GMT)
commit88b5af89e35584f12330bc6932176d5df413d1b1 (patch)
tree91c57b512a0f364560060613a7e7bd28ec20dc38 /src
parent571f0dc0a33b22bfc1f1ffd4521e7c4e5151647c (diff)
downloadQt-88b5af89e35584f12330bc6932176d5df413d1b1.zip
Qt-88b5af89e35584f12330bc6932176d5df413d1b1.tar.gz
Qt-88b5af89e35584f12330bc6932176d5df413d1b1.tar.bz2
Fixed drawing of QPixmaps with masks in the GL 2 and X11 engines.
A regression from 4.6.x. This is an X11-only problem caused by the separate masks that an X11 QPixmap can contain. These masks we're not taken into account when a number optimizations were done for 4.7. Introduction of the texture-from-pixmap extension in 4.6 also broke masked pixmaps under X11. Task-number: QTBUG-13814 Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpixmap_x11.cpp11
-rw-r--r--src/gui/image/qpixmap_x11_p.h1
-rw-r--r--src/gui/image/qpixmapdata.cpp5
-rw-r--r--src/gui/image/qpixmapdata_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/opengl/qgl_x11.cpp4
6 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 3d9c363..32676ba 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1321,6 +1321,15 @@ QBitmap QX11PixmapData::mask() const
return mask;
}
+bool QX11PixmapData::hasMask() const
+{
+ return
+#ifndef QT_NO_XRENDER
+ (picture && d == 32) ||
+#endif
+ (d == 1) || x11_mask;
+}
+
/*!
Sets a mask bitmap.
@@ -1549,7 +1558,7 @@ QImage QX11PixmapData::toImage(const QRect &rect) const
if (!xiWrapper.xi)
return QImage();
- if (canTakeQImageFromXImage(xiWrapper))
+ if (!x11_mask && canTakeQImageFromXImage(xiWrapper))
return takeQImageFromXImage(xiWrapper);
QImage image = toImage(xiWrapper, rect);
diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h
index 821fb69..fcad1a2 100644
--- a/src/gui/image/qpixmap_x11_p.h
+++ b/src/gui/image/qpixmap_x11_p.h
@@ -82,6 +82,7 @@ public:
void fill(const QColor &color);
QBitmap mask() const;
+ bool hasMask() const;
void setMask(const QBitmap &mask);
bool hasAlphaChannel() const;
void setAlphaChannel(const QPixmap &alphaChannel);
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index ef1f6c4..2813ed1 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -239,6 +239,11 @@ QBitmap QPixmapData::mask() const
return QBitmap::fromImage(mask);
}
+bool QPixmapData::hasMask() const
+{
+ return hasAlphaChannel();
+}
+
QPixmap QPixmapData::transformed(const QTransform &matrix,
Qt::TransformationMode mode) const
{
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index ec62b0b..c341930 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -99,6 +99,7 @@ public:
virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0;
virtual void fill(const QColor &color) = 0;
virtual QBitmap mask() const;
+ virtual bool hasMask() const;
virtual void setMask(const QBitmap &mask);
virtual bool hasAlphaChannel() const = 0;
virtual QPixmap transformed(const QTransform &matrix,
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index aa217f6..6eb5a36 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1314,7 +1314,7 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c
QGLRect srcRect(src.left(), top, src.right(), bottom);
bool isBitmap = pixmap.isQBitmap();
- bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel();
+ bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel() && !pixmap.pixmapData()->hasMask();
d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index f3a4c95..7f4c670 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -1776,6 +1776,10 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data());
Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class);
+ // We can't use TFP if the pixmap has a separate X11 mask
+ if (pixmapData->x11_mask)
+ return 0;
+
if (!qt_resolveTextureFromPixmap(paintDevice))
return 0;