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

Side by Side Diff: cc/animation/scroll_offset_animation_curve.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/animation/scroll_offset_animation_curve.h" 5 #include "cc/animation/scroll_offset_animation_curve.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return target_value_; 76 return target_value_;
77 77
78 double progress = (timing_function_->GetValue(t / duration)); 78 double progress = (timing_function_->GetValue(t / duration));
79 return gfx::ScrollOffset( 79 return gfx::ScrollOffset(
80 gfx::Tween::FloatValueBetween( 80 gfx::Tween::FloatValueBetween(
81 progress, initial_value_.x(), target_value_.x()), 81 progress, initial_value_.x(), target_value_.x()),
82 gfx::Tween::FloatValueBetween( 82 gfx::Tween::FloatValueBetween(
83 progress, initial_value_.y(), target_value_.y())); 83 progress, initial_value_.y(), target_value_.y()));
84 } 84 }
85 85
86 double ScrollOffsetAnimationCurve::Duration() const { 86 base::TimeDelta ScrollOffsetAnimationCurve::Duration() const {
87 return total_animation_duration_.InSecondsF(); 87 return total_animation_duration_;
88 } 88 }
89 89
90 AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const { 90 AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const {
91 return ScrollOffset; 91 return ScrollOffset;
92 } 92 }
93 93
94 scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { 94 scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const {
95 scoped_ptr<TimingFunction> timing_function( 95 scoped_ptr<TimingFunction> timing_function(
96 static_cast<TimingFunction*>(timing_function_->Clone().release())); 96 static_cast<TimingFunction*>(timing_function_->Clone().release()));
97 scoped_ptr<ScrollOffsetAnimationCurve> curve_clone = 97 scoped_ptr<ScrollOffsetAnimationCurve> curve_clone =
(...skipping 26 matching lines...) Expand all
124 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); 124 (MaximumDimension(old_delta) / MaximumDimension(new_delta));
125 125
126 initial_value_ = current_position; 126 initial_value_ = current_position;
127 target_value_ = new_target; 127 target_value_ = new_target;
128 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); 128 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration);
129 last_retarget_ = base::TimeDelta::FromSecondsD(t); 129 last_retarget_ = base::TimeDelta::FromSecondsD(t);
130 timing_function_ = EaseOutWithInitialVelocity(new_velocity); 130 timing_function_ = EaseOutWithInitialVelocity(new_velocity);
131 } 131 }
132 132
133 } // namespace cc 133 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scroll_offset_animation_curve.h ('k') | cc/animation/scroll_offset_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698