void CCLayerTreeHostImpl::animateLayersRecursive(CCLayerImpl* current, double frameBeginTimeSecs, CCAnimationEventsVector& events, bool& didAnimate, bool& needsAnimateLayers) { bool subtreeNeedsAnimateLayers = false; CCLayerAnimationControllerImpl* currentController = current->layerAnimationController(); bool hadActiveAnimation = currentController->hasActiveAnimation(); currentController->animate(frameBeginTimeSecs, events); bool startedAnimation = events.size() > 0; // We animated if we either ticked a running animation, or started a new animation. if (hadActiveAnimation || startedAnimation) didAnimate = true; // If the current controller still has an active animation, we must continue animating layers. if (currentController->hasActiveAnimation()) subtreeNeedsAnimateLayers = true; for (size_t i = 0; i < current->children().size(); ++i) { bool childNeedsAnimateLayers = false; animateLayersRecursive(current->children()[i].get(), frameBeginTimeSecs, events, didAnimate, childNeedsAnimateLayers); if (childNeedsAnimateLayers) subtreeNeedsAnimateLayers = true; } needsAnimateLayers = subtreeNeedsAnimateLayers; }
void CCLayerTreeHost::animateLayers(double monotonicTime) { if (!m_settings.threadedAnimationEnabled || !m_needsAnimateLayers) return; TRACE_EVENT("CCLayerTreeHostImpl::animateLayers", this, 0); m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTime); }
void CCLayerTreeHost::animateLayers(double monotonicTime) { if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) return; TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTime); }
void CCLayerTreeHostImpl::animateLayers(double frameBeginTimeMs) { if (!m_settings.threadedAnimationEnabled || !m_needsAnimateLayers || !m_rootLayerImpl) return; TRACE_EVENT("CCLayerTreeHostImpl::animateLayers", this, 0); OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector)); bool didAnimate = false; animateLayersRecursive(m_rootLayerImpl.get(), frameBeginTimeMs / 1000, *events, didAnimate, m_needsAnimateLayers); if (!events->isEmpty()) m_client->postAnimationEventsToMainThreadOnImplThread(events.release()); if (didAnimate) m_client->setNeedsRedrawOnImplThread(); }
bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double monotonicTime) { if (!current) return false; bool subtreeNeedsAnimateLayers = false; CCLayerAnimationController* currentController = current->layerAnimationController(); currentController->animate(monotonicTime, 0); // If the current controller still has an active animation, we must continue animating layers. if (currentController->hasActiveAnimation()) subtreeNeedsAnimateLayers = true; for (size_t i = 0; i < current->children().size(); ++i) { if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) subtreeNeedsAnimateLayers = true; } return subtreeNeedsAnimateLayers; }