diff options
author | Christian Strømme <christian.stromme@qt.io> | 2018-05-14 17:28:38 +0200 |
---|---|---|
committer | Christian Stromme <christian.stromme@qt.io> | 2018-05-15 14:50:03 +0000 |
commit | e7957d332fbb68a3950a7bdb3bdb11d113f0f8b2 (patch) | |
tree | 8cb9291e5079236bdf852c7e733afef2cb0b041a /src/runtime/q3dsanimationmanager.cpp | |
parent | f92bae2ef0e33b722317467e888e80d16bd6a92a (diff) |
Don't update the slide position value unless it changes
Saves us some work by discarding values that didn't actually change.
Change-Id: I1f777426bd385199a6cc68fac8dc5c3891968bc8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/runtime/q3dsanimationmanager.cpp')
-rw-r--r-- | src/runtime/q3dsanimationmanager.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/q3dsanimationmanager.cpp b/src/runtime/q3dsanimationmanager.cpp index 79234f3..9c8eadb 100644 --- a/src/runtime/q3dsanimationmanager.cpp +++ b/src/runtime/q3dsanimationmanager.cpp @@ -515,16 +515,22 @@ public: void valueChanged(const QVariant &value) override { Q_ASSERT(m_slide); + const float newValue = value.toFloat(); + if (qFuzzyCompare(m_previousValue, newValue)) + return; + Q3DSSlidePlayer *slidePlayer = m_slide->attached<Q3DSSlideAttached>()->slidePlayer; // TODO: See QT3DS-1302 if (!slidePlayer) return; - slidePlayer->setSlideTime(m_slide, value.toFloat() * 1000.0f); + slidePlayer->setSlideTime(m_slide, newValue * 1000.0f); + m_previousValue = newValue; } private: Q3DSSlide *m_slide; + float m_previousValue = -1.0f; }; void Q3DSAnimationManager::clearAnimations(Q3DSSlide *slide) |