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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 m_deviceScaleFactor = deviceScaleFactor; | 810 m_deviceScaleFactor = deviceScaleFactor; |
811 | 811 |
812 setNeedsCommit(); | 812 setNeedsCommit(); |
813 } | 813 } |
814 | 814 |
815 void CCLayerTreeHost::animateLayers(double monotonicTime) | 815 void CCLayerTreeHost::animateLayers(double monotonicTime) |
816 { | 816 { |
817 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) | 817 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) |
818 return; | 818 return; |
819 | 819 |
820 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); | 820 TRACE_EVENT0("cc", "CCLayerTreeHost::animateLayers"); |
821 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi
me); | 821 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi
me); |
822 } | 822 } |
823 | 823 |
824 bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono
tonicTime) | 824 bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono
tonicTime) |
825 { | 825 { |
826 if (!current) | 826 if (!current) |
827 return false; | 827 return false; |
828 | 828 |
829 bool subtreeNeedsAnimateLayers = false; | 829 bool subtreeNeedsAnimateLayers = false; |
830 CCLayerAnimationController* currentController = current->layerAnimationContr
oller(); | 830 CCLayerAnimationController* currentController = current->layerAnimationContr
oller(); |
831 currentController->animate(monotonicTime, 0); | 831 currentController->animate(monotonicTime, 0); |
832 | 832 |
833 // If the current controller still has an active animation, we must continue
animating layers. | 833 // If the current controller still has an active animation, we must continue
animating layers. |
834 if (currentController->hasActiveAnimation()) | 834 if (currentController->hasActiveAnimation()) |
835 subtreeNeedsAnimateLayers = true; | 835 subtreeNeedsAnimateLayers = true; |
836 | 836 |
837 for (size_t i = 0; i < current->children().size(); ++i) { | 837 for (size_t i = 0; i < current->children().size(); ++i) { |
838 if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) | 838 if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) |
839 subtreeNeedsAnimateLayers = true; | 839 subtreeNeedsAnimateLayers = true; |
840 } | 840 } |
841 | |
842 return subtreeNeedsAnimateLayers; | 841 return subtreeNeedsAnimateLayers; |
843 } | 842 } |
844 | 843 |
845 void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector&
events, LayerChromium* layer, double wallClockTime) | 844 void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector&
events, LayerChromium* layer, double wallClockTime) |
846 { | 845 { |
847 if (!layer) | 846 if (!layer) |
848 return; | 847 return; |
849 | 848 |
850 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { | 849 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { |
851 if (layer->id() == events[eventIndex].layerId) { | 850 if (layer->id() == events[eventIndex].layerId) { |
852 if (events[eventIndex].type == CCAnimationEvent::Started) | 851 if (events[eventIndex].type == CCAnimationEvent::Started) |
853 layer->notifyAnimationStarted(events[eventIndex], wallClockTime)
; | 852 layer->notifyAnimationStarted(events[eventIndex], wallClockTime)
; |
854 else | 853 else |
855 layer->notifyAnimationFinished(wallClockTime); | 854 layer->notifyAnimationFinished(wallClockTime); |
856 } | 855 } |
857 } | 856 } |
858 | 857 |
859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 858 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 859 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
861 } | 860 } |
862 | 861 |
863 } // namespace cc | 862 } // namespace cc |
OLD | NEW |