| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "cc/layers/heads_up_display_layer_impl.h" | 9 #include "cc/layers/heads_up_display_layer_impl.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 } | 1432 } |
| 1433 | 1433 |
| 1434 float device_scale_factor = 3.f; | 1434 float device_scale_factor = 3.f; |
| 1435 float page_scale_factor = 5.f; | 1435 float page_scale_factor = 5.f; |
| 1436 float max_page_scale_factor = 10.f; | 1436 float max_page_scale_factor = 10.f; |
| 1437 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( | 1437 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( |
| 1438 root->bounds(), device_scale_factor * page_scale_factor); | 1438 root->bounds(), device_scale_factor * page_scale_factor); |
| 1439 host_impl().SetViewportSize(scaled_bounds_for_root); | 1439 host_impl().SetViewportSize(scaled_bounds_for_root); |
| 1440 | 1440 |
| 1441 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); | 1441 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); |
| 1442 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 1442 host_impl().active_tree()->SetViewportLayersFromIds( |
| 1443 Layer::INVALID_ID); | 1443 Layer::INVALID_ID, 1, Layer::INVALID_ID, Layer::INVALID_ID, 1, |
| 1444 Layer::INVALID_ID); |
| 1444 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 1445 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 1445 host_impl().active_tree()->PushPageScaleFromMainThread( | 1446 host_impl().active_tree()->PushPageScaleFromMainThread( |
| 1446 page_scale_factor, page_scale_factor, max_page_scale_factor); | 1447 page_scale_factor, page_scale_factor, max_page_scale_factor); |
| 1447 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 1448 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 1448 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1449 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1449 | 1450 |
| 1450 // Sanity check the scenario we just created. | 1451 // Sanity check the scenario we just created. |
| 1451 // The visible content rect for test_layer is actually 100x100, even though | 1452 // The visible content rect for test_layer is actually 100x100, even though |
| 1452 // its layout size is 50x50, positioned at 25x25. | 1453 // its layout size is 50x50, positioned at 25x25. |
| 1453 LayerImpl* test_layer = root->test_properties()->children[0]; | 1454 LayerImpl* test_layer = root->test_properties()->children[0]; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 } | 1660 } |
| 1660 | 1661 |
| 1661 float device_scale_factor = 3.f; | 1662 float device_scale_factor = 3.f; |
| 1662 float page_scale_factor = 1.f; | 1663 float page_scale_factor = 1.f; |
| 1663 float max_page_scale_factor = 1.f; | 1664 float max_page_scale_factor = 1.f; |
| 1664 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( | 1665 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( |
| 1665 root->bounds(), device_scale_factor * page_scale_factor); | 1666 root->bounds(), device_scale_factor * page_scale_factor); |
| 1666 host_impl().SetViewportSize(scaled_bounds_for_root); | 1667 host_impl().SetViewportSize(scaled_bounds_for_root); |
| 1667 | 1668 |
| 1668 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); | 1669 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); |
| 1669 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 1670 host_impl().active_tree()->SetViewportLayersFromIds( |
| 1670 Layer::INVALID_ID); | 1671 Layer::INVALID_ID, 1, Layer::INVALID_ID, Layer::INVALID_ID, 1, |
| 1672 Layer::INVALID_ID); |
| 1671 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 1673 host_impl().active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 1672 host_impl().active_tree()->PushPageScaleFromMainThread( | 1674 host_impl().active_tree()->PushPageScaleFromMainThread( |
| 1673 page_scale_factor, page_scale_factor, max_page_scale_factor); | 1675 page_scale_factor, page_scale_factor, max_page_scale_factor); |
| 1674 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 1676 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 1675 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1677 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1676 | 1678 |
| 1677 // Sanity check the scenario we just created. | 1679 // Sanity check the scenario we just created. |
| 1678 ASSERT_EQ(2u, GetRenderSurfaceList().size()); | 1680 ASSERT_EQ(2u, GetRenderSurfaceList().size()); |
| 1679 | 1681 |
| 1680 // Hit checking for a point outside the layer should return a null pointer. | 1682 // Hit checking for a point outside the layer should return a null pointer. |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 | 2054 |
| 2053 host_impl().active_tree()->BuildPropertyTreesForTesting(); | 2055 host_impl().active_tree()->BuildPropertyTreesForTesting(); |
| 2054 | 2056 |
| 2055 float device_scale_factor = 3.f; | 2057 float device_scale_factor = 3.f; |
| 2056 float page_scale_factor = 5.f; | 2058 float page_scale_factor = 5.f; |
| 2057 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( | 2059 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( |
| 2058 root->bounds(), device_scale_factor * page_scale_factor); | 2060 root->bounds(), device_scale_factor * page_scale_factor); |
| 2059 host_impl().SetViewportSize(scaled_bounds_for_root); | 2061 host_impl().SetViewportSize(scaled_bounds_for_root); |
| 2060 | 2062 |
| 2061 host_impl().active_tree()->SetViewportLayersFromIds( | 2063 host_impl().active_tree()->SetViewportLayersFromIds( |
| 2062 Layer::INVALID_ID, root->id(), Layer::INVALID_ID, Layer::INVALID_ID); | 2064 Layer::INVALID_ID, root->id(), Layer::INVALID_ID, Layer::INVALID_ID, |
| 2065 Layer::INVALID_ID, Layer::INVALID_ID); |
| 2063 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); | 2066 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); |
| 2064 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 2067 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 2065 | 2068 |
| 2066 host_impl().active_tree()->PushPageScaleFromMainThread( | 2069 host_impl().active_tree()->PushPageScaleFromMainThread( |
| 2067 page_scale_factor, page_scale_factor, page_scale_factor); | 2070 page_scale_factor, page_scale_factor, page_scale_factor); |
| 2068 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 2071 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 2069 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2072 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 2070 | 2073 |
| 2071 // Sanity check the scenario we just created. | 2074 // Sanity check the scenario we just created. |
| 2072 ASSERT_EQ(1u, GetRenderSurfaceList().size()); | 2075 ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 auto weak_promise = promise->AsWeakPtr(); | 2353 auto weak_promise = promise->AsWeakPtr(); |
| 2351 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); | 2354 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); |
| 2352 host_impl().active_tree()->BreakSwapPromises( | 2355 host_impl().active_tree()->BreakSwapPromises( |
| 2353 SwapPromise::DidNotSwapReason::SWAP_FAILS); | 2356 SwapPromise::DidNotSwapReason::SWAP_FAILS); |
| 2354 EXPECT_FALSE(weak_promise); | 2357 EXPECT_FALSE(weak_promise); |
| 2355 } | 2358 } |
| 2356 } | 2359 } |
| 2357 | 2360 |
| 2358 } // namespace | 2361 } // namespace |
| 2359 } // namespace cc | 2362 } // namespace cc |
| OLD | NEW |