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

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

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/test/animation_test_common.h" 7 #include "cc/test/animation_test_common.h"
8 8
9 #include "CCKeyframedAnimationCurve.h" 9 #include "CCKeyframedAnimationCurve.h"
10 #include "CCLayerAnimationController.h" 10 #include "CCLayerAnimationController.h"
11 #include "CCLayerImpl.h" 11 #include "CCLayerImpl.h"
12 #include "cc/layer.h" 12 #include "cc/layer.h"
13 #include <public/WebTransformOperations.h> 13 #include <public/WebTransformOperations.h>
14 14
15 using namespace cc; 15 using namespace cc;
16 16
17 namespace { 17 namespace {
18 18
19 template <class Target> 19 template <class Target>
20 void addOpacityTransition(Target& target, double duration, float startOpacity, f loat endOpacity, bool useTimingFunction) 20 void addOpacityTransition(Target& target, double duration, float startOpacity, f loat endOpacity, bool useTimingFunction)
21 { 21 {
22 scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCu rve::create()); 22 scoped_ptr<KeyframedFloatAnimationCurve> curve(KeyframedFloatAnimationCurve: :create());
23 23
24 scoped_ptr<CCTimingFunction> func; 24 scoped_ptr<TimingFunction> func;
25 if (!useTimingFunction) 25 if (!useTimingFunction)
26 func = CCEaseTimingFunction::create(); 26 func = EaseTimingFunction::create();
27 if (duration > 0) 27 if (duration > 0)
28 curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, func.Pass()) ); 28 curve->addKeyframe(FloatKeyframe::create(0, startOpacity, func.Pass()));
29 curve->addKeyframe(CCFloatKeyframe::create(duration, endOpacity, scoped_ptr< cc::CCTimingFunction>())); 29 curve->addKeyframe(FloatKeyframe::create(duration, endOpacity, scoped_ptr<cc ::TimingFunction>()));
30 30
31 scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.Pass As<CCAnimationCurve>(), 0, 0, CCActiveAnimation::Opacity)); 31 scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<A nimationCurve>(), 0, 0, ActiveAnimation::Opacity));
32 animation->setNeedsSynchronizedStartTime(true); 32 animation->setNeedsSynchronizedStartTime(true);
33 33
34 target.addAnimation(animation.Pass()); 34 target.addAnimation(animation.Pass());
35 } 35 }
36 36
37 template <class Target> 37 template <class Target>
38 void addAnimatedTransform(Target& target, double duration, int deltaX, int delta Y) 38 void addAnimatedTransform(Target& target, double duration, int deltaX, int delta Y)
39 { 39 {
40 static int id = 0; 40 static int id = 0;
41 scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAni mationCurve::create()); 41 scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimati onCurve::create());
42 42
43 if (duration > 0) { 43 if (duration > 0) {
44 WebKit::WebTransformOperations startOperations; 44 WebKit::WebTransformOperations startOperations;
45 startOperations.appendTranslate(deltaX, deltaY, 0); 45 startOperations.appendTranslate(deltaX, deltaY, 0);
46 curve->addKeyframe(CCTransformKeyframe::create(0, startOperations, scope d_ptr<cc::CCTimingFunction>())); 46 curve->addKeyframe(TransformKeyframe::create(0, startOperations, scoped_ ptr<cc::TimingFunction>()));
47 } 47 }
48 48
49 WebKit::WebTransformOperations operations; 49 WebKit::WebTransformOperations operations;
50 operations.appendTranslate(deltaX, deltaY, 0); 50 operations.appendTranslate(deltaX, deltaY, 0);
51 curve->addKeyframe(CCTransformKeyframe::create(duration, operations, scoped_ ptr<cc::CCTimingFunction>())); 51 curve->addKeyframe(TransformKeyframe::create(duration, operations, scoped_pt r<cc::TimingFunction>()));
52 52
53 scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.Pass As<CCAnimationCurve>(), id++, 0, CCActiveAnimation::Transform)); 53 scoped_ptr<ActiveAnimation> animation(ActiveAnimation::create(curve.PassAs<A nimationCurve>(), id++, 0, ActiveAnimation::Transform));
54 animation->setNeedsSynchronizedStartTime(true); 54 animation->setNeedsSynchronizedStartTime(true);
55 55
56 target.addAnimation(animation.Pass()); 56 target.addAnimation(animation.Pass());
57 } 57 }
58 58
59 } // namespace 59 } // namespace
60 60
61 namespace WebKitTests { 61 namespace WebKitTests {
62 62
63 FakeFloatAnimationCurve::FakeFloatAnimationCurve() 63 FakeFloatAnimationCurve::FakeFloatAnimationCurve()
(...skipping 13 matching lines...) Expand all
77 double FakeFloatAnimationCurve::duration() const 77 double FakeFloatAnimationCurve::duration() const
78 { 78 {
79 return m_duration; 79 return m_duration;
80 } 80 }
81 81
82 float FakeFloatAnimationCurve::getValue(double now) const 82 float FakeFloatAnimationCurve::getValue(double now) const
83 { 83 {
84 return 0; 84 return 0;
85 } 85 }
86 86
87 scoped_ptr<cc::CCAnimationCurve> FakeFloatAnimationCurve::clone() const 87 scoped_ptr<cc::AnimationCurve> FakeFloatAnimationCurve::clone() const
88 { 88 {
89 return make_scoped_ptr(new FakeFloatAnimationCurve).PassAs<cc::CCAnimationCu rve>(); 89 return make_scoped_ptr(new FakeFloatAnimationCurve).PassAs<cc::AnimationCurv e>();
90 } 90 }
91 91
92 FakeTransformTransition::FakeTransformTransition(double duration) 92 FakeTransformTransition::FakeTransformTransition(double duration)
93 : m_duration(duration) 93 : m_duration(duration)
94 { 94 {
95 } 95 }
96 96
97 FakeTransformTransition::~FakeTransformTransition() 97 FakeTransformTransition::~FakeTransformTransition()
98 { 98 {
99 } 99 }
100 100
101 double FakeTransformTransition::duration() const 101 double FakeTransformTransition::duration() const
102 { 102 {
103 return m_duration; 103 return m_duration;
104 } 104 }
105 105
106 WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c onst 106 WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c onst
107 { 107 {
108 return WebKit::WebTransformationMatrix(); 108 return WebKit::WebTransformationMatrix();
109 } 109 }
110 110
111 scoped_ptr<cc::CCAnimationCurve> FakeTransformTransition::clone() const 111 scoped_ptr<cc::AnimationCurve> FakeTransformTransition::clone() const
112 { 112 {
113 return make_scoped_ptr(new FakeTransformTransition(*this)).PassAs<cc::CCAnim ationCurve>(); 113 return make_scoped_ptr(new FakeTransformTransition(*this)).PassAs<cc::Animat ionCurve>();
114 } 114 }
115 115
116 116
117 FakeFloatTransition::FakeFloatTransition(double duration, float from, float to) 117 FakeFloatTransition::FakeFloatTransition(double duration, float from, float to)
118 : m_duration(duration) 118 : m_duration(duration)
119 , m_from(from) 119 , m_from(from)
120 , m_to(to) 120 , m_to(to)
121 { 121 {
122 } 122 }
123 123
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit: :WebTransformationMatrix& transform) 165 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit: :WebTransformationMatrix& transform)
166 { 166 {
167 m_transform = transform; 167 m_transform = transform;
168 } 168 }
169 169
170 const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans form() const 170 const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans form() const
171 { 171 {
172 return m_transform; 172 return m_transform;
173 } 173 }
174 174
175 scoped_ptr<cc::CCAnimationCurve> FakeFloatTransition::clone() const 175 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::clone() const
176 { 176 {
177 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::CCAnimatio nCurve>(); 177 return make_scoped_ptr(new FakeFloatTransition(*this)).PassAs<cc::AnimationC urve>();
178 } 178 }
179 179
180 void addOpacityTransitionToController(cc::CCLayerAnimationController& controller , double duration, float startOpacity, float endOpacity, bool useTimingFunction) 180 void addOpacityTransitionToController(cc::LayerAnimationController& controller, double duration, float startOpacity, float endOpacity, bool useTimingFunction)
181 { 181 {
182 addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimi ngFunction); 182 addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimi ngFunction);
183 } 183 }
184 184
185 void addAnimatedTransformToController(cc::CCLayerAnimationController& controller , double duration, int deltaX, int deltaY) 185 void addAnimatedTransformToController(cc::LayerAnimationController& controller, double duration, int deltaX, int deltaY)
186 { 186 {
187 addAnimatedTransform(controller, duration, deltaX, deltaY); 187 addAnimatedTransform(controller, duration, deltaX, deltaY);
188 } 188 }
189 189
190 void addOpacityTransitionToLayer(cc::LayerChromium& layer, double duration, floa t startOpacity, float endOpacity, bool useTimingFunction) 190 void addOpacityTransitionToLayer(cc::Layer& layer, double duration, float startO pacity, float endOpacity, bool useTimingFunction)
191 { 191 {
192 addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFun ction); 192 addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFun ction);
193 } 193 }
194 194
195 void addOpacityTransitionToLayer(cc::CCLayerImpl& layer, double duration, float startOpacity, float endOpacity, bool useTimingFunction) 195 void addOpacityTransitionToLayer(cc::LayerImpl& layer, double duration, float st artOpacity, float endOpacity, bool useTimingFunction)
196 { 196 {
197 addOpacityTransition(*layer.layerAnimationController(), duration, startOpaci ty, endOpacity, useTimingFunction); 197 addOpacityTransition(*layer.layerAnimationController(), duration, startOpaci ty, endOpacity, useTimingFunction);
198 } 198 }
199 199
200 void addAnimatedTransformToLayer(cc::LayerChromium& layer, double duration, int deltaX, int deltaY) 200 void addAnimatedTransformToLayer(cc::Layer& layer, double duration, int deltaX, int deltaY)
201 { 201 {
202 addAnimatedTransform(layer, duration, deltaX, deltaY); 202 addAnimatedTransform(layer, duration, deltaX, deltaY);
203 } 203 }
204 204
205 void addAnimatedTransformToLayer(cc::CCLayerImpl& layer, double duration, int de ltaX, int deltaY) 205 void addAnimatedTransformToLayer(cc::LayerImpl& layer, double duration, int delt aX, int deltaY)
206 { 206 {
207 addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, de ltaY); 207 addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, de ltaY);
208 } 208 }
209 209
210 } // namespace WebKitTests 210 } // namespace WebKitTests
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698