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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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(), id, AnimationIdProvider::NextGroupId(), 47 Animation::Create(curve.Pass(),
48 Animation::OPACITY)); 48 id,
49 AnimationIdProvider::NextGroupId(),
50 Animation::Opacity));
49 animation->set_needs_synchronized_start_time(true); 51 animation->set_needs_synchronized_start_time(true);
50 52
51 target->AddAnimation(animation.Pass()); 53 target->AddAnimation(animation.Pass());
52 return id; 54 return id;
53 } 55 }
54 56
55 template <class Target> 57 template <class Target>
56 int AddAnimatedTransform(Target* target, 58 int AddAnimatedTransform(Target* target,
57 double duration, 59 double duration,
58 TransformOperations start_operations, 60 TransformOperations start_operations,
59 TransformOperations operations) { 61 TransformOperations operations) {
60 scoped_ptr<KeyframedTransformAnimationCurve> 62 scoped_ptr<KeyframedTransformAnimationCurve>
61 curve(KeyframedTransformAnimationCurve::Create()); 63 curve(KeyframedTransformAnimationCurve::Create());
62 64
63 if (duration > 0.0) { 65 if (duration > 0.0) {
64 curve->AddKeyframe(TransformKeyframe::Create(base::TimeDelta(), 66 curve->AddKeyframe(TransformKeyframe::Create(base::TimeDelta(),
65 start_operations, nullptr)); 67 start_operations, nullptr));
66 } 68 }
67 69
68 curve->AddKeyframe(TransformKeyframe::Create( 70 curve->AddKeyframe(TransformKeyframe::Create(
69 base::TimeDelta::FromSecondsD(duration), operations, nullptr)); 71 base::TimeDelta::FromSecondsD(duration), operations, nullptr));
70 72
71 int id = AnimationIdProvider::NextAnimationId(); 73 int id = AnimationIdProvider::NextAnimationId();
72 74
73 scoped_ptr<Animation> animation( 75 scoped_ptr<Animation> animation(
74 Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(), 76 Animation::Create(curve.Pass(),
75 Animation::TRANSFORM)); 77 id,
78 AnimationIdProvider::NextGroupId(),
79 Animation::Transform));
76 animation->set_needs_synchronized_start_time(true); 80 animation->set_needs_synchronized_start_time(true);
77 81
78 target->AddAnimation(animation.Pass()); 82 target->AddAnimation(animation.Pass());
79 return id; 83 return id;
80 } 84 }
81 85
82 template <class Target> 86 template <class Target>
83 int AddAnimatedTransform(Target* target, 87 int AddAnimatedTransform(Target* target,
84 double duration, 88 double duration,
85 int delta_x, 89 int delta_x,
(...skipping 25 matching lines...) Expand all
111 } 115 }
112 116
113 FilterOperations filters; 117 FilterOperations filters;
114 filters.Append(FilterOperation::CreateBrightnessFilter(end_brightness)); 118 filters.Append(FilterOperation::CreateBrightnessFilter(end_brightness));
115 curve->AddKeyframe(FilterKeyframe::Create( 119 curve->AddKeyframe(FilterKeyframe::Create(
116 base::TimeDelta::FromSecondsD(duration), filters, nullptr)); 120 base::TimeDelta::FromSecondsD(duration), filters, nullptr));
117 121
118 int id = AnimationIdProvider::NextAnimationId(); 122 int id = AnimationIdProvider::NextAnimationId();
119 123
120 scoped_ptr<Animation> animation(Animation::Create( 124 scoped_ptr<Animation> animation(Animation::Create(
121 curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::FILTER)); 125 curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::Filter));
122 animation->set_needs_synchronized_start_time(true); 126 animation->set_needs_synchronized_start_time(true);
123 127
124 target->AddAnimation(animation.Pass()); 128 target->AddAnimation(animation.Pass());
125 return id; 129 return id;
126 } 130 }
127 131
128 FakeFloatAnimationCurve::FakeFloatAnimationCurve() 132 FakeFloatAnimationCurve::FakeFloatAnimationCurve()
129 : duration_(base::TimeDelta::FromSecondsD(1.0)) { 133 : duration_(base::TimeDelta::FromSecondsD(1.0)) {
130 } 134 }
131 135
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 double duration, 350 double duration,
347 float start_brightness, 351 float start_brightness,
348 float end_brightness) { 352 float end_brightness) {
349 return AddAnimatedFilter(layer->layer_animation_controller(), 353 return AddAnimatedFilter(layer->layer_animation_controller(),
350 duration, 354 duration,
351 start_brightness, 355 start_brightness,
352 end_brightness); 356 end_brightness);
353 } 357 }
354 358
355 } // namespace cc 359 } // 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