wasm: recreate backing store texture with valid gl context

The compositor context is not current during the resize()
call, but will be during updateTexture().

Change-Id: I29c2e06aa251b564b5d622dc9380ec994e15aab0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
bb10
Morten Johan Sørvig 2019-05-10 12:04:52 +02:00
parent 4d289edb14
commit 3278eae577
2 changed files with 7 additions and 3 deletions

View File

@ -81,6 +81,11 @@ void QWasmBackingStore::updateTexture()
if (m_dirty.isNull())
return;
if (m_recreateTexture && m_texture->isCreated()) {
m_recreateTexture = false;
m_texture->destroy();
}
if (!m_texture->isCreated()) {
m_texture->setMinificationFilter(QOpenGLTexture::Nearest);
m_texture->setMagnificationFilter(QOpenGLTexture::Nearest);
@ -146,9 +151,7 @@ void QWasmBackingStore::resize(const QSize &size, const QRegion &staticContents)
m_image = QImage(size * window()->devicePixelRatio(), QImage::Format_RGB32);
m_image.setDevicePixelRatio(window()->devicePixelRatio());
if (m_texture->isCreated())
m_texture->destroy();
m_recreateTexture = true;
}
QImage QWasmBackingStore::toImage() const

View File

@ -64,6 +64,7 @@ private:
QImage m_image;
QScopedPointer<QOpenGLTexture> m_texture;
QRegion m_dirty;
bool m_recreateTexture = false;
};
QT_END_NAMESPACE