summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-05-27 12:02:14 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-05-27 12:09:40 (GMT)
commit962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f (patch)
tree9fccf497be456fff3cfde4d5b0d0ea07aae0d7af /src/opengl/gl2paintengineex
parent71cb35e942b94e4dba2055acdebbf90c352da762 (diff)
downloadQt-962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f.zip
Qt-962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f.tar.gz
Qt-962d216ce9f9f1e6bd73fe43e3d2a7c86f64b75f.tar.bz2
Make QGLWidgets have the same background colour as QWidgets
QWidgets are filled with Qt::transparent when WA_TranslucentBackground is set, reguardless of what their background colour has been set to. This patch makes QGLWidgets behave the same way. Reviewed-By: Samuel Rødal
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 5c8b364..f7dbed3 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1083,16 +1083,6 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
// qDebug("You should see green now");
// sleep(5);
- const QColor &c = d->drawable.backgroundColor();
- glClearColor(c.redF(), c.greenF(), c.blueF(), d->drawable.format().alpha() ? c.alphaF() : 1.0);
- if (d->drawable.context()->d_func()->clear_on_painter_begin && d->drawable.autoFillBackground()) {
- GLbitfield clearBits = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
-#ifndef QT_OPENGL_ES
- clearBits |= GL_ACCUM_BUFFER_BIT;
-#endif
- glClear(clearBits);
- }
-
d->brushTextureDirty = true;
d->brushUniformsDirty = true;
d->matrixDirty = true;
@@ -1105,11 +1095,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
glDisable(GL_SCISSOR_TEST);
QGLPixmapData *source = d->drawable.copyOnBegin();
- if (d->drawable.autoFillBackground()) {
- QColor color = d->drawable.backgroundColor();
-
- float alpha = color.alphaF();
- glClearColor(color.redF() * alpha, color.greenF() * alpha, color.blueF() * alpha, alpha);
+ if (d->drawable.context()->d_func()->clear_on_painter_begin && d->drawable.autoFillBackground()) {
+ if (d->drawable.hasTransparentBackground())
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ else {
+ const QColor &c = d->drawable.backgroundColor();
+ float alpha = c.alphaF();
+ glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
+ }
glClear(GL_COLOR_BUFFER_BIT);
} else if (source) {
d->transferMode(ImageDrawingMode);