OLD | NEW |
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 | 200 |
201 float FakeFloatTransition::GetValue(base::TimeDelta time) const { | 201 float FakeFloatTransition::GetValue(base::TimeDelta time) const { |
202 double progress = TimeUtil::Divide(time, duration_); | 202 double progress = TimeUtil::Divide(time, duration_); |
203 if (progress >= 1.0) | 203 if (progress >= 1.0) |
204 progress = 1.0; | 204 progress = 1.0; |
205 return (1.0 - progress) * from_ + progress * to_; | 205 return (1.0 - progress) * from_ + progress * to_; |
206 } | 206 } |
207 | 207 |
208 FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver() | 208 FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver() |
209 : opacity_(0.0f), | 209 : opacity_(0.0f), animation_waiting_for_deletion_(false) { |
210 animation_waiting_for_deletion_(false), | |
211 scroll_offset_animation_removed_(false) { | |
212 } | 210 } |
213 | 211 |
214 FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() {} | 212 FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() {} |
215 | 213 |
216 void FakeLayerAnimationValueObserver::OnFilterAnimated( | 214 void FakeLayerAnimationValueObserver::OnFilterAnimated( |
217 const FilterOperations& filters) { | 215 const FilterOperations& filters) { |
218 filters_ = filters; | 216 filters_ = filters; |
219 } | 217 } |
220 | 218 |
221 void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) { | 219 void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) { |
222 opacity_ = opacity; | 220 opacity_ = opacity; |
223 } | 221 } |
224 | 222 |
225 void FakeLayerAnimationValueObserver::OnTransformAnimated( | 223 void FakeLayerAnimationValueObserver::OnTransformAnimated( |
226 const gfx::Transform& transform) { | 224 const gfx::Transform& transform) { |
227 transform_ = transform; | 225 transform_ = transform; |
228 } | 226 } |
229 | 227 |
230 void FakeLayerAnimationValueObserver::OnScrollOffsetAnimated( | 228 void FakeLayerAnimationValueObserver::OnScrollOffsetAnimated( |
231 const gfx::ScrollOffset& scroll_offset) { | 229 const gfx::ScrollOffset& scroll_offset) { |
232 scroll_offset_ = scroll_offset; | 230 scroll_offset_ = scroll_offset; |
233 } | 231 } |
234 | 232 |
235 void FakeLayerAnimationValueObserver::OnAnimationWaitingForDeletion() { | 233 void FakeLayerAnimationValueObserver::OnAnimationWaitingForDeletion() { |
236 animation_waiting_for_deletion_ = true; | 234 animation_waiting_for_deletion_ = true; |
237 } | 235 } |
238 | 236 |
239 void FakeLayerAnimationValueObserver::OnScrollOffsetAnimationRemoved() { | |
240 scroll_offset_animation_removed_ = true; | |
241 } | |
242 | |
243 bool FakeLayerAnimationValueObserver::IsActive() const { | 237 bool FakeLayerAnimationValueObserver::IsActive() const { |
244 return true; | 238 return true; |
245 } | 239 } |
246 | 240 |
247 bool FakeInactiveLayerAnimationValueObserver::IsActive() const { | 241 bool FakeInactiveLayerAnimationValueObserver::IsActive() const { |
248 return false; | 242 return false; |
249 } | 243 } |
250 | 244 |
251 gfx::ScrollOffset FakeLayerAnimationValueProvider::ScrollOffsetForAnimation() | 245 gfx::ScrollOffset FakeLayerAnimationValueProvider::ScrollOffsetForAnimation() |
252 const { | 246 const { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 double duration, | 350 double duration, |
357 float start_brightness, | 351 float start_brightness, |
358 float end_brightness) { | 352 float end_brightness) { |
359 return AddAnimatedFilter(layer->layer_animation_controller(), | 353 return AddAnimatedFilter(layer->layer_animation_controller(), |
360 duration, | 354 duration, |
361 start_brightness, | 355 start_brightness, |
362 end_brightness); | 356 end_brightness); |
363 } | 357 } |
364 | 358 |
365 } // namespace cc | 359 } // namespace cc |
OLD | NEW |