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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->ForceRenderSurface()) && |
| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 376 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
375 const SimpleEnclosedRegion& occluded = | 377 const SimpleEnclosedRegion& occluded = |
376 stack_.back().occlusion_from_inside_target; | 378 stack_.back().occlusion_from_inside_target; |
377 Region visible_region(screen_space_clip_rect_); | 379 Region visible_region(screen_space_clip_rect_); |
378 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 380 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
379 visible_region.Subtract(occluded.GetRect(i)); | 381 visible_region.Subtract(occluded.GetRect(i)); |
380 return visible_region; | 382 return visible_region; |
381 } | 383 } |
382 | 384 |
383 } // namespace cc | 385 } // namespace cc |
OLD | NEW |