summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-06-12 14:41:19 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-06-12 15:21:15 (GMT)
commit22fc2f7a832d8dc19c23b92710f520149e439971 (patch)
tree041f5d34a15f1191381ba51509578d1f33b2bb1b /src/opengl
parent4c2697c093a495c289b1eb0689ac9bbca5442343 (diff)
downloadQt-22fc2f7a832d8dc19c23b92710f520149e439971.zip
Qt-22fc2f7a832d8dc19c23b92710f520149e439971.tar.gz
Qt-22fc2f7a832d8dc19c23b92710f520149e439971.tar.bz2
Fixed bitmap drawing in GL 2 engine when not using GL pixmap backend.
QPixmap shouldn't return true in hasAlphaChannel() for bitmaps, instead the paint engine should check whether the pixmap is a bitmap or not. In addition, QBrush::isOpaque() returned true for bitmap brushes, which is wrong according to the documentation. Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp6
-rw-r--r--src/opengl/qpixmapdata_gl.cpp2
2 files changed, 5 insertions, 3 deletions
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