diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-13 10:05:52 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@digia.com> | 2014-08-13 16:14:19 +0200 |
commit | 5621a7c5014ac337d41a00ca8f53f172bd17b792 (patch) | |
tree | 9dd679d1ea0319c989377a0e940b152e0a169350 /src/plugins/platforms/xcb | |
parent | 6c3c1a4cb8e4973b8e603edfbe608e1b1587f3f2 (diff) |
Fix composition for windows with alpha
While we will cover the entire surface with our textured quads, the clear
is still necessary in order to make top-levels with TranslucentBackground
render correctly: We don't want to blend transparent areas with undefined
content that is in the surface's framebuffer.
Blending is problematic for alpha values. We now prevent the blended alpha
from being written out. This ensures that in examples like qquickviewcomparison,
where the backingstore image contains an alpha of 0.5 while the QQuickWidget
texture 1.0, the result is still an alpha value of 1.0 in the final image.
Writing out an alpha of 0.5 would break on systems where windows get an alpha
buffer by default.
hellogl2 can now take a --transparent parameter which makes the QOpenGLWidget
being cleared to transparent in order to verify it works in combination
with Qt::WA_TranslucentBackground.
The swapped red and blue problem is also corrected. RGBA8888 does not need
swizzling. The only format that needs this is RGB32.
Task-number: QTBUG-40716
Change-Id: I54a9fd3a91a1b59575b38cdb908835315514e40f
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbbackingstore.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbbackingstore.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index ada5b0eedf..6258b29fc7 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -337,9 +337,10 @@ void QXcbBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin #ifndef QT_NO_OPENGL void QXcbBackingStore::composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, - QPlatformTextureList *textures, QOpenGLContext *context) + QPlatformTextureList *textures, QOpenGLContext *context, + bool translucentBackground) { - QPlatformBackingStore::composeAndFlush(window, region, offset, textures, context); + QPlatformBackingStore::composeAndFlush(window, region, offset, textures, context, translucentBackground); Q_XCB_NOOP(connection()); diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index af3c004c2d..725d0511af 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -62,7 +62,8 @@ public: void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); #ifndef QT_NO_OPENGL void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, - QPlatformTextureList *textures, QOpenGLContext *context); + QPlatformTextureList *textures, QOpenGLContext *context, + bool translucentBackground); #endif QImage toImage() const; void resize(const QSize &size, const QRegion &staticContents); |