diff options
author | Andy Nichols <andy.nichols@qt.io> | 2017-07-12 14:44:40 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2017-10-17 11:32:04 +0000 |
commit | a3b06ac83de95c2596317c200114d1019e665215 (patch) | |
tree | 48c304896509efe207d34401a2d8ae6899c192a0 /src/quickwidgets | |
parent | 341a04377bcb0fb1fd7c2c52bd4a8b7cfd35b44c (diff) |
Software Adaptation: Fix QQuickWidget when moving between screens
When changing between screens, the QImage representing the contents of
the scene will be changed, but the software adaptation was only updating
the contents of the image that had change since the last frame, leading
to uninitialized image data being shown. Now QQuickWidget will force a
full repaint on the new image.
Task-number: QTBUG-61798
Change-Id: Iab200faee8cf6457f2eab6d33dddbe7781c9fcf1
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quickwidgets')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 6 | ||||
-rw-r--r-- | src/quickwidgets/qquickwidget_p.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 5aff0ee393..4c4f5fa9f3 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -201,6 +201,7 @@ QQuickWidgetPrivate::QQuickWidgetPrivate() , fakeHidden(false) , requestedSamples(0) , useSoftwareRenderer(false) + , forceFullUpdate(false) { } @@ -306,6 +307,10 @@ void QQuickWidgetPrivate::render(bool needsSync) auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer); if (softwareRenderer && !softwareImage.isNull()) { softwareRenderer->setCurrentPaintDevice(&softwareImage); + if (forceFullUpdate) { + softwareRenderer->markDirty(); + forceFullUpdate = false; + } renderControl->render(); updateRegion += softwareRenderer->flushRegion(); @@ -916,6 +921,7 @@ void QQuickWidget::createFramebufferObject() const QSize imageSize = size() * devicePixelRatioF(); d->softwareImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied); d->softwareImage.setDevicePixelRatio(devicePixelRatioF()); + d->forceFullUpdate = true; return; } diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h index 6892e6e0b4..9747315577 100644 --- a/src/quickwidgets/qquickwidget_p.h +++ b/src/quickwidgets/qquickwidget_p.h @@ -144,6 +144,7 @@ public: bool useSoftwareRenderer; QImage softwareImage; QRegion updateRegion; + bool forceFullUpdate; }; QT_END_NAMESPACE |