| 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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 EXPECT_TRUE(it); | 1111 EXPECT_TRUE(it); |
| 1112 std::set<Tile*> unique_tiles; | 1112 std::set<Tile*> unique_tiles; |
| 1113 unique_tiles.insert(*it); | 1113 unique_tiles.insert(*it); |
| 1114 Tile* last_tile = *it; | 1114 Tile* last_tile = *it; |
| 1115 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; | 1115 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; |
| 1116 | 1116 |
| 1117 // On the second iteration, mark everything as ready to draw (solid color). | 1117 // On the second iteration, mark everything as ready to draw (solid color). |
| 1118 if (i == 1) { | 1118 if (i == 1) { |
| 1119 ManagedTileState::TileVersion& tile_version = | 1119 ManagedTileState::TileDrawInfo& draw_info = last_tile->GetTileDrawInfo(); |
| 1120 last_tile->GetTileVersionForTesting( | 1120 draw_info.SetSolidColorForTesting(SK_ColorRED); |
| 1121 last_tile->DetermineRasterModeForTree(ACTIVE_TREE)); | |
| 1122 tile_version.SetSolidColorForTesting(SK_ColorRED); | |
| 1123 } | 1121 } |
| 1124 ++it; | 1122 ++it; |
| 1125 int eventually_bin_order_correct_count = 0; | 1123 int eventually_bin_order_correct_count = 0; |
| 1126 int eventually_bin_order_incorrect_count = 0; | 1124 int eventually_bin_order_incorrect_count = 0; |
| 1127 while (it) { | 1125 while (it) { |
| 1128 Tile* new_tile = *it; | 1126 Tile* new_tile = *it; |
| 1129 ++it; | 1127 ++it; |
| 1130 unique_tiles.insert(new_tile); | 1128 unique_tiles.insert(new_tile); |
| 1131 | 1129 |
| 1132 TilePriority last_priority = last_tile->priority(ACTIVE_TREE); | 1130 TilePriority last_priority = last_tile->priority(ACTIVE_TREE); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1147 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); | 1145 EXPECT_EQ(TilePriority::SOON, new_priority.priority_bin); |
| 1148 } | 1146 } |
| 1149 } | 1147 } |
| 1150 have_tiles[new_priority.priority_bin] = true; | 1148 have_tiles[new_priority.priority_bin] = true; |
| 1151 | 1149 |
| 1152 last_tile = new_tile; | 1150 last_tile = new_tile; |
| 1153 | 1151 |
| 1154 // On the second iteration, mark everything as ready to draw (solid | 1152 // On the second iteration, mark everything as ready to draw (solid |
| 1155 // color). | 1153 // color). |
| 1156 if (i == 1) { | 1154 if (i == 1) { |
| 1157 ManagedTileState::TileVersion& tile_version = | 1155 ManagedTileState::TileDrawInfo& draw_info = |
| 1158 last_tile->GetTileVersionForTesting( | 1156 last_tile->GetTileDrawInfo(); |
| 1159 last_tile->DetermineRasterModeForTree(ACTIVE_TREE)); | 1157 draw_info.SetSolidColorForTesting(SK_ColorRED); |
| 1160 tile_version.SetSolidColorForTesting(SK_ColorRED); | |
| 1161 } | 1158 } |
| 1162 } | 1159 } |
| 1163 | 1160 |
| 1164 EXPECT_GT(eventually_bin_order_correct_count, | 1161 EXPECT_GT(eventually_bin_order_correct_count, |
| 1165 eventually_bin_order_incorrect_count); | 1162 eventually_bin_order_incorrect_count); |
| 1166 | 1163 |
| 1167 // We should have now and eventually tiles, as well as soon tiles from | 1164 // We should have now and eventually tiles, as well as soon tiles from |
| 1168 // the border region. | 1165 // the border region. |
| 1169 EXPECT_TRUE(have_tiles[TilePriority::NOW]); | 1166 EXPECT_TRUE(have_tiles[TilePriority::NOW]); |
| 1170 EXPECT_TRUE(have_tiles[TilePriority::SOON]); | 1167 EXPECT_TRUE(have_tiles[TilePriority::SOON]); |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0)); | 2163 EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0)); |
| 2167 | 2164 |
| 2168 // Reset the active tiling. The recycle tiles should be released too. | 2165 // Reset the active tiling. The recycle tiles should be released too. |
| 2169 active_tiling->Reset(); | 2166 active_tiling->Reset(); |
| 2170 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | 2167 EXPECT_FALSE(active_tiling->TileAt(0, 0)); |
| 2171 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 2168 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 2172 } | 2169 } |
| 2173 | 2170 |
| 2174 } // namespace | 2171 } // namespace |
| 2175 } // namespace cc | 2172 } // namespace cc |
| OLD | NEW |