| Index: cc/animation/timing_function.cc
|
| diff --git a/cc/animation/timing_function.cc b/cc/animation/timing_function.cc
|
| index 7fdb37fed962a48fa68a3e9b58252b694c50f4ca..3c6d4eb8cd3ffbd384d6a97a2c5a78e85d5f489d 100644
|
| --- a/cc/animation/timing_function.cc
|
| +++ b/cc/animation/timing_function.cc
|
| @@ -162,4 +162,29 @@ scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() {
|
| 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>();
|
| }
|
|
|
| +scoped_ptr<StepsTimingFunction> StepsTimingFunction::Create(
|
| + int steps, bool stepsAtStart) {
|
| + return make_scoped_ptr(new StepsTimingFunction(steps, stepsAtStart));
|
| +}
|
| +
|
| +StepsTimingFunction::StepsTimingFunction(int steps,
|
| + bool stepsAtStart)
|
| + : steps_(steps), stepsAtStart_(stepsAtStart) {}
|
| +
|
| +StepsTimingFunction::~StepsTimingFunction() {}
|
| +
|
| +float StepsTimingFunction::GetValue(double x) const {
|
| + return std::min(1.0, (floor(steps_ * x) + stepsAtStart_) / steps_);
|
| +}
|
| +
|
| +scoped_ptr<AnimationCurve> StepsTimingFunction::Clone() const {
|
| + return make_scoped_ptr(
|
| + new StepsTimingFunction(*this)).PassAs<AnimationCurve>();
|
| +}
|
| +
|
| +void StepsTimingFunction::Range(float* min, float* max) const {
|
| + *min = static_cast<float>(stepsAtStart_) / static_cast<float>(steps_);
|
| + *max = 1.0;
|
| +}
|
| +
|
| } // namespace cc
|
|
|