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 "cc/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 m_renderer->getFramebufferPixels(pixels, rect); | 879 m_renderer->getFramebufferPixels(pixels, rect); |
880 } | 880 } |
881 | 881 |
882 LayerImpl* LayerTreeHostImpl::rootLayer() const | 882 LayerImpl* LayerTreeHostImpl::rootLayer() const |
883 { | 883 { |
884 return m_activeTree->RootLayer(); | 884 return m_activeTree->RootLayer(); |
885 } | 885 } |
886 | 886 |
887 LayerImpl* LayerTreeHostImpl::rootScrollLayer() const | 887 LayerImpl* LayerTreeHostImpl::rootScrollLayer() const |
888 { | 888 { |
889 return m_activeTree->root_scroll_layer(); | 889 return m_activeTree->RootScrollLayer(); |
890 } | 890 } |
891 | 891 |
892 LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const | 892 LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const |
893 { | 893 { |
894 return m_activeTree->currently_scrolling_layer(); | 894 return m_activeTree->CurrentlyScrollingLayer(); |
895 } | 895 } |
896 | 896 |
897 // Content layers can be either directly scrollable or contained in an outer | 897 // Content layers can be either directly scrollable or contained in an outer |
898 // scrolling layer which applies the scroll transform. Given a content layer, | 898 // scrolling layer which applies the scroll transform. Given a content layer, |
899 // this function returns the associated scroll layer if any. | 899 // this function returns the associated scroll layer if any. |
900 static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) | 900 static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) |
901 { | 901 { |
902 if (!layerImpl) | 902 if (!layerImpl) |
903 return 0; | 903 return 0; |
904 | 904 |
905 if (layerImpl->scrollable()) | 905 if (layerImpl->scrollable()) |
906 return layerImpl; | 906 return layerImpl; |
907 | 907 |
908 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()-
>scrollable()) | 908 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()-
>scrollable()) |
909 return layerImpl->parent(); | 909 return layerImpl->parent(); |
910 | 910 |
911 return 0; | 911 return 0; |
912 } | 912 } |
913 | 913 |
914 LayerTreeImpl* LayerTreeHostImpl::activeTree() | |
915 { | |
916 return m_activeTree.get(); | |
917 } | |
918 | |
919 void LayerTreeHostImpl::createPendingTree() | 914 void LayerTreeHostImpl::createPendingTree() |
920 { | 915 { |
921 CHECK(!m_pendingTree); | 916 CHECK(!m_pendingTree); |
922 m_pendingTree = LayerTreeImpl::create(this); | 917 m_pendingTree = LayerTreeImpl::create(this); |
923 m_client->onCanDrawStateChanged(canDraw()); | 918 m_client->onCanDrawStateChanged(canDraw()); |
924 m_client->onHasPendingTreeStateChanged(pendingTree()); | 919 m_client->onHasPendingTreeStateChanged(pendingTree()); |
925 } | 920 } |
926 | 921 |
927 void LayerTreeHostImpl::checkForCompletedSetPixels() | 922 void LayerTreeHostImpl::checkForCompletedSetPixels() |
928 { | 923 { |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 | 1413 |
1419 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx
::Vector2d scrollOffset, float pageScale) | 1414 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx
::Vector2d scrollOffset, float pageScale) |
1420 { | 1415 { |
1421 if (!rootScrollLayer()) | 1416 if (!rootScrollLayer()) |
1422 return; | 1417 return; |
1423 | 1418 |
1424 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 1419 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
1425 scroll.layerId = rootScrollLayer()->id(); | 1420 scroll.layerId = rootScrollLayer()->id(); |
1426 scroll.scrollDelta = scrollOffset - rootScrollLayer()->scrollOffset(); | 1421 scroll.scrollDelta = scrollOffset - rootScrollLayer()->scrollOffset(); |
1427 scrollInfo->scrolls.push_back(scroll); | 1422 scrollInfo->scrolls.push_back(scroll); |
1428 activeTree()->root_scroll_layer()->setSentScrollDelta(scroll.scrollDelta); | 1423 activeTree()->RootScrollLayer()->setSentScrollDelta(scroll.scrollDelta); |
1429 scrollInfo->pageScaleDelta = pageScale / m_pinchZoomViewport.page_scale_fact
or(); | 1424 scrollInfo->pageScaleDelta = pageScale / m_pinchZoomViewport.page_scale_fact
or(); |
1430 m_pinchZoomViewport.set_sent_page_scale_delta(scrollInfo->pageScaleDelta); | 1425 m_pinchZoomViewport.set_sent_page_scale_delta(scrollInfo->pageScaleDelta); |
1431 } | 1426 } |
1432 | 1427 |
1433 static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerI
mpl) | 1428 static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerI
mpl) |
1434 { | 1429 { |
1435 if (!layerImpl) | 1430 if (!layerImpl) |
1436 return; | 1431 return; |
1437 | 1432 |
1438 if (!layerImpl->scrollDelta().IsZero()) { | 1433 if (!layerImpl->scrollDelta().IsZero()) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1669 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
1675 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1670 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
1676 } | 1671 } |
1677 | 1672 |
1678 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) | 1673 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) |
1679 { | 1674 { |
1680 m_paintTimeCounter->SavePaintTime(totalPaintTime); | 1675 m_paintTimeCounter->SavePaintTime(totalPaintTime); |
1681 } | 1676 } |
1682 | 1677 |
1683 } // namespace cc | 1678 } // namespace cc |
OLD | NEW |