| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "cc/layers/layer_iterator.h" | 8 #include "cc/layers/layer_iterator.h" |
| 9 #include "cc/layers/solid_color_layer_impl.h" | 9 #include "cc/layers/solid_color_layer_impl.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl_client.h" | 10 #include "cc/test/fake_layer_tree_host_impl_client.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); | 94 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); |
| 95 | 95 |
| 96 LayerIteratorPosition<LayerImpl> pos = begin; | 96 LayerIteratorPosition<LayerImpl> pos = begin; |
| 97 | 97 |
| 98 // The opaque_layer adds occlusion over the whole viewport. | 98 // The opaque_layer adds occlusion over the whole viewport. |
| 99 tracker.EnterLayer(pos); | 99 tracker.EnterLayer(pos); |
| 100 tracker.LeaveLayer(pos); | 100 tracker.LeaveLayer(pos); |
| 101 | 101 |
| 102 gfx::Transform transform_to_target; | 102 gfx::Transform transform_to_target; |
| 103 transform_to_target.Translate(0, 96); | 103 transform_to_target.Translate(0, 96); |
| 104 bool impl_draw_transform_is_unknown = false; | |
| 105 | 104 |
| 106 do { | 105 do { |
| 107 for (int x = 0; x < viewport_rect.width(); x += 256) { | 106 for (int x = 0; x < viewport_rect.width(); x += 256) { |
| 108 for (int y = 0; y < viewport_rect.height(); y += 256) { | 107 for (int y = 0; y < viewport_rect.height(); y += 256) { |
| 109 gfx::Rect query_content_rect(x, y, 256, 256); | 108 gfx::Rect query_content_rect(x, y, 256, 256); |
| 110 gfx::Rect unoccluded = | 109 gfx::Rect unoccluded = |
| 111 tracker.UnoccludedContentRect(pos.target_render_surface_layer, | 110 tracker.UnoccludedContentRect(pos.target_render_surface_layer, |
| 112 query_content_rect, | 111 query_content_rect, |
| 113 transform_to_target, | 112 transform_to_target); |
| 114 impl_draw_transform_is_unknown); | |
| 115 // Sanity test that we're not hitting early outs. | 113 // Sanity test that we're not hitting early outs. |
| 116 bool expect_empty = | 114 bool expect_empty = |
| 117 query_content_rect.right() <= viewport_rect.width() && | 115 query_content_rect.right() <= viewport_rect.width() && |
| 118 query_content_rect.bottom() + 96 <= viewport_rect.height(); | 116 query_content_rect.bottom() + 96 <= viewport_rect.height(); |
| 119 CHECK_EQ(expect_empty, unoccluded.IsEmpty()) | 117 CHECK_EQ(expect_empty, unoccluded.IsEmpty()) |
| 120 << query_content_rect.ToString(); | 118 << query_content_rect.ToString(); |
| 121 } | 119 } |
| 122 } | 120 } |
| 123 | 121 |
| 124 timer_.NextLap(); | 122 timer_.NextLap(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 tracker.EnterLayer(pos); | 171 tracker.EnterLayer(pos); |
| 174 tracker.LeaveLayer(pos); | 172 tracker.LeaveLayer(pos); |
| 175 ++begin; | 173 ++begin; |
| 176 } | 174 } |
| 177 LayerIteratorPosition<LayerImpl> pos = begin; | 175 LayerIteratorPosition<LayerImpl> pos = begin; |
| 178 tracker.EnterLayer(pos); | 176 tracker.EnterLayer(pos); |
| 179 tracker.LeaveLayer(pos); | 177 tracker.LeaveLayer(pos); |
| 180 | 178 |
| 181 gfx::Transform transform_to_target; | 179 gfx::Transform transform_to_target; |
| 182 transform_to_target.Translate(0, 96); | 180 transform_to_target.Translate(0, 96); |
| 183 bool impl_draw_transform_is_unknown = false; | |
| 184 | 181 |
| 185 do { | 182 do { |
| 186 for (int x = 0; x < viewport_rect.width(); x += 256) { | 183 for (int x = 0; x < viewport_rect.width(); x += 256) { |
| 187 for (int y = 0; y < viewport_rect.height(); y += 256) { | 184 for (int y = 0; y < viewport_rect.height(); y += 256) { |
| 188 gfx::Rect query_content_rect(x, y, 256, 256); | 185 gfx::Rect query_content_rect(x, y, 256, 256); |
| 189 gfx::Rect unoccluded = | 186 gfx::Rect unoccluded = |
| 190 tracker.UnoccludedContentRect(pos.target_render_surface_layer, | 187 tracker.UnoccludedContentRect(pos.target_render_surface_layer, |
| 191 query_content_rect, | 188 query_content_rect, |
| 192 transform_to_target, | 189 transform_to_target); |
| 193 impl_draw_transform_is_unknown); | |
| 194 } | 190 } |
| 195 } | 191 } |
| 196 | 192 |
| 197 timer_.NextLap(); | 193 timer_.NextLap(); |
| 198 } while (!timer_.HasTimeLimitExpired()); | 194 } while (!timer_.HasTimeLimitExpired()); |
| 199 | 195 |
| 200 ++begin; | 196 ++begin; |
| 201 LayerIteratorPosition<LayerImpl> next = begin; | 197 LayerIteratorPosition<LayerImpl> next = begin; |
| 202 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); | 198 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); |
| 203 | 199 |
| 204 ++begin; | 200 ++begin; |
| 205 EXPECT_EQ(end, begin); | 201 EXPECT_EQ(end, begin); |
| 206 | 202 |
| 207 PrintResults(); | 203 PrintResults(); |
| 208 } | 204 } |
| 209 | 205 |
| 210 } // namespace | 206 } // namespace |
| 211 } // namespace cc | 207 } // namespace cc |
| OLD | NEW |