| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 float FakeFloatTransition::GetValue(double time) const { | 181 float FakeFloatTransition::GetValue(double time) const { |
| 182 time /= duration_; | 182 time /= duration_; |
| 183 if (time >= 1.0) | 183 if (time >= 1.0) |
| 184 time = 1.0; | 184 time = 1.0; |
| 185 return (1.0 - time) * from_ + time * to_; | 185 return (1.0 - time) * from_ + time * to_; |
| 186 } | 186 } |
| 187 | 187 |
| 188 FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver() | 188 FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver() |
| 189 : opacity_(0.0f) {} | 189 : opacity_(0.0f), |
| 190 animation_waiting_for_deletion_(false) {} |
| 190 | 191 |
| 191 FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() {} | 192 FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() {} |
| 192 | 193 |
| 193 void FakeLayerAnimationValueObserver::OnFilterAnimated( | 194 void FakeLayerAnimationValueObserver::OnFilterAnimated( |
| 194 const FilterOperations& filters) { | 195 const FilterOperations& filters) { |
| 195 filters_ = filters; | 196 filters_ = filters; |
| 196 } | 197 } |
| 197 | 198 |
| 198 void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) { | 199 void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) { |
| 199 opacity_ = opacity; | 200 opacity_ = opacity; |
| 200 } | 201 } |
| 201 | 202 |
| 202 void FakeLayerAnimationValueObserver::OnTransformAnimated( | 203 void FakeLayerAnimationValueObserver::OnTransformAnimated( |
| 203 const gfx::Transform& transform) { | 204 const gfx::Transform& transform) { |
| 204 transform_ = transform; | 205 transform_ = transform; |
| 205 } | 206 } |
| 206 | 207 |
| 208 void FakeLayerAnimationValueObserver::OnAnimationWaitingForDeletion() { |
| 209 animation_waiting_for_deletion_ = true; |
| 210 } |
| 211 |
| 207 bool FakeLayerAnimationValueObserver::IsActive() const { | 212 bool FakeLayerAnimationValueObserver::IsActive() const { |
| 208 return true; | 213 return true; |
| 209 } | 214 } |
| 210 | 215 |
| 211 bool FakeInactiveLayerAnimationValueObserver::IsActive() const { | 216 bool FakeInactiveLayerAnimationValueObserver::IsActive() const { |
| 212 return false; | 217 return false; |
| 213 } | 218 } |
| 214 | 219 |
| 215 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::Clone() const { | 220 scoped_ptr<cc::AnimationCurve> FakeFloatTransition::Clone() const { |
| 216 return make_scoped_ptr( | 221 return make_scoped_ptr( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 double duration, | 304 double duration, |
| 300 float start_brightness, | 305 float start_brightness, |
| 301 float end_brightness) { | 306 float end_brightness) { |
| 302 return AddAnimatedFilter(layer->layer_animation_controller(), | 307 return AddAnimatedFilter(layer->layer_animation_controller(), |
| 303 duration, | 308 duration, |
| 304 start_brightness, | 309 start_brightness, |
| 305 end_brightness); | 310 end_brightness); |
| 306 } | 311 } |
| 307 | 312 |
| 308 } // namespace cc | 313 } // namespace cc |
| OLD | NEW |