| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
| 8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
| 9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
| 10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 host_impl->active_tree()->root_layer()->children()[0]-> | 498 host_impl->active_tree()->root_layer()->children()[0]-> |
| 499 layer_animation_controller(); | 499 layer_animation_controller(); |
| 500 Animation* animation = | 500 Animation* animation = |
| 501 controller_impl->GetAnimation(Animation::Opacity); | 501 controller_impl->GetAnimation(Animation::Opacity); |
| 502 if (!animation) | 502 if (!animation) |
| 503 return; | 503 return; |
| 504 | 504 |
| 505 const FloatAnimationCurve* curve = | 505 const FloatAnimationCurve* curve = |
| 506 animation->curve()->ToFloatAnimationCurve(); | 506 animation->curve()->ToFloatAnimationCurve(); |
| 507 float start_opacity = curve->GetValue(0.0); | 507 float start_opacity = curve->GetValue(0.0); |
| 508 float end_opacity = curve->GetValue(curve->Duration()); | 508 float end_opacity = curve->GetValue(curve->Duration().InSecondsF()); |
| 509 float linearly_interpolated_opacity = | 509 float linearly_interpolated_opacity = |
| 510 0.25f * end_opacity + 0.75f * start_opacity; | 510 0.25f * end_opacity + 0.75f * start_opacity; |
| 511 double time = curve->Duration() * 0.25; | 511 double time = curve->Duration().InSecondsF() * 0.25; |
| 512 // If the linear timing function associated with this animation was not | 512 // If the linear timing function associated with this animation was not |
| 513 // picked up, then the linearly interpolated opacity would be different | 513 // picked up, then the linearly interpolated opacity would be different |
| 514 // because of the default ease timing function. | 514 // because of the default ease timing function. |
| 515 EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time)); | 515 EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time)); |
| 516 | 516 |
| 517 EndTest(); | 517 EndTest(); |
| 518 } | 518 } |
| 519 | 519 |
| 520 void AfterTest() override {} | 520 void AfterTest() override {} |
| 521 | 521 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 private: | 1193 private: |
| 1194 scoped_refptr<Layer> content_; | 1194 scoped_refptr<Layer> content_; |
| 1195 int num_swap_buffers_; | 1195 int num_swap_buffers_; |
| 1196 }; | 1196 }; |
| 1197 | 1197 |
| 1198 SINGLE_AND_MULTI_THREAD_TEST_F( | 1198 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1199 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1199 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
| 1200 | 1200 |
| 1201 } // namespace | 1201 } // namespace |
| 1202 } // namespace cc | 1202 } // namespace cc |
| OLD | NEW |