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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 | 226 |
227 RenderSurfaceType* surface = finished_target->render_surface(); | 227 RenderSurfaceType* surface = finished_target->render_surface(); |
228 | 228 |
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() || !SurfaceOpacityKnown(surface) || |
237 !SurfaceOpacityKnown(surface) || | |
238 surface->draw_opacity() < 1 || | 237 surface->draw_opacity() < 1 || |
238 !finished_target->uses_default_blend_mode() || | |
danakj
2013/11/13 21:02:03
Can you add a unit test for this case to occlusion
rosca
2013/11/18 10:01:35
I added unit tests for occlusion in layer_tree_hos
| |
239 target_is_only_for_copy_request || | 239 target_is_only_for_copy_request || |
240 finished_target->filters().HasFilterThatAffectsOpacity()) { | 240 finished_target->filters().HasFilterThatAffectsOpacity()) { |
241 stack_.back().occlusion_from_outside_target.Clear(); | 241 stack_.back().occlusion_from_outside_target.Clear(); |
242 stack_.back().occlusion_from_inside_target.Clear(); | 242 stack_.back().occlusion_from_inside_target.Clear(); |
243 } else if (!SurfaceTransformsToTargetKnown(surface)) { | 243 } else if (!SurfaceTransformsToTargetKnown(surface)) { |
244 stack_.back().occlusion_from_inside_target.Clear(); | 244 stack_.back().occlusion_from_inside_target.Clear(); |
245 stack_.back().occlusion_from_outside_target.Clear(); | 245 stack_.back().occlusion_from_outside_target.Clear(); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 DCHECK_EQ(layer->render_target(), stack_.back().target); | 407 DCHECK_EQ(layer->render_target(), stack_.back().target); |
408 if (stack_.empty()) | 408 if (stack_.empty()) |
409 return; | 409 return; |
410 | 410 |
411 if (layer->draw_properties().skip_drawing) | 411 if (layer->draw_properties().skip_drawing) |
412 return; | 412 return; |
413 | 413 |
414 if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1) | 414 if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1) |
415 return; | 415 return; |
416 | 416 |
417 if (!layer->uses_default_blend_mode()) | |
danakj
2013/11/13 21:02:03
Can you add a unit test for this case as well?
| |
418 return; | |
419 | |
417 if (LayerIsInUnsorted3dRenderingContext(layer)) | 420 if (LayerIsInUnsorted3dRenderingContext(layer)) |
418 return; | 421 return; |
419 | 422 |
420 if (!LayerTransformsToTargetKnown(layer)) | 423 if (!LayerTransformsToTargetKnown(layer)) |
421 return; | 424 return; |
422 | 425 |
423 Region opaque_contents = layer->VisibleContentOpaqueRegion(); | 426 Region opaque_contents = layer->VisibleContentOpaqueRegion(); |
424 if (opaque_contents.IsEmpty()) | 427 if (opaque_contents.IsEmpty()) |
425 return; | 428 return; |
426 | 429 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 unoccluded_rect.Intersect(content_rect); | 681 unoccluded_rect.Intersect(content_rect); |
679 | 682 |
680 return unoccluded_rect; | 683 return unoccluded_rect; |
681 } | 684 } |
682 | 685 |
683 // Instantiate (and export) templates here for the linker. | 686 // Instantiate (and export) templates here for the linker. |
684 template class OcclusionTrackerBase<Layer, RenderSurface>; | 687 template class OcclusionTrackerBase<Layer, RenderSurface>; |
685 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 688 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
686 | 689 |
687 } // namespace cc | 690 } // namespace cc |
OLD | NEW |