OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 // No invalidation. | 2093 // No invalidation. |
2094 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); | 2094 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
2095 | 2095 |
2096 // Verify active tree not ready. | 2096 // Verify active tree not ready. |
2097 Tile* some_active_tile = | 2097 Tile* some_active_tile = |
2098 active_layer_->HighResTiling()->AllTilesForTesting()[0]; | 2098 active_layer_->HighResTiling()->AllTilesForTesting()[0]; |
2099 EXPECT_FALSE(some_active_tile->draw_info().IsReadyToDraw()); | 2099 EXPECT_FALSE(some_active_tile->draw_info().IsReadyToDraw()); |
2100 | 2100 |
2101 // When high res are required, all tiles in active high res tiling should be | 2101 // When high res are required, all tiles in active high res tiling should be |
2102 // required for activation. | 2102 // required for activation. |
2103 host_impl_.SetRequiresHighResToDraw(); | 2103 host_impl_.SetRequiresHighResToDraw(true); |
2104 | 2104 |
2105 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); | 2105 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); |
2106 pending_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); | 2106 pending_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); |
2107 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); | 2107 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); |
2108 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); | 2108 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); |
2109 | 2109 |
2110 EXPECT_TRUE(pending_layer_->HighResTiling()->AllTilesForTesting().empty()); | 2110 EXPECT_TRUE(pending_layer_->HighResTiling()->AllTilesForTesting().empty()); |
2111 EXPECT_TRUE(pending_layer_->LowResTiling()->AllTilesForTesting().empty()); | 2111 EXPECT_TRUE(pending_layer_->LowResTiling()->AllTilesForTesting().empty()); |
2112 AssertAllTilesRequired(active_layer_->HighResTiling()); | 2112 AssertAllTilesRequired(active_layer_->HighResTiling()); |
2113 AssertNoTilesRequired(active_layer_->LowResTiling()); | 2113 AssertNoTilesRequired(active_layer_->LowResTiling()); |
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4737 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4737 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4738 scoped_refptr<FakePicturePileImpl> active_pile = | 4738 scoped_refptr<FakePicturePileImpl> active_pile = |
4739 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4739 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4740 | 4740 |
4741 SetupTrees(pending_pile, active_pile); | 4741 SetupTrees(pending_pile, active_pile); |
4742 | 4742 |
4743 Region invalidation; | 4743 Region invalidation; |
4744 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100); | 4744 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100); |
4745 gfx::Transform transform; | 4745 gfx::Transform transform; |
4746 | 4746 |
4747 host_impl_.SetRequiresHighResToDraw(); | 4747 host_impl_.SetRequiresHighResToDraw(true); |
4748 | 4748 |
4749 // Update tiles. | 4749 // Update tiles. |
4750 pending_layer_->draw_properties().visible_content_rect = viewport; | 4750 pending_layer_->draw_properties().visible_content_rect = viewport; |
4751 pending_layer_->draw_properties().screen_space_transform = transform; | 4751 pending_layer_->draw_properties().screen_space_transform = transform; |
4752 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, | 4752 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, |
4753 false); | 4753 false); |
4754 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); | 4754 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); |
4755 | 4755 |
4756 // Ensure we can't activate. | 4756 // Ensure we can't activate. |
4757 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate()); | 4757 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate()); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5102 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 5102 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
5103 EXPECT_EQ(result.width(), 448); | 5103 EXPECT_EQ(result.width(), 448); |
5104 EXPECT_EQ(result.height(), 448); | 5104 EXPECT_EQ(result.height(), 448); |
5105 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 5105 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
5106 EXPECT_EQ(result.width(), 512); | 5106 EXPECT_EQ(result.width(), 512); |
5107 EXPECT_EQ(result.height(), 500 + 2); | 5107 EXPECT_EQ(result.height(), 500 + 2); |
5108 } | 5108 } |
5109 | 5109 |
5110 } // namespace | 5110 } // namespace |
5111 } // namespace cc | 5111 } // namespace cc |
OLD | NEW |