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

Unified Diff: cc/animation/scroll_offset_animation_curve.cc

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: blow up the patchset :( Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: cc/animation/scroll_offset_animation_curve.cc
diff --git a/cc/animation/scroll_offset_animation_curve.cc b/cc/animation/scroll_offset_animation_curve.cc
index 8211a950fe2b24382bc4cf0f7b5c276980ed28a0..2df55f96f4dd40ced443266e4287e8ef6af1d1f2 100644
--- a/cc/animation/scroll_offset_animation_curve.cc
+++ b/cc/animation/scroll_offset_animation_curve.cc
@@ -45,14 +45,14 @@ static scoped_ptr<TimingFunction> EaseOutWithInitialVelocity(double velocity) {
} // namespace
scoped_ptr<ScrollOffsetAnimationCurve> ScrollOffsetAnimationCurve::Create(
- const gfx::Vector2dF& target_value,
+ const gfx::ScrollOffset& target_value,
scoped_ptr<TimingFunction> timing_function) {
return make_scoped_ptr(
new ScrollOffsetAnimationCurve(target_value, timing_function.Pass()));
}
ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
- const gfx::Vector2dF& target_value,
+ const gfx::ScrollOffset& target_value,
scoped_ptr<TimingFunction> timing_function)
: target_value_(target_value), timing_function_(timing_function.Pass()) {
}
@@ -60,12 +60,13 @@ ScrollOffsetAnimationCurve::ScrollOffsetAnimationCurve(
ScrollOffsetAnimationCurve::~ScrollOffsetAnimationCurve() {}
void ScrollOffsetAnimationCurve::SetInitialValue(
- const gfx::Vector2dF& initial_value) {
+ const gfx::ScrollOffset& initial_value) {
initial_value_ = initial_value;
- total_animation_duration_ = DurationFromDelta(target_value_ - initial_value_);
+ total_animation_duration_ = DurationFromDelta(
+ ScrollOffsetToVector2dF(target_value_ - initial_value_));
}
-gfx::Vector2dF ScrollOffsetAnimationCurve::GetValue(double t) const {
+gfx::ScrollOffset ScrollOffsetAnimationCurve::GetValue(double t) const {
double duration = (total_animation_duration_ - last_retarget_).InSecondsF();
t -= last_retarget_.InSecondsF();
@@ -76,10 +77,11 @@ gfx::Vector2dF ScrollOffsetAnimationCurve::GetValue(double t) const {
return target_value_;
double progress = (timing_function_->GetValue(t / duration));
- return gfx::Vector2dF(gfx::Tween::FloatValueBetween(
- progress, initial_value_.x(), target_value_.x()),
- gfx::Tween::FloatValueBetween(
- progress, initial_value_.y(), target_value_.y()));
+ return gfx::ScrollOffset(
+ gfx::Tween::FloatValueBetween(
+ progress, initial_value_.x(), target_value_.x()),
+ gfx::Tween::FloatValueBetween(
+ progress, initial_value_.y(), target_value_.y()));
}
double ScrollOffsetAnimationCurve::Duration() const {
@@ -103,10 +105,12 @@ scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const {
void ScrollOffsetAnimationCurve::UpdateTarget(
double t,
- const gfx::Vector2dF& new_target) {
- gfx::Vector2dF current_position = GetValue(t);
- gfx::Vector2dF old_delta = target_value_ - initial_value_;
- gfx::Vector2dF new_delta = new_target - current_position;
+ const gfx::ScrollOffset& new_target) {
+ gfx::ScrollOffset current_position = GetValue(t);
+ gfx::Vector2dF old_delta =
+ ScrollOffsetToVector2dF(target_value_ - initial_value_);
+ gfx::Vector2dF new_delta =
+ ScrollOffsetToVector2dF(new_target - current_position);
double old_duration =
(total_animation_duration_ - last_retarget_).InSecondsF();

Powered by Google App Engine
This is Rietveld 408576698