| 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 "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperati
ons.h" | 11 #include "cc/transform_operations.h" |
| 12 | 12 |
| 13 using cc::Animation; | 13 using cc::Animation; |
| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 43 target.addAnimation(animation.Pass()); | 43 target.addAnimation(animation.Pass()); |
| 44 return id; | 44 return id; |
| 45 } | 45 } |
| 46 | 46 |
| 47 template <class Target> | 47 template <class Target> |
| 48 int addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY
) | 48 int addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY
) |
| 49 { | 49 { |
| 50 scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimati
onCurve::create()); | 50 scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimati
onCurve::create()); |
| 51 | 51 |
| 52 if (duration > 0) { | 52 if (duration > 0) { |
| 53 WebKit::WebTransformOperations startOperations; | 53 TransformOperations startOperations; |
| 54 startOperations.appendTranslate(deltaX, deltaY, 0); | 54 startOperations.AppendTranslate(deltaX, deltaY, 0); |
| 55 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_
ptr<cc::TimingFunction>())); | 55 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_
ptr<cc::TimingFunction>())); |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebKit::WebTransformOperations operations; | 58 TransformOperations operations; |
| 59 operations.appendTranslate(deltaX, deltaY, 0); | 59 operations.AppendTranslate(deltaX, deltaY, 0); |
| 60 curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_pt
r<cc::TimingFunction>())); | 60 curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_pt
r<cc::TimingFunction>())); |
| 61 | 61 |
| 62 int id = nextAnimationId++; | 62 int id = nextAnimationId++; |
| 63 | 63 |
| 64 scoped_ptr<Animation> animation(Animation::create(curve.PassAs<AnimationCurv
e>(), id, 0, Animation::Transform)); | 64 scoped_ptr<Animation> animation(Animation::create(curve.PassAs<AnimationCurv
e>(), id, 0, Animation::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 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 { | 199 { |
| 200 return addAnimatedTransform(layer, duration, deltaX, deltaY); | 200 return addAnimatedTransform(layer, duration, deltaX, deltaY); |
| 201 } | 201 } |
| 202 | 202 |
| 203 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) | 203 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta
X, int deltaY) |
| 204 { | 204 { |
| 205 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); | 205 return addAnimatedTransform(*layer.layerAnimationController(), duration, del
taX, deltaY); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace cc | 208 } // namespace cc |
| OLD | NEW |