OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/property_tree_builder.h" | 5 #include "cc/trees/property_tree_builder.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 template <typename LayerType> | 94 template <typename LayerType> |
95 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, | 95 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
96 LayerType* layer, | 96 LayerType* layer, |
97 bool created_transform_node, | 97 bool created_transform_node, |
98 DataForRecursion<LayerType>* data_for_children) { | 98 DataForRecursion<LayerType>* data_for_children) { |
99 ClipNode* parent = GetClipParent(data_from_ancestor, layer); | 99 ClipNode* parent = GetClipParent(data_from_ancestor, layer); |
100 int parent_id = parent->id; | 100 int parent_id = parent->id; |
101 | 101 |
102 bool ancestor_clips_subtree = | 102 bool ancestor_clips_subtree = |
103 data_from_ancestor.ancestor_clips_subtree || | 103 data_from_ancestor.ancestor_clips_subtree || layer->clip_parent(); |
104 (layer->clip_parent() && layer->clip_parent()->is_clipped()); | |
105 | 104 |
106 data_for_children->ancestor_clips_subtree = false; | 105 data_for_children->ancestor_clips_subtree = false; |
107 bool has_unclipped_surface = false; | 106 bool has_unclipped_surface = false; |
108 | 107 |
109 if (layer->has_render_surface()) { | 108 if (layer->has_render_surface()) { |
110 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) | 109 if (ancestor_clips_subtree && layer->num_unclipped_descendants() > 0) |
111 data_for_children->ancestor_clips_subtree = true; | 110 data_for_children->ancestor_clips_subtree = true; |
112 else if (!ancestor_clips_subtree && !layer->num_unclipped_descendants()) | 111 else if (!ancestor_clips_subtree && !layer->num_unclipped_descendants()) |
113 has_unclipped_surface = true; | 112 has_unclipped_surface = true; |
114 } else { | 113 } else { |
(...skipping 24 matching lines...) Expand all Loading... |
139 data_for_children->render_target->transform_tree_index(); | 138 data_for_children->render_target->transform_tree_index(); |
140 node.owner_id = layer->id(); | 139 node.owner_id = layer->id(); |
141 | 140 |
142 data_for_children->clip_tree_parent = | 141 data_for_children->clip_tree_parent = |
143 data_for_children->clip_tree->Insert(node, parent_id); | 142 data_for_children->clip_tree->Insert(node, parent_id); |
144 } | 143 } |
145 | 144 |
146 layer->SetClipTreeIndex( | 145 layer->SetClipTreeIndex( |
147 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); | 146 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); |
148 | 147 |
149 layer->set_is_clipped(data_for_children->ancestor_clips_subtree); | |
150 | |
151 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the | 148 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the |
152 // clip for all children since we may need to draw. We need to figure out a | 149 // clip for all children since we may need to draw. We need to figure out a |
153 // better way, since we will need both the clipped and unclipped versions. | 150 // better way, since we will need both the clipped and unclipped versions. |
154 } | 151 } |
155 | 152 |
156 template <typename LayerType> | 153 template <typename LayerType> |
157 bool AddTransformNodeIfNeeded( | 154 bool AddTransformNodeIfNeeded( |
158 const DataForRecursion<LayerType>& data_from_ancestor, | 155 const DataForRecursion<LayerType>& data_from_ancestor, |
159 LayerType* layer, | 156 LayerType* layer, |
160 DataForRecursion<LayerType>* data_for_children) { | 157 DataForRecursion<LayerType>* data_for_children) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 const gfx::Rect& viewport, | 497 const gfx::Rect& viewport, |
501 const gfx::Transform& device_transform, | 498 const gfx::Transform& device_transform, |
502 PropertyTrees* property_trees) { | 499 PropertyTrees* property_trees) { |
503 BuildPropertyTreesTopLevelInternal( | 500 BuildPropertyTreesTopLevelInternal( |
504 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 501 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
505 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, | 502 outer_viewport_scroll_layer, page_scale_factor, device_scale_factor, |
506 viewport, device_transform, property_trees); | 503 viewport, device_transform, property_trees); |
507 } | 504 } |
508 | 505 |
509 } // namespace cc | 506 } // namespace cc |
OLD | NEW |