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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 for (PictureLayerTiling::CoverageIterator iter( | 1531 for (PictureLayerTiling::CoverageIterator iter( |
1532 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); | 1532 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); |
1533 iter; | 1533 iter; |
1534 ++iter) { | 1534 ++iter) { |
1535 if (!*iter) | 1535 if (!*iter) |
1536 continue; | 1536 continue; |
1537 Tile* tile = *iter; | 1537 Tile* tile = *iter; |
1538 if (viewport_for_tile_priority.Intersects(iter.geometry_rect())) { | 1538 if (viewport_for_tile_priority.Intersects(iter.geometry_rect())) { |
1539 num_inside++; | 1539 num_inside++; |
1540 // Mark everything in viewport for tile priority as ready to draw. | 1540 // Mark everything in viewport for tile priority as ready to draw. |
1541 ManagedTileState::TileVersion& tile_version = | 1541 ManagedTileState::TileDrawInfo& draw_info = tile->GetTileDrawInfo(); |
1542 tile->GetTileVersionForTesting( | 1542 draw_info.SetSolidColorForTesting(SK_ColorRED); |
1543 tile->DetermineRasterModeForTree(PENDING_TREE)); | |
1544 tile_version.SetSolidColorForTesting(SK_ColorRED); | |
1545 } else { | 1543 } else { |
1546 num_outside++; | 1544 num_outside++; |
1547 EXPECT_FALSE(tile->required_for_activation()); | 1545 EXPECT_FALSE(tile->required_for_activation()); |
1548 } | 1546 } |
1549 } | 1547 } |
1550 | 1548 |
1551 EXPECT_GT(num_inside, 0); | 1549 EXPECT_GT(num_inside, 0); |
1552 EXPECT_GT(num_outside, 0); | 1550 EXPECT_GT(num_outside, 0); |
1553 | 1551 |
1554 // Activate and draw active layer. | 1552 // Activate and draw active layer. |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 | 2611 |
2614 pending_layer_->draw_properties().visible_content_rect = | 2612 pending_layer_->draw_properties().visible_content_rect = |
2615 gfx::Rect(0, 0, 500, 500); | 2613 gfx::Rect(0, 0, 500, 500); |
2616 pending_layer_->UpdateTiles(Occlusion()); | 2614 pending_layer_->UpdateTiles(Occlusion()); |
2617 | 2615 |
2618 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); | 2616 std::vector<Tile*> high_res_tiles = high_res_tiling->AllTilesForTesting(); |
2619 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); | 2617 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); |
2620 tile_it != high_res_tiles.end(); | 2618 tile_it != high_res_tiles.end(); |
2621 ++tile_it) { | 2619 ++tile_it) { |
2622 Tile* tile = *tile_it; | 2620 Tile* tile = *tile_it; |
2623 ManagedTileState::TileVersion& tile_version = | 2621 ManagedTileState::TileDrawInfo& draw_info = tile->GetTileDrawInfo(); |
2624 tile->GetTileVersionForTesting( | 2622 draw_info.SetSolidColorForTesting(SK_ColorRED); |
2625 tile->DetermineRasterModeForTree(ACTIVE_TREE)); | |
2626 tile_version.SetSolidColorForTesting(SK_ColorRED); | |
2627 } | 2623 } |
2628 | 2624 |
2629 non_ideal_tile_count = 0; | 2625 non_ideal_tile_count = 0; |
2630 low_res_tile_count = 0; | 2626 low_res_tile_count = 0; |
2631 high_res_tile_count = 0; | 2627 high_res_tile_count = 0; |
2632 for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); | 2628 for (it = PictureLayerImpl::LayerRasterTileIterator(pending_layer_, false); |
2633 it; | 2629 it; |
2634 ++it) { | 2630 ++it) { |
2635 Tile* tile = *it; | 2631 Tile* tile = *it; |
2636 TilePriority priority = tile->priority(PENDING_TREE); | 2632 TilePriority priority = tile->priority(PENDING_TREE); |
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4365 SetupPendingTree(pending_pile2); | 4361 SetupPendingTree(pending_pile2); |
4366 ActivateTree(); | 4362 ActivateTree(); |
4367 | 4363 |
4368 // We've switched to a solid color, so we should end up with no tilings. | 4364 // We've switched to a solid color, so we should end up with no tilings. |
4369 ASSERT_TRUE(active_layer_->tilings()); | 4365 ASSERT_TRUE(active_layer_->tilings()); |
4370 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4366 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
4371 } | 4367 } |
4372 | 4368 |
4373 } // namespace | 4369 } // namespace |
4374 } // namespace cc | 4370 } // namespace cc |
OLD | NEW |