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

Unified Diff: cc/animation/timing_function.cc

Issue 2830553002: Fix step timing outside range [0,1] (Closed)
Patch Set: Rebase Created 3 years, 8 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/timing_function.cc
diff --git a/cc/animation/timing_function.cc b/cc/animation/timing_function.cc
index b7308bb31c9564fa588a296172a640a631ac70e0..d0d55ad54fa75f6357fc3318229048a7d49e54f0 100644
--- a/cc/animation/timing_function.cc
+++ b/cc/animation/timing_function.cc
@@ -109,8 +109,12 @@ float StepsTimingFunction::Velocity(double x) const {
double StepsTimingFunction::GetPreciseValue(double t) const {
const double steps = static_cast<double>(steps_);
- return MathUtil::ClampToRange(
- std::floor((steps * t) + GetStepsStartOffset()) / steps, 0.0, 1.0);
+ double current_step = std::floor((steps * t) + GetStepsStartOffset());
+ if (t >= 0 && current_step < 0)
+ current_step = 0;
+ if (t <= 1 && current_step > steps)
+ current_step = steps;
+ return current_step / steps;
}
float StepsTimingFunction::GetStepsStartOffset() const {

Powered by Google App Engine
This is Rietveld 408576698