| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Readbacks always happen on render targets so we only need to check | 229 // Readbacks always happen on render targets so we only need to check |
| 230 // for readbacks here. | 230 // for readbacks here. |
| 231 bool target_is_only_for_copy_request = | 231 bool target_is_only_for_copy_request = |
| 232 finished_target->HasCopyRequest() && LayerIsHidden(finished_target); | 232 finished_target->HasCopyRequest() && LayerIsHidden(finished_target); |
| 233 | 233 |
| 234 // If the occlusion within the surface can not be applied to things outside of | 234 // If the occlusion within the surface can not be applied to things outside of |
| 235 // the surface's subtree, then clear the occlusion here so it won't be used. | 235 // the surface's subtree, then clear the occlusion here so it won't be used. |
| 236 if (finished_target->mask_layer() || | 236 if (finished_target->mask_layer() || |
| 237 !SurfaceOpacityKnown(surface) || | 237 !SurfaceOpacityKnown(surface) || |
| 238 surface->draw_opacity() < 1 || | 238 surface->draw_opacity() < 1 || |
| 239 !finished_target->uses_default_blend_mode() || |
| 239 target_is_only_for_copy_request || | 240 target_is_only_for_copy_request || |
| 240 finished_target->filters().HasFilterThatAffectsOpacity()) { | 241 finished_target->filters().HasFilterThatAffectsOpacity()) { |
| 241 stack_.back().occlusion_from_outside_target.Clear(); | 242 stack_.back().occlusion_from_outside_target.Clear(); |
| 242 stack_.back().occlusion_from_inside_target.Clear(); | 243 stack_.back().occlusion_from_inside_target.Clear(); |
| 243 } else if (!SurfaceTransformsToTargetKnown(surface)) { | 244 } else if (!SurfaceTransformsToTargetKnown(surface)) { |
| 244 stack_.back().occlusion_from_inside_target.Clear(); | 245 stack_.back().occlusion_from_inside_target.Clear(); |
| 245 stack_.back().occlusion_from_outside_target.Clear(); | 246 stack_.back().occlusion_from_outside_target.Clear(); |
| 246 } | 247 } |
| 247 } | 248 } |
| 248 | 249 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 void OcclusionTrackerBase<LayerType, RenderSurfaceType>:: | 411 void OcclusionTrackerBase<LayerType, RenderSurfaceType>:: |
| 411 MarkOccludedBehindLayer(const LayerType* layer) { | 412 MarkOccludedBehindLayer(const LayerType* layer) { |
| 412 DCHECK(!stack_.empty()); | 413 DCHECK(!stack_.empty()); |
| 413 DCHECK_EQ(layer->render_target(), stack_.back().target); | 414 DCHECK_EQ(layer->render_target(), stack_.back().target); |
| 414 if (stack_.empty()) | 415 if (stack_.empty()) |
| 415 return; | 416 return; |
| 416 | 417 |
| 417 if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1) | 418 if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1) |
| 418 return; | 419 return; |
| 419 | 420 |
| 421 if (!layer->uses_default_blend_mode()) |
| 422 return; |
| 423 |
| 420 if (LayerIsInUnsorted3dRenderingContext(layer)) | 424 if (LayerIsInUnsorted3dRenderingContext(layer)) |
| 421 return; | 425 return; |
| 422 | 426 |
| 423 if (!LayerTransformsToTargetKnown(layer)) | 427 if (!LayerTransformsToTargetKnown(layer)) |
| 424 return; | 428 return; |
| 425 | 429 |
| 426 Region opaque_contents = layer->VisibleContentOpaqueRegion(); | 430 Region opaque_contents = layer->VisibleContentOpaqueRegion(); |
| 427 if (opaque_contents.IsEmpty()) | 431 if (opaque_contents.IsEmpty()) |
| 428 return; | 432 return; |
| 429 | 433 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 unoccluded_rect.Intersect(content_rect); | 708 unoccluded_rect.Intersect(content_rect); |
| 705 | 709 |
| 706 return unoccluded_rect; | 710 return unoccluded_rect; |
| 707 } | 711 } |
| 708 | 712 |
| 709 // Instantiate (and export) templates here for the linker. | 713 // Instantiate (and export) templates here for the linker. |
| 710 template class OcclusionTrackerBase<Layer, RenderSurface>; | 714 template class OcclusionTrackerBase<Layer, RenderSurface>; |
| 711 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 715 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
| 712 | 716 |
| 713 } // namespace cc | 717 } // namespace cc |
| OLD | NEW |