| 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 // Fake set priorities. | 1024 // Fake set priorities. |
| 1025 int tile_count = 0; | 1025 int tile_count = 0; |
| 1026 for (PictureLayerTiling::CoverageIterator iter( | 1026 for (PictureLayerTiling::CoverageIterator iter( |
| 1027 tiling, | 1027 tiling, |
| 1028 pending_layer_->contents_scale_x(), | 1028 pending_layer_->contents_scale_x(), |
| 1029 gfx::Rect(pending_layer_->visible_content_rect())); | 1029 gfx::Rect(pending_layer_->visible_content_rect())); |
| 1030 iter; | 1030 iter; |
| 1031 ++iter) { | 1031 ++iter) { |
| 1032 if (!*iter) | 1032 if (!*iter) |
| 1033 continue; | 1033 continue; |
| 1034 Tile* tile = *iter; | |
| 1035 TilePriority priority; | 1034 TilePriority priority; |
| 1036 priority.resolution = HIGH_RESOLUTION; | 1035 priority.resolution = HIGH_RESOLUTION; |
| 1037 if (++tile_count % 2) { | 1036 if (++tile_count % 2) { |
| 1038 priority.time_to_visible_in_seconds = 0.f; | 1037 priority.time_to_visible_in_seconds = 0.f; |
| 1039 priority.distance_to_visible_in_pixels = 0.f; | 1038 priority.distance_to_visible_in_pixels = 0.f; |
| 1040 } else { | 1039 } else { |
| 1041 priority.time_to_visible_in_seconds = 1.f; | 1040 priority.time_to_visible_in_seconds = 1.f; |
| 1042 priority.distance_to_visible_in_pixels = 1.f; | 1041 priority.distance_to_visible_in_pixels = 1.f; |
| 1043 } | 1042 } |
| 1044 tile->SetPriority(PENDING_TREE, priority); | 1043 iter.SetPriorityForTesting(priority); |
| 1045 } | 1044 } |
| 1046 | 1045 |
| 1047 pending_layer_->MarkVisibleResourcesAsRequired(); | 1046 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1048 | 1047 |
| 1049 int num_visible = 0; | 1048 int num_visible = 0; |
| 1050 int num_offscreen = 0; | 1049 int num_offscreen = 0; |
| 1051 | 1050 |
| 1052 for (PictureLayerTiling::CoverageIterator iter( | 1051 for (PictureLayerTiling::CoverageIterator iter( |
| 1053 tiling, | 1052 tiling, |
| 1054 pending_layer_->contents_scale_x(), | 1053 pending_layer_->contents_scale_x(), |
| 1055 gfx::Rect(pending_layer_->visible_content_rect())); | 1054 gfx::Rect(pending_layer_->visible_content_rect())); |
| 1056 iter; | 1055 iter; |
| 1057 ++iter) { | 1056 ++iter) { |
| 1058 if (!*iter) | 1057 if (!*iter) |
| 1059 continue; | 1058 continue; |
| 1060 const Tile* tile = *iter; | 1059 const Tile* tile = *iter; |
| 1061 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels == 0.f) { | 1060 if (iter.priority().distance_to_visible_in_pixels == 0.f) { |
| 1062 EXPECT_TRUE(tile->required_for_activation()); | 1061 EXPECT_TRUE(tile->required_for_activation()); |
| 1063 num_visible++; | 1062 num_visible++; |
| 1064 } else { | 1063 } else { |
| 1065 EXPECT_FALSE(tile->required_for_activation()); | 1064 EXPECT_FALSE(tile->required_for_activation()); |
| 1066 num_offscreen++; | 1065 num_offscreen++; |
| 1067 } | 1066 } |
| 1068 } | 1067 } |
| 1069 | 1068 |
| 1070 EXPECT_GT(num_visible, 0); | 1069 EXPECT_GT(num_visible, 0); |
| 1071 EXPECT_GT(num_offscreen, 0); | 1070 EXPECT_GT(num_offscreen, 0); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 TestContextProvider::Create(), NULL)); | 1184 TestContextProvider::Create(), NULL)); |
| 1186 | 1185 |
| 1187 // These will crash PictureLayerImpl if this is not true. | 1186 // These will crash PictureLayerImpl if this is not true. |
| 1188 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); | 1187 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); |
| 1189 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); | 1188 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); |
| 1190 host_impl_.active_tree()->UpdateDrawProperties(); | 1189 host_impl_.active_tree()->UpdateDrawProperties(); |
| 1191 } | 1190 } |
| 1192 | 1191 |
| 1193 } // namespace | 1192 } // namespace |
| 1194 } // namespace cc | 1193 } // namespace cc |
| OLD | NEW |