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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 pending_layer_->contents_scale_x(), | 1214 pending_layer_->contents_scale_x(), |
1215 gfx::Rect(pending_layer_->visible_content_rect())); | 1215 gfx::Rect(pending_layer_->visible_content_rect())); |
1216 iter; | 1216 iter; |
1217 ++iter) { | 1217 ++iter) { |
1218 if (!*iter) | 1218 if (!*iter) |
1219 continue; | 1219 continue; |
1220 Tile* tile = *iter; | 1220 Tile* tile = *iter; |
1221 TilePriority priority; | 1221 TilePriority priority; |
1222 priority.resolution = HIGH_RESOLUTION; | 1222 priority.resolution = HIGH_RESOLUTION; |
1223 if (++tile_count % 2) { | 1223 if (++tile_count % 2) { |
1224 priority.time_to_visible_in_seconds = 0.f; | 1224 priority.priority_bin = TilePriority::NOW; |
1225 priority.distance_to_visible_in_pixels = 0.f; | 1225 priority.distance_to_visible = 0.f; |
1226 } else { | 1226 } else { |
1227 priority.time_to_visible_in_seconds = 1.f; | 1227 priority.priority_bin = TilePriority::SOON; |
1228 priority.distance_to_visible_in_pixels = 1.f; | 1228 priority.distance_to_visible = 1.f; |
1229 } | 1229 } |
1230 tile->SetPriority(PENDING_TREE, priority); | 1230 tile->SetPriority(PENDING_TREE, priority); |
1231 } | 1231 } |
1232 | 1232 |
1233 pending_layer_->MarkVisibleResourcesAsRequired(); | 1233 pending_layer_->MarkVisibleResourcesAsRequired(); |
1234 | 1234 |
1235 int num_visible = 0; | 1235 int num_visible = 0; |
1236 int num_offscreen = 0; | 1236 int num_offscreen = 0; |
1237 | 1237 |
1238 for (PictureLayerTiling::CoverageIterator iter( | 1238 for (PictureLayerTiling::CoverageIterator iter( |
1239 tiling, | 1239 tiling, |
1240 pending_layer_->contents_scale_x(), | 1240 pending_layer_->contents_scale_x(), |
1241 gfx::Rect(pending_layer_->visible_content_rect())); | 1241 gfx::Rect(pending_layer_->visible_content_rect())); |
1242 iter; | 1242 iter; |
1243 ++iter) { | 1243 ++iter) { |
1244 if (!*iter) | 1244 if (!*iter) |
1245 continue; | 1245 continue; |
1246 const Tile* tile = *iter; | 1246 const Tile* tile = *iter; |
1247 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels == 0.f) { | 1247 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { |
1248 EXPECT_TRUE(tile->required_for_activation()); | 1248 EXPECT_TRUE(tile->required_for_activation()); |
1249 num_visible++; | 1249 num_visible++; |
1250 } else { | 1250 } else { |
1251 EXPECT_FALSE(tile->required_for_activation()); | 1251 EXPECT_FALSE(tile->required_for_activation()); |
1252 num_offscreen++; | 1252 num_offscreen++; |
1253 } | 1253 } |
1254 } | 1254 } |
1255 | 1255 |
1256 EXPECT_GT(num_visible, 0); | 1256 EXPECT_GT(num_visible, 0); |
1257 EXPECT_GT(num_offscreen, 0); | 1257 EXPECT_GT(num_offscreen, 0); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 TestContextProvider::Create(), NULL)); | 1535 TestContextProvider::Create(), NULL)); |
1536 | 1536 |
1537 // These will crash PictureLayerImpl if this is not true. | 1537 // These will crash PictureLayerImpl if this is not true. |
1538 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); | 1538 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); |
1539 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); | 1539 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); |
1540 host_impl_.active_tree()->UpdateDrawProperties(); | 1540 host_impl_.active_tree()->UpdateDrawProperties(); |
1541 } | 1541 } |
1542 | 1542 |
1543 } // namespace | 1543 } // namespace |
1544 } // namespace cc | 1544 } // namespace cc |
OLD | NEW |