summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qbrush.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp6
-rw-r--r--src/opengl/qpixmapdata_gl.cpp2
-rw-r--r--tests/auto/qbrush/tst_qbrush.cpp11
4 files changed, 19 insertions, 4 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index ea93764..591f63e 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -846,7 +846,9 @@ bool QBrush::isOpaque() const
return false;
return true;
} else if (d->style == Qt::TexturePattern) {
- return !texture().hasAlpha();
+ return qHasPixmapTexture(*this)
+ ? !texture().hasAlphaChannel() && !texture().isQBitmap()
+ : !textureImage().hasAlphaChannel();
}
return false;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 833f8cf..19cb02a 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1002,8 +1002,10 @@ void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, c
glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, true);
- //FIXME: we should use hasAlpha() instead, but that's SLOW at the moment
- d->drawTexture(dest, src, pixmap.size(), !pixmap.hasAlphaChannel(), pixmap.depth() == 1);
+ bool isBitmap = pixmap.isQBitmap();
+ bool isOpaque = !isBitmap && !pixmap.hasAlphaChannel();
+
+ d->drawTexture(dest, src, pixmap.size(), isOpaque, isBitmap);
}
void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src,
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 4c53c46..48feb82 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -262,7 +262,7 @@ void QGLPixmapData::fill(const QColor &color)
bool QGLPixmapData::hasAlphaChannel() const
{
- return pixelType() == BitmapType || m_hasAlpha;
+ return m_hasAlpha;
}
QImage QGLPixmapData::fillImage(const QColor &color) const
diff --git a/tests/auto/qbrush/tst_qbrush.cpp b/tests/auto/qbrush/tst_qbrush.cpp
index 11f715a..7ef930f 100644
--- a/tests/auto/qbrush/tst_qbrush.cpp
+++ b/tests/auto/qbrush/tst_qbrush.cpp
@@ -44,6 +44,7 @@
#include "qbrush.h"
#include <QPainter>
+#include <QBitmap>
#include <qdebug.h>
@@ -76,6 +77,7 @@ private slots:
void textures();
void nullBrush();
+ void isOpaque();
};
Q_DECLARE_METATYPE(QBrush)
@@ -379,5 +381,14 @@ void tst_QBrush::nullBrush()
QCOMPARE(brush.color(), QColor(100,0,0));
}
+void tst_QBrush::isOpaque()
+{
+ QBitmap bm(8, 8);
+ bm.fill(Qt::black);
+
+ QBrush brush(bm);
+ QVERIFY(!brush.isOpaque());
+}
+
QTEST_MAIN(tst_QBrush)
#include "tst_qbrush.moc"