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

Side by Side Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 693883004: Make cc::animation::TrimTimeToCurrentIteration,cc::AnimationCurve::Duration use TimeTicks/TimeDelta (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/trees/layer_tree_host_impl.cc ('k') | ui/compositor/float_animation_curve_adapter.h » ('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/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
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
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
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | ui/compositor/float_animation_curve_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698