diff options
author | BogDan Vatra <bogdan@kde.org> | 2014-03-13 11:24:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-15 10:45:42 +0100 |
commit | f9e1e595a9a83a93dea98d7b34bf545d06d01387 (patch) | |
tree | e572bffda0618585d3a1c9bf011dd330d04e1874 /src/plugins | |
parent | 287fa94fe2f93e2857a4c15f69435c4ea14de82e (diff) |
Android: Delay the set of the BackingStore if window->handle() is null.
Task-number: QTBUG-37458
Change-Id: Idddfe1876aff3d14d8c6c060d04236c5dc611bce
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformbackingstore.cpp | 21 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformbackingstore.h | 3 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformbackingstore.cpp b/src/plugins/platforms/android/qandroidplatformbackingstore.cpp index b85b1157a8..ff49f59076 100644 --- a/src/plugins/platforms/android/qandroidplatformbackingstore.cpp +++ b/src/plugins/platforms/android/qandroidplatformbackingstore.cpp @@ -50,11 +50,8 @@ QT_BEGIN_NAMESPACE QAndroidPlatformBackingStore::QAndroidPlatformBackingStore(QWindow *window) : QPlatformBackingStore(window) { - Q_ASSERT(window->handle()); - if (window->surfaceType() == QSurface::RasterSurface) - (static_cast<QAndroidPlatformRasterWindow *>(window->handle()))->setBackingStore(this); - else - qWarning("QAndroidPlatformBackingStore does not support GL windows."); + if (window->handle()) + setBackingStore(window); } QPaintDevice *QAndroidPlatformBackingStore::paintDevice() @@ -64,9 +61,11 @@ QPaintDevice *QAndroidPlatformBackingStore::paintDevice() void QAndroidPlatformBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(window); Q_UNUSED(offset); + if (!m_backingStoreSet) + setBackingStore(window); + (static_cast<QAndroidPlatformRasterWindow *>(window->handle()))->repaint(region); } @@ -78,4 +77,14 @@ void QAndroidPlatformBackingStore::resize(const QSize &size, const QRegion &stat m_image = QImage(size, window()->screen()->handle()->format()); } +void QAndroidPlatformBackingStore::setBackingStore(QWindow *window) +{ + if (window->surfaceType() == QSurface::RasterSurface) { + (static_cast<QAndroidPlatformRasterWindow *>(window->handle()))->setBackingStore(this); + m_backingStoreSet = true; + } else { + qWarning("QAndroidPlatformBackingStore does not support GL windows."); + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformbackingstore.h b/src/plugins/platforms/android/qandroidplatformbackingstore.h index e6ea3dcce0..4c24e129c3 100644 --- a/src/plugins/platforms/android/qandroidplatformbackingstore.h +++ b/src/plugins/platforms/android/qandroidplatformbackingstore.h @@ -56,9 +56,10 @@ public: virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); virtual void resize(const QSize &size, const QRegion &staticContents); const QImage image() { return m_image; } - + void setBackingStore(QWindow *window); protected: QImage m_image; + bool m_backingStoreSet = false; }; QT_END_NAMESPACE |