diff options
author | Thomas Senyk <thomas.senyk@qt.io> | 2022-12-15 18:01:12 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-02 07:15:26 +0000 |
commit | a31179edc7b546be6866d64d0437d7a928f979e3 (patch) | |
tree | 684ca5e412713bba0f2c238b987dfdce440cbaaa /src | |
parent | 3d80fdbd08af83345058c32bddf45a2a7c8fcf43 (diff) |
Fix QQuickImageParticle in case of QRhi re-create
With this patch QQuickImageParticle will now properly re-query
the m_rhi member the next time updatePaintNode() is called
Additionally a new (override)
QQuickImageParticle::invalidateSceneGraph()
will call reset() so that potential sub-nodes (e.g. SpriteParticle)
will also be re-created
Last but not least: QQuickSpriteEngine::startAssemblingImage()
was missing to reset it's sprites container
(without that the sprites would pile up and eventually
fail with "Too many animations" error)
Change-Id: I172fd23ddfac475542aabc6cc17d8fee74f728b2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit b899dff5d496e8bebb6bb81e37951d03f8469f63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/particles/qquickimageparticle.cpp | 7 | ||||
-rw-r--r-- | src/particles/qquickimageparticle_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickspriteengine.cpp | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index c862d56d19..56ae09c0ed 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -766,6 +766,7 @@ void QQuickImageParticle::sceneGraphInvalidated() m_material = nullptr; delete m_outgoingNode; m_outgoingNode = nullptr; + m_apiChecked = false; } void QQuickImageParticle::setImage(const QUrl &image) @@ -1074,6 +1075,12 @@ void QQuickImageParticle::reset() update(); } + +void QQuickImageParticle::invalidateSceneGraph() +{ + reset(); +} + void QQuickImageParticle::createEngine() { if (m_spriteEngine) diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h index 6cab5da070..71d64e55d6 100644 --- a/src/particles/qquickimageparticle_p.h +++ b/src/particles/qquickimageparticle_p.h @@ -395,6 +395,8 @@ private Q_SLOTS: void spritesUpdate(qreal time = 0 ); void mainThreadFetchImageData(); void finishBuildParticleNodes(QSGNode **n); + void invalidateSceneGraph(); + private: struct ImageData { QUrl source; diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index c0e90375b6..af4f993cbf 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -352,6 +352,7 @@ void QQuickSpriteEngine::startAssemblingImage() return; m_loaded = false; m_errorsPrinted = false; + m_sprites.clear(); //This could also trigger the start of the image loading in Sprites, however that currently happens in Sprite::setSource |