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

Unified Diff: ui/compositor/transform_animation_curve_adapter.cc

Issue 719453007: Make Keyframe use TimeTicks/TimeDelta to represent time instead of double. (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 side-by-side diff with in-line comments
Download patch
Index: ui/compositor/transform_animation_curve_adapter.cc
diff --git a/ui/compositor/transform_animation_curve_adapter.cc b/ui/compositor/transform_animation_curve_adapter.cc
index 2c114889321967b826f8381c076fa3dc342354ad..1b67ca20860ece67a378dc31972dc05da680fa83 100644
--- a/ui/compositor/transform_animation_curve_adapter.cc
+++ b/ui/compositor/transform_animation_curve_adapter.cc
@@ -4,6 +4,8 @@
#include "ui/compositor/transform_animation_curve_adapter.h"
+#include "cc/base/time_util.h"
+
namespace ui {
TransformAnimationCurveAdapter::TransformAnimationCurveAdapter(
@@ -32,12 +34,12 @@ scoped_ptr<cc::AnimationCurve> TransformAnimationCurveAdapter::Clone() const {
}
gfx::Transform TransformAnimationCurveAdapter::GetValue(
- double t) const {
- if (t >= duration_.InSecondsF())
+ base::TimeDelta t) const {
+ if (t >= duration_)
return target_value_;
- if (t <= 0.0)
+ if (t <= base::TimeDelta())
return initial_value_;
- double progress = t / duration_.InSecondsF();
+ double progress = cc::TimeUtil::Divide(t, duration_);
gfx::DecomposedTransform to_return;
gfx::BlendDecomposedTransforms(&to_return,
@@ -80,7 +82,8 @@ InverseTransformCurveAdapter::InverseTransformCurveAdapter(
: base_curve_(base_curve),
initial_value_(initial_value),
duration_(duration) {
- effective_initial_value_ = base_curve_.GetValue(0.0) * initial_value_;
+ effective_initial_value_ =
+ base_curve_.GetValue(base::TimeDelta()) * initial_value_;
}
InverseTransformCurveAdapter::~InverseTransformCurveAdapter() {
@@ -95,9 +98,8 @@ scoped_ptr<cc::AnimationCurve> InverseTransformCurveAdapter::Clone() const {
new InverseTransformCurveAdapter(base_curve_, initial_value_, duration_));
}
-gfx::Transform InverseTransformCurveAdapter::GetValue(
- double t) const {
- if (t <= 0.0)
+gfx::Transform InverseTransformCurveAdapter::GetValue(base::TimeDelta t) const {
+ if (t <= base::TimeDelta())
return initial_value_;
gfx::Transform base_transform = base_curve_.GetValue(t);
« no previous file with comments | « ui/compositor/transform_animation_curve_adapter.h ('k') | ui/compositor/transform_animation_curve_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698