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

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

Issue 12676029: cc: Fix capitalization style in chromified files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « cc/scheduler/texture_uploader.cc ('k') | cc/test/fake_proxy.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/animation/keyframed_animation_curve.h" 7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/animation/layer_animation_controller.h" 8 #include "cc/animation/layer_animation_controller.h"
9 #include "cc/animation/transform_operations.h" 9 #include "cc/animation/transform_operations.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
11 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.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
22 namespace cc { 22 namespace cc {
23 23
24 static int nextAnimationId = 0; 24 static int s_next_animation_id = 0;
25 25
26 template <class Target> 26 template <class Target>
27 int AddOpacityTransition(Target* target, 27 int AddOpacityTransition(Target* target,
28 double duration, 28 double duration,
29 float startOpacity, 29 float start_opacity,
30 float endOpacity, 30 float end_opacity,
31 bool useTimingFunction) { 31 bool use_timing_function) {
32 scoped_ptr<KeyframedFloatAnimationCurve> 32 scoped_ptr<KeyframedFloatAnimationCurve>
33 curve(KeyframedFloatAnimationCurve::Create()); 33 curve(KeyframedFloatAnimationCurve::Create());
34 34
35 scoped_ptr<TimingFunction> func; 35 scoped_ptr<TimingFunction> func;
36 if (!useTimingFunction) 36 if (!use_timing_function)
37 func = EaseTimingFunction::Create(); 37 func = EaseTimingFunction::Create();
38 if (duration > 0.0) 38 if (duration > 0.0)
39 curve->AddKeyframe(FloatKeyframe::Create(0.0, startOpacity, func.Pass())); 39 curve->AddKeyframe(FloatKeyframe::Create(0.0, start_opacity, func.Pass()));
40 curve->AddKeyframe(FloatKeyframe::Create(duration, 40 curve->AddKeyframe(FloatKeyframe::Create(duration,
41 endOpacity, 41 end_opacity,
42 scoped_ptr<cc::TimingFunction>())); 42 scoped_ptr<cc::TimingFunction>()));
43 43
44 int id = nextAnimationId++; 44 int id = s_next_animation_id++;
45 45
46 scoped_ptr<Animation> animation(Animation::Create( 46 scoped_ptr<Animation> animation(Animation::Create(
47 curve.PassAs<AnimationCurve>(), 47 curve.PassAs<AnimationCurve>(),
48 id, 48 id,
49 0, 49 0,
50 Animation::Opacity)); 50 Animation::Opacity));
51 animation->set_needs_synchronized_start_time(true); 51 animation->set_needs_synchronized_start_time(true);
52 52
53 target->AddAnimation(animation.Pass()); 53 target->AddAnimation(animation.Pass());
54 return id; 54 return id;
55 } 55 }
56 56
57 template <class Target> 57 template <class Target>
58 int AddAnimatedTransform(Target* target, 58 int AddAnimatedTransform(Target* target,
59 double duration, 59 double duration,
60 int deltaX, 60 int delta_x,
61 int deltaY) { 61 int delta_y) {
62 scoped_ptr<KeyframedTransformAnimationCurve> 62 scoped_ptr<KeyframedTransformAnimationCurve>
63 curve(KeyframedTransformAnimationCurve::Create()); 63 curve(KeyframedTransformAnimationCurve::Create());
64 64
65 if (duration > 0.0) { 65 if (duration > 0.0) {
66 TransformOperations startOperations; 66 TransformOperations start_operations;
67 startOperations.AppendTranslate(deltaX, deltaY, 0.0); 67 start_operations.AppendTranslate(delta_x, delta_y, 0.0);
68 curve->AddKeyframe(TransformKeyframe::Create( 68 curve->AddKeyframe(TransformKeyframe::Create(
69 0.0, 69 0.0,
70 startOperations, 70 start_operations,
71 scoped_ptr<cc::TimingFunction>())); 71 scoped_ptr<cc::TimingFunction>()));
72 } 72 }
73 73
74 TransformOperations operations; 74 TransformOperations operations;
75 operations.AppendTranslate(deltaX, deltaY, 0.0); 75 operations.AppendTranslate(delta_x, delta_y, 0.0);
76 curve->AddKeyframe(TransformKeyframe::Create( 76 curve->AddKeyframe(TransformKeyframe::Create(
77 duration, 77 duration,
78 operations, 78 operations,
79 scoped_ptr<cc::TimingFunction>())); 79 scoped_ptr<cc::TimingFunction>()));
80 80
81 int id = nextAnimationId++; 81 int id = s_next_animation_id++;
82 82
83 scoped_ptr<Animation> animation(Animation::Create( 83 scoped_ptr<Animation> animation(Animation::Create(
84 curve.PassAs<AnimationCurve>(), 84 curve.PassAs<AnimationCurve>(),
85 id, 0, Animation::Transform)); 85 id, 0, Animation::Transform));
86 animation->set_needs_synchronized_start_time(true); 86 animation->set_needs_synchronized_start_time(true);
87 87
88 target->AddAnimation(animation.Pass()); 88 target->AddAnimation(animation.Pass());
89 return id; 89 return id;
90 } 90 }
91 91
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 double duration, 241 double duration,
242 int delta_x, 242 int delta_x,
243 int delta_y) { 243 int delta_y) {
244 return AddAnimatedTransform(layer->layer_animation_controller(), 244 return AddAnimatedTransform(layer->layer_animation_controller(),
245 duration, 245 duration,
246 delta_x, 246 delta_x,
247 delta_y); 247 delta_y);
248 } 248 }
249 249
250 } // namespace cc 250 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/texture_uploader.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698