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

Unified Diff: cc/animation/timing_function.h

Issue 2019613002: Blink Compositor Animation: Make Animation and Curve methods non-virtual. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix codereview issues. Add cc::TimingFunction::Type enum. Created 4 years, 7 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
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/timing_function.h
diff --git a/cc/animation/timing_function.h b/cc/animation/timing_function.h
index d1807f6f091c90a2cffd947d2f95c20541c1c195..8f021ce735348c7ace44d764a6498a8e21354c8f 100644
--- a/cc/animation/timing_function.h
+++ b/cc/animation/timing_function.h
@@ -18,6 +18,10 @@ class CC_EXPORT TimingFunction {
public:
virtual ~TimingFunction();
+ // Note that LINEAR is a nullptr TimingFunction (for now).
+ enum class Type { LINEAR, CUBIC_BEZIER, STEPS };
+
+ virtual Type GetType() const = 0;
virtual float GetValue(double t) const = 0;
virtual float Velocity(double time) const = 0;
// The smallest and largest values returned by GetValue for inputs in [0, 1].
@@ -43,15 +47,23 @@ class CC_EXPORT CubicBezierTimingFunction : public TimingFunction {
~CubicBezierTimingFunction() override;
// TimingFunction implementation.
+ Type GetType() const override;
float GetValue(double time) const override;
float Velocity(double time) const override;
void Range(float* min, float* max) const override;
std::unique_ptr<TimingFunction> Clone() const override;
+ EaseType ease_type() const { return ease_type_; }
+
protected:
- CubicBezierTimingFunction(double x1, double y1, double x2, double y2);
+ CubicBezierTimingFunction(EaseType ease_type,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
gfx::CubicBezier bezier_;
+ EaseType ease_type_;
private:
DISALLOW_ASSIGN(CubicBezierTimingFunction);
@@ -99,9 +111,10 @@ class CC_EXPORT StepsTimingFunction : public TimingFunction {
StepPosition step_position);
~StepsTimingFunction() override;
+ // TimingFunction implementation.
+ Type GetType() const override;
float GetValue(double t) const override;
std::unique_ptr<TimingFunction> Clone() const override;
-
void Range(float* min, float* max) const override;
float Velocity(double time) const override;
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698