Browse Source

qt: handle fast x-y-x source switch in `TextureProviderObserver`

mmdevice-clean/8
Fatih Uzunoglu 6 months ago
committed by Steve Lhomme
parent
commit
8c8eba64f0
  1. 13
      modules/gui/qt/util/textureproviderobserver.cpp

13
modules/gui/qt/util/textureproviderobserver.cpp

@ -94,10 +94,17 @@ void TextureProviderObserver::setSource(const QQuickItem *source, bool enforce)
return;
}
assert(!m_provider);
const auto provider = m_source->textureProvider(); // This can only be called in the rendering thread.
assert(provider);
m_provider = m_source->textureProvider(); // This can only be called in the rendering thread.
assert(m_provider);
assert(!m_provider || (provider == m_provider)); // If providers are different, source must be different too (which is handled above).
if (Q_UNLIKELY(provider == m_provider)) // Unlikely, source set to something else (such as null), and then set back to its original value really fast.
{
updateProperties(); // Not sure if really necessary, but we do not lose anything.
return;
}
m_provider = provider;
connect(m_provider, &QSGTextureProvider::textureChanged, this, &TextureProviderObserver::updateProperties, Qt::DirectConnection);

Loading…
Cancel
Save