diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-04-08 17:27:14 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-05-09 15:56:20 +0000 |
commit | 844ea8beea8d8edb68fea18017cdc57592b2808c (patch) | |
tree | 9022f103b0231239bcd07c73e88fb273d9407b80 /src/platformsupport/fbconvenience/qfbbackingstore.cpp | |
parent | 1e971f855546f1b94c7cdf7a31ad64ebe6c3e23d (diff) |
linuxfb: Support transparency
Always clearing to opaque black makes it impossible to create
semi-transparent overlays with linuxfb. Instead, behave like other
platforms' backingstores: if the target image has an alpha channel,
clear to transparent instead and set the correct composition mode.
Task-number: QTBUG-52475
Change-Id: I2db4588e0112e200a3aa5eed49f806c37d7ca8b5
Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io>
Diffstat (limited to 'src/platformsupport/fbconvenience/qfbbackingstore.cpp')
-rw-r--r-- | src/platformsupport/fbconvenience/qfbbackingstore.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp index 2800a81507..5eddf71145 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp +++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp @@ -37,6 +37,7 @@ #include <qpa/qplatformwindow.h> #include <QtGui/qscreen.h> +#include <QtGui/qpainter.h> QT_BEGIN_NAMESPACE @@ -84,9 +85,17 @@ void QFbBackingStore::unlock() mImageMutex.unlock(); } -void QFbBackingStore::beginPaint(const QRegion &) +void QFbBackingStore::beginPaint(const QRegion ®ion) { lock(); + + if (mImage.hasAlphaChannel()) { + QPainter p(&mImage); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector<QRect> rects = region.rects(); + for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) + p.fillRect(*it, Qt::transparent); + } } void QFbBackingStore::endPaint() |