summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qt.io>2017-06-17 15:28:49 +0900
committerTasuku Suzuki <tasuku.suzuki@qt.io>2017-06-19 00:08:41 +0000
commit29dbb9acede3f5d9e477fdedd53d04be4136c0de (patch)
tree0b932b70b1bb353c2ca36eca946899ec71d6169e
parentaf4d463cc8f4f404ffe406f77a01fac5b4be49b7 (diff)
downloadqtwayland-29dbb9acede3f5d9e477fdedd53d04be4136c0de.tar.gz
Translucent background support
Change-Id: I6e7b5869097f579020c7a4439441a63a0771e955 Task-number: QTBUG-55956 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/client/qwaylandshmbackingstore.cpp10
-rw-r--r--src/client/qwaylandshmbackingstore_p.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index 0afdda4c..045748a1 100644
--- a/src/client/qwaylandshmbackingstore.cpp
+++ b/src/client/qwaylandshmbackingstore.cpp
@@ -171,12 +171,20 @@ QPaintDevice *QWaylandShmBackingStore::paintDevice()
return contentSurface();
}
-void QWaylandShmBackingStore::beginPaint(const QRegion &)
+void QWaylandShmBackingStore::beginPaint(const QRegion &region)
{
mPainting = true;
ensureSize();
waylandWindow()->setCanResize(false);
+
+ if (mBackBuffer->image()->hasAlphaChannel()) {
+ QPainter p(paintDevice());
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ const QColor blank = Qt::transparent;
+ for (const QRect &rect : region)
+ p.fillRect(rect, blank);
+ }
}
void QWaylandShmBackingStore::endPaint()
diff --git a/src/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h
index 8564cc9d..251368ef 100644
--- a/src/client/qwaylandshmbackingstore_p.h
+++ b/src/client/qwaylandshmbackingstore_p.h
@@ -94,7 +94,7 @@ public:
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
void resize(const QSize &size, const QRegion &staticContents) override;
void resize(const QSize &size);
- void beginPaint(const QRegion &) override;
+ void beginPaint(const QRegion &region) override;
void endPaint() override;
QWaylandAbstractDecoration *windowDecoration() const;