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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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/surfaces/display_unittest.cc ('k') | cc/test/data/blue.png » ('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/animation_id_provider.h" 7 #include "cc/animation/animation_id_provider.h"
8 #include "cc/animation/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 26 matching lines...) Expand all
37 func = EaseTimingFunction::Create(); 37 func = EaseTimingFunction::Create();
38 if (duration > 0.0) 38 if (duration > 0.0)
39 curve->AddKeyframe( 39 curve->AddKeyframe(
40 FloatKeyframe::Create(base::TimeDelta(), start_opacity, func.Pass())); 40 FloatKeyframe::Create(base::TimeDelta(), start_opacity, func.Pass()));
41 curve->AddKeyframe(FloatKeyframe::Create( 41 curve->AddKeyframe(FloatKeyframe::Create(
42 base::TimeDelta::FromSecondsD(duration), end_opacity, nullptr)); 42 base::TimeDelta::FromSecondsD(duration), end_opacity, nullptr));
43 43
44 int id = AnimationIdProvider::NextAnimationId(); 44 int id = AnimationIdProvider::NextAnimationId();
45 45
46 scoped_ptr<Animation> animation( 46 scoped_ptr<Animation> animation(
47 Animation::Create(curve.Pass(), 47 Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(),
48 id, 48 Animation::OPACITY));
49 AnimationIdProvider::NextGroupId(),
50 Animation::Opacity));
51 animation->set_needs_synchronized_start_time(true); 49 animation->set_needs_synchronized_start_time(true);
52 50
53 target->AddAnimation(animation.Pass()); 51 target->AddAnimation(animation.Pass());
54 return id; 52 return id;
55 } 53 }
56 54
57 template <class Target> 55 template <class Target>
58 int AddAnimatedTransform(Target* target, 56 int AddAnimatedTransform(Target* target,
59 double duration, 57 double duration,
60 TransformOperations start_operations, 58 TransformOperations start_operations,
61 TransformOperations operations) { 59 TransformOperations operations) {
62 scoped_ptr<KeyframedTransformAnimationCurve> 60 scoped_ptr<KeyframedTransformAnimationCurve>
63 curve(KeyframedTransformAnimationCurve::Create()); 61 curve(KeyframedTransformAnimationCurve::Create());
64 62
65 if (duration > 0.0) { 63 if (duration > 0.0) {
66 curve->AddKeyframe(TransformKeyframe::Create(base::TimeDelta(), 64 curve->AddKeyframe(TransformKeyframe::Create(base::TimeDelta(),
67 start_operations, nullptr)); 65 start_operations, nullptr));
68 } 66 }
69 67
70 curve->AddKeyframe(TransformKeyframe::Create( 68 curve->AddKeyframe(TransformKeyframe::Create(
71 base::TimeDelta::FromSecondsD(duration), operations, nullptr)); 69 base::TimeDelta::FromSecondsD(duration), operations, nullptr));
72 70
73 int id = AnimationIdProvider::NextAnimationId(); 71 int id = AnimationIdProvider::NextAnimationId();
74 72
75 scoped_ptr<Animation> animation( 73 scoped_ptr<Animation> animation(
76 Animation::Create(curve.Pass(), 74 Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(),
77 id, 75 Animation::TRANSFORM));
78 AnimationIdProvider::NextGroupId(),
79 Animation::Transform));
80 animation->set_needs_synchronized_start_time(true); 76 animation->set_needs_synchronized_start_time(true);
81 77
82 target->AddAnimation(animation.Pass()); 78 target->AddAnimation(animation.Pass());
83 return id; 79 return id;
84 } 80 }
85 81
86 template <class Target> 82 template <class Target>
87 int AddAnimatedTransform(Target* target, 83 int AddAnimatedTransform(Target* target,
88 double duration, 84 double duration,
89 int delta_x, 85 int delta_x,
(...skipping 25 matching lines...) Expand all
115 } 111 }
116 112
117 FilterOperations filters; 113 FilterOperations filters;
118 filters.Append(FilterOperation::CreateBrightnessFilter(end_brightness)); 114 filters.Append(FilterOperation::CreateBrightnessFilter(end_brightness));
119 curve->AddKeyframe(FilterKeyframe::Create( 115 curve->AddKeyframe(FilterKeyframe::Create(
120 base::TimeDelta::FromSecondsD(duration), filters, nullptr)); 116 base::TimeDelta::FromSecondsD(duration), filters, nullptr));
121 117
122 int id = AnimationIdProvider::NextAnimationId(); 118 int id = AnimationIdProvider::NextAnimationId();
123 119
124 scoped_ptr<Animation> animation(Animation::Create( 120 scoped_ptr<Animation> animation(Animation::Create(
125 curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::Filter)); 121 curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::FILTER));
126 animation->set_needs_synchronized_start_time(true); 122 animation->set_needs_synchronized_start_time(true);
127 123
128 target->AddAnimation(animation.Pass()); 124 target->AddAnimation(animation.Pass());
129 return id; 125 return id;
130 } 126 }
131 127
132 FakeFloatAnimationCurve::FakeFloatAnimationCurve() 128 FakeFloatAnimationCurve::FakeFloatAnimationCurve()
133 : duration_(base::TimeDelta::FromSecondsD(1.0)) { 129 : duration_(base::TimeDelta::FromSecondsD(1.0)) {
134 } 130 }
135 131
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 double duration, 346 double duration,
351 float start_brightness, 347 float start_brightness,
352 float end_brightness) { 348 float end_brightness) {
353 return AddAnimatedFilter(layer->layer_animation_controller(), 349 return AddAnimatedFilter(layer->layer_animation_controller(),
354 duration, 350 duration,
355 start_brightness, 351 start_brightness,
356 end_brightness); 352 end_brightness);
357 } 353 }
358 354
359 } // namespace cc 355 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/test/data/blue.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698