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