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