OLD | NEW |
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 CCKeyframedAnimationCurve_h | 5 #ifndef CCKeyframedAnimationCurve_h |
6 #define CCKeyframedAnimationCurve_h | 6 #define CCKeyframedAnimationCurve_h |
7 | 7 |
8 #include "CCAnimationCurve.h" | 8 #include "CCAnimationCurve.h" |
9 #include "CCTimingFunction.h" | 9 #include "CCTimingFunction.h" |
10 #include "scoped_ptr_vector.h" | 10 #include "scoped_ptr_vector.h" |
11 #include <public/WebTransformOperations.h> | 11 #include <public/WebTransformOperations.h> |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class CCKeyframe { | 15 class Keyframe { |
16 public: | 16 public: |
17 double time() const; | 17 double time() const; |
18 const CCTimingFunction* timingFunction() const; | 18 const TimingFunction* timingFunction() const; |
19 | 19 |
20 protected: | 20 protected: |
21 CCKeyframe(double time, scoped_ptr<CCTimingFunction>); | 21 Keyframe(double time, scoped_ptr<TimingFunction>); |
22 virtual ~CCKeyframe(); | 22 virtual ~Keyframe(); |
23 | 23 |
24 private: | 24 private: |
25 double m_time; | 25 double m_time; |
26 scoped_ptr<CCTimingFunction> m_timingFunction; | 26 scoped_ptr<TimingFunction> m_timingFunction; |
27 }; | 27 }; |
28 | 28 |
29 class CCFloatKeyframe : public CCKeyframe { | 29 class FloatKeyframe : public Keyframe { |
30 public: | 30 public: |
31 static scoped_ptr<CCFloatKeyframe> create(double time, float value, scoped_p
tr<CCTimingFunction>); | 31 static scoped_ptr<FloatKeyframe> create(double time, float value, scoped_ptr
<TimingFunction>); |
32 virtual ~CCFloatKeyframe(); | 32 virtual ~FloatKeyframe(); |
33 | 33 |
34 float value() const; | 34 float value() const; |
35 | 35 |
36 scoped_ptr<CCFloatKeyframe> clone() const; | 36 scoped_ptr<FloatKeyframe> clone() const; |
37 | 37 |
38 private: | 38 private: |
39 CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction>); | 39 FloatKeyframe(double time, float value, scoped_ptr<TimingFunction>); |
40 | 40 |
41 float m_value; | 41 float m_value; |
42 }; | 42 }; |
43 | 43 |
44 class CCTransformKeyframe : public CCKeyframe { | 44 class TransformKeyframe : public Keyframe { |
45 public: | 45 public: |
46 static scoped_ptr<CCTransformKeyframe> create(double time, const WebKit::Web
TransformOperations& value, scoped_ptr<CCTimingFunction>); | 46 static scoped_ptr<TransformKeyframe> create(double time, const WebKit::WebTr
ansformOperations& value, scoped_ptr<TimingFunction>); |
47 virtual ~CCTransformKeyframe(); | 47 virtual ~TransformKeyframe(); |
48 | 48 |
49 const WebKit::WebTransformOperations& value() const; | 49 const WebKit::WebTransformOperations& value() const; |
50 | 50 |
51 scoped_ptr<CCTransformKeyframe> clone() const; | 51 scoped_ptr<TransformKeyframe> clone() const; |
52 | 52 |
53 private: | 53 private: |
54 CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value
, scoped_ptr<CCTimingFunction>); | 54 TransformKeyframe(double time, const WebKit::WebTransformOperations& value,
scoped_ptr<TimingFunction>); |
55 | 55 |
56 WebKit::WebTransformOperations m_value; | 56 WebKit::WebTransformOperations m_value; |
57 }; | 57 }; |
58 | 58 |
59 class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve { | 59 class KeyframedFloatAnimationCurve : public FloatAnimationCurve { |
60 public: | 60 public: |
61 // It is required that the keyframes be sorted by time. | 61 // It is required that the keyframes be sorted by time. |
62 static scoped_ptr<CCKeyframedFloatAnimationCurve> create(); | 62 static scoped_ptr<KeyframedFloatAnimationCurve> create(); |
63 | 63 |
64 virtual ~CCKeyframedFloatAnimationCurve(); | 64 virtual ~KeyframedFloatAnimationCurve(); |
65 | 65 |
66 void addKeyframe(scoped_ptr<CCFloatKeyframe>); | 66 void addKeyframe(scoped_ptr<FloatKeyframe>); |
67 | 67 |
68 // CCAnimationCurve implementation | 68 // AnimationCurve implementation |
69 virtual double duration() const OVERRIDE; | 69 virtual double duration() const OVERRIDE; |
70 virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; | 70 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; |
71 | 71 |
72 // CCFloatAnimationCurve implementation | 72 // FloatAnimationCurve implementation |
73 virtual float getValue(double t) const OVERRIDE; | 73 virtual float getValue(double t) const OVERRIDE; |
74 | 74 |
75 private: | 75 private: |
76 CCKeyframedFloatAnimationCurve(); | 76 KeyframedFloatAnimationCurve(); |
77 | 77 |
78 // Always sorted in order of increasing time. No two keyframes have the | 78 // Always sorted in order of increasing time. No two keyframes have the |
79 // same time. | 79 // same time. |
80 ScopedPtrVector<CCFloatKeyframe> m_keyframes; | 80 ScopedPtrVector<FloatKeyframe> m_keyframes; |
81 }; | 81 }; |
82 | 82 |
83 class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve { | 83 class KeyframedTransformAnimationCurve : public TransformAnimationCurve { |
84 public: | 84 public: |
85 // It is required that the keyframes be sorted by time. | 85 // It is required that the keyframes be sorted by time. |
86 static scoped_ptr<CCKeyframedTransformAnimationCurve> create(); | 86 static scoped_ptr<KeyframedTransformAnimationCurve> create(); |
87 | 87 |
88 virtual ~CCKeyframedTransformAnimationCurve(); | 88 virtual ~KeyframedTransformAnimationCurve(); |
89 | 89 |
90 void addKeyframe(scoped_ptr<CCTransformKeyframe>); | 90 void addKeyframe(scoped_ptr<TransformKeyframe>); |
91 | 91 |
92 // CCAnimationCurve implementation | 92 // AnimationCurve implementation |
93 virtual double duration() const OVERRIDE; | 93 virtual double duration() const OVERRIDE; |
94 virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE; | 94 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE; |
95 | 95 |
96 // CCTransformAnimationCurve implementation | 96 // TransformAnimationCurve implementation |
97 virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; | 97 virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; |
98 | 98 |
99 private: | 99 private: |
100 CCKeyframedTransformAnimationCurve(); | 100 KeyframedTransformAnimationCurve(); |
101 | 101 |
102 // Always sorted in order of increasing time. No two keyframes have the | 102 // Always sorted in order of increasing time. No two keyframes have the |
103 // same time. | 103 // same time. |
104 ScopedPtrVector<CCTransformKeyframe> m_keyframes; | 104 ScopedPtrVector<TransformKeyframe> m_keyframes; |
105 }; | 105 }; |
106 | 106 |
107 } // namespace cc | 107 } // namespace cc |
108 | 108 |
109 #endif // CCKeyframedAnimationCurve_h | 109 #endif // CCKeyframedAnimationCurve_h |
OLD | NEW |