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