diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-05-10 12:04:52 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-09-18 08:29:06 +0200 |
commit | 3278eae5773f21f6b1cc059fa392609e28caa902 (patch) | |
tree | 00f5d5a27cc4545d0c228deaf26be14272f7a2c8 /src/plugins/platforms/wasm | |
parent | 4d289edb14aeb4976218cc306bfc514e37521b82 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/wasm')
-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 |