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

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

Issue 11644004: Only create instances of WebTransformOperations using cc::TransformOperations::Create (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase, and fix WebTransformAnimationCurveImpl Created 8 years 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
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::ActiveAnimation; 14 using cc::ActiveAnimation;
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 22 matching lines...) Expand all
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
52 if (duration > 0) { 53 if (duration > 0) {
53 WebKit::WebTransformOperations startOperations; 54 scoped_ptr<WebKit::WebTransformOperations> startOperations(
54 startOperations.appendTranslate(deltaX, deltaY, 0); 55 TransformOperations::Create());
55 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ ptr<cc::TimingFunction>())); 56 startOperations->appendTranslate(deltaX, deltaY, 0);
57 curve->addKeyframe(TransformKeyframe::create(0, *startOperations, scoped _ptr<cc::TimingFunction>()));
56 } 58 }
57 59
58 WebKit::WebTransformOperations operations; 60 scoped_ptr<WebKit::WebTransformOperations> operations(
59 operations.appendTranslate(deltaX, deltaY, 0); 61 TransformOperations::Create());
60 curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_pt r<cc::TimingFunction>())); 62 operations->appendTranslate(deltaX, deltaY, 0);
63 curve->addKeyframe(TransformKeyframe::create(duration, *operations, scoped_p tr<cc::TimingFunction>()));
61 64
62 int id = nextAnimationId++; 65 int id = nextAnimationId++;
63 66
64 scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<A nimationCurve>(), id, 0, ActiveAnimation::Transform)); 67 scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<A nimationCurve>(), id, 0, ActiveAnimation::Transform));
65 animation->setNeedsSynchronizedStartTime(true); 68 animation->setNeedsSynchronizedStartTime(true);
66 69
67 target.addAnimation(animation.Pass()); 70 target.addAnimation(animation.Pass());
68 return id; 71 return id;
69 } 72 }
70 73
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 { 197 {
195 return addAnimatedTransform(layer, duration, deltaX, deltaY); 198 return addAnimatedTransform(layer, duration, deltaX, deltaY);
196 } 199 }
197 200
198 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta X, int deltaY) 201 int addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delta X, int deltaY)
199 { 202 {
200 return addAnimatedTransform(*layer.layerAnimationController(), duration, del taX, deltaY); 203 return addAnimatedTransform(*layer.layerAnimationController(), duration, del taX, deltaY);
201 } 204 }
202 205
203 } // namespace cc 206 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698