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/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 void OcclusionTracker::MarkOccludedBehindLayer(const LayerImpl* layer) { | 322 void OcclusionTracker::MarkOccludedBehindLayer(const LayerImpl* layer) { |
323 DCHECK(!stack_.empty()); | 323 DCHECK(!stack_.empty()); |
324 DCHECK_EQ(layer->render_target(), stack_.back().target); | 324 DCHECK_EQ(layer->render_target(), stack_.back().target); |
325 | 325 |
326 if (layer->draw_opacity() < 1) | 326 if (layer->draw_opacity() < 1) |
327 return; | 327 return; |
328 | 328 |
329 // The only currently supported draw_blend_mode is SrcOver mode, so | 329 // The only currently supported draw_blend_mode is SrcOver mode, so |
330 // draw_blend_mode does not affect occlusion. | 330 // draw_blend_mode does not affect occlusion. |
331 DCHECK_EQ(layer->draw_blend_mode(), SkXfermode::kSrcOver_Mode); | 331 DCHECK_EQ(layer->draw_blend_mode(), SkBlendMode::kSrcOver); |
332 | 332 |
333 if (layer->Is3dSorted()) | 333 if (layer->Is3dSorted()) |
334 return; | 334 return; |
335 | 335 |
336 SimpleEnclosedRegion opaque_layer_region = layer->VisibleOpaqueRegion(); | 336 SimpleEnclosedRegion opaque_layer_region = layer->VisibleOpaqueRegion(); |
337 if (opaque_layer_region.IsEmpty()) | 337 if (opaque_layer_region.IsEmpty()) |
338 return; | 338 return; |
339 | 339 |
340 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds())); | 340 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds())); |
341 | 341 |
(...skipping 27 matching lines...) Expand all Loading... |
369 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 369 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
370 const SimpleEnclosedRegion& occluded = | 370 const SimpleEnclosedRegion& occluded = |
371 stack_.back().occlusion_from_inside_target; | 371 stack_.back().occlusion_from_inside_target; |
372 Region visible_region(screen_space_clip_rect_); | 372 Region visible_region(screen_space_clip_rect_); |
373 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 373 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
374 visible_region.Subtract(occluded.GetRect(i)); | 374 visible_region.Subtract(occluded.GetRect(i)); |
375 return visible_region; | 375 return visible_region; |
376 } | 376 } |
377 | 377 |
378 } // namespace cc | 378 } // namespace cc |
OLD | NEW |