| 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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 { | 883 { |
| 884 m_client->onSwapBuffersCompleteOnImplThread(); | 884 m_client->onSwapBuffersCompleteOnImplThread(); |
| 885 } | 885 } |
| 886 | 886 |
| 887 void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect) | 887 void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect) |
| 888 { | 888 { |
| 889 DCHECK(m_renderer); | 889 DCHECK(m_renderer); |
| 890 m_renderer->getFramebufferPixels(pixels, rect); | 890 m_renderer->getFramebufferPixels(pixels, rect); |
| 891 } | 891 } |
| 892 | 892 |
| 893 bool LayerTreeHostImpl::haveRootScrollLayer() const { |
| 894 return rootScrollLayer(); |
| 895 } |
| 896 |
| 897 float LayerTreeHostImpl::rootScrollLayerTotalScrollY() const { |
| 898 if (LayerImpl* layer = rootScrollLayer()) |
| 899 return layer->scrollOffset().y() + layer->scrollDelta().y(); |
| 900 return 0.0f; |
| 901 } |
| 902 |
| 893 LayerImpl* LayerTreeHostImpl::rootLayer() const | 903 LayerImpl* LayerTreeHostImpl::rootLayer() const |
| 894 { | 904 { |
| 895 return m_activeTree->RootLayer(); | 905 return m_activeTree->RootLayer(); |
| 896 } | 906 } |
| 897 | 907 |
| 898 LayerImpl* LayerTreeHostImpl::rootScrollLayer() const | 908 LayerImpl* LayerTreeHostImpl::rootScrollLayer() const |
| 899 { | 909 { |
| 900 return m_activeTree->root_scroll_layer(); | 910 return m_activeTree->RootScrollLayer(); |
| 901 } | 911 } |
| 902 | 912 |
| 903 LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const | 913 LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const |
| 904 { | 914 { |
| 905 return m_activeTree->currently_scrolling_layer(); | 915 return m_activeTree->CurrentlyScrollingLayer(); |
| 906 } | 916 } |
| 907 | 917 |
| 908 // Content layers can be either directly scrollable or contained in an outer | 918 // Content layers can be either directly scrollable or contained in an outer |
| 909 // scrolling layer which applies the scroll transform. Given a content layer, | 919 // scrolling layer which applies the scroll transform. Given a content layer, |
| 910 // this function returns the associated scroll layer if any. | 920 // this function returns the associated scroll layer if any. |
| 911 static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) | 921 static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) |
| 912 { | 922 { |
| 913 if (!layerImpl) | 923 if (!layerImpl) |
| 914 return 0; | 924 return 0; |
| 915 | 925 |
| 916 if (layerImpl->scrollable()) | 926 if (layerImpl->scrollable()) |
| 917 return layerImpl; | 927 return layerImpl; |
| 918 | 928 |
| 919 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()-
>scrollable()) | 929 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()-
>scrollable()) |
| 920 return layerImpl->parent(); | 930 return layerImpl->parent(); |
| 921 | 931 |
| 922 return 0; | 932 return 0; |
| 923 } | 933 } |
| 924 | 934 |
| 925 LayerTreeImpl* LayerTreeHostImpl::activeTree() | |
| 926 { | |
| 927 return m_activeTree.get(); | |
| 928 } | |
| 929 | |
| 930 void LayerTreeHostImpl::createPendingTree() | 935 void LayerTreeHostImpl::createPendingTree() |
| 931 { | 936 { |
| 932 CHECK(!m_pendingTree); | 937 CHECK(!m_pendingTree); |
| 933 m_pendingTree = LayerTreeImpl::create(this); | 938 m_pendingTree = LayerTreeImpl::create(this); |
| 934 m_client->onCanDrawStateChanged(canDraw()); | 939 m_client->onCanDrawStateChanged(canDraw()); |
| 935 m_client->onHasPendingTreeStateChanged(pendingTree()); | 940 m_client->onHasPendingTreeStateChanged(pendingTree()); |
| 936 } | 941 } |
| 937 | 942 |
| 938 void LayerTreeHostImpl::checkForCompletedTextures() | 943 void LayerTreeHostImpl::checkForCompletedTextures() |
| 939 { | 944 { |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 | 1421 |
| 1417 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx
::Vector2d scrollOffset, float pageScale) | 1422 void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx
::Vector2d scrollOffset, float pageScale) |
| 1418 { | 1423 { |
| 1419 if (!rootScrollLayer()) | 1424 if (!rootScrollLayer()) |
| 1420 return; | 1425 return; |
| 1421 | 1426 |
| 1422 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 1427 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
| 1423 scroll.layerId = rootScrollLayer()->id(); | 1428 scroll.layerId = rootScrollLayer()->id(); |
| 1424 scroll.scrollDelta = scrollOffset - rootScrollLayer()->scrollOffset(); | 1429 scroll.scrollDelta = scrollOffset - rootScrollLayer()->scrollOffset(); |
| 1425 scrollInfo->scrolls.push_back(scroll); | 1430 scrollInfo->scrolls.push_back(scroll); |
| 1426 activeTree()->root_scroll_layer()->setSentScrollDelta(scroll.scrollDelta); | 1431 activeTree()->RootScrollLayer()->setSentScrollDelta(scroll.scrollDelta); |
| 1427 scrollInfo->pageScaleDelta = pageScale / m_pinchZoomViewport.page_scale_fact
or(); | 1432 scrollInfo->pageScaleDelta = pageScale / m_pinchZoomViewport.page_scale_fact
or(); |
| 1428 m_pinchZoomViewport.set_sent_page_scale_delta(scrollInfo->pageScaleDelta); | 1433 m_pinchZoomViewport.set_sent_page_scale_delta(scrollInfo->pageScaleDelta); |
| 1429 } | 1434 } |
| 1430 | 1435 |
| 1431 static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerI
mpl) | 1436 static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerI
mpl) |
| 1432 { | 1437 { |
| 1433 if (!layerImpl) | 1438 if (!layerImpl) |
| 1434 return; | 1439 return; |
| 1435 | 1440 |
| 1436 if (!layerImpl->scrollDelta().IsZero()) { | 1441 if (!layerImpl->scrollDelta().IsZero()) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); | 1677 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); |
| 1673 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); | 1678 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); |
| 1674 } | 1679 } |
| 1675 | 1680 |
| 1676 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) | 1681 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) |
| 1677 { | 1682 { |
| 1678 m_paintTimeCounter->SavePaintTime(totalPaintTime); | 1683 m_paintTimeCounter->SavePaintTime(totalPaintTime); |
| 1679 } | 1684 } |
| 1680 | 1685 |
| 1681 } // namespace cc | 1686 } // namespace cc |
| OLD | NEW |