| 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 RenderSurfaceImpl* surface = finished_target->render_surface(); | 183 RenderSurfaceImpl* surface = finished_target->render_surface(); |
| 184 | 184 |
| 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 !surface->UsesDefaultBlendMode() || target_is_only_for_copy_request || |
| 194 target_is_only_for_copy_request || | |
| 195 surface->Filters().HasFilterThatAffectsOpacity()) { | 194 surface->Filters().HasFilterThatAffectsOpacity()) { |
| 196 stack_.back().occlusion_from_outside_target.Clear(); | 195 stack_.back().occlusion_from_outside_target.Clear(); |
| 197 stack_.back().occlusion_from_inside_target.Clear(); | 196 stack_.back().occlusion_from_inside_target.Clear(); |
| 198 } | 197 } |
| 199 } | 198 } |
| 200 | 199 |
| 201 static void ReduceOcclusionBelowSurface( | 200 static void ReduceOcclusionBelowSurface( |
| 202 const RenderSurfaceImpl* contributing_surface, | 201 const RenderSurfaceImpl* contributing_surface, |
| 203 const gfx::Rect& surface_rect, | 202 const gfx::Rect& surface_rect, |
| 204 const gfx::Transform& surface_transform, | 203 const gfx::Transform& surface_transform, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 392 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
| 394 const SimpleEnclosedRegion& occluded = | 393 const SimpleEnclosedRegion& occluded = |
| 395 stack_.back().occlusion_from_inside_target; | 394 stack_.back().occlusion_from_inside_target; |
| 396 Region visible_region(screen_space_clip_rect_); | 395 Region visible_region(screen_space_clip_rect_); |
| 397 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 396 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
| 398 visible_region.Subtract(occluded.GetRect(i)); | 397 visible_region.Subtract(occluded.GetRect(i)); |
| 399 return visible_region; | 398 return visible_region; |
| 400 } | 399 } |
| 401 | 400 |
| 402 } // namespace cc | 401 } // namespace cc |
| OLD | NEW |