summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp')
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp b/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp
index ab92bac37d..8abfbf2763 100644
--- a/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp
@@ -41,6 +41,7 @@
#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/QOpenGLContext>
+#include <QtGui/QPainter>
#include "qeglplatformbackingstore_p.h"
#include "qeglcompositor_p.h"
@@ -209,9 +210,16 @@ void QEGLPlatformBackingStore::composited()
}
}
-void QEGLPlatformBackingStore::beginPaint(const QRegion &rgn)
+void QEGLPlatformBackingStore::beginPaint(const QRegion &region)
{
- m_dirty |= rgn;
+ m_dirty |= region;
+
+ if (m_image.hasAlphaChannel()) {
+ QPainter p(&m_image);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ foreach (const QRect &r, region.rects())
+ p.fillRect(r, Qt::transparent);
+ }
}
void QEGLPlatformBackingStore::resize(const QSize &size, const QRegion &staticContents)
@@ -223,7 +231,15 @@ void QEGLPlatformBackingStore::resize(const QSize &size, const QRegion &staticCo
if (!dstWin || (!dstWin->isRaster() && dstWin->window()->surfaceType() != QSurface::RasterGLSurface))
return;
- m_image = QImage(size, QImage::Format_RGB32);
+ // Child windows do not get real native surfaces and so share the same
+ // format as the parent, regardless of what has been requested. The
+ // exception is WA_TranslucentBackground that sets alphaBufferSize in the
+ // requested format, this has to be taken into account when compositing.
+ const bool translucent = m_window->window()->requestedFormat().alphaBufferSize() > 0;
+ const QImage::Format format = translucent ? QImage::Format_RGBA8888 : QImage::Format_RGBX8888;
+
+ m_image = QImage(size, format);
+
m_window->create();
screen->compositingContext()->makeCurrent(dstWin->window());