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

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

Issue 2147283002: cc : Fix occlusion tracking bug for contributing surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mask test 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 | « cc/trees/occlusion_tracker.h ('k') | no next file » | 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 30 matching lines...) Expand all
41 if (stack_.size() < 2) 41 if (stack_.size() < 2)
42 return Occlusion(); 42 return Occlusion();
43 // A contributing surface doesn't get occluded by things inside its own 43 // A contributing surface doesn't get occluded by things inside its own
44 // surface, so only things outside the surface can occlude it. That occlusion 44 // surface, so only things outside the surface can occlude it. That occlusion
45 // is found just below the top of the stack (if it exists). 45 // is found just below the top of the stack (if it exists).
46 const StackObject& second_last = stack_[stack_.size() - 2]; 46 const StackObject& second_last = stack_[stack_.size() - 2];
47 return Occlusion(draw_transform, second_last.occlusion_from_outside_target, 47 return Occlusion(draw_transform, second_last.occlusion_from_outside_target,
48 second_last.occlusion_from_inside_target); 48 second_last.occlusion_from_inside_target);
49 } 49 }
50 50
51 const RenderSurfaceImpl*
52 OcclusionTracker::OcclusionSurfaceForContributingSurface() const {
53 // A contributing surface doesn't get occluded by things inside its own
54 // surface, so only things outside the surface can occlude it. That occlusion
55 // is found just below the top of the stack (if it exists).
56 return (stack_.size() < 2) ? nullptr : stack_[stack_.size() - 2].target;
57 }
58
51 void OcclusionTracker::EnterLayer(const LayerIteratorPosition& layer_iterator) { 59 void OcclusionTracker::EnterLayer(const LayerIteratorPosition& layer_iterator) {
52 LayerImpl* render_target = layer_iterator.target_render_surface_layer; 60 LayerImpl* render_target = layer_iterator.target_render_surface_layer;
53 61
54 if (layer_iterator.represents_itself) 62 if (layer_iterator.represents_itself)
55 EnterRenderTarget(render_target); 63 EnterRenderTarget(render_target);
56 else if (layer_iterator.represents_target_render_surface) 64 else if (layer_iterator.represents_target_render_surface)
57 FinishedRenderTarget(render_target); 65 FinishedRenderTarget(render_target);
58 } 66 }
59 67
60 void OcclusionTracker::LeaveLayer(const LayerIteratorPosition& layer_iterator) { 68 void OcclusionTracker::LeaveLayer(const LayerIteratorPosition& layer_iterator) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); 392 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target);
385 const SimpleEnclosedRegion& occluded = 393 const SimpleEnclosedRegion& occluded =
386 stack_.back().occlusion_from_inside_target; 394 stack_.back().occlusion_from_inside_target;
387 Region visible_region(screen_space_clip_rect_); 395 Region visible_region(screen_space_clip_rect_);
388 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) 396 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i)
389 visible_region.Subtract(occluded.GetRect(i)); 397 visible_region.Subtract(occluded.GetRect(i));
390 return visible_region; 398 return visible_region;
391 } 399 }
392 400
393 } // namespace cc 401 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698