OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/quad_culler.h" | 5 #include "cc/trees/quad_culler.h" |
6 | 6 |
| 7 #include <vector> |
| 8 |
7 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
8 #include "cc/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
9 #include "cc/layers/append_quads_data.h" | 11 #include "cc/layers/append_quads_data.h" |
10 #include "cc/layers/tiled_layer_impl.h" | 12 #include "cc/layers/tiled_layer_impl.h" |
11 #include "cc/quads/tile_draw_quad.h" | 13 #include "cc/quads/tile_draw_quad.h" |
12 #include "cc/resources/layer_tiling_data.h" | 14 #include "cc/resources/layer_tiling_data.h" |
13 #include "cc/test/fake_impl_proxy.h" | 15 #include "cc/test/fake_impl_proxy.h" |
14 #include "cc/test/fake_layer_tree_host_impl.h" | 16 #include "cc/test/fake_layer_tree_host_impl.h" |
15 #include "cc/trees/occlusion_tracker.h" | 17 #include "cc/trees/occlusion_tracker.h" |
16 #include "cc/trees/single_thread_proxy.h" | 18 #include "cc/trees/single_thread_proxy.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 parent->render_surface()->layer_list().push_back(layer.get()); | 99 parent->render_surface()->layer_list().push_back(layer.get()); |
98 rect_in_target.Union(MathUtil::MapClippedRect( | 100 rect_in_target.Union(MathUtil::MapClippedRect( |
99 parent->draw_transform(), parent->visible_content_rect())); | 101 parent->draw_transform(), parent->visible_content_rect())); |
100 parent->render_surface()->SetContentRect(rect_in_target); | 102 parent->render_surface()->SetContentRect(rect_in_target); |
101 } | 103 } |
102 layer->draw_properties().drawable_content_rect = rect_in_target; | 104 layer->draw_properties().drawable_content_rect = rect_in_target; |
103 | 105 |
104 return layer.Pass(); | 106 return layer.Pass(); |
105 } | 107 } |
106 | 108 |
107 void AppendQuads(QuadList& quad_list, | 109 void AppendQuads(QuadList* quad_list, |
108 SharedQuadStateList& shared_state_list, | 110 SharedQuadStateList& shared_state_list, |
109 TiledLayerImpl* layer, | 111 TiledLayerImpl* layer, |
110 LayerIteratorType& it, | 112 LayerIteratorType& it, |
111 OcclusionTrackerImpl& occlusion_tracker) { | 113 OcclusionTrackerImpl& occlusion_tracker) { |
112 occlusion_tracker.EnterLayer(it); | 114 occlusion_tracker.EnterLayer(it); |
113 QuadCuller quad_culler( | 115 QuadCuller quad_culler( |
114 &quad_list, &shared_state_list, layer, occlusion_tracker, false, false); | 116 quad_list, &shared_state_list, layer, occlusion_tracker, false, false); |
115 AppendQuadsData data; | 117 AppendQuadsData data; |
116 layer->AppendQuads(&quad_culler, &data); | 118 layer->AppendQuads(&quad_culler, &data); |
117 occlusion_tracker.LeaveLayer(it); | 119 occlusion_tracker.LeaveLayer(it); |
118 ++it; | 120 ++it; |
119 } | 121 } |
120 | 122 |
121 protected: | 123 protected: |
122 FakeImplProxy proxy_; | 124 FakeImplProxy proxy_; |
123 FakeLayerTreeHostImpl host_impl_; | 125 FakeLayerTreeHostImpl host_impl_; |
124 int layer_id_; | 126 int layer_id_; |
(...skipping 26 matching lines...) Expand all Loading... |
151 gfx::Transform(), | 153 gfx::Transform(), |
152 child_rect, | 154 child_rect, |
153 1, | 155 1, |
154 false, | 156 false, |
155 gfx::Rect(), | 157 gfx::Rect(), |
156 render_surface_layer_list); | 158 render_surface_layer_list); |
157 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 159 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
158 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 160 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
159 | 161 |
160 AppendQuads( | 162 AppendQuads( |
161 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 163 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
162 AppendQuads( | 164 AppendQuads( |
163 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 165 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
164 EXPECT_EQ(quad_list.size(), 13u); | 166 EXPECT_EQ(quad_list.size(), 13u); |
165 EXPECT_NEAR( | 167 EXPECT_NEAR( |
166 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 168 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
167 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), | 169 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), |
168 40000, | 170 40000, |
169 1); | 171 1); |
170 EXPECT_NEAR( | 172 EXPECT_NEAR( |
171 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 173 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
172 } | 174 } |
173 | 175 |
(...skipping 12 matching lines...) Expand all Loading... |
186 gfx::Transform(), | 188 gfx::Transform(), |
187 child_rect, | 189 child_rect, |
188 1, | 190 1, |
189 true, | 191 true, |
190 gfx::Rect(), | 192 gfx::Rect(), |
191 render_surface_layer_list); | 193 render_surface_layer_list); |
192 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 194 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
193 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 195 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
194 | 196 |
195 AppendQuads( | 197 AppendQuads( |
196 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 198 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
197 AppendQuads( | 199 AppendQuads( |
198 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 200 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
199 EXPECT_EQ(quad_list.size(), 9u); | 201 EXPECT_EQ(quad_list.size(), 9u); |
200 EXPECT_NEAR( | 202 EXPECT_NEAR( |
201 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 203 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
202 EXPECT_NEAR( | 204 EXPECT_NEAR( |
203 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 205 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
204 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 206 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
205 40000, | 207 40000, |
206 1); | 208 1); |
207 } | 209 } |
208 | 210 |
(...skipping 12 matching lines...) Expand all Loading... |
221 child_transform, | 223 child_transform, |
222 child_rect, | 224 child_rect, |
223 0.9f, | 225 0.9f, |
224 true, | 226 true, |
225 gfx::Rect(), | 227 gfx::Rect(), |
226 render_surface_layer_list); | 228 render_surface_layer_list); |
227 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 229 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
228 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 230 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
229 | 231 |
230 AppendQuads( | 232 AppendQuads( |
231 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 233 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
232 AppendQuads( | 234 AppendQuads( |
233 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 235 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
234 EXPECT_EQ(quad_list.size(), 13u); | 236 EXPECT_EQ(quad_list.size(), 13u); |
235 EXPECT_NEAR( | 237 EXPECT_NEAR( |
236 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 238 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
237 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), | 239 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), |
238 40000, | 240 40000, |
239 1); | 241 1); |
240 EXPECT_NEAR( | 242 EXPECT_NEAR( |
241 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 243 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
242 } | 244 } |
243 | 245 |
(...skipping 12 matching lines...) Expand all Loading... |
256 child_transform, | 258 child_transform, |
257 child_rect, | 259 child_rect, |
258 1, | 260 1, |
259 false, | 261 false, |
260 gfx::Rect(), | 262 gfx::Rect(), |
261 render_surface_layer_list); | 263 render_surface_layer_list); |
262 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 264 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
263 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 265 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
264 | 266 |
265 AppendQuads( | 267 AppendQuads( |
266 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 268 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
267 AppendQuads( | 269 AppendQuads( |
268 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 270 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
269 EXPECT_EQ(quad_list.size(), 13u); | 271 EXPECT_EQ(quad_list.size(), 13u); |
270 EXPECT_NEAR( | 272 EXPECT_NEAR( |
271 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 273 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
272 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), | 274 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), |
273 40000, | 275 40000, |
274 1); | 276 1); |
275 EXPECT_NEAR( | 277 EXPECT_NEAR( |
276 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 278 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
277 } | 279 } |
278 | 280 |
(...skipping 12 matching lines...) Expand all Loading... |
291 child_transform, | 293 child_transform, |
292 child_rect, | 294 child_rect, |
293 1, | 295 1, |
294 true, | 296 true, |
295 gfx::Rect(), | 297 gfx::Rect(), |
296 render_surface_layer_list); | 298 render_surface_layer_list); |
297 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 299 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
298 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 300 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
299 | 301 |
300 AppendQuads( | 302 AppendQuads( |
301 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 303 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
302 AppendQuads( | 304 AppendQuads( |
303 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 305 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
304 ASSERT_EQ(quad_list.size(), 12u); | 306 ASSERT_EQ(quad_list.size(), 12u); |
305 | 307 |
306 gfx::Rect quad_visible_rect1 = quad_list[5]->visible_rect; | 308 gfx::Rect quad_visible_rect1 = quad_list[5]->visible_rect; |
307 EXPECT_EQ(quad_visible_rect1.height(), 50); | 309 EXPECT_EQ(quad_visible_rect1.height(), 50); |
308 | 310 |
309 gfx::Rect quad_visible_rect3 = quad_list[7]->visible_rect; | 311 gfx::Rect quad_visible_rect3 = quad_list[7]->visible_rect; |
310 EXPECT_EQ(quad_visible_rect3.width(), 50); | 312 EXPECT_EQ(quad_visible_rect3.width(), 50); |
311 | 313 |
312 // Next index is 8, not 9, since centre quad culled. | 314 // Next index is 8, not 9, since centre quad culled. |
313 gfx::Rect quad_visible_rect4 = quad_list[8]->visible_rect; | 315 gfx::Rect quad_visible_rect4 = quad_list[8]->visible_rect; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 child_transform, | 353 child_transform, |
352 child_rect, | 354 child_rect, |
353 1, | 355 1, |
354 true, | 356 true, |
355 gfx::Rect(), | 357 gfx::Rect(), |
356 render_surface_layer_list); | 358 render_surface_layer_list); |
357 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 359 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
358 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 360 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
359 | 361 |
360 AppendQuads( | 362 AppendQuads( |
361 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 363 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
362 AppendQuads( | 364 AppendQuads( |
363 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 365 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
364 EXPECT_EQ(quad_list.size(), 2u); | 366 EXPECT_EQ(quad_list.size(), 2u); |
365 | 367 |
366 EXPECT_NEAR( | 368 EXPECT_NEAR( |
367 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 20363, 1); | 369 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 20363, 1); |
368 EXPECT_NEAR( | 370 EXPECT_NEAR( |
369 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 371 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
370 EXPECT_NEAR( | 372 EXPECT_NEAR( |
371 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 373 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
372 } | 374 } |
373 | 375 |
(...skipping 22 matching lines...) Expand all Loading... |
396 child_transform, | 398 child_transform, |
397 child_rect, | 399 child_rect, |
398 1, | 400 1, |
399 true, | 401 true, |
400 gfx::Rect(), | 402 gfx::Rect(), |
401 render_surface_layer_list); | 403 render_surface_layer_list); |
402 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 404 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
403 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 405 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
404 | 406 |
405 AppendQuads( | 407 AppendQuads( |
406 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 408 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
407 AppendQuads( | 409 AppendQuads( |
408 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 410 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
409 EXPECT_EQ(quad_list.size(), 2u); | 411 EXPECT_EQ(quad_list.size(), 2u); |
410 | 412 |
411 EXPECT_NEAR( | 413 EXPECT_NEAR( |
412 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 19643, 1); | 414 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 19643, 1); |
413 EXPECT_NEAR( | 415 EXPECT_NEAR( |
414 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 416 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
415 EXPECT_NEAR( | 417 EXPECT_NEAR( |
416 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 418 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
417 } | 419 } |
418 | 420 |
(...skipping 12 matching lines...) Expand all Loading... |
431 child_transform, | 433 child_transform, |
432 child_rect, | 434 child_rect, |
433 1, | 435 1, |
434 true, | 436 true, |
435 gfx::Rect(), | 437 gfx::Rect(), |
436 render_surface_layer_list); | 438 render_surface_layer_list); |
437 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 439 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
438 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 440 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
439 | 441 |
440 AppendQuads( | 442 AppendQuads( |
441 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 443 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
442 AppendQuads( | 444 AppendQuads( |
443 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 445 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
444 EXPECT_EQ(quad_list.size(), 9u); | 446 EXPECT_EQ(quad_list.size(), 9u); |
445 EXPECT_NEAR( | 447 EXPECT_NEAR( |
446 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 448 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
447 EXPECT_NEAR( | 449 EXPECT_NEAR( |
448 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 450 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
449 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 451 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
450 40000, | 452 40000, |
451 1); | 453 1); |
452 } | 454 } |
453 | 455 |
(...skipping 16 matching lines...) Expand all Loading... |
470 child_transform, | 472 child_transform, |
471 child_rect, | 473 child_rect, |
472 1, | 474 1, |
473 false, | 475 false, |
474 child_opaque_rect, | 476 child_opaque_rect, |
475 render_surface_layer_list); | 477 render_surface_layer_list); |
476 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 478 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
477 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 479 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
478 | 480 |
479 AppendQuads( | 481 AppendQuads( |
480 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 482 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
481 AppendQuads( | 483 AppendQuads( |
482 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 484 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
483 EXPECT_EQ(quad_list.size(), 12u); | 485 EXPECT_EQ(quad_list.size(), 12u); |
484 EXPECT_NEAR( | 486 EXPECT_NEAR( |
485 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 487 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
486 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), | 488 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), |
487 30000, | 489 30000, |
488 1); | 490 1); |
489 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 491 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
490 10000, | 492 10000, |
491 1); | 493 1); |
492 } | 494 } |
(...skipping 17 matching lines...) Expand all Loading... |
510 child_transform, | 512 child_transform, |
511 child_rect, | 513 child_rect, |
512 1, | 514 1, |
513 false, | 515 false, |
514 child_opaque_rect, | 516 child_opaque_rect, |
515 render_surface_layer_list); | 517 render_surface_layer_list); |
516 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 518 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
517 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 519 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
518 | 520 |
519 AppendQuads( | 521 AppendQuads( |
520 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 522 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
521 AppendQuads( | 523 AppendQuads( |
522 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 524 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
523 EXPECT_EQ(quad_list.size(), 12u); | 525 EXPECT_EQ(quad_list.size(), 12u); |
524 EXPECT_NEAR( | 526 EXPECT_NEAR( |
525 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 527 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
526 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), | 528 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), |
527 25000, | 529 25000, |
528 1); | 530 1); |
529 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 531 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
530 15000, | 532 15000, |
531 1); | 533 1); |
532 } | 534 } |
(...skipping 17 matching lines...) Expand all Loading... |
550 child_transform, | 552 child_transform, |
551 child_rect, | 553 child_rect, |
552 1, | 554 1, |
553 false, | 555 false, |
554 child_opaque_rect, | 556 child_opaque_rect, |
555 render_surface_layer_list); | 557 render_surface_layer_list); |
556 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 558 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
557 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 559 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
558 | 560 |
559 AppendQuads( | 561 AppendQuads( |
560 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 562 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
561 AppendQuads( | 563 AppendQuads( |
562 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 564 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
563 EXPECT_EQ(quad_list.size(), 13u); | 565 EXPECT_EQ(quad_list.size(), 13u); |
564 EXPECT_NEAR( | 566 EXPECT_NEAR( |
565 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); | 567 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); |
566 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), | 568 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), |
567 30000, | 569 30000, |
568 1); | 570 1); |
569 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 571 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
570 10000, | 572 10000, |
571 1); | 573 1); |
572 } | 574 } |
(...skipping 15 matching lines...) Expand all Loading... |
588 child_transform, | 590 child_transform, |
589 child_rect, | 591 child_rect, |
590 1, | 592 1, |
591 true, | 593 true, |
592 gfx::Rect(), | 594 gfx::Rect(), |
593 render_surface_layer_list); | 595 render_surface_layer_list); |
594 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 596 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
595 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 597 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
596 | 598 |
597 AppendQuads( | 599 AppendQuads( |
598 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 600 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
599 AppendQuads( | 601 AppendQuads( |
600 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 602 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
601 EXPECT_EQ(quad_list.size(), 13u); | 603 EXPECT_EQ(quad_list.size(), 13u); |
602 EXPECT_NEAR( | 604 EXPECT_NEAR( |
603 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 130000, 1); | 605 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 130000, 1); |
604 EXPECT_NEAR( | 606 EXPECT_NEAR( |
605 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 607 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
606 EXPECT_NEAR( | 608 EXPECT_NEAR( |
607 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 609 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
608 } | 610 } |
609 | 611 |
610 // This test requires some explanation: here we are rotating the quads to be | 612 // This test requires some explanation: here we are rotating the quads to be |
(...skipping 20 matching lines...) Expand all Loading... |
631 gfx::Transform(), | 633 gfx::Transform(), |
632 child_rect, | 634 child_rect, |
633 1, | 635 1, |
634 true, | 636 true, |
635 gfx::Rect(), | 637 gfx::Rect(), |
636 render_surface_layer_list); | 638 render_surface_layer_list); |
637 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); | 639 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000)); |
638 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 640 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
639 | 641 |
640 AppendQuads( | 642 AppendQuads( |
641 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 643 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
642 AppendQuads( | 644 AppendQuads( |
643 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 645 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
644 EXPECT_EQ(quad_list.size(), 12u); | 646 EXPECT_EQ(quad_list.size(), 12u); |
645 EXPECT_NEAR( | 647 EXPECT_NEAR( |
646 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 100600, 1); | 648 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 100600, 1); |
647 EXPECT_NEAR( | 649 EXPECT_NEAR( |
648 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 650 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
649 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 651 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
650 29400, | 652 29400, |
651 1); | 653 1); |
652 } | 654 } |
653 | 655 |
(...skipping 11 matching lines...) Expand all Loading... |
665 gfx::Transform(), | 667 gfx::Transform(), |
666 child_rect, | 668 child_rect, |
667 1, | 669 1, |
668 true, | 670 true, |
669 gfx::Rect(), | 671 gfx::Rect(), |
670 render_surface_layer_list); | 672 render_surface_layer_list); |
671 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(200, 100, 100, 100)); | 673 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(200, 100, 100, 100)); |
672 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 674 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
673 | 675 |
674 AppendQuads( | 676 AppendQuads( |
675 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 677 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
676 AppendQuads( | 678 AppendQuads( |
677 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 679 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
678 EXPECT_EQ(quad_list.size(), 1u); | 680 EXPECT_EQ(quad_list.size(), 1u); |
679 EXPECT_NEAR( | 681 EXPECT_NEAR( |
680 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); | 682 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); |
681 EXPECT_NEAR( | 683 EXPECT_NEAR( |
682 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 684 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
683 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 685 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
684 120000, | 686 120000, |
685 1); | 687 1); |
686 } | 688 } |
687 | 689 |
(...skipping 11 matching lines...) Expand all Loading... |
699 gfx::Transform(), | 701 gfx::Transform(), |
700 child_rect, | 702 child_rect, |
701 1, | 703 1, |
702 true, | 704 true, |
703 gfx::Rect(), | 705 gfx::Rect(), |
704 render_surface_layer_list); | 706 render_surface_layer_list); |
705 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(100, 100, 100, 100)); | 707 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(100, 100, 100, 100)); |
706 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 708 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
707 | 709 |
708 AppendQuads( | 710 AppendQuads( |
709 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 711 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
710 AppendQuads( | 712 AppendQuads( |
711 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 713 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
712 EXPECT_EQ(quad_list.size(), 1u); | 714 EXPECT_EQ(quad_list.size(), 1u); |
713 EXPECT_NEAR( | 715 EXPECT_NEAR( |
714 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); | 716 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); |
715 EXPECT_NEAR( | 717 EXPECT_NEAR( |
716 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 718 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
717 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 719 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
718 120000, | 720 120000, |
719 1); | 721 1); |
720 } | 722 } |
721 | 723 |
(...skipping 11 matching lines...) Expand all Loading... |
733 gfx::Transform(), | 735 gfx::Transform(), |
734 child_rect, | 736 child_rect, |
735 1, | 737 1, |
736 true, | 738 true, |
737 gfx::Rect(), | 739 gfx::Rect(), |
738 render_surface_layer_list); | 740 render_surface_layer_list); |
739 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200)); | 741 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200)); |
740 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 742 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
741 | 743 |
742 AppendQuads( | 744 AppendQuads( |
743 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 745 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
744 AppendQuads( | 746 AppendQuads( |
745 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 747 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
746 EXPECT_EQ(quad_list.size(), 9u); | 748 EXPECT_EQ(quad_list.size(), 9u); |
747 EXPECT_NEAR( | 749 EXPECT_NEAR( |
748 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 40000, 1); | 750 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 40000, 1); |
749 EXPECT_NEAR( | 751 EXPECT_NEAR( |
750 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 752 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
751 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 753 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
752 90000, | 754 90000, |
753 1); | 755 1); |
754 } | 756 } |
755 | 757 |
(...skipping 11 matching lines...) Expand all Loading... |
767 gfx::Transform(), | 769 gfx::Transform(), |
768 child_rect, | 770 child_rect, |
769 1, | 771 1, |
770 true, | 772 true, |
771 gfx::Rect(), | 773 gfx::Rect(), |
772 render_surface_layer_list); | 774 render_surface_layer_list); |
773 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(500, 500, 100, 100)); | 775 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(500, 500, 100, 100)); |
774 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 776 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
775 | 777 |
776 AppendQuads( | 778 AppendQuads( |
777 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 779 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
778 AppendQuads( | 780 AppendQuads( |
779 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 781 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
780 EXPECT_EQ(quad_list.size(), 0u); | 782 EXPECT_EQ(quad_list.size(), 0u); |
781 EXPECT_NEAR( | 783 EXPECT_NEAR( |
782 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); | 784 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); |
783 EXPECT_NEAR( | 785 EXPECT_NEAR( |
784 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 786 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
785 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), | 787 EXPECT_NEAR(occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), |
786 130000, | 788 130000, |
787 1); | 789 1); |
788 } | 790 } |
789 | 791 |
(...skipping 12 matching lines...) Expand all Loading... |
802 child_rect, | 804 child_rect, |
803 1, | 805 1, |
804 true, | 806 true, |
805 gfx::Rect(), | 807 gfx::Rect(), |
806 render_surface_layer_list); | 808 render_surface_layer_list); |
807 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200), | 809 TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200), |
808 false); | 810 false); |
809 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); | 811 LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list); |
810 | 812 |
811 AppendQuads( | 813 AppendQuads( |
812 quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); | 814 &quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker); |
813 AppendQuads( | 815 AppendQuads( |
814 quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); | 816 &quad_list, shared_state_list, root_layer.get(), it, occlusion_tracker); |
815 EXPECT_EQ(quad_list.size(), 9u); | 817 EXPECT_EQ(quad_list.size(), 9u); |
816 EXPECT_NEAR( | 818 EXPECT_NEAR( |
817 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); | 819 occlusion_tracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); |
818 EXPECT_NEAR( | 820 EXPECT_NEAR( |
819 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); | 821 occlusion_tracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); |
820 EXPECT_NEAR( | 822 EXPECT_NEAR( |
821 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); | 823 occlusion_tracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); |
822 } | 824 } |
823 | 825 |
824 } // namespace | 826 } // namespace |
825 } // namespace cc | 827 } // namespace cc |
OLD | NEW |