Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 793573006: Refactoring for merging ManagedTileState into Tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename HasResources to HasResource Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 int num_outside = 0; 1667 int num_outside = 0;
1668 for (PictureLayerTiling::CoverageIterator iter( 1668 for (PictureLayerTiling::CoverageIterator iter(
1669 pending_layer_->HighResTiling(), 1.f, gfx::Rect(layer_bounds)); 1669 pending_layer_->HighResTiling(), 1.f, gfx::Rect(layer_bounds));
1670 iter; ++iter) { 1670 iter; ++iter) {
1671 if (!*iter) 1671 if (!*iter)
1672 continue; 1672 continue;
1673 Tile* tile = *iter; 1673 Tile* tile = *iter;
1674 if (viewport_for_tile_priority.Intersects(iter.geometry_rect())) { 1674 if (viewport_for_tile_priority.Intersects(iter.geometry_rect())) {
1675 num_inside++; 1675 num_inside++;
1676 // Mark everything in viewport for tile priority as ready to draw. 1676 // Mark everything in viewport for tile priority as ready to draw.
1677 ManagedTileState::DrawInfo& draw_info = tile->draw_info(); 1677 TileDrawInfo& draw_info = tile->draw_info();
1678 draw_info.SetSolidColorForTesting(SK_ColorRED); 1678 draw_info.SetSolidColorForTesting(SK_ColorRED);
1679 } else { 1679 } else {
1680 num_outside++; 1680 num_outside++;
1681 EXPECT_FALSE(tile->required_for_activation()); 1681 EXPECT_FALSE(tile->required_for_activation());
1682 } 1682 }
1683 } 1683 }
1684 1684
1685 EXPECT_GT(num_inside, 0); 1685 EXPECT_GT(num_inside, 0);
1686 EXPECT_GT(num_outside, 0); 1686 EXPECT_GT(num_outside, 0);
1687 1687
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 pending_layer_->draw_properties().visible_content_rect = 2812 pending_layer_->draw_properties().visible_content_rect =
2813 gfx::Rect(0, 0, 500, 500); 2813 gfx::Rect(0, 0, 500, 500);
2814 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); 2814 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw);
2815 2815
2816 std::vector<Tile*> high_res_tiles = 2816 std::vector<Tile*> high_res_tiles =
2817 pending_layer_->HighResTiling()->AllTilesForTesting(); 2817 pending_layer_->HighResTiling()->AllTilesForTesting();
2818 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin(); 2818 for (std::vector<Tile*>::iterator tile_it = high_res_tiles.begin();
2819 tile_it != high_res_tiles.end(); 2819 tile_it != high_res_tiles.end();
2820 ++tile_it) { 2820 ++tile_it) {
2821 Tile* tile = *tile_it; 2821 Tile* tile = *tile_it;
2822 ManagedTileState::DrawInfo& draw_info = tile->draw_info(); 2822 TileDrawInfo& draw_info = tile->draw_info();
2823 draw_info.SetSolidColorForTesting(SK_ColorRED); 2823 draw_info.SetSolidColorForTesting(SK_ColorRED);
2824 } 2824 }
2825 2825
2826 non_ideal_tile_count = 0; 2826 non_ideal_tile_count = 0;
2827 low_res_tile_count = 0; 2827 low_res_tile_count = 0;
2828 high_res_tile_count = 0; 2828 high_res_tile_count = 0;
2829 queue = pending_layer_->CreateRasterQueue(true); 2829 queue = pending_layer_->CreateRasterQueue(true);
2830 while (!queue->IsEmpty()) { 2830 while (!queue->IsEmpty()) {
2831 Tile* tile = queue->Top(); 2831 Tile* tile = queue->Top();
2832 TilePriority priority = tile->priority(PENDING_TREE); 2832 TilePriority priority = tile->priority(PENDING_TREE);
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
4758 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4758 result = layer->CalculateTileSize(gfx::Size(447, 400));
4759 EXPECT_EQ(result.width(), 448); 4759 EXPECT_EQ(result.width(), 448);
4760 EXPECT_EQ(result.height(), 448); 4760 EXPECT_EQ(result.height(), 448);
4761 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4761 result = layer->CalculateTileSize(gfx::Size(500, 499));
4762 EXPECT_EQ(result.width(), 512); 4762 EXPECT_EQ(result.width(), 512);
4763 EXPECT_EQ(result.height(), 500 + 2); 4763 EXPECT_EQ(result.height(), 500 + 2);
4764 } 4764 }
4765 4765
4766 } // namespace 4766 } // namespace
4767 } // namespace cc 4767 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698