OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() && | 568 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() && |
569 num_descendants_that_draw_content > 0) { | 569 num_descendants_that_draw_content > 0) { |
570 TRACE_EVENT_INSTANT0( | 570 TRACE_EVENT_INSTANT0( |
571 "cc", | 571 "cc", |
572 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening", | 572 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening", |
573 TRACE_EVENT_SCOPE_THREAD); | 573 TRACE_EVENT_SCOPE_THREAD); |
574 DCHECK(!is_root); | 574 DCHECK(!is_root); |
575 return true; | 575 return true; |
576 } | 576 } |
577 | 577 |
| 578 // If the layer has blending. |
| 579 // TODO(rosca): this is temporary, until blending is implemented for other |
| 580 // types of quads than RenderPassQuad. Layers having descendants that draw |
| 581 // content will still create a separate rendering surface. |
| 582 if (!layer->uses_default_blend_mode()) { |
| 583 TRACE_EVENT_INSTANT0( |
| 584 "cc", |
| 585 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface blending", |
| 586 TRACE_EVENT_SCOPE_THREAD); |
| 587 return true; |
| 588 } |
| 589 |
| 590 // If the layer has isolation. |
| 591 // TODO(rosca): to be optimized - create separate rendering surface only when |
| 592 // the blending descendants might have access to the content behind this layer |
| 593 // (layer has transparent background or descendants overflow) |
| 594 if (layer->is_root_for_isolated_group()) { |
| 595 TRACE_EVENT_INSTANT0( |
| 596 "cc", |
| 597 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface isolation", |
| 598 TRACE_EVENT_SCOPE_THREAD); |
| 599 return true; |
| 600 } |
| 601 |
578 // If the layer clips its descendants but it is not axis-aligned with respect | 602 // If the layer clips its descendants but it is not axis-aligned with respect |
579 // to its parent. | 603 // to its parent. |
580 bool layer_clips_external_content = | 604 bool layer_clips_external_content = |
581 LayerClipsSubtree(layer) || layer->HasDelegatedContent(); | 605 LayerClipsSubtree(layer) || layer->HasDelegatedContent(); |
582 if (layer_clips_external_content && !axis_aligned_with_respect_to_parent && | 606 if (layer_clips_external_content && !axis_aligned_with_respect_to_parent && |
583 !layer->draw_properties().descendants_can_clip_selves) { | 607 !layer->draw_properties().descendants_can_clip_selves) { |
584 TRACE_EVENT_INSTANT0( | 608 TRACE_EVENT_INSTANT0( |
585 "cc", | 609 "cc", |
586 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping", | 610 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping", |
587 TRACE_EVENT_SCOPE_THREAD); | 611 TRACE_EVENT_SCOPE_THREAD); |
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 // At this point, we think the point does hit the touch event handler region | 2251 // At this point, we think the point does hit the touch event handler region |
2228 // on the layer, but we need to walk up the parents to ensure that the layer | 2252 // on the layer, but we need to walk up the parents to ensure that the layer |
2229 // was not clipped in such a way that the hit point actually should not hit | 2253 // was not clipped in such a way that the hit point actually should not hit |
2230 // the layer. | 2254 // the layer. |
2231 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 2255 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
2232 return false; | 2256 return false; |
2233 | 2257 |
2234 return true; | 2258 return true; |
2235 } | 2259 } |
2236 } // namespace cc | 2260 } // namespace cc |
OLD | NEW |