OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 root->AddChild(test_layer.Pass()); | 1788 root->AddChild(test_layer.Pass()); |
1789 } | 1789 } |
1790 | 1790 |
1791 float device_scale_factor = 3.f; | 1791 float device_scale_factor = 3.f; |
1792 float page_scale_factor = 5.f; | 1792 float page_scale_factor = 5.f; |
1793 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( | 1793 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( |
1794 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); | 1794 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); |
1795 host_impl().SetViewportSize(scaled_bounds_for_root); | 1795 host_impl().SetViewportSize(scaled_bounds_for_root); |
1796 | 1796 |
1797 host_impl().SetDeviceScaleFactor(device_scale_factor); | 1797 host_impl().SetDeviceScaleFactor(device_scale_factor); |
1798 host_impl().active_tree()->SetPageScaleFactorAndLimits( | 1798 host_impl().active_tree()->PushPageScaleFromMainThread( |
1799 page_scale_factor, page_scale_factor, page_scale_factor); | 1799 page_scale_factor, page_scale_factor, page_scale_factor); |
| 1800 host_impl().SetPageScaleOnActiveTree(page_scale_factor); |
1800 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1801 host_impl().active_tree()->SetRootLayer(root.Pass()); |
1801 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 1802 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, |
1802 Layer::INVALID_ID); | 1803 Layer::INVALID_ID); |
1803 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1804 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1804 | 1805 |
1805 // Sanity check the scenario we just created. | 1806 // Sanity check the scenario we just created. |
1806 // The visible content rect for test_layer is actually 100x100, even though | 1807 // The visible content rect for test_layer is actually 100x100, even though |
1807 // its layout size is 50x50, positioned at 25x25. | 1808 // its layout size is 50x50, positioned at 25x25. |
1808 LayerImpl* test_layer = | 1809 LayerImpl* test_layer = |
1809 host_impl().active_tree()->root_layer()->children()[0]; | 1810 host_impl().active_tree()->root_layer()->children()[0]; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 root->AddChild(sub_layer.Pass()); | 2293 root->AddChild(sub_layer.Pass()); |
2293 } | 2294 } |
2294 | 2295 |
2295 float device_scale_factor = 3.f; | 2296 float device_scale_factor = 3.f; |
2296 float page_scale_factor = 5.f; | 2297 float page_scale_factor = 5.f; |
2297 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( | 2298 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( |
2298 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); | 2299 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); |
2299 host_impl().SetViewportSize(scaled_bounds_for_root); | 2300 host_impl().SetViewportSize(scaled_bounds_for_root); |
2300 | 2301 |
2301 host_impl().SetDeviceScaleFactor(device_scale_factor); | 2302 host_impl().SetDeviceScaleFactor(device_scale_factor); |
2302 host_impl().active_tree()->SetPageScaleFactorAndLimits( | 2303 host_impl().active_tree()->PushPageScaleFromMainThread( |
2303 page_scale_factor, page_scale_factor, page_scale_factor); | 2304 page_scale_factor, page_scale_factor, page_scale_factor); |
| 2305 host_impl().SetPageScaleOnActiveTree(page_scale_factor); |
2304 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2306 host_impl().active_tree()->SetRootLayer(root.Pass()); |
2305 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 2307 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, |
2306 Layer::INVALID_ID); | 2308 Layer::INVALID_ID); |
2307 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2309 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
2308 | 2310 |
2309 // Sanity check the scenario we just created. | 2311 // Sanity check the scenario we just created. |
2310 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 2312 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
2311 | 2313 |
2312 LayerSelectionBound left_input; | 2314 LayerSelectionBound left_input; |
2313 left_input.type = SELECTION_BOUND_LEFT; | 2315 left_input.type = SELECTION_BOUND_LEFT; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2360 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
2359 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2361 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
2360 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2362 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
2361 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2363 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
2362 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2364 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
2363 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2365 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
2364 } | 2366 } |
2365 | 2367 |
2366 } // namespace | 2368 } // namespace |
2367 } // namespace cc | 2369 } // namespace cc |
OLD | NEW |