Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: cc/test/animation_test_common.cc

Issue 11876016: Define cc::TransformOperations and webkit::WebTransformOperationsImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Put TransformOperation into its own header Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/keyframed_animation_curve_unittest.cc ('k') | cc/transform_operation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/transform_operations.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperati ons.h" 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperati ons.h"
12 13
13 using cc::Animation; 14 using cc::Animation;
14 using cc::AnimationCurve; 15 using cc::AnimationCurve;
15 using cc::EaseTimingFunction; 16 using cc::EaseTimingFunction;
16 using cc::FloatKeyframe; 17 using cc::FloatKeyframe;
17 using cc::KeyframedFloatAnimationCurve; 18 using cc::KeyframedFloatAnimationCurve;
18 using cc::KeyframedTransformAnimationCurve; 19 using cc::KeyframedTransformAnimationCurve;
19 using cc::TimingFunction; 20 using cc::TimingFunction;
20 using cc::TransformKeyframe; 21 using cc::TransformKeyframe;
(...skipping 21 matching lines...) Expand all
42 43
43 target.addAnimation(animation.Pass()); 44 target.addAnimation(animation.Pass());
44 return id; 45 return id;
45 } 46 }
46 47
47 template <class Target> 48 template <class Target>
48 int addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY ) 49 int addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY )
49 { 50 {
50 scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimati onCurve::create()); 51 scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimati onCurve::create());
51 52
53 #if WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL
54 if (duration > 0) {
55 TransformOperations startOperations;
56 startOperations.AppendTranslate(deltaX, deltaY, 0);
57 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ ptr<cc::TimingFunction>()));
58 }
59
60 TransformOperations operations;
61 operations.AppendTranslate(deltaX, deltaY, 0);
62 #else
52 if (duration > 0) { 63 if (duration > 0) {
53 WebKit::WebTransformOperations startOperations; 64 WebKit::WebTransformOperations startOperations;
54 startOperations.appendTranslate(deltaX, deltaY, 0); 65 startOperations.appendTranslate(deltaX, deltaY, 0);
55 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ ptr<cc::TimingFunction>())); 66 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ ptr<cc::TimingFunction>()));
56 } 67 }
57 68
58 WebKit::WebTransformOperations operations; 69 WebKit::WebTransformOperations operations;
59 operations.appendTranslate(deltaX, deltaY, 0); 70 operations.appendTranslate(deltaX, deltaY, 0);
71 #endif
60 curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_pt r<cc::TimingFunction>())); 72 curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_pt r<cc::TimingFunction>()));
61 73
62 int id = nextAnimationId++; 74 int id = nextAnimationId++;
63 75
64 scoped_ptr<Animation> animation(Animation::create(curve.PassAs<AnimationCurv e>(), id, 0, Animation::Transform)); 76 scoped_ptr<Animation> animation(Animation::create(curve.PassAs<AnimationCurv e>(), id, 0, Animation::Transform));
65 animation->setNeedsSynchronizedStartTime(true); 77 animation->setNeedsSynchronizedStartTime(true);
66 78
67 target.addAnimation(animation.Pass()); 79 target.addAnimation(animation.Pass());
68 return id; 80 return id;
69 } 81 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 211 {
200 return addAnimatedTransform(layer, duration, deltaX, deltaY); 212 return addAnimatedTransform(layer, duration, deltaX, deltaY);
201 } 213 }
202 214
203 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta X, int deltaY) 215 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta X, int deltaY)
204 { 216 {
205 return addAnimatedTransform(*layer.layerAnimationController(), duration, del taX, deltaY); 217 return addAnimatedTransform(*layer.layerAnimationController(), duration, del taX, deltaY);
206 } 218 }
207 219
208 } // namespace cc 220 } // namespace cc
OLDNEW
« no previous file with comments | « cc/keyframed_animation_curve_unittest.cc ('k') | cc/transform_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698