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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerAnimationController.h" | 7 #include "CCLayerAnimationController.h" |
8 | 8 |
9 #include "CCActiveAnimation.h" | 9 #include "CCActiveAnimation.h" |
10 #include "CCKeyframedAnimationCurve.h" | 10 #include "CCKeyframedAnimationCurve.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // to be copied over and started; it may have already finished. In this
case, the impl thread animation | 177 // to be copied over and started; it may have already finished. In this
case, the impl thread animation |
178 // will have already notified that it has started and the main thread an
imation will no longer need | 178 // will have already notified that it has started and the main thread an
imation will no longer need |
179 // a synchronized start time. | 179 // a synchronized start time. |
180 if (!m_activeAnimations[i]->needsSynchronizedStartTime()) | 180 if (!m_activeAnimations[i]->needsSynchronizedStartTime()) |
181 continue; | 181 continue; |
182 | 182 |
183 // The new animation should be set to run as soon as possible. | 183 // The new animation should be set to run as soon as possible. |
184 CCActiveAnimation::RunState initialRunState = CCActiveAnimation::Waiting
ForTargetAvailability; | 184 CCActiveAnimation::RunState initialRunState = CCActiveAnimation::Waiting
ForTargetAvailability; |
185 double startTime = 0; | 185 double startTime = 0; |
186 scoped_ptr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndIniti
alize(CCActiveAnimation::ControllingInstance, initialRunState, startTime)); | 186 scoped_ptr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneAndIniti
alize(CCActiveAnimation::ControllingInstance, initialRunState, startTime)); |
187 ASSERT(!toAdd->needsSynchronizedStartTime()); | 187 DCHECK(!toAdd->needsSynchronizedStartTime()); |
188 controllerImpl->addAnimation(toAdd.Pass()); | 188 controllerImpl->addAnimation(toAdd.Pass()); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 void CCLayerAnimationController::removeAnimationsCompletedOnMainThread(CCLayerAn
imationController* controllerImpl) const | 192 void CCLayerAnimationController::removeAnimationsCompletedOnMainThread(CCLayerAn
imationController* controllerImpl) const |
193 { | 193 { |
194 // Delete all impl thread animations for which there is no corresponding mai
n thread animation. | 194 // Delete all impl thread animations for which there is no corresponding mai
n thread animation. |
195 // Each iteration, controller->m_activeAnimations.size() is decremented or i
is incremented | 195 // Each iteration, controller->m_activeAnimations.size() is decremented or i
is incremented |
196 // guaranteeing progress towards loop termination. | 196 // guaranteeing progress towards loop termination. |
197 for (size_t i = 0; i < controllerImpl->m_activeAnimations.size();) { | 197 for (size_t i = 0; i < controllerImpl->m_activeAnimations.size();) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 const float opacity = floatAnimationCurve->getValue(trimmed); | 390 const float opacity = floatAnimationCurve->getValue(trimmed); |
391 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) | 391 if (m_activeAnimations[i]->isFinishedAt(monotonicTime)) |
392 m_activeAnimations[i]->setRunState(CCActiveAnimation::Finish
ed, monotonicTime); | 392 m_activeAnimations[i]->setRunState(CCActiveAnimation::Finish
ed, monotonicTime); |
393 | 393 |
394 m_client->setOpacityFromAnimation(opacity); | 394 m_client->setOpacityFromAnimation(opacity); |
395 break; | 395 break; |
396 } | 396 } |
397 | 397 |
398 // Do nothing for sentinel value. | 398 // Do nothing for sentinel value. |
399 case CCActiveAnimation::TargetPropertyEnumSize: | 399 case CCActiveAnimation::TargetPropertyEnumSize: |
400 ASSERT_NOT_REACHED(); | 400 NOTREACHED(); |
401 | |
402 } | 401 } |
403 } | 402 } |
404 } | 403 } |
405 } | 404 } |
406 | 405 |
407 } // namespace cc | 406 } // namespace cc |
OLD | NEW |