Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: cc/trees/occlusion_tracker.cc

Issue 2176903002: cc: Fix occlusion tracking for layers with non-default blend modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698