| 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 // Fake set priorities. | 1082 // Fake set priorities. |
| 1083 int tile_count = 0; | 1083 int tile_count = 0; |
| 1084 for (PictureLayerTiling::CoverageIterator iter( | 1084 for (PictureLayerTiling::CoverageIterator iter( |
| 1085 tiling, | 1085 tiling, |
| 1086 pending_layer_->contents_scale_x(), | 1086 pending_layer_->contents_scale_x(), |
| 1087 gfx::Rect(pending_layer_->visible_content_rect())); | 1087 gfx::Rect(pending_layer_->visible_content_rect())); |
| 1088 iter; | 1088 iter; |
| 1089 ++iter) { | 1089 ++iter) { |
| 1090 if (!*iter) | 1090 if (!*iter) |
| 1091 continue; | 1091 continue; |
| 1092 Tile* tile = *iter; | |
| 1093 TilePriority priority; | 1092 TilePriority priority; |
| 1094 priority.resolution = HIGH_RESOLUTION; | 1093 priority.resolution = HIGH_RESOLUTION; |
| 1095 if (++tile_count % 2) { | 1094 if (++tile_count % 2) { |
| 1096 priority.time_to_visible_in_seconds = 0.f; | 1095 priority.time_to_visible_in_seconds = 0.f; |
| 1097 priority.distance_to_visible_in_pixels = 0.f; | 1096 priority.distance_to_visible_in_pixels = 0.f; |
| 1098 } else { | 1097 } else { |
| 1099 priority.time_to_visible_in_seconds = 1.f; | 1098 priority.time_to_visible_in_seconds = 1.f; |
| 1100 priority.distance_to_visible_in_pixels = 1.f; | 1099 priority.distance_to_visible_in_pixels = 1.f; |
| 1101 } | 1100 } |
| 1102 tile->SetPriority(PENDING_TREE, priority); | 1101 iter.SetPriorityForTesting(priority); |
| 1103 } | 1102 } |
| 1104 | 1103 |
| 1105 pending_layer_->MarkVisibleResourcesAsRequired(); | 1104 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1106 | 1105 |
| 1107 int num_visible = 0; | 1106 int num_visible = 0; |
| 1108 int num_offscreen = 0; | 1107 int num_offscreen = 0; |
| 1109 | 1108 |
| 1110 for (PictureLayerTiling::CoverageIterator iter( | 1109 for (PictureLayerTiling::CoverageIterator iter( |
| 1111 tiling, | 1110 tiling, |
| 1112 pending_layer_->contents_scale_x(), | 1111 pending_layer_->contents_scale_x(), |
| 1113 gfx::Rect(pending_layer_->visible_content_rect())); | 1112 gfx::Rect(pending_layer_->visible_content_rect())); |
| 1114 iter; | 1113 iter; |
| 1115 ++iter) { | 1114 ++iter) { |
| 1116 if (!*iter) | 1115 if (!*iter) |
| 1117 continue; | 1116 continue; |
| 1118 const Tile* tile = *iter; | 1117 const Tile* tile = *iter; |
| 1119 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels == 0.f) { | 1118 if (iter.priority().distance_to_visible_in_pixels == 0.f) { |
| 1120 EXPECT_TRUE(tile->required_for_activation()); | 1119 EXPECT_TRUE(tile->required_for_activation()); |
| 1121 num_visible++; | 1120 num_visible++; |
| 1122 } else { | 1121 } else { |
| 1123 EXPECT_FALSE(tile->required_for_activation()); | 1122 EXPECT_FALSE(tile->required_for_activation()); |
| 1124 num_offscreen++; | 1123 num_offscreen++; |
| 1125 } | 1124 } |
| 1126 } | 1125 } |
| 1127 | 1126 |
| 1128 EXPECT_GT(num_visible, 0); | 1127 EXPECT_GT(num_visible, 0); |
| 1129 EXPECT_GT(num_offscreen, 0); | 1128 EXPECT_GT(num_offscreen, 0); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 TestContextProvider::Create(), NULL)); | 1242 TestContextProvider::Create(), NULL)); |
| 1244 | 1243 |
| 1245 // These will crash PictureLayerImpl if this is not true. | 1244 // These will crash PictureLayerImpl if this is not true. |
| 1246 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); | 1245 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); |
| 1247 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); | 1246 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); |
| 1248 host_impl_.active_tree()->UpdateDrawProperties(); | 1247 host_impl_.active_tree()->UpdateDrawProperties(); |
| 1249 } | 1248 } |
| 1250 | 1249 |
| 1251 } // namespace | 1250 } // namespace |
| 1252 } // namespace cc | 1251 } // namespace cc |
| OLD | NEW |