OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/test/animation_test_common.h" | 5 #include "cc/test/animation_test_common.h" |
6 | 6 |
7 #include "cc/keyframed_animation_curve.h" | 7 #include "cc/keyframed_animation_curve.h" |
8 #include "cc/layer.h" | 8 #include "cc/layer.h" |
9 #include "cc/layer_animation_controller.h" | 9 #include "cc/layer_animation_controller.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
11 #include <public/WebTransformOperations.h> | 11 #include <public/WebTransformOperations.h> |
12 | 12 |
13 using cc::ActiveAnimation; | 13 using cc::ActiveAnimation; |
14 using cc::AnimationCurve; | 14 using cc::AnimationCurve; |
15 using cc::EaseTimingFunction; | 15 using cc::EaseTimingFunction; |
16 using cc::FloatKeyframe; | 16 using cc::FloatKeyframe; |
17 using cc::KeyframedFloatAnimationCurve; | 17 using cc::KeyframedFloatAnimationCurve; |
18 using cc::KeyframedTransformAnimationCurve; | 18 using cc::KeyframedTransformAnimationCurve; |
19 using cc::TimingFunction; | 19 using cc::TimingFunction; |
20 using cc::TransformKeyframe; | 20 using cc::TransformKeyframe; |
21 | 21 |
22 namespace { | 22 namespace cc { |
23 | 23 |
24 static int nextAnimationId = 0; | 24 static int nextAnimationId = 0; |
25 | 25 |
26 template <class Target> | 26 template <class Target> |
27 int addOpacityTransition(Target& target, double duration, float startOpacity, fl
oat endOpacity, bool useTimingFunction) | 27 int addOpacityTransition(Target& target, double duration, float startOpacity, fl
oat endOpacity, bool useTimingFunction) |
28 { | 28 { |
29 scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve:
:create()); | 29 scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve:
:create()); |
30 | 30 |
31 scoped_ptr<TimingFunction> func; | 31 scoped_ptr<TimingFunction> func; |
32 if (!useTimingFunction) | 32 if (!useTimingFunction) |
(...skipping 28 matching lines...) Expand all Loading... |
61 | 61 |
62 int id = nextAnimationId++; | 62 int id = nextAnimationId++; |
63 | 63 |
64 scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<A
nimationCurve>(), id, 0, ActiveAnimation::Transform)); | 64 scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<A
nimationCurve>(), id, 0, ActiveAnimation::Transform)); |
65 animation->setNeedsSynchronizedStartTime(true); | 65 animation->setNeedsSynchronizedStartTime(true); |
66 | 66 |
67 target.addAnimation(animation.Pass()); | 67 target.addAnimation(animation.Pass()); |
68 return id; | 68 return id; |
69 } | 69 } |
70 | 70 |
71 } // namespace | |
72 | |
73 namespace cc { | |
74 | |
75 FakeFloatAnimationCurve::FakeFloatAnimationCurve() | 71 FakeFloatAnimationCurve::FakeFloatAnimationCurve() |
76 : m_duration(1) | 72 : m_duration(1) |
77 { | 73 { |
78 } | 74 } |
79 | 75 |
80 FakeFloatAnimationCurve::FakeFloatAnimationCurve(double duration) | 76 FakeFloatAnimationCurve::FakeFloatAnimationCurve(double duration) |
81 : m_duration(duration) | 77 : m_duration(duration) |
82 { | 78 { |
83 } | 79 } |
84 | 80 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 { | 209 { |
214 return addAnimatedTransform(layer, duration, deltaX, deltaY); | 210 return addAnimatedTransform(layer, duration, deltaX, deltaY); |
215 } | 211 } |
216 | 212 |
217 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) | 213 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) |
218 { | 214 { |
219 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); | 215 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); |
220 } | 216 } |
221 | 217 |
222 } // namespace cc | 218 } // namespace cc |
OLD | NEW |