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

Side by Side Diff: cc/keyframed_animation_curve.h

Issue 12517003: cc: Chromify the Animation and LayerAnimationController classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/animation_unittest.cc ('k') | cc/keyframed_animation_curve.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_KEYFRAMED_ANIMATION_CURVE_H_ 5 #ifndef CC_KEYFRAMED_ANIMATION_CURVE_H_
6 #define CC_KEYFRAMED_ANIMATION_CURVE_H_ 6 #define CC_KEYFRAMED_ANIMATION_CURVE_H_
7 7
8 #include "cc/animation_curve.h" 8 #include "cc/animation_curve.h"
9 #include "cc/cc_export.h" 9 #include "cc/cc_export.h"
10 #include "cc/scoped_ptr_vector.h" 10 #include "cc/scoped_ptr_vector.h"
11 #include "cc/timing_function.h" 11 #include "cc/timing_function.h"
12 #include "cc/transform_operations.h" 12 #include "cc/transform_operations.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class CC_EXPORT Keyframe { 16 class CC_EXPORT Keyframe {
17 public: 17 public:
18 double time() const; 18 double Time() const;
19 const TimingFunction* timingFunction() const; 19 const TimingFunction* timing_function() const {
20 return timing_function_.get();
21 }
20 22
21 protected: 23 protected:
22 Keyframe(double time, scoped_ptr<TimingFunction>); 24 Keyframe(double time, scoped_ptr<TimingFunction> timing_function);
23 virtual ~Keyframe(); 25 virtual ~Keyframe();
24 26
25 private: 27 private:
26 double m_time; 28 double time_;
27 scoped_ptr<TimingFunction> m_timingFunction; 29 scoped_ptr<TimingFunction> timing_function_;
28 30
29 DISALLOW_COPY_AND_ASSIGN(Keyframe); 31 DISALLOW_COPY_AND_ASSIGN(Keyframe);
30 }; 32 };
31 33
32 class CC_EXPORT FloatKeyframe : public Keyframe { 34 class CC_EXPORT FloatKeyframe : public Keyframe {
33 public: 35 public:
34 static scoped_ptr<FloatKeyframe> create(double time, float value, scoped_ptr <TimingFunction>); 36 static scoped_ptr<FloatKeyframe> Create(
35 virtual ~FloatKeyframe(); 37 double time,
38 float value,
39 scoped_ptr<TimingFunction> timing_function);
40 virtual ~FloatKeyframe();
36 41
37 float value() const; 42 float Value() const;
38 43
39 scoped_ptr<FloatKeyframe> clone() const; 44 scoped_ptr<FloatKeyframe> Clone() const;
40 45
41 private: 46 private:
42 FloatKeyframe(double time, float value, scoped_ptr<TimingFunction>); 47 FloatKeyframe(double time,
48 float value,
49 scoped_ptr<TimingFunction> timing_function);
43 50
44 float m_value; 51 float value_;
45 }; 52 };
46 53
47 class CC_EXPORT TransformKeyframe : public Keyframe { 54 class CC_EXPORT TransformKeyframe : public Keyframe {
48 public: 55 public:
49 static scoped_ptr<TransformKeyframe> create(double time, const TransformOper ations& value, scoped_ptr<TimingFunction>); 56 static scoped_ptr<TransformKeyframe> Create(
50 virtual ~TransformKeyframe(); 57 double time,
58 const TransformOperations& value,
59 scoped_ptr<TimingFunction> timing_function);
60 virtual ~TransformKeyframe();
51 61
52 const TransformOperations& value() const; 62 const TransformOperations& Value() const;
53 63
54 scoped_ptr<TransformKeyframe> clone() const; 64 scoped_ptr<TransformKeyframe> Clone() const;
55 65
56 private: 66 private:
57 TransformKeyframe(double time, const TransformOperations& value, scoped_ptr< TimingFunction>); 67 TransformKeyframe(
68 double time,
69 const TransformOperations& value,
70 scoped_ptr<TimingFunction> timing_function);
58 71
59 TransformOperations m_value; 72 TransformOperations value_;
60 }; 73 };
61 74
62 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { 75 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve {
63 public: 76 public:
64 // It is required that the keyframes be sorted by time. 77 // It is required that the keyframes be sorted by time.
65 static scoped_ptr<KeyframedFloatAnimationCurve> create(); 78 static scoped_ptr<KeyframedFloatAnimationCurve> Create();
66 79
67 virtual ~KeyframedFloatAnimationCurve(); 80 virtual ~KeyframedFloatAnimationCurve();
68 81
69 void addKeyframe(scoped_ptr<FloatKeyframe>); 82 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe);
70 83
71 // AnimationCurve implementation 84 // AnimationCurve implementation
72 virtual double duration() const OVERRIDE; 85 virtual double Duration() const OVERRIDE;
73 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; 86 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
74 87
75 // FloatAnimationCurve implementation 88 // FloatAnimationCurve implementation
76 virtual float getValue(double t) const OVERRIDE; 89 virtual float GetValue(double t) const OVERRIDE;
77 90
78 private: 91 private:
79 KeyframedFloatAnimationCurve(); 92 KeyframedFloatAnimationCurve();
80 93
81 // Always sorted in order of increasing time. No two keyframes have the 94 // Always sorted in order of increasing time. No two keyframes have the
82 // same time. 95 // same time.
83 ScopedPtrVector<FloatKeyframe> m_keyframes; 96 ScopedPtrVector<FloatKeyframe> keyframes_;
84 97
85 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); 98 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve);
86 }; 99 };
87 100
88 class CC_EXPORT KeyframedTransformAnimationCurve : public TransformAnimationCurv e { 101 class CC_EXPORT KeyframedTransformAnimationCurve : public TransformAnimationCurv e {
89 public: 102 public:
90 // It is required that the keyframes be sorted by time. 103 // It is required that the keyframes be sorted by time.
91 static scoped_ptr<KeyframedTransformAnimationCurve> create(); 104 static scoped_ptr<KeyframedTransformAnimationCurve> Create();
92 105
93 virtual ~KeyframedTransformAnimationCurve(); 106 virtual ~KeyframedTransformAnimationCurve();
94 107
95 void addKeyframe(scoped_ptr<TransformKeyframe>); 108 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe);
96 109
97 // AnimationCurve implementation 110 // AnimationCurve implementation
98 virtual double duration() const OVERRIDE; 111 virtual double Duration() const OVERRIDE;
99 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; 112 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
100 113
101 // TransformAnimationCurve implementation 114 // TransformAnimationCurve implementation
102 virtual gfx::Transform getValue(double t) const OVERRIDE; 115 virtual gfx::Transform GetValue(double t) const OVERRIDE;
103 116
104 private: 117 private:
105 KeyframedTransformAnimationCurve(); 118 KeyframedTransformAnimationCurve();
106 119
107 // Always sorted in order of increasing time. No two keyframes have the 120 // Always sorted in order of increasing time. No two keyframes have the
108 // same time. 121 // same time.
109 ScopedPtrVector<TransformKeyframe> m_keyframes; 122 ScopedPtrVector<TransformKeyframe> keyframes_;
110 123
111 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); 124 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve);
112 }; 125 };
113 126
114 } // namespace cc 127 } // namespace cc
115 128
116 #endif // CC_KEYFRAMED_ANIMATION_CURVE_H_ 129 #endif // CC_KEYFRAMED_ANIMATION_CURVE_H_
OLDNEW
« no previous file with comments | « cc/animation_unittest.cc ('k') | cc/keyframed_animation_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698