diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-08-20 11:44:57 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-08-20 18:53:09 +0200 |
commit | dfc8f8b5d4a02f33c7f9063c2a28450902a9d863 (patch) | |
tree | 095f3071c064c535b1577e821b1e1cd7ff3e67c5 /src/corelib/animation/qabstractanimation_p.h | |
parent | 28add98e24f4f7a29037b145088f30a0f3d89d5c (diff) |
Rework how animationsystem interoperate with an animation driver.
We need to keep track of both wall time which are used for pauses
and actual animation driver time which is used for actual animations.
When switching between these, we need to also maintain the temporal
drift potentially introduced by the driver and also the time
that has passed in wall-time from when a pause has started until
an action animation takes over.
This change introduces a well defined elapsed() function in
QUnifiedTimer which will return the right value based on which
mode we are currently in. It also introduces start/stopAnimationDriver
functions which helps us maintain the temporal drift and pause-delta.
Change-Id: I5b5100432a6db444a413d1bca4f2d5f800e8cf3e
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/corelib/animation/qabstractanimation_p.h')
-rw-r--r-- | src/corelib/animation/qabstractanimation_p.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 39d9cf0fe6..6e71356c4c 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -132,9 +132,8 @@ private: class Q_CORE_EXPORT QAnimationDriverPrivate : public QObjectPrivate { public: - QAnimationDriverPrivate() : running(false), startTime(0) {} + QAnimationDriverPrivate() : running(false) {} bool running; - qint64 startTime; }; class Q_CORE_EXPORT QAbstractAnimationTimer : public QObject @@ -193,6 +192,10 @@ public: int runningAnimationCount(); void registerProfilerCallback(void (*cb)(qint64)); + void startAnimationDriver(); + void stopAnimationDriver(); + qint64 elapsed() const; + protected: void timerEvent(QTimerEvent *); @@ -233,6 +236,9 @@ private: int closestPausedAnimationTimerTimeToFinish(); void (*profilerCallback)(qint64); + + qint64 driverStartTime; // The time the animation driver was started + qint64 temporalDrift; // The delta between animation driver time and wall time. }; class QAnimationTimer : public QAbstractAnimationTimer |