| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "TraceEvent.h" | 34 #include "TraceEvent.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 PassOwnPtr<ActivePlatformGestureAnimation> ActivePlatformGestureAnimation::creat
e(PassOwnPtr<PlatformGestureCurve> curve, PlatformGestureCurveTarget* target) | 39 PassOwnPtr<ActivePlatformGestureAnimation> ActivePlatformGestureAnimation::creat
e(PassOwnPtr<PlatformGestureCurve> curve, PlatformGestureCurveTarget* target) |
| 40 { | 40 { |
| 41 return adoptPtr(new ActivePlatformGestureAnimation(curve, target)); | 41 return adoptPtr(new ActivePlatformGestureAnimation(curve, target)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 PassOwnPtr<ActivePlatformGestureAnimation> ActivePlatformGestureAnimation::creat
e(PassOwnPtr<PlatformGestureCurve> curve, PlatformGestureCurveTarget* target, do
uble startTime) |
| 45 { |
| 46 return adoptPtr(new ActivePlatformGestureAnimation(curve, target, startTime)
); |
| 47 } |
| 48 |
| 44 ActivePlatformGestureAnimation::~ActivePlatformGestureAnimation() | 49 ActivePlatformGestureAnimation::~ActivePlatformGestureAnimation() |
| 45 { | 50 { |
| 46 #if PLATFORM(CHROMIUM) | 51 #if PLATFORM(CHROMIUM) |
| 47 TRACE_EVENT_FINISH0("input", "GestureAnimation", this); | 52 TRACE_EVENT_FINISH0("input", "GestureAnimation", this); |
| 48 #endif | 53 #endif |
| 49 } | 54 } |
| 50 | 55 |
| 51 ActivePlatformGestureAnimation::ActivePlatformGestureAnimation(PassOwnPtr<Platfo
rmGestureCurve> curve, PlatformGestureCurveTarget* target) | 56 ActivePlatformGestureAnimation::ActivePlatformGestureAnimation(PassOwnPtr<Platfo
rmGestureCurve> curve, PlatformGestureCurveTarget* target) |
| 52 : m_startTime(0) | 57 : m_startTime(0) |
| 53 , m_waitingForFirstTick(true) | 58 , m_waitingForFirstTick(true) |
| 54 , m_curve(curve) | 59 , m_curve(curve) |
| 55 , m_target(target) | 60 , m_target(target) |
| 56 { | 61 { |
| 57 #if PLATFORM(CHROMIUM) | 62 #if PLATFORM(CHROMIUM) |
| 58 TRACE_EVENT_START1("input", "GestureAnimation", this, "curve", m_curve->debu
gName()); | 63 TRACE_EVENT_START1("input", "GestureAnimation", this, "curve", m_curve->debu
gName()); |
| 59 #endif | 64 #endif |
| 60 } | 65 } |
| 61 | 66 |
| 67 ActivePlatformGestureAnimation::ActivePlatformGestureAnimation(PassOwnPtr<Platfo
rmGestureCurve> curve, PlatformGestureCurveTarget* target, double startTime) |
| 68 : m_startTime(startTime) |
| 69 , m_waitingForFirstTick(false) |
| 70 , m_curve(curve) |
| 71 , m_target(target) |
| 72 { |
| 73 #if PLATFORM(CHROMIUM) |
| 74 TRACE_EVENT_START1("input", "GestureAnimation", this, "curve", m_curve->debu
gName()); |
| 75 #endif |
| 76 } |
| 77 |
| 62 bool ActivePlatformGestureAnimation::animate(double time) | 78 bool ActivePlatformGestureAnimation::animate(double time) |
| 63 { | 79 { |
| 64 if (m_waitingForFirstTick) { | 80 if (m_waitingForFirstTick) { |
| 65 m_startTime = time; | 81 m_startTime = time; |
| 66 m_waitingForFirstTick = false; | 82 m_waitingForFirstTick = false; |
| 67 } | 83 } |
| 68 // All PlatformGestureCurves assume zero-based time, so we subtract | 84 // All PlatformGestureCurves assume zero-based time, so we subtract |
| 69 // the animation start time before passing to the curve. | 85 // the animation start time before passing to the curve. |
| 70 return m_curve->apply(time - m_startTime, m_target); | 86 return m_curve->apply(time - m_startTime, m_target); |
| 71 } | 87 } |
| 72 | 88 |
| 73 } // namespace WebCore | 89 } // namespace WebCore |
| OLD | NEW |