Browse Source

qt: do not notify comparison key change by default in `TextureProviderObserver`

Although it is not as rapid as size change (layer resize case), comparison key
may still change often. Now that we have a property to enable notify all
changes, we can make comparison key changes not notified by default.
mmdevice-clean/8
Fatih Uzunoglu 7 months ago
committed by Steve Lhomme
parent
commit
4962271021
  1. 12
      modules/gui/qt/util/textureproviderobserver.cpp
  2. 2
      modules/gui/qt/util/textureproviderobserver.hpp

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

@ -282,8 +282,16 @@ void TextureProviderObserver::updateProperties()
// Comparison key
const qint64 comparisonKey = texture->comparisonKey();
if (m_comparisonKey.exchange(comparisonKey, memoryOrder) != comparisonKey)
emit comparisonKeyChanged(comparisonKey);
if (notifyAllChanges)
{
if (m_comparisonKey.exchange(comparisonKey, memoryOrder) != comparisonKey) {
emit comparisonKeyChanged(comparisonKey);
}
}
else
{
m_comparisonKey.store(comparisonKey, memoryOrder);
}
}
return;

2
modules/gui/qt/util/textureproviderobserver.hpp

@ -56,6 +56,7 @@ class TextureProviderObserver : public QObject
Q_PROPERTY(QSize textureSize READ textureSize NOTIFY textureSizeChanged FINAL) // Scene graph texture size
Q_PROPERTY(QSize nativeTextureSize READ nativeTextureSize NOTIFY nativeTextureSizeChanged FINAL) // Native texture size (e.g. for atlas textures, the atlas size)
Q_PROPERTY(QRectF normalizedTextureSubRect READ normalizedTextureSubRect NOTIFY normalizedTextureSubRectChanged FINAL)
Q_PROPERTY(qint64 comparisonKey READ comparisonKey NOTIFY comparisonKeyChanged FINAL)
// NOTE: Since it is not expected that these properties change rapidly, they have notify signals.
// These signals may be emitted in the rendering thread, thus if the connection is auto
@ -64,7 +65,6 @@ class TextureProviderObserver : public QObject
Q_PROPERTY(bool hasMipmaps READ hasMipmaps NOTIFY hasMipmapsChanged FINAL)
Q_PROPERTY(bool isAtlasTexture READ isAtlasTexture NOTIFY isAtlasTextureChanged FINAL)
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL) // whether a texture is provided or not
Q_PROPERTY(qint64 comparisonKey READ comparisonKey NOTIFY comparisonKeyChanged FINAL)
public:
explicit TextureProviderObserver(QObject *parent = nullptr);

Loading…
Cancel
Save