Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: cc/CCActiveAnimation.cpp

Issue 11085029: [cc] Use base ptr types for cc's CSS animation classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCActiveAnimation.h ('k') | cc/CCActiveAnimationTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "config.h" 5 #include "config.h"
6 6
7 #include "CCActiveAnimation.h" 7 #include "CCActiveAnimation.h"
8 8
9 #include "CCAnimationCurve.h" 9 #include "CCAnimationCurve.h"
10 #include "TraceEvent.h" 10 #include "TraceEvent.h"
(...skipping 24 matching lines...) Expand all
35 "Transform", 35 "Transform",
36 "Opacity" 36 "Opacity"
37 }; 37 };
38 38
39 COMPILE_ASSERT(static_cast<int>(cc::CCActiveAnimation::TargetPropertyEnumSize) = = arraysize(s_targetPropertyNames), TargetProperty_names_match_enum); 39 COMPILE_ASSERT(static_cast<int>(cc::CCActiveAnimation::TargetPropertyEnumSize) = = arraysize(s_targetPropertyNames), TargetProperty_names_match_enum);
40 40
41 } // namespace 41 } // namespace
42 42
43 namespace cc { 43 namespace cc {
44 44
45 PassOwnPtr<CCActiveAnimation> CCActiveAnimation::create(PassOwnPtr<CCAnimationCu rve> curve, int animationId, int groupId, TargetProperty targetProperty) 45 scoped_ptr<CCActiveAnimation> CCActiveAnimation::create(scoped_ptr<CCAnimationCu rve> curve, int animationId, int groupId, TargetProperty targetProperty)
46 { 46 {
47 return adoptPtr(new CCActiveAnimation(curve, animationId, groupId, targetPro perty)); 47 return make_scoped_ptr(new CCActiveAnimation(curve.Pass(), animationId, grou pId, targetProperty));
48 } 48 }
49 49
50 CCActiveAnimation::CCActiveAnimation(PassOwnPtr<CCAnimationCurve> curve, int ani mationId, int groupId, TargetProperty targetProperty) 50 CCActiveAnimation::CCActiveAnimation(scoped_ptr<CCAnimationCurve> curve, int ani mationId, int groupId, TargetProperty targetProperty)
51 : m_curve(curve) 51 : m_curve(curve.Pass())
52 , m_id(animationId) 52 , m_id(animationId)
53 , m_group(groupId) 53 , m_group(groupId)
54 , m_targetProperty(targetProperty) 54 , m_targetProperty(targetProperty)
55 , m_runState(WaitingForTargetAvailability) 55 , m_runState(WaitingForTargetAvailability)
56 , m_iterations(1) 56 , m_iterations(1)
57 , m_startTime(0) 57 , m_startTime(0)
58 , m_alternatesDirection(false) 58 , m_alternatesDirection(false)
59 , m_timeOffset(0) 59 , m_timeOffset(0)
60 , m_needsSynchronizedStartTime(false) 60 , m_needsSynchronizedStartTime(false)
61 , m_suspended(false) 61 , m_suspended(false)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Calculate x where trimmed = x + n * m_curve->duration() for some positive integer n. 173 // Calculate x where trimmed = x + n * m_curve->duration() for some positive integer n.
174 trimmed = fmod(trimmed, m_curve->duration()); 174 trimmed = fmod(trimmed, m_curve->duration());
175 175
176 // If we're alternating and on an odd iteration, reverse the direction. 176 // If we're alternating and on an odd iteration, reverse the direction.
177 if (m_alternatesDirection && iteration % 2 == 1) 177 if (m_alternatesDirection && iteration % 2 == 1)
178 return m_curve->duration() - trimmed; 178 return m_curve->duration() - trimmed;
179 179
180 return trimmed; 180 return trimmed;
181 } 181 }
182 182
183 PassOwnPtr<CCActiveAnimation> CCActiveAnimation::clone(InstanceType instanceType ) const 183 scoped_ptr<CCActiveAnimation> CCActiveAnimation::clone(InstanceType instanceType ) const
184 { 184 {
185 return cloneAndInitialize(instanceType, m_runState, m_startTime); 185 return cloneAndInitialize(instanceType, m_runState, m_startTime);
186 } 186 }
187 187
188 PassOwnPtr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType instanceType, RunState initialRunState, double startTime) const 188 scoped_ptr<CCActiveAnimation> CCActiveAnimation::cloneAndInitialize(InstanceType instanceType, RunState initialRunState, double startTime) const
189 { 189 {
190 OwnPtr<CCActiveAnimation> toReturn(adoptPtr(new CCActiveAnimation(m_curve->c lone(), m_id, m_group, m_targetProperty))); 190 scoped_ptr<CCActiveAnimation> toReturn(new CCActiveAnimation(m_curve->clone( ), m_id, m_group, m_targetProperty));
191 toReturn->m_runState = initialRunState; 191 toReturn->m_runState = initialRunState;
192 toReturn->m_iterations = m_iterations; 192 toReturn->m_iterations = m_iterations;
193 toReturn->m_startTime = startTime; 193 toReturn->m_startTime = startTime;
194 toReturn->m_pauseTime = m_pauseTime; 194 toReturn->m_pauseTime = m_pauseTime;
195 toReturn->m_totalPausedTime = m_totalPausedTime; 195 toReturn->m_totalPausedTime = m_totalPausedTime;
196 toReturn->m_timeOffset = m_timeOffset; 196 toReturn->m_timeOffset = m_timeOffset;
197 toReturn->m_alternatesDirection = m_alternatesDirection; 197 toReturn->m_alternatesDirection = m_alternatesDirection;
198 toReturn->m_isControllingInstance = instanceType == ControllingInstance; 198 toReturn->m_isControllingInstance = instanceType == ControllingInstance;
199 return toReturn.release(); 199 return toReturn.Pass();
200 } 200 }
201 201
202 void CCActiveAnimation::pushPropertiesTo(CCActiveAnimation* other) const 202 void CCActiveAnimation::pushPropertiesTo(CCActiveAnimation* other) const
203 { 203 {
204 // Currently, we only push changes due to pausing and resuming animations on the main thread. 204 // Currently, we only push changes due to pausing and resuming animations on the main thread.
205 if (m_runState == CCActiveAnimation::Paused || other->m_runState == CCActive Animation::Paused) { 205 if (m_runState == CCActiveAnimation::Paused || other->m_runState == CCActive Animation::Paused) {
206 other->m_runState = m_runState; 206 other->m_runState = m_runState;
207 other->m_pauseTime = m_pauseTime; 207 other->m_pauseTime = m_pauseTime;
208 other->m_totalPausedTime = m_totalPausedTime; 208 other->m_totalPausedTime = m_totalPausedTime;
209 } 209 }
210 } 210 }
211 211
212 } // namespace cc 212 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCActiveAnimation.h ('k') | cc/CCActiveAnimationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698