OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 } | 1138 } |
1139 | 1139 |
1140 EXPECT_TRUE(it); | 1140 EXPECT_TRUE(it); |
1141 std::set<Tile*> unique_tiles; | 1141 std::set<Tile*> unique_tiles; |
1142 unique_tiles.insert(*it); | 1142 unique_tiles.insert(*it); |
1143 Tile* last_tile = *it; | 1143 Tile* last_tile = *it; |
1144 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; | 1144 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; |
1145 | 1145 |
1146 // On the second iteration, mark everything as ready to draw (solid color). | 1146 // On the second iteration, mark everything as ready to draw (solid color). |
1147 if (i == 1) { | 1147 if (i == 1) { |
1148 ManagedTileState::DrawInfo& draw_info = last_tile->draw_info(); | 1148 TileDrawInfo& draw_info = last_tile->draw_info(); |
1149 draw_info.SetSolidColorForTesting(SK_ColorRED); | 1149 draw_info.SetSolidColorForTesting(SK_ColorRED); |
1150 } | 1150 } |
1151 ++it; | 1151 ++it; |
1152 int eventually_bin_order_correct_count = 0; | 1152 int eventually_bin_order_correct_count = 0; |
1153 int eventually_bin_order_incorrect_count = 0; | 1153 int eventually_bin_order_incorrect_count = 0; |
1154 while (it) { | 1154 while (it) { |
1155 Tile* new_tile = *it; | 1155 Tile* new_tile = *it; |
1156 ++it; | 1156 ++it; |
1157 unique_tiles.insert(new_tile); | 1157 unique_tiles.insert(new_tile); |
1158 | 1158 |
(...skipping 15 matching lines...) Expand all Loading... |
1174 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); | 1174 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); |
1175 } | 1175 } |
1176 } | 1176 } |
1177 have_tiles[new_priority.priority_bin] = true; | 1177 have_tiles[new_priority.priority_bin] = true; |
1178 | 1178 |
1179 last_tile = new_tile; | 1179 last_tile = new_tile; |
1180 | 1180 |
1181 // On the second iteration, mark everything as ready to draw (solid | 1181 // On the second iteration, mark everything as ready to draw (solid |
1182 // color). | 1182 // color). |
1183 if (i == 1) { | 1183 if (i == 1) { |
1184 ManagedTileState::DrawInfo& draw_info = last_tile->draw_info(); | 1184 TileDrawInfo& draw_info = last_tile->draw_info(); |
1185 draw_info.SetSolidColorForTesting(SK_ColorRED); | 1185 draw_info.SetSolidColorForTesting(SK_ColorRED); |
1186 } | 1186 } |
1187 } | 1187 } |
1188 | 1188 |
1189 EXPECT_GT(eventually_bin_order_correct_count, | 1189 EXPECT_GT(eventually_bin_order_correct_count, |
1190 eventually_bin_order_incorrect_count); | 1190 eventually_bin_order_incorrect_count); |
1191 | 1191 |
1192 // We should have now and eventually tiles, as well as soon tiles from | 1192 // We should have now and eventually tiles, as well as soon tiles from |
1193 // the border region. | 1193 // the border region. |
1194 EXPECT_TRUE(have_tiles[TilePriority::NOW]); | 1194 EXPECT_TRUE(have_tiles[TilePriority::NOW]); |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 tiling_->SetRasterSourceAndResize(pile); | 2059 tiling_->SetRasterSourceAndResize(pile); |
2060 | 2060 |
2061 // Tile size in the tiling should be resized to 250x200. | 2061 // Tile size in the tiling should be resized to 250x200. |
2062 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); | 2062 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); |
2063 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); | 2063 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); |
2064 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); | 2064 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); |
2065 } | 2065 } |
2066 | 2066 |
2067 } // namespace | 2067 } // namespace |
2068 } // namespace cc | 2068 } // namespace cc |
OLD | NEW |