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