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

Side by Side Diff: cc/animation/timing_function.h

Issue 606543002: CC: Stop TimingFunction inheriting from AnimationCurve. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « cc/animation/keyframed_animation_curve.cc ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_ANIMATION_TIMING_FUNCTION_H_ 5 #ifndef CC_ANIMATION_TIMING_FUNCTION_H_
6 #define CC_ANIMATION_TIMING_FUNCTION_H_ 6 #define CC_ANIMATION_TIMING_FUNCTION_H_
7 7
8 #include "cc/animation/animation_curve.h"
9 #include "cc/base/cc_export.h" 8 #include "cc/base/cc_export.h"
10 #include "ui/gfx/geometry/cubic_bezier.h" 9 #include "ui/gfx/geometry/cubic_bezier.h"
11 10
12 namespace cc { 11 namespace cc {
13 12
14 // See http://www.w3.org/TR/css3-transitions/. 13 // See http://www.w3.org/TR/css3-transitions/.
15 class CC_EXPORT TimingFunction : public FloatAnimationCurve { 14 class CC_EXPORT TimingFunction {
16 public: 15 public:
17 virtual ~TimingFunction(); 16 virtual ~TimingFunction();
18 17
19 // Partial implementation of FloatAnimationCurve. 18 virtual float GetValue(double t) const = 0;
20 virtual double Duration() const OVERRIDE; 19 virtual float Velocity(double time) const = 0;
21 20 // The smallest and largest values returned by GetValue for inputs in [0, 1].
22 // The smallest and largest values returned by GetValue for inputs in
23 // [0, 1].
24 virtual void Range(float* min, float* max) const = 0; 21 virtual void Range(float* min, float* max) const = 0;
25 virtual float Velocity(double time) const = 0; 22 virtual scoped_ptr<TimingFunction> Clone() const = 0;
ikilpatrick 2014/09/25 05:03:18 Is there an idiomatic ordering? Should the .cc fil
samli 2014/09/25 07:46:36 Looks fine to me.
ikilpatrick 2014/09/25 08:50:27 Reordered.
26 23
27 protected: 24 protected:
28 TimingFunction(); 25 TimingFunction();
29 26
30 private: 27 private:
31 DISALLOW_ASSIGN(TimingFunction); 28 DISALLOW_ASSIGN(TimingFunction);
32 }; 29 };
33 30
34 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction { 31 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction {
35 public: 32 public:
36 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1, 33 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1,
37 double x2, double y2); 34 double x2, double y2);
38 virtual ~CubicBezierTimingFunction(); 35 virtual ~CubicBezierTimingFunction();
39 36
40 // Partial implementation of FloatAnimationCurve. 37 // TimingFunction implementation.
41 virtual float GetValue(double time) const OVERRIDE; 38 virtual float GetValue(double time) const OVERRIDE;
42 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 39 virtual float Velocity(double time) const OVERRIDE;
43
44 virtual void Range(float* min, float* max) const OVERRIDE; 40 virtual void Range(float* min, float* max) const OVERRIDE;
45 virtual float Velocity(double time) const OVERRIDE; 41 virtual scoped_ptr<TimingFunction> Clone() const OVERRIDE;
46 42
47 protected: 43 protected:
48 CubicBezierTimingFunction(double x1, double y1, double x2, double y2); 44 CubicBezierTimingFunction(double x1, double y1, double x2, double y2);
49 45
50 gfx::CubicBezier bezier_; 46 gfx::CubicBezier bezier_;
51 47
52 private: 48 private:
53 DISALLOW_ASSIGN(CubicBezierTimingFunction); 49 DISALLOW_ASSIGN(CubicBezierTimingFunction);
54 }; 50 };
55 51
(...skipping 25 matching lines...) Expand all
81 public: 77 public:
82 static scoped_ptr<TimingFunction> Create(); 78 static scoped_ptr<TimingFunction> Create();
83 79
84 private: 80 private:
85 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction); 81 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction);
86 }; 82 };
87 83
88 } // namespace cc 84 } // namespace cc
89 85
90 #endif // CC_ANIMATION_TIMING_FUNCTION_H_ 86 #endif // CC_ANIMATION_TIMING_FUNCTION_H_
OLDNEW
« no previous file with comments | « cc/animation/keyframed_animation_curve.cc ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698