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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 tracker.GetCurrentOcclusionForLayer(transform_to_target); | 120 tracker.GetCurrentOcclusionForLayer(transform_to_target); |
121 for (int x = 0; x < viewport_rect.width(); x += 256) { | 121 for (int x = 0; x < viewport_rect.width(); x += 256) { |
122 for (int y = 0; y < viewport_rect.height(); y += 256) { | 122 for (int y = 0; y < viewport_rect.height(); y += 256) { |
123 gfx::Rect query_content_rect(x, y, 256, 256); | 123 gfx::Rect query_content_rect(x, y, 256, 256); |
124 gfx::Rect unoccluded = | 124 gfx::Rect unoccluded = |
125 occlusion.GetUnoccludedContentRect(query_content_rect); | 125 occlusion.GetUnoccludedContentRect(query_content_rect); |
126 // Sanity test that we're not hitting early outs. | 126 // Sanity test that we're not hitting early outs. |
127 bool expect_empty = | 127 bool expect_empty = |
128 query_content_rect.right() <= viewport_rect.width() && | 128 query_content_rect.right() <= viewport_rect.width() && |
129 query_content_rect.bottom() + 96 <= viewport_rect.height(); | 129 query_content_rect.bottom() + 96 <= viewport_rect.height(); |
130 CHECK_EQ(expect_empty, unoccluded.IsEmpty()) | 130 ASSERT_EQ(expect_empty, unoccluded.IsEmpty()) |
131 << query_content_rect.ToString(); | 131 << query_content_rect.ToString(); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 timer_.NextLap(); | 135 timer_.NextLap(); |
136 } while (!timer_.HasTimeLimitExpired()); | 136 } while (!timer_.HasTimeLimitExpired()); |
137 | 137 |
138 ++begin; | 138 ++begin; |
139 LayerIteratorPosition next = begin; | 139 LayerIteratorPosition next = begin; |
140 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); | 140 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 // The opaque_layers add occlusion. | 181 // The opaque_layers add occlusion. |
182 for (int i = 0; i < kNumOpaqueLayers - 1; ++i) { | 182 for (int i = 0; i < kNumOpaqueLayers - 1; ++i) { |
183 LayerIteratorPosition pos = begin; | 183 LayerIteratorPosition pos = begin; |
184 tracker.EnterLayer(pos); | 184 tracker.EnterLayer(pos); |
185 tracker.LeaveLayer(pos); | 185 tracker.LeaveLayer(pos); |
186 ++begin; | 186 ++begin; |
187 } | 187 } |
188 LayerIteratorPosition pos = begin; | 188 LayerIteratorPosition pos = begin; |
189 tracker.EnterLayer(pos); | 189 tracker.EnterLayer(pos); |
190 tracker.LeaveLayer(pos); | 190 tracker.LeaveLayer(pos); |
191 | 191 /* This block doesn't seem to do anything, missing part of the loop body? |
Peter Kasting
2016/06/10 05:50:06
Dana, I think you wrote this, want to comment on w
| |
192 gfx::Transform transform_to_target; | 192 gfx::Transform transform_to_target; |
193 transform_to_target.Translate(0, 96); | 193 transform_to_target.Translate(0, 96); |
194 | 194 |
195 do { | 195 do { |
196 Occlusion occlusion = | 196 Occlusion occlusion = |
197 tracker.GetCurrentOcclusionForLayer(transform_to_target); | 197 tracker.GetCurrentOcclusionForLayer(transform_to_target); |
198 for (int x = 0; x < viewport_rect.width(); x += 256) { | 198 for (int x = 0; x < viewport_rect.width(); x += 256) { |
199 for (int y = 0; y < viewport_rect.height(); y += 256) { | 199 for (int y = 0; y < viewport_rect.height(); y += 256) { |
200 gfx::Rect query_content_rect(x, y, 256, 256); | 200 gfx::Rect query_content_rect(x, y, 256, 256); |
201 gfx::Rect unoccluded = | 201 gfx::Rect unoccluded = |
202 occlusion.GetUnoccludedContentRect(query_content_rect); | 202 occlusion.GetUnoccludedContentRect(query_content_rect); |
203 occlusion.GetUnoccludedContentRect(query_content_rect); | |
Peter Kasting
2016/06/10 05:50:06
Oops, ignore this typo line
| |
203 } | 204 } |
204 } | 205 } |
205 | 206 |
206 timer_.NextLap(); | 207 timer_.NextLap(); |
207 } while (!timer_.HasTimeLimitExpired()); | 208 } while (!timer_.HasTimeLimitExpired()); |
208 | 209 */ |
209 ++begin; | 210 ++begin; |
210 LayerIteratorPosition next = begin; | 211 LayerIteratorPosition next = begin; |
211 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); | 212 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); |
212 | 213 |
213 ++begin; | 214 ++begin; |
214 EXPECT_EQ(end, begin); | 215 EXPECT_EQ(end, begin); |
215 | 216 |
216 PrintResults(); | 217 PrintResults(); |
217 } | 218 } |
218 | 219 |
219 } // namespace | 220 } // namespace |
220 } // namespace cc | 221 } // namespace cc |
OLD | NEW |