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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Readbacks always happen on render targets so we only need to check | 185 // Readbacks always happen on render targets so we only need to check |
186 // for readbacks here. | 186 // for readbacks here. |
187 bool target_is_only_for_copy_request = | 187 bool target_is_only_for_copy_request = |
188 surface->HasCopyRequest() && finished_target->IsHidden(); | 188 surface->HasCopyRequest() && finished_target->IsHidden(); |
189 | 189 |
190 // If the occlusion within the surface can not be applied to things outside of | 190 // If the occlusion within the surface can not be applied to things outside of |
191 // the surface's subtree, then clear the occlusion here so it won't be used. | 191 // the surface's subtree, then clear the occlusion here so it won't be used. |
192 if (surface->MaskLayer() || surface->draw_opacity() < 1 || | 192 if (surface->MaskLayer() || surface->draw_opacity() < 1 || |
193 !finished_target->uses_default_blend_mode() || | 193 !finished_target->uses_default_blend_mode() || |
194 target_is_only_for_copy_request || | 194 target_is_only_for_copy_request || |
195 finished_target->filters().HasFilterThatAffectsOpacity()) { | 195 surface->Filters().HasFilterThatAffectsOpacity()) { |
196 stack_.back().occlusion_from_outside_target.Clear(); | 196 stack_.back().occlusion_from_outside_target.Clear(); |
197 stack_.back().occlusion_from_inside_target.Clear(); | 197 stack_.back().occlusion_from_inside_target.Clear(); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 static void ReduceOcclusionBelowSurface( | 201 static void ReduceOcclusionBelowSurface( |
202 const RenderSurfaceImpl* contributing_surface, | 202 const RenderSurfaceImpl* contributing_surface, |
203 const gfx::Rect& surface_rect, | 203 const gfx::Rect& surface_rect, |
204 const gfx::Transform& surface_transform, | 204 const gfx::Transform& surface_transform, |
205 SimpleEnclosedRegion* occlusion_from_inside_target) { | 205 SimpleEnclosedRegion* occlusion_from_inside_target) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 392 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
393 const SimpleEnclosedRegion& occluded = | 393 const SimpleEnclosedRegion& occluded = |
394 stack_.back().occlusion_from_inside_target; | 394 stack_.back().occlusion_from_inside_target; |
395 Region visible_region(screen_space_clip_rect_); | 395 Region visible_region(screen_space_clip_rect_); |
396 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 396 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
397 visible_region.Subtract(occluded.GetRect(i)); | 397 visible_region.Subtract(occluded.GetRect(i)); |
398 return visible_region; | 398 return visible_region; |
399 } | 399 } |
400 | 400 |
401 } // namespace cc | 401 } // namespace cc |
OLD | NEW |