| 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 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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()->SetPageScaleFactorAndLimits( | 
| 1799       page_scale_factor, page_scale_factor, page_scale_factor); | 1799       page_scale_factor, page_scale_factor, page_scale_factor); | 
| 1800   host_impl().active_tree()->SetRootLayer(root.Pass()); | 1800   host_impl().active_tree()->SetRootLayer(root.Pass()); | 
| 1801   host_impl().active_tree()->SetViewportLayersFromIds(1, 1, Layer::INVALID_ID); | 1801   host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 
|  | 1802                                                       Layer::INVALID_ID); | 
| 1802   host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1803   host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 
| 1803 | 1804 | 
| 1804   // Sanity check the scenario we just created. | 1805   // Sanity check the scenario we just created. | 
| 1805   // The visible content rect for test_layer is actually 100x100, even though | 1806   // The visible content rect for test_layer is actually 100x100, even though | 
| 1806   // its layout size is 50x50, positioned at 25x25. | 1807   // its layout size is 50x50, positioned at 25x25. | 
| 1807   LayerImpl* test_layer = | 1808   LayerImpl* test_layer = | 
| 1808       host_impl().active_tree()->root_layer()->children()[0]; | 1809       host_impl().active_tree()->root_layer()->children()[0]; | 
| 1809   ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1810   ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 
| 1810   ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1811   ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 
| 1811 | 1812 | 
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2294   float device_scale_factor = 3.f; | 2295   float device_scale_factor = 3.f; | 
| 2295   float page_scale_factor = 5.f; | 2296   float page_scale_factor = 5.f; | 
| 2296   gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( | 2297   gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( | 
| 2297       gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); | 2298       gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); | 
| 2298   host_impl().SetViewportSize(scaled_bounds_for_root); | 2299   host_impl().SetViewportSize(scaled_bounds_for_root); | 
| 2299 | 2300 | 
| 2300   host_impl().SetDeviceScaleFactor(device_scale_factor); | 2301   host_impl().SetDeviceScaleFactor(device_scale_factor); | 
| 2301   host_impl().active_tree()->SetPageScaleFactorAndLimits( | 2302   host_impl().active_tree()->SetPageScaleFactorAndLimits( | 
| 2302       page_scale_factor, page_scale_factor, page_scale_factor); | 2303       page_scale_factor, page_scale_factor, page_scale_factor); | 
| 2303   host_impl().active_tree()->SetRootLayer(root.Pass()); | 2304   host_impl().active_tree()->SetRootLayer(root.Pass()); | 
| 2304   host_impl().active_tree()->SetViewportLayersFromIds(1, 1, Layer::INVALID_ID); | 2305   host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 
|  | 2306                                                       Layer::INVALID_ID); | 
| 2305   host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2307   host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 
| 2306 | 2308 | 
| 2307   // Sanity check the scenario we just created. | 2309   // Sanity check the scenario we just created. | 
| 2308   ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 2310   ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 
| 2309 | 2311 | 
| 2310   LayerSelectionBound left_input; | 2312   LayerSelectionBound left_input; | 
| 2311   left_input.type = SELECTION_BOUND_LEFT; | 2313   left_input.type = SELECTION_BOUND_LEFT; | 
| 2312   left_input.edge_top = gfx::PointF(10, 10); | 2314   left_input.edge_top = gfx::PointF(10, 10); | 
| 2313   left_input.edge_bottom = gfx::PointF(10, 30); | 2315   left_input.edge_bottom = gfx::PointF(10, 30); | 
| 2314   left_input.layer_id = root_layer_id; | 2316   left_input.layer_id = root_layer_id; | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2356   EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2358   EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 
| 2357   scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2359   scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 
| 2358   root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2360   root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 
| 2359   root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2361   root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 
| 2360   root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2362   root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 
| 2361   EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2363   EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 
| 2362 } | 2364 } | 
| 2363 | 2365 | 
| 2364 }  // namespace | 2366 }  // namespace | 
| 2365 }  // namespace cc | 2367 }  // namespace cc | 
| OLD | NEW | 
|---|