diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-12-18 10:14:57 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-12-18 10:15:32 +0100 |
commit | 1776037b0443dc57d59afe0772a83b1d47aced14 (patch) | |
tree | 56213eee7188e5f1d2e4abe290b3757603c835ef /src/render/texture/qtexture.cpp | |
parent | c2ea752f684290d156c500c6a7174fe3f27fa086 (diff) | |
parent | c754eb2883394852f155e31f5366fa25a4ffad42 (diff) |
Merge branch '5.15' into dev
Change-Id: I731aa986e1cc45b3af920db1a23f256927beecf7
Diffstat (limited to 'src/render/texture/qtexture.cpp')
-rw-r--r-- | src/render/texture/qtexture.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp index bca66e630..84a228428 100644 --- a/src/render/texture/qtexture.cpp +++ b/src/render/texture/qtexture.cpp @@ -1125,7 +1125,7 @@ TextureDownloadRequest::TextureDownloadRequest(const QTextureFromSourceGenerator } -// Executed in aspect thread +// Executed in main thread void TextureDownloadRequest::onCompleted() { if (cancelled() || !succeeded()) @@ -1142,16 +1142,11 @@ void TextureDownloadRequest::onCompleted() QTextureFromSourceGeneratorPtr oldGenerator = qSharedPointerCast<QTextureFromSourceGenerator>(texture->dataGenerator()); - // We create a new functor - // Which is a copy of the old one + the downloaded sourceData - auto newGenerator = QTextureFromSourceGeneratorPtr::create(*oldGenerator); - // Set raw data on functor so that it can really load something - newGenerator->m_sourceData = m_data; + oldGenerator->m_sourceData = m_data; - // Set new generator on texture - // it implictely marks the texture as dirty so that the functor runs again with the downloaded data - texture->setDataGenerator(newGenerator); + // Mark the texture as dirty so that the functor runs again with the downloaded data + texture->addDirtyFlag(Render::Texture::DirtyDataGenerator); } /*! @@ -1520,7 +1515,10 @@ QTextureLoader::QTextureLoader(QNode *parent) // Regenerate the texture functor when properties we support overriding // from QAbstractTexture get changed. Q_D(QTextureLoader); - auto regenerate = [=] () { d->updateGenerator(); }; + auto regenerate = [=] () { + if (!notificationsBlocked()) // check the change doesn't come from the backend + d->updateGenerator(); + }; connect(this, &QAbstractTexture::formatChanged, regenerate); } |