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 CCActiveAnimation_h | 5 #ifndef CCActiveAnimation_h |
6 #define CCActiveAnimation_h | 6 #define CCActiveAnimation_h |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include <wtf/OwnPtr.h> |
| 10 #include <wtf/PassOwnPtr.h> |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 class CCAnimationCurve; | 14 class CCAnimationCurve; |
14 | 15 |
15 // A CCActiveAnimation, contains all the state required to play a CCAnimationCur
ve. | 16 // A CCActiveAnimation, contains all the state required to play a CCAnimationCur
ve. |
16 // Specifically, the affected property, the run state (paused, finished, etc.), | 17 // Specifically, the affected property, the run state (paused, finished, etc.), |
17 // loop count, last pause time, and the total time spent paused. | 18 // loop count, last pause time, and the total time spent paused. |
18 class CCActiveAnimation { | 19 class CCActiveAnimation { |
19 public: | 20 public: |
(...skipping 19 matching lines...) Expand all Loading... |
39 RunStateEnumSize | 40 RunStateEnumSize |
40 }; | 41 }; |
41 | 42 |
42 enum TargetProperty { | 43 enum TargetProperty { |
43 Transform = 0, | 44 Transform = 0, |
44 Opacity, | 45 Opacity, |
45 // This sentinel must be last. | 46 // This sentinel must be last. |
46 TargetPropertyEnumSize | 47 TargetPropertyEnumSize |
47 }; | 48 }; |
48 | 49 |
49 static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, in
t animationId, int groupId, TargetProperty); | 50 static PassOwnPtr<CCActiveAnimation> create(PassOwnPtr<CCAnimationCurve>, in
t animationId, int groupId, TargetProperty); |
50 | 51 |
51 virtual ~CCActiveAnimation(); | 52 virtual ~CCActiveAnimation(); |
52 | 53 |
53 int id() const { return m_id; } | 54 int id() const { return m_id; } |
54 int group() const { return m_group; } | 55 int group() const { return m_group; } |
55 TargetProperty targetProperty() const { return m_targetProperty; } | 56 TargetProperty targetProperty() const { return m_targetProperty; } |
56 | 57 |
57 RunState runState() const { return m_runState; } | 58 RunState runState() const { return m_runState; } |
58 void setRunState(RunState, double monotonicTime); | 59 void setRunState(RunState, double monotonicTime); |
59 | 60 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 // Takes the given absolute time, and using the start time and the number | 94 // Takes the given absolute time, and using the start time and the number |
94 // of iterations, returns the relative time in the current iteration. | 95 // of iterations, returns the relative time in the current iteration. |
95 double trimTimeToCurrentIteration(double monotonicTime) const; | 96 double trimTimeToCurrentIteration(double monotonicTime) const; |
96 | 97 |
97 enum InstanceType { | 98 enum InstanceType { |
98 ControllingInstance = 0, | 99 ControllingInstance = 0, |
99 NonControllingInstance | 100 NonControllingInstance |
100 }; | 101 }; |
101 | 102 |
102 scoped_ptr<CCActiveAnimation> clone(InstanceType) const; | 103 PassOwnPtr<CCActiveAnimation> clone(InstanceType) const; |
103 scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState init
ialRunState, double startTime) const; | 104 PassOwnPtr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState init
ialRunState, double startTime) const; |
104 bool isControllingInstance() const { return m_isControllingInstance; } | 105 bool isControllingInstance() const { return m_isControllingInstance; } |
105 | 106 |
106 void pushPropertiesTo(CCActiveAnimation*) const; | 107 void pushPropertiesTo(CCActiveAnimation*) const; |
107 | 108 |
108 private: | 109 private: |
109 CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId
, TargetProperty); | 110 CCActiveAnimation(PassOwnPtr<CCAnimationCurve>, int animationId, int groupId
, TargetProperty); |
110 | 111 |
111 scoped_ptr<CCAnimationCurve> m_curve; | 112 OwnPtr<CCAnimationCurve> m_curve; |
112 | 113 |
113 // IDs are not necessarily unique. | 114 // IDs are not necessarily unique. |
114 int m_id; | 115 int m_id; |
115 | 116 |
116 // Animations that must be run together are called 'grouped' and have the sa
me group id | 117 // Animations that must be run together are called 'grouped' and have the sa
me group id |
117 // Grouped animations are guaranteed to start at the same time and no other
animations | 118 // Grouped animations are guaranteed to start at the same time and no other
animations |
118 // may animate any of the group's target properties until all animations in
the | 119 // may animate any of the group's target properties until all animations in
the |
119 // group have finished animating. Note: an active animation's group id and t
arget | 120 // group have finished animating. Note: an active animation's group id and t
arget |
120 // property uniquely identify that animation. | 121 // property uniquely identify that animation. |
121 int m_group; | 122 int m_group; |
(...skipping 30 matching lines...) Expand all Loading... |
152 // that ultimately controls the values of the animating layer and so we will
refer | 153 // that ultimately controls the values of the animating layer and so we will
refer |
153 // to it as the 'controlling instance'. | 154 // to it as the 'controlling instance'. |
154 bool m_isControllingInstance; | 155 bool m_isControllingInstance; |
155 | 156 |
156 DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation); | 157 DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation); |
157 }; | 158 }; |
158 | 159 |
159 } // namespace cc | 160 } // namespace cc |
160 | 161 |
161 #endif // CCActiveAnimation_h | 162 #endif // CCActiveAnimation_h |
OLD | NEW |