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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() && | 569 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() && |
570 num_descendants_that_draw_content > 0) { | 570 num_descendants_that_draw_content > 0) { |
571 TRACE_EVENT_INSTANT0( | 571 TRACE_EVENT_INSTANT0( |
572 "cc", | 572 "cc", |
573 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening", | 573 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening", |
574 TRACE_EVENT_SCOPE_THREAD); | 574 TRACE_EVENT_SCOPE_THREAD); |
575 DCHECK(!is_root); | 575 DCHECK(!is_root); |
576 return true; | 576 return true; |
577 } | 577 } |
578 | 578 |
| 579 // If the layer has blending. |
| 580 // TODO(rosca): this is temporary, until blending is implemented for other |
| 581 // types of quads than RenderPassQuad. Layers having descendants that draw |
| 582 // content will still create a separate rendering surface. |
| 583 if (layer->has_blend_mode()) { |
| 584 TRACE_EVENT_INSTANT0( |
| 585 "cc", |
| 586 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface blending", |
| 587 TRACE_EVENT_SCOPE_THREAD); |
| 588 return true; |
| 589 } |
| 590 |
| 591 // If the layer has isolation. |
| 592 // TODO(rosca): to be optimized - create separate rendering surface only when |
| 593 // the blending descendants might have access to the content behind this layer |
| 594 // (layer has transparent background or descendants overflow) |
| 595 if (layer->is_root_for_isolated_group()) { |
| 596 TRACE_EVENT_INSTANT0( |
| 597 "cc", |
| 598 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface isolation", |
| 599 TRACE_EVENT_SCOPE_THREAD); |
| 600 return true; |
| 601 } |
| 602 |
579 // If the layer clips its descendants but it is not axis-aligned with respect | 603 // If the layer clips its descendants but it is not axis-aligned with respect |
580 // to its parent. | 604 // to its parent. |
581 bool layer_clips_external_content = | 605 bool layer_clips_external_content = |
582 LayerClipsSubtree(layer) || layer->HasDelegatedContent(); | 606 LayerClipsSubtree(layer) || layer->HasDelegatedContent(); |
583 if (layer_clips_external_content && !axis_aligned_with_respect_to_parent && | 607 if (layer_clips_external_content && !axis_aligned_with_respect_to_parent && |
584 !layer->draw_properties().descendants_can_clip_selves) { | 608 !layer->draw_properties().descendants_can_clip_selves) { |
585 TRACE_EVENT_INSTANT0( | 609 TRACE_EVENT_INSTANT0( |
586 "cc", | 610 "cc", |
587 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping", | 611 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping", |
588 TRACE_EVENT_SCOPE_THREAD); | 612 TRACE_EVENT_SCOPE_THREAD); |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 // At this point, we think the point does hit the touch event handler region | 2240 // At this point, we think the point does hit the touch event handler region |
2217 // on the layer, but we need to walk up the parents to ensure that the layer | 2241 // on the layer, but we need to walk up the parents to ensure that the layer |
2218 // was not clipped in such a way that the hit point actually should not hit | 2242 // was not clipped in such a way that the hit point actually should not hit |
2219 // the layer. | 2243 // the layer. |
2220 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) | 2244 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) |
2221 return false; | 2245 return false; |
2222 | 2246 |
2223 return true; | 2247 return true; |
2224 } | 2248 } |
2225 } // namespace cc | 2249 } // namespace cc |
OLD | NEW |