summaryrefslogtreecommitdiffstats
path: root/src/opengl/qpixmapdata_gl.cpp
diff options
context:
space:
mode:
authorJeremy Katz <jeremy.katz@nokia.com>2009-09-25 14:44:15 (GMT)
committerJeremy Katz <jeremy.katz@nokia.com>2009-09-25 14:44:15 (GMT)
commit2c37fde6b5a503a14bb4655a785d51be77fe889b (patch)
treefe35633047ac706f4736fc119bcd2abbb6d79d22 /src/opengl/qpixmapdata_gl.cpp
parent2b1f40b7dcf7ef69fe1f832ff544fcb31cf5c3a1 (diff)
parentb4c52810efd42ba9cd8087180a5bf9d48c18de84 (diff)
downloadQt-2c37fde6b5a503a14bb4655a785d51be77fe889b.zip
Qt-2c37fde6b5a503a14bb4655a785d51be77fe889b.tar.gz
Qt-2c37fde6b5a503a14bb4655a785d51be77fe889b.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/opengl/qpixmapdata_gl.cpp')
-rw-r--r--src/opengl/qpixmapdata_gl.cpp26
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