diff options
author | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-09-09 15:07:44 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-09-15 08:18:18 +0000 |
commit | 858c62583ff776edb8c9e539f0331f5d658de2d1 (patch) | |
tree | 3021fae40200ced101149a13ee0f76c2d0b6d367 /src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp | |
parent | 893140169557eb06d79e783d38673217deab28c1 (diff) |
Fix crash when using Software Renderer on HiDPI QBackingStore
For some reason the QPaintDevice of a QBackingStore is not valid on
HiDPI QBackingStores until QBackingStore::begin() has been called. I
suspect this is a bug in qtbase, but until this is fixed this change
will make sure that the paint device will always be valid, even in this
unusual situation.
Task-number: QTBUG-55875
Change-Id: I63137d0de9b68d29bfcf86d1807f576923875b5d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp')
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp index ae89ed7d8a..cad826fb27 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp @@ -101,8 +101,13 @@ void QSGSoftwareRenderer::render() return; // If there is a backingstore, set the current paint device - if (m_backingStore) + if (m_backingStore) { + // For HiDPI QBackingStores, the paint device is not valid + // until begin() has been called. See: QTBUG-55875 + m_backingStore->beginPaint(QRegion()); m_paintDevice = m_backingStore->paintDevice(); + m_backingStore->endPaint(); + } QElapsedTimer renderTimer; @@ -133,8 +138,12 @@ void QSGSoftwareRenderer::render() qint64 optimizeRenderListTime = renderTimer.restart(); // If Rendering to a backingstore, prepare it to be updated - if (m_backingStore != nullptr) + if (m_backingStore != nullptr) { m_backingStore->beginPaint(updateRegion); + // It is possible that a QBackingStore's paintDevice() will change + // when begin() is called. + m_paintDevice = m_backingStore->paintDevice(); + } QPainter painter(m_paintDevice); painter.setRenderHint(QPainter::Antialiasing); |