| OLD | NEW |
| (Empty) |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 | |
| 7 #include "CCActiveGestureAnimation.h" | |
| 8 | |
| 9 #include "CCGestureCurve.h" | |
| 10 #include "TraceEvent.h" | |
| 11 | |
| 12 namespace WebCore { | |
| 13 | |
| 14 PassOwnPtr<CCActiveGestureAnimation> CCActiveGestureAnimation::create(PassOwnPtr
<CCGestureCurve> curve, CCGestureCurveTarget* target) | |
| 15 { | |
| 16 return adoptPtr(new CCActiveGestureAnimation(curve, target)); | |
| 17 } | |
| 18 | |
| 19 CCActiveGestureAnimation::CCActiveGestureAnimation(PassOwnPtr<CCGestureCurve> cu
rve, CCGestureCurveTarget* target) | |
| 20 : m_startTime(0) | |
| 21 , m_waitingForFirstTick(true) | |
| 22 , m_gestureCurve(curve) | |
| 23 , m_gestureCurveTarget(target) | |
| 24 { | |
| 25 TRACE_EVENT_ASYNC_BEGIN1("input", "GestureAnimation", this, "curve", m_gestu
reCurve->debugName()); | |
| 26 } | |
| 27 | |
| 28 CCActiveGestureAnimation::~CCActiveGestureAnimation() | |
| 29 { | |
| 30 TRACE_EVENT_ASYNC_END0("input", "GestureAnimation", this); | |
| 31 } | |
| 32 | |
| 33 bool CCActiveGestureAnimation::animate(double monotonicTime) | |
| 34 { | |
| 35 if (m_waitingForFirstTick) { | |
| 36 m_startTime = monotonicTime; | |
| 37 m_waitingForFirstTick = false; | |
| 38 } | |
| 39 | |
| 40 // CCGestureCurves used zero-based time, so subtract start-time. | |
| 41 return m_gestureCurve->apply(monotonicTime - m_startTime, m_gestureCurveTarg
et); | |
| 42 } | |
| 43 | |
| 44 } // namespace WebCore | |
| OLD | NEW |