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

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

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Rebased to resolve conflict. Created 3 years, 4 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/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree.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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void OcclusionTracker::FinishedRenderTarget( 183 void OcclusionTracker::FinishedRenderTarget(
184 const RenderSurfaceImpl* finished_target_surface) { 184 const RenderSurfaceImpl* finished_target_surface) {
185 // Make sure we know about the target surface. 185 // Make sure we know about the target surface.
186 EnterRenderTarget(finished_target_surface); 186 EnterRenderTarget(finished_target_surface);
187 187
188 bool is_hidden = 188 bool is_hidden =
189 finished_target_surface->OwningEffectNode()->screen_space_opacity == 0.f; 189 finished_target_surface->OwningEffectNode()->screen_space_opacity == 0.f;
190 190
191 // Readbacks always happen on render targets so we only need to check 191 // Readbacks always happen on render targets so we only need to check
192 // for readbacks here. 192 // for readbacks here.
193 bool target_is_only_for_copy_request = 193 bool target_is_only_for_copy_request_or_force_render_surface =
194 finished_target_surface->HasCopyRequest() && is_hidden; 194 (finished_target_surface->HasCopyRequest() ||
195 finished_target_surface->ShouldCacheRenderSurface()) &&
196 is_hidden;
195 197
196 // If the occlusion within the surface can not be applied to things outside of 198 // If the occlusion within the surface can not be applied to things outside of
197 // the surface's subtree, then clear the occlusion here so it won't be used. 199 // the surface's subtree, then clear the occlusion here so it won't be used.
198 if (finished_target_surface->HasMask() || 200 if (finished_target_surface->HasMask() ||
199 finished_target_surface->draw_opacity() < 1 || 201 finished_target_surface->draw_opacity() < 1 ||
200 !finished_target_surface->UsesDefaultBlendMode() || 202 !finished_target_surface->UsesDefaultBlendMode() ||
201 target_is_only_for_copy_request || 203 target_is_only_for_copy_request_or_force_render_surface ||
202 finished_target_surface->Filters().HasFilterThatAffectsOpacity()) { 204 finished_target_surface->Filters().HasFilterThatAffectsOpacity()) {
203 stack_.back().occlusion_from_outside_target.Clear(); 205 stack_.back().occlusion_from_outside_target.Clear();
204 stack_.back().occlusion_from_inside_target.Clear(); 206 stack_.back().occlusion_from_inside_target.Clear();
205 } 207 }
206 } 208 }
207 209
208 static void ReduceOcclusionBelowSurface( 210 static void ReduceOcclusionBelowSurface(
209 const RenderSurfaceImpl* contributing_surface, 211 const RenderSurfaceImpl* contributing_surface,
210 const gfx::Rect& surface_rect, 212 const gfx::Rect& surface_rect,
211 const gfx::Transform& surface_transform, 213 const gfx::Transform& surface_transform,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); 377 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target);
376 const SimpleEnclosedRegion& occluded = 378 const SimpleEnclosedRegion& occluded =
377 stack_.back().occlusion_from_inside_target; 379 stack_.back().occlusion_from_inside_target;
378 Region visible_region(screen_space_clip_rect_); 380 Region visible_region(screen_space_clip_rect_);
379 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) 381 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i)
380 visible_region.Subtract(occluded.GetRect(i)); 382 visible_region.Subtract(occluded.GetRect(i));
381 return visible_region; 383 return visible_region;
382 } 384 }
383 385
384 } // namespace cc 386 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698