Chromium Code Reviews| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 &stack_.back().occlusion_from_outside_target); | 343 &stack_.back().occlusion_from_outside_target); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void OcclusionTracker::MarkOccludedBehindLayer(const LayerImpl* layer) { | 346 void OcclusionTracker::MarkOccludedBehindLayer(const LayerImpl* layer) { |
| 347 DCHECK(!stack_.empty()); | 347 DCHECK(!stack_.empty()); |
| 348 DCHECK_EQ(layer->render_target(), stack_.back().target); | 348 DCHECK_EQ(layer->render_target(), stack_.back().target); |
| 349 | 349 |
| 350 if (layer->draw_opacity() < 1) | 350 if (layer->draw_opacity() < 1) |
| 351 return; | 351 return; |
| 352 | 352 |
| 353 if (!layer->uses_default_blend_mode()) | 353 // The only currently supported draw_blend_mode is SrcOver mode, so |
| 354 return; | 354 // draw_blend_mode does not affect occlusion. |
| 355 DCHECK_EQ(layer->draw_blend_mode(), SkXfermode::kSrcOver_Mode); | |
|
ajuma
2016/07/25 18:34:42
An alternative would be to delete draw_blend_mode
| |
| 355 | 356 |
| 356 if (layer->Is3dSorted()) | 357 if (layer->Is3dSorted()) |
| 357 return; | 358 return; |
| 358 | 359 |
| 359 SimpleEnclosedRegion opaque_layer_region = layer->VisibleOpaqueRegion(); | 360 SimpleEnclosedRegion opaque_layer_region = layer->VisibleOpaqueRegion(); |
| 360 if (opaque_layer_region.IsEmpty()) | 361 if (opaque_layer_region.IsEmpty()) |
| 361 return; | 362 return; |
| 362 | 363 |
| 363 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds())); | 364 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds())); |
| 364 | 365 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 392 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 393 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
| 393 const SimpleEnclosedRegion& occluded = | 394 const SimpleEnclosedRegion& occluded = |
| 394 stack_.back().occlusion_from_inside_target; | 395 stack_.back().occlusion_from_inside_target; |
| 395 Region visible_region(screen_space_clip_rect_); | 396 Region visible_region(screen_space_clip_rect_); |
| 396 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 397 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
| 397 visible_region.Subtract(occluded.GetRect(i)); | 398 visible_region.Subtract(occluded.GetRect(i)); |
| 398 return visible_region; | 399 return visible_region; |
| 399 } | 400 } |
| 400 | 401 |
| 401 } // namespace cc | 402 } // namespace cc |
| OLD | NEW |