diff options
| author | Christiaan Janssen <christiaan.janssen@nokia.com> | 2011-10-07 14:58:50 +0200 |
|---|---|---|
| committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-10 15:04:22 +0200 |
| commit | 56921b1f885152e338f726bc5042b479a54944c5 (patch) | |
| tree | 77c86fff968ff14d7eaf16c9dc5bebdf499a609f /src/corelib/animation/qabstractanimation.cpp | |
| parent | e5baaf05e8a24b18ea3dbbb937f13b4525334678 (diff) | |
QUnifiedTimer: Add callback for timer ticks. Used for profiling
Change-Id: Ia7cf823dee7f0b491db2f041d29cdfc0e385f18e
Reviewed-on: http://codereview.qt-project.org/6253
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
| -rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index fd63b25a762..830c5da6b6c 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -168,7 +168,7 @@ Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), currentAnimationIdx(0), insideTick(false), consistentTiming(false), slowMode(false), - slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0) + slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0), profilerCallback(0) { time.invalidate(); driver = &defaultDriver; @@ -234,12 +234,20 @@ void QUnifiedTimer::updateAnimationsTime(qint64 timeStep) int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); + + if (profilerCallback) + profilerCallback(delta); } insideTick = false; currentAnimationIdx = 0; } } +void QUnifiedTimer::registerProfilerCallback(void (*cb)(qint64)) +{ + profilerCallback = cb; +} + void QUnifiedTimer::updateAnimationTimer() { QUnifiedTimer *inst = QUnifiedTimer::instance(false); |
