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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set
tings, this, &m_proxy); | 112 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set
tings, this, &m_proxy); |
113 | 113 |
114 myHostImpl->initializeRenderer(graphicsContext.Pass()); | 114 myHostImpl->initializeRenderer(graphicsContext.Pass()); |
115 myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 115 myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); |
116 | 116 |
117 root->setAnchorPoint(gfx::PointF(0, 0)); | 117 root->setAnchorPoint(gfx::PointF(0, 0)); |
118 root->setPosition(gfx::PointF(0, 0)); | 118 root->setPosition(gfx::PointF(0, 0)); |
119 root->setBounds(gfx::Size(10, 10)); | 119 root->setBounds(gfx::Size(10, 10)); |
120 root->setContentBounds(gfx::Size(10, 10)); | 120 root->setContentBounds(gfx::Size(10, 10)); |
121 root->setVisibleContentRect(gfx::Rect(0, 0, 10, 10)); | |
122 root->setDrawsContent(true); | 121 root->setDrawsContent(true); |
| 122 root->drawProperties().visibleContentRect = gfx::Rect(0, 0, 10, 10); |
123 myHostImpl->setRootLayer(root.Pass()); | 123 myHostImpl->setRootLayer(root.Pass()); |
124 return myHostImpl.Pass(); | 124 return myHostImpl.Pass(); |
125 } | 125 } |
126 | 126 |
127 static void expectClearedScrollDeltasRecursive(LayerImpl* layer) | 127 static void expectClearedScrollDeltasRecursive(LayerImpl* layer) |
128 { | 128 { |
129 ASSERT_EQ(layer->scrollDelta(), gfx::Vector2d()); | 129 ASSERT_EQ(layer->scrollDelta(), gfx::Vector2d()); |
130 for (size_t i = 0; i < layer->children().size(); ++i) | 130 for (size_t i = 0; i < layer->children().size(); ++i) |
131 expectClearedScrollDeltasRecursive(layer->children()[i]); | 131 expectClearedScrollDeltasRecursive(layer->children()[i]); |
132 } | 132 } |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 explicit DidDrawCheckLayer(int id) | 898 explicit DidDrawCheckLayer(int id) |
899 : TiledLayerImpl(id) | 899 : TiledLayerImpl(id) |
900 , m_didDrawCalled(false) | 900 , m_didDrawCalled(false) |
901 , m_willDrawCalled(false) | 901 , m_willDrawCalled(false) |
902 { | 902 { |
903 setAnchorPoint(gfx::PointF(0, 0)); | 903 setAnchorPoint(gfx::PointF(0, 0)); |
904 setBounds(gfx::Size(10, 10)); | 904 setBounds(gfx::Size(10, 10)); |
905 setContentBounds(gfx::Size(10, 10)); | 905 setContentBounds(gfx::Size(10, 10)); |
906 setDrawsContent(true); | 906 setDrawsContent(true); |
907 setSkipsDraw(false); | 907 setSkipsDraw(false); |
908 setVisibleContentRect(gfx::Rect(0, 0, 10, 10)); | 908 drawProperties().visibleContentRect = gfx::Rect(0, 0, 10, 10); |
909 | 909 |
910 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10
0, 100), LayerTilingData::HasBorderTexels); | 910 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10
0, 100), LayerTilingData::HasBorderTexels); |
911 tiler->setBounds(contentBounds()); | 911 tiler->setBounds(contentBounds()); |
912 setTilingData(*tiler.get()); | 912 setTilingData(*tiler.get()); |
913 } | 913 } |
914 | 914 |
915 private: | 915 private: |
916 bool m_didDrawCalled; | 916 bool m_didDrawCalled; |
917 bool m_willDrawCalled; | 917 bool m_willDrawCalled; |
918 }; | 918 }; |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 | 2371 |
2372 gfx::Rect rootRect(0, 0, 100, 100); | 2372 gfx::Rect rootRect(0, 0, 100, 100); |
2373 gfx::Rect childRect(10, 10, 50, 50); | 2373 gfx::Rect childRect(10, 10, 50, 50); |
2374 gfx::Rect grandChildRect(5, 5, 150, 150); | 2374 gfx::Rect grandChildRect(5, 5, 150, 150); |
2375 | 2375 |
2376 root->createRenderSurface(); | 2376 root->createRenderSurface(); |
2377 root->setAnchorPoint(gfx::PointF(0, 0)); | 2377 root->setAnchorPoint(gfx::PointF(0, 0)); |
2378 root->setPosition(gfx::PointF(rootRect.x(), rootRect.y())); | 2378 root->setPosition(gfx::PointF(rootRect.x(), rootRect.y())); |
2379 root->setBounds(gfx::Size(rootRect.width(), rootRect.height())); | 2379 root->setBounds(gfx::Size(rootRect.width(), rootRect.height())); |
2380 root->setContentBounds(root->bounds()); | 2380 root->setContentBounds(root->bounds()); |
2381 root->setVisibleContentRect(rootRect); | 2381 root->drawProperties().visibleContentRect = rootRect; |
2382 root->setDrawsContent(false); | 2382 root->setDrawsContent(false); |
2383 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root
Rect.width(), rootRect.height()))); | 2383 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root
Rect.width(), rootRect.height()))); |
2384 | 2384 |
2385 child->setAnchorPoint(gfx::PointF(0, 0)); | 2385 child->setAnchorPoint(gfx::PointF(0, 0)); |
2386 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); | 2386 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); |
2387 child->setOpacity(0.5f); | 2387 child->setOpacity(0.5f); |
2388 child->setBounds(gfx::Size(childRect.width(), childRect.height())); | 2388 child->setBounds(gfx::Size(childRect.width(), childRect.height())); |
2389 child->setContentBounds(child->bounds()); | 2389 child->setContentBounds(child->bounds()); |
2390 child->setVisibleContentRect(childRect); | 2390 child->drawProperties().visibleContentRect = childRect; |
2391 child->setDrawsContent(false); | 2391 child->setDrawsContent(false); |
2392 child->setForceRenderSurface(true); | 2392 child->setForceRenderSurface(true); |
2393 | 2393 |
2394 grandChild->setAnchorPoint(gfx::PointF(0, 0)); | 2394 grandChild->setAnchorPoint(gfx::PointF(0, 0)); |
2395 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); | 2395 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); |
2396 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh
t())); | 2396 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh
t())); |
2397 grandChild->setContentBounds(grandChild->bounds()); | 2397 grandChild->setContentBounds(grandChild->bounds()); |
2398 grandChild->setVisibleContentRect(grandChildRect); | 2398 grandChild->drawProperties().visibleContentRect = grandChildRect; |
2399 grandChild->setDrawsContent(true); | 2399 grandChild->setDrawsContent(true); |
2400 | 2400 |
2401 child->addChild(grandChild.Pass()); | 2401 child->addChild(grandChild.Pass()); |
2402 root->addChild(child.Pass()); | 2402 root->addChild(child.Pass()); |
2403 | 2403 |
2404 myHostImpl->setRootLayer(root.Pass()); | 2404 myHostImpl->setRootLayer(root.Pass()); |
2405 return myHostImpl.Pass(); | 2405 return myHostImpl.Pass(); |
2406 } | 2406 } |
2407 | 2407 |
2408 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) | 2408 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) |
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4892 { | 4892 { |
4893 pinchZoomPanViewportAndScrollBoundaryTest(2); | 4893 pinchZoomPanViewportAndScrollBoundaryTest(2); |
4894 } | 4894 } |
4895 | 4895 |
4896 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4896 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4897 LayerTreeHostImplTest, | 4897 LayerTreeHostImplTest, |
4898 ::testing::Values(false, true)); | 4898 ::testing::Values(false, true)); |
4899 | 4899 |
4900 } // namespace | 4900 } // namespace |
4901 } // namespace cc | 4901 } // namespace cc |
OLD | NEW |