| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void OcclusionTracker::FinishedRenderTarget(const LayerImpl* finished_target) { | 171 void OcclusionTracker::FinishedRenderTarget(const LayerImpl* finished_target) { |
| 172 // Make sure we know about the target surface. | 172 // Make sure we know about the target surface. |
| 173 EnterRenderTarget(finished_target); | 173 EnterRenderTarget(finished_target); |
| 174 | 174 |
| 175 RenderSurfaceImpl* surface = finished_target->render_surface(); | 175 RenderSurfaceImpl* surface = finished_target->render_surface(); |
| 176 | 176 |
| 177 // Readbacks always happen on render targets so we only need to check | 177 // Readbacks always happen on render targets so we only need to check |
| 178 // for readbacks here. | 178 // for readbacks here. |
| 179 bool target_is_only_for_copy_request = | 179 bool target_is_only_for_copy_request = |
| 180 finished_target->HasCopyRequest() && finished_target->IsHidden(); | 180 surface->HasCopyRequest() && finished_target->IsHidden(); |
| 181 | 181 |
| 182 // If the occlusion within the surface can not be applied to things outside of | 182 // If the occlusion within the surface can not be applied to things outside of |
| 183 // the surface's subtree, then clear the occlusion here so it won't be used. | 183 // the surface's subtree, then clear the occlusion here so it won't be used. |
| 184 if (finished_target->mask_layer() || surface->draw_opacity() < 1 || | 184 if (finished_target->mask_layer() || surface->draw_opacity() < 1 || |
| 185 !finished_target->uses_default_blend_mode() || | 185 !finished_target->uses_default_blend_mode() || |
| 186 target_is_only_for_copy_request || | 186 target_is_only_for_copy_request || |
| 187 finished_target->filters().HasFilterThatAffectsOpacity()) { | 187 finished_target->filters().HasFilterThatAffectsOpacity()) { |
| 188 stack_.back().occlusion_from_outside_target.Clear(); | 188 stack_.back().occlusion_from_outside_target.Clear(); |
| 189 stack_.back().occlusion_from_inside_target.Clear(); | 189 stack_.back().occlusion_from_inside_target.Clear(); |
| 190 } | 190 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 DCHECK(layer_tree->root_layer()->render_surface() == stack_.back().target); | 394 DCHECK(layer_tree->root_layer()->render_surface() == stack_.back().target); |
| 395 const SimpleEnclosedRegion& occluded = | 395 const SimpleEnclosedRegion& occluded = |
| 396 stack_.back().occlusion_from_inside_target; | 396 stack_.back().occlusion_from_inside_target; |
| 397 Region visible_region(screen_space_clip_rect_); | 397 Region visible_region(screen_space_clip_rect_); |
| 398 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 398 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
| 399 visible_region.Subtract(occluded.GetRect(i)); | 399 visible_region.Subtract(occluded.GetRect(i)); |
| 400 return visible_region; | 400 return visible_region; |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace cc | 403 } // namespace cc |
| OLD | NEW |