diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-09-25 12:30:11 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-09-25 12:32:11 (GMT) |
commit | f63b210e677e59c5b28d6e7b8bfa0af290c75bcb (patch) | |
tree | 8b21d6fbb02247fc6c14b7678d94309988cbc95e /src/opengl/qpixmapdata_gl.cpp | |
parent | a39f17108e43e8b676738c15d8f0c150787de514 (diff) | |
download | Qt-f63b210e677e59c5b28d6e7b8bfa0af290c75bcb.zip Qt-f63b210e677e59c5b28d6e7b8bfa0af290c75bcb.tar.gz Qt-f63b210e677e59c5b28d6e7b8bfa0af290c75bcb.tar.bz2 |
Fixed crash with QPixmap::fill() when pixmap is painted to using opengl1
Reviewed-by: Samuel
Diffstat (limited to 'src/opengl/qpixmapdata_gl.cpp')
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 8cb6c8d..2331c6d 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -384,8 +384,20 @@ void QGLPixmapData::fill(const QColor &color) m_hasFillColor = true; m_fillColor = color; } else { - QImage image = fillImage(color); - fromImage(image, 0); + + if (m_source.isNull()) { + m_fillColor = color; + m_hasFillColor = true; + + } else if (m_source.depth() == 32) { + m_source.fill(PREMUL(color.rgba())); + + } else if (m_source.depth() == 1) { + if (color == Qt::color1) + m_source.fill(1); + else + m_source.fill(0); + } } } @@ -399,15 +411,11 @@ QImage QGLPixmapData::fillImage(const QColor &color) const QImage img; if (pixelType() == BitmapType) { img = QImage(w, h, QImage::Format_MonoLSB); - img.setNumColors(2); - img.setColor(0, QColor(Qt::color0).rgba()); - img.setColor(1, QColor(Qt::color1).rgba()); - int gray = qGray(color.rgba()); - if (qAbs(255 - gray) < gray) - img.fill(0); - else + if (color == Qt::color1) img.fill(1); + else + img.fill(0); } else { img = QImage(w, h, m_hasAlpha |