diff options
-rw-r--r-- | src/plugins/platforms/wasm/qwasmbackingstore.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/wasm/qwasmbackingstore.h | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.cpp b/src/plugins/platforms/wasm/qwasmbackingstore.cpp index e8eda2605f..7e8a382512 100644 --- a/src/plugins/platforms/wasm/qwasmbackingstore.cpp +++ b/src/plugins/platforms/wasm/qwasmbackingstore.cpp @@ -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 diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.h b/src/plugins/platforms/wasm/qwasmbackingstore.h index 4bca83c457..b93c96b483 100644 --- a/src/plugins/platforms/wasm/qwasmbackingstore.h +++ b/src/plugins/platforms/wasm/qwasmbackingstore.h @@ -64,6 +64,7 @@ private: QImage m_image; QScopedPointer<QOpenGLTexture> m_texture; QRegion m_dirty; + bool m_recreateTexture = false; }; QT_END_NAMESPACE |