OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
8 | 8 |
9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 m_proxy->acquireLayerTextures(); | 222 m_proxy->acquireLayerTextures(); |
223 } | 223 } |
224 | 224 |
225 void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) | 225 void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) |
226 { | 226 { |
227 m_animating = true; | 227 m_animating = true; |
228 m_client->animate(monotonicFrameBeginTime); | 228 m_client->animate(monotonicFrameBeginTime); |
229 animateLayers(monotonicFrameBeginTime); | 229 animateLayers(monotonicFrameBeginTime); |
230 m_animating = false; | 230 m_animating = false; |
231 | 231 |
232 m_renderingStats.numAnimationFrames++; | 232 m_renderingStats.mainAnimationFrameCount++; |
233 } | 233 } |
234 | 234 |
235 void CCLayerTreeHost::layout() | 235 void CCLayerTreeHost::layout() |
236 { | 236 { |
237 m_client->layout(); | 237 m_client->layout(); |
238 } | 238 } |
239 | 239 |
240 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) | 240 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) |
241 { | 241 { |
242 ASSERT(CCProxy::isImplThread()); | 242 ASSERT(CCProxy::isImplThread()); |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 m_deviceScaleFactor = deviceScaleFactor; | 773 m_deviceScaleFactor = deviceScaleFactor; |
774 | 774 |
775 setNeedsCommit(); | 775 setNeedsCommit(); |
776 } | 776 } |
777 | 777 |
778 void CCLayerTreeHost::animateLayers(double monotonicTime) | 778 void CCLayerTreeHost::animateLayers(double monotonicTime) |
779 { | 779 { |
780 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) | 780 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) |
781 return; | 781 return; |
782 | 782 |
783 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); | 783 TRACE_EVENT0("cc", "CCLayerTreeHost::animateLayers"); |
784 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi
me); | 784 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi
me); |
785 } | 785 } |
786 | 786 |
787 bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono
tonicTime) | 787 bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono
tonicTime) |
788 { | 788 { |
789 if (!current) | 789 if (!current) |
790 return false; | 790 return false; |
791 | 791 |
792 bool subtreeNeedsAnimateLayers = false; | 792 bool subtreeNeedsAnimateLayers = false; |
793 CCLayerAnimationController* currentController = current->layerAnimationContr
oller(); | 793 CCLayerAnimationController* currentController = current->layerAnimationContr
oller(); |
794 currentController->animate(monotonicTime, 0); | 794 currentController->animate(monotonicTime, 0); |
795 | 795 |
796 // If the current controller still has an active animation, we must continue
animating layers. | 796 // If the current controller still has an active animation, we must continue
animating layers. |
797 if (currentController->hasActiveAnimation()) | 797 if (currentController->hasActiveAnimation()) |
798 subtreeNeedsAnimateLayers = true; | 798 subtreeNeedsAnimateLayers = true; |
799 | 799 |
800 for (size_t i = 0; i < current->children().size(); ++i) { | 800 for (size_t i = 0; i < current->children().size(); ++i) { |
801 if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) | 801 if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) |
802 subtreeNeedsAnimateLayers = true; | 802 subtreeNeedsAnimateLayers = true; |
803 } | 803 } |
804 | |
805 return subtreeNeedsAnimateLayers; | 804 return subtreeNeedsAnimateLayers; |
806 } | 805 } |
807 | 806 |
808 void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector&
events, LayerChromium* layer, double wallClockTime) | 807 void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector&
events, LayerChromium* layer, double wallClockTime) |
809 { | 808 { |
810 if (!layer) | 809 if (!layer) |
811 return; | 810 return; |
812 | 811 |
813 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { | 812 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { |
814 if (layer->id() == events[eventIndex].layerId) { | 813 if (layer->id() == events[eventIndex].layerId) { |
815 if (events[eventIndex].type == CCAnimationEvent::Started) | 814 if (events[eventIndex].type == CCAnimationEvent::Started) |
816 layer->notifyAnimationStarted(events[eventIndex], wallClockTime)
; | 815 layer->notifyAnimationStarted(events[eventIndex], wallClockTime)
; |
817 else | 816 else |
818 layer->notifyAnimationFinished(wallClockTime); | 817 layer->notifyAnimationFinished(wallClockTime); |
819 } | 818 } |
820 } | 819 } |
821 | 820 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 821 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 822 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
824 } | 823 } |
825 | 824 |
826 } // namespace cc | 825 } // namespace cc |
OLD | NEW |