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