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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 void CCLayerAnimationController::startAnimationsWaitingForNextTick(double monoto
nicTime, CCAnimationEventsVector* events) | 215 void CCLayerAnimationController::startAnimationsWaitingForNextTick(double monoto
nicTime, CCAnimationEventsVector* events) |
216 { | 216 { |
217 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 217 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
218 if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForNe
xtTick) { | 218 if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForNe
xtTick) { |
219 m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monot
onicTime); | 219 m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monot
onicTime); |
220 if (!m_activeAnimations[i]->hasSetStartTime()) | 220 if (!m_activeAnimations[i]->hasSetStartTime()) |
221 m_activeAnimations[i]->setStartTime(monotonicTime); | 221 m_activeAnimations[i]->setStartTime(monotonicTime); |
222 if (events) | 222 if (events) |
223 events->append(CCAnimationEvent(CCAnimationEvent::Started, m_cli
ent->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty
(), monotonicTime)); | 223 events->push_back(CCAnimationEvent(CCAnimationEvent::Started, m_
client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetPrope
rty(), monotonicTime)); |
224 } | 224 } |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 void CCLayerAnimationController::startAnimationsWaitingForStartTime(double monot
onicTime, CCAnimationEventsVector* events) | 228 void CCLayerAnimationController::startAnimationsWaitingForStartTime(double monot
onicTime, CCAnimationEventsVector* events) |
229 { | 229 { |
230 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 230 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
231 if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForSt
artTime && m_activeAnimations[i]->startTime() <= monotonicTime) { | 231 if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForSt
artTime && m_activeAnimations[i]->startTime() <= monotonicTime) { |
232 m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monot
onicTime); | 232 m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monot
onicTime); |
233 if (events) | 233 if (events) |
234 events->append(CCAnimationEvent(CCAnimationEvent::Started, m_cli
ent->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty
(), monotonicTime)); | 234 events->push_back(CCAnimationEvent(CCAnimationEvent::Started, m_
client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetPrope
rty(), monotonicTime)); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 void CCLayerAnimationController::startAnimationsWaitingForTargetAvailability(dou
ble monotonicTime, CCAnimationEventsVector* events) | 239 void CCLayerAnimationController::startAnimationsWaitingForTargetAvailability(dou
ble monotonicTime, CCAnimationEventsVector* events) |
240 { | 240 { |
241 // First collect running properties. | 241 // First collect running properties. |
242 TargetProperties blockedProperties; | 242 TargetProperties blockedProperties; |
243 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { | 243 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
244 if (m_activeAnimations[i]->runState() == CCActiveAnimation::Running || m
_activeAnimations[i]->runState() == CCActiveAnimation::Finished) | 244 if (m_activeAnimations[i]->runState() == CCActiveAnimation::Running || m
_activeAnimations[i]->runState() == CCActiveAnimation::Finished) |
(...skipping 18 matching lines...) Expand all Loading... |
263 if (!blockedProperties.add(*pIter).isNewEntry) | 263 if (!blockedProperties.add(*pIter).isNewEntry) |
264 nullIntersection = false; | 264 nullIntersection = false; |
265 } | 265 } |
266 | 266 |
267 // If the intersection is null, then we are free to start the animat
ions in the group. | 267 // If the intersection is null, then we are free to start the animat
ions in the group. |
268 if (nullIntersection) { | 268 if (nullIntersection) { |
269 m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, m
onotonicTime); | 269 m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, m
onotonicTime); |
270 if (!m_activeAnimations[i]->hasSetStartTime()) | 270 if (!m_activeAnimations[i]->hasSetStartTime()) |
271 m_activeAnimations[i]->setStartTime(monotonicTime); | 271 m_activeAnimations[i]->setStartTime(monotonicTime); |
272 if (events) | 272 if (events) |
273 events->append(CCAnimationEvent(CCAnimationEvent::Started, m
_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProp
erty(), monotonicTime)); | 273 events->push_back(CCAnimationEvent(CCAnimationEvent::Started
, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetP
roperty(), monotonicTime)); |
274 for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) { | 274 for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) { |
275 if (m_activeAnimations[i]->group() == m_activeAnimations[j]-
>group()) { | 275 if (m_activeAnimations[i]->group() == m_activeAnimations[j]-
>group()) { |
276 m_activeAnimations[j]->setRunState(CCActiveAnimation::Ru
nning, monotonicTime); | 276 m_activeAnimations[j]->setRunState(CCActiveAnimation::Ru
nning, monotonicTime); |
277 if (!m_activeAnimations[j]->hasSetStartTime()) | 277 if (!m_activeAnimations[j]->hasSetStartTime()) |
278 m_activeAnimations[j]->setStartTime(monotonicTime); | 278 m_activeAnimations[j]->setStartTime(monotonicTime); |
279 } | 279 } |
280 } | 280 } |
281 } | 281 } |
282 } | 282 } |
283 } | 283 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 break; | 319 break; |
320 } | 320 } |
321 } | 321 } |
322 } | 322 } |
323 if (allAnimsWithSameIdAreFinished) { | 323 if (allAnimsWithSameIdAreFinished) { |
324 // We now need to remove all animations with the same group id as gr
oupId | 324 // We now need to remove all animations with the same group id as gr
oupId |
325 // (and send along animation finished notifications, if necessary). | 325 // (and send along animation finished notifications, if necessary). |
326 for (size_t j = i; j < m_activeAnimations.size(); j++) { | 326 for (size_t j = i; j < m_activeAnimations.size(); j++) { |
327 if (groupId == m_activeAnimations[j]->group()) { | 327 if (groupId == m_activeAnimations[j]->group()) { |
328 if (events) | 328 if (events) |
329 events->append(CCAnimationEvent(CCAnimationEvent::Finish
ed, m_client->id(), m_activeAnimations[j]->group(), m_activeAnimations[j]->targe
tProperty(), monotonicTime)); | 329 events->push_back(CCAnimationEvent(CCAnimationEvent::Fin
ished, m_client->id(), m_activeAnimations[j]->group(), m_activeAnimations[j]->ta
rgetProperty(), monotonicTime)); |
330 m_activeAnimations[j]->setRunState(CCActiveAnimation::Waitin
gForDeletion, monotonicTime); | 330 m_activeAnimations[j]->setRunState(CCActiveAnimation::Waitin
gForDeletion, monotonicTime); |
331 } | 331 } |
332 } | 332 } |
333 } | 333 } |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 void CCLayerAnimationController::purgeAnimationsMarkedForDeletion() | 337 void CCLayerAnimationController::purgeAnimationsMarkedForDeletion() |
338 { | 338 { |
339 for (size_t i = 0; i < m_activeAnimations.size();) { | 339 for (size_t i = 0; i < m_activeAnimations.size();) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ASSERT_NOT_REACHED(); |
401 | 401 |
402 } | 402 } |
403 } | 403 } |
404 } | 404 } |
405 } | 405 } |
406 | 406 |
407 } // namespace cc | 407 } // namespace cc |
OLD | NEW |