summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2012-04-02 11:59:04 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-16 22:25:06 +0200
commit1d95d8b608d5f689afd3c40535ab67ffabb343e9 (patch)
treee7ceaa850586e562f166a791bc176a3ba2e3bf11
parente786478d64f6ace802e103a54783784572048864 (diff)
widgets/qpa: Fix painting to a fully transparent top level widget
QWS used to have a line to change the composite mode from SourceOver to Source for the top level widget. This wasn't used with QPA and I removed the internal DontSetCompositionMode in qtbase. It turns out that the QWS way is the most efficient one to initialize the background of the widget. The alternative is to have the QPlatformBackingStore::beginPaint always clear the entire to be painted area and then paint the background of the widget. The difference of painting each pixel once or twice is noticable on embedded platforms and in the range of one to two fps. This does come from Qt5. The change removes the hasFeature test as CompositionMode_Source is available for all backends. Reproduce the issue with: echo "QWidget {background: transparent}" > style.css ./examples/widgets/wiggly/wiggly -stylesheet style.css Task-number: QTBUG-24526 Change-Id: I3e3f8a263cd3cf9dec8628ca8a3bb28c70572121 Original-Id: Ica4c980bb3bf6eb87ddb5b510ac7493292d01543 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
-rw-r--r--src/gui/kernel/qwidget.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index eea7b7cccf..030e31bd95 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2420,11 +2420,19 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) {
const QBrush bg = q->palette().brush(QPalette::Window);
-#ifdef Q_WS_QWS
- if (!(flags & DontSetCompositionMode) && painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff))
- painter->setCompositionMode(QPainter::CompositionMode_Source); //copy alpha straight in
-#endif
+#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
+ if (!(flags & DontSetCompositionMode)) {
+ //copy alpha straight in
+ QPainter::CompositionMode oldMode = painter->compositionMode();
+ painter->setCompositionMode(QPainter::CompositionMode_Source);
+ fillRegion(painter, rgn, bg);
+ painter->setCompositionMode(oldMode);
+ } else {
+ fillRegion(painter, rgn, bg);
+ }
+#else
fillRegion(painter, rgn, bg);
+#endif
}
if (q->autoFillBackground())
@@ -5707,7 +5715,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
else
flags |= DontSubtractOpaqueChildren;
-#ifdef Q_WS_QWS
+#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
flags |= DontSetCompositionMode;
#endif