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>
This commit is contained in:
BogDan Vatra 2014-03-13 11:24:38 +02:00 committed by The Qt Project
parent 287fa94fe2
commit f9e1e595a9
2 changed files with 17 additions and 7 deletions

View File

@ -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 &region, 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

View File

@ -56,9 +56,10 @@ public:
virtual void flush(QWindow *window, const QRegion &region, 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