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" |
11 #include "cc/layers/layer.h" | 11 #include "cc/layers/layer.h" |
| 12 #include "cc/layers/layer_impl.h" |
12 #include "cc/trees/layer_tree_host.h" | 13 #include "cc/trees/layer_tree_host.h" |
13 #include "ui/gfx/geometry/point_f.h" | 14 #include "ui/gfx/geometry/point_f.h" |
14 #include "ui/gfx/geometry/vector2d_conversions.h" | 15 #include "ui/gfx/geometry/vector2d_conversions.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
18 class LayerTreeHost; | 19 class LayerTreeHost; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
| 23 template <typename LayerType> |
22 struct DataForRecursion { | 24 struct DataForRecursion { |
23 TransformTree* transform_tree; | 25 TransformTree* transform_tree; |
24 ClipTree* clip_tree; | 26 ClipTree* clip_tree; |
25 OpacityTree* opacity_tree; | 27 OpacityTree* opacity_tree; |
26 Layer* transform_tree_parent; | 28 LayerType* transform_tree_parent; |
27 Layer* transform_fixed_parent; | 29 LayerType* transform_fixed_parent; |
28 Layer* render_target; | 30 LayerType* render_target; |
29 int clip_tree_parent; | 31 int clip_tree_parent; |
30 int opacity_tree_parent; | 32 int opacity_tree_parent; |
31 const Layer* page_scale_layer; | 33 const LayerType* page_scale_layer; |
32 float page_scale_factor; | 34 float page_scale_factor; |
33 float device_scale_factor; | 35 float device_scale_factor; |
34 bool in_subtree_of_page_scale_application_layer; | 36 bool in_subtree_of_page_scale_application_layer; |
35 bool should_flatten; | 37 bool should_flatten; |
36 bool ancestor_clips_subtree; | 38 bool ancestor_clips_subtree; |
37 const gfx::Transform* device_transform; | 39 const gfx::Transform* device_transform; |
38 gfx::Vector2dF scroll_compensation_adjustment; | 40 gfx::Vector2dF scroll_compensation_adjustment; |
39 }; | 41 }; |
40 | 42 |
41 static Layer* GetTransformParent(const DataForRecursion& data, Layer* layer) { | 43 template <typename LayerType> |
| 44 static LayerType* GetTransformParent(const DataForRecursion<LayerType>& data, |
| 45 LayerType* layer) { |
42 return layer->position_constraint().is_fixed_position() | 46 return layer->position_constraint().is_fixed_position() |
43 ? data.transform_fixed_parent | 47 ? data.transform_fixed_parent |
44 : data.transform_tree_parent; | 48 : data.transform_tree_parent; |
45 } | 49 } |
46 | 50 |
47 static ClipNode* GetClipParent(const DataForRecursion& data, Layer* layer) { | 51 template <typename LayerType> |
| 52 static ClipNode* GetClipParent(const DataForRecursion<LayerType>& data, |
| 53 LayerType* layer) { |
48 const bool inherits_clip = !layer->parent() || !layer->clip_parent(); | 54 const bool inherits_clip = !layer->parent() || !layer->clip_parent(); |
49 const int id = inherits_clip ? data.clip_tree_parent | 55 const int id = inherits_clip ? data.clip_tree_parent |
50 : layer->clip_parent()->clip_tree_index(); | 56 : layer->clip_parent()->clip_tree_index(); |
51 return data.clip_tree->Node(id); | 57 return data.clip_tree->Node(id); |
52 } | 58 } |
53 | 59 |
54 static bool HasPotentiallyRunningAnimation(Layer* layer, | 60 template <typename LayerType> |
| 61 static bool HasPotentiallyRunningAnimation(LayerType* layer, |
55 Animation::TargetProperty property) { | 62 Animation::TargetProperty property) { |
56 if (Animation* animation = | 63 if (Animation* animation = |
57 layer->layer_animation_controller()->GetAnimation(property)) { | 64 layer->layer_animation_controller()->GetAnimation(property)) { |
58 return !animation->is_finished(); | 65 return !animation->is_finished(); |
59 } | 66 } |
60 return false; | 67 return false; |
61 } | 68 } |
62 | 69 |
63 static bool RequiresClipNode(Layer* layer, | 70 template <typename LayerType> |
64 const DataForRecursion& data, | 71 static bool RequiresClipNode(LayerType* layer, |
| 72 const DataForRecursion<LayerType>& data, |
65 int parent_transform_id, | 73 int parent_transform_id, |
66 bool is_clipped) { | 74 bool is_clipped) { |
67 const bool render_surface_applies_clip = | 75 const bool render_surface_applies_clip = |
68 layer->render_surface() && is_clipped; | 76 layer->render_surface() && is_clipped; |
69 const bool render_surface_may_grow_due_to_clip_children = | 77 const bool render_surface_may_grow_due_to_clip_children = |
70 layer->render_surface() && layer->num_unclipped_descendants() > 0; | 78 layer->render_surface() && layer->num_unclipped_descendants() > 0; |
71 | 79 |
72 if (!layer->parent() || layer->masks_to_bounds() || layer->mask_layer() || | 80 if (!layer->parent() || layer->masks_to_bounds() || layer->mask_layer() || |
73 render_surface_may_grow_due_to_clip_children) | 81 render_surface_may_grow_due_to_clip_children) |
74 return true; | 82 return true; |
75 | 83 |
76 if (!render_surface_applies_clip) | 84 if (!render_surface_applies_clip) |
77 return false; | 85 return false; |
78 | 86 |
79 bool axis_aligned_with_respect_to_parent = | 87 bool axis_aligned_with_respect_to_parent = |
80 data.transform_tree->Are2DAxisAligned(layer->transform_tree_index(), | 88 data.transform_tree->Are2DAxisAligned(layer->transform_tree_index(), |
81 parent_transform_id); | 89 parent_transform_id); |
82 | 90 |
83 return !axis_aligned_with_respect_to_parent; | 91 return !axis_aligned_with_respect_to_parent; |
84 } | 92 } |
85 | 93 |
86 static bool LayerClipsSubtree(Layer* layer) { | 94 template <typename LayerType> |
| 95 static bool LayerClipsSubtree(LayerType* layer) { |
87 return layer->masks_to_bounds() || layer->mask_layer(); | 96 return layer->masks_to_bounds() || layer->mask_layer(); |
88 } | 97 } |
89 | 98 |
90 void AddClipNodeIfNeeded(const DataForRecursion& data_from_ancestor, | 99 template <typename LayerType> |
91 Layer* layer, | 100 void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor, |
| 101 LayerType* layer, |
92 bool created_transform_node, | 102 bool created_transform_node, |
93 DataForRecursion* data_for_children) { | 103 DataForRecursion<LayerType>* data_for_children) { |
94 ClipNode* parent = GetClipParent(data_from_ancestor, layer); | 104 ClipNode* parent = GetClipParent(data_from_ancestor, layer); |
95 int parent_id = parent->id; | 105 int parent_id = parent->id; |
96 | 106 |
97 bool ancestor_clips_subtree = | 107 bool ancestor_clips_subtree = |
98 data_from_ancestor.ancestor_clips_subtree || layer->clip_parent(); | 108 data_from_ancestor.ancestor_clips_subtree || layer->clip_parent(); |
99 | 109 |
100 data_for_children->ancestor_clips_subtree = false; | 110 data_for_children->ancestor_clips_subtree = false; |
101 bool has_unclipped_surface = false; | 111 bool has_unclipped_surface = false; |
102 | 112 |
103 if (layer->has_render_surface()) { | 113 if (layer->has_render_surface()) { |
(...skipping 10 matching lines...) Expand all Loading... |
114 | 124 |
115 if (has_unclipped_surface) | 125 if (has_unclipped_surface) |
116 parent_id = 0; | 126 parent_id = 0; |
117 | 127 |
118 if (!RequiresClipNode(layer, data_from_ancestor, parent->data.transform_id, | 128 if (!RequiresClipNode(layer, data_from_ancestor, parent->data.transform_id, |
119 data_for_children->ancestor_clips_subtree)) { | 129 data_for_children->ancestor_clips_subtree)) { |
120 // Unclipped surfaces reset the clip rect. | 130 // Unclipped surfaces reset the clip rect. |
121 data_for_children->clip_tree_parent = parent_id; | 131 data_for_children->clip_tree_parent = parent_id; |
122 } else if (layer->parent()) { | 132 } else if (layer->parent()) { |
123 // Note the root clip gets handled elsewhere. | 133 // Note the root clip gets handled elsewhere. |
124 Layer* transform_parent = data_for_children->transform_tree_parent; | 134 LayerType* transform_parent = data_for_children->transform_tree_parent; |
125 if (layer->position_constraint().is_fixed_position() && | 135 if (layer->position_constraint().is_fixed_position() && |
126 !created_transform_node) { | 136 !created_transform_node) { |
127 transform_parent = data_for_children->transform_fixed_parent; | 137 transform_parent = data_for_children->transform_fixed_parent; |
128 } | 138 } |
129 ClipNode node; | 139 ClipNode node; |
130 node.data.clip = gfx::RectF( | 140 node.data.clip = gfx::RectF( |
131 gfx::PointF() + layer->offset_to_transform_parent(), layer->bounds()); | 141 gfx::PointF() + layer->offset_to_transform_parent(), layer->bounds()); |
132 node.data.transform_id = transform_parent->transform_tree_index(); | 142 node.data.transform_id = transform_parent->transform_tree_index(); |
133 node.data.target_id = | 143 node.data.target_id = |
134 data_for_children->render_target->transform_tree_index(); | 144 data_for_children->render_target->transform_tree_index(); |
135 node.owner_id = layer->id(); | 145 node.owner_id = layer->id(); |
136 | 146 |
137 data_for_children->clip_tree_parent = | 147 data_for_children->clip_tree_parent = |
138 data_for_children->clip_tree->Insert(node, parent_id); | 148 data_for_children->clip_tree->Insert(node, parent_id); |
139 } | 149 } |
140 | 150 |
141 layer->set_clip_tree_index( | 151 layer->set_clip_tree_index( |
142 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); | 152 has_unclipped_surface ? 0 : data_for_children->clip_tree_parent); |
143 | 153 |
144 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the | 154 // TODO(awoloszyn): Right now when we hit a node with a replica, we reset the |
145 // clip for all children since we may need to draw. We need to figure out a | 155 // clip for all children since we may need to draw. We need to figure out a |
146 // better way, since we will need both the clipped and unclipped versions. | 156 // better way, since we will need both the clipped and unclipped versions. |
147 } | 157 } |
148 | 158 |
149 bool AddTransformNodeIfNeeded(const DataForRecursion& data_from_ancestor, | 159 template <typename LayerType> |
150 Layer* layer, | 160 bool AddTransformNodeIfNeeded( |
151 DataForRecursion* data_for_children) { | 161 const DataForRecursion<LayerType>& data_from_ancestor, |
| 162 LayerType* layer, |
| 163 DataForRecursion<LayerType>* data_for_children) { |
152 const bool is_root = !layer->parent(); | 164 const bool is_root = !layer->parent(); |
153 const bool is_page_scale_application_layer = | 165 const bool is_page_scale_application_layer = |
154 layer->parent() && layer->parent() == data_from_ancestor.page_scale_layer; | 166 layer->parent() && layer->parent() == data_from_ancestor.page_scale_layer; |
155 const bool is_scrollable = layer->scrollable(); | 167 const bool is_scrollable = layer->scrollable(); |
156 const bool is_fixed = layer->position_constraint().is_fixed_position(); | 168 const bool is_fixed = layer->position_constraint().is_fixed_position(); |
157 | 169 |
158 const bool has_significant_transform = | 170 const bool has_significant_transform = |
159 !layer->transform().IsIdentityOr2DTranslation(); | 171 !layer->transform().IsIdentityOr2DTranslation(); |
160 | 172 |
161 const bool has_potentially_animated_transform = | 173 const bool has_potentially_animated_transform = |
162 HasPotentiallyRunningAnimation(layer, Animation::TRANSFORM); | 174 HasPotentiallyRunningAnimation(layer, Animation::TRANSFORM); |
163 | 175 |
164 const bool has_animated_transform = | 176 const bool has_animated_transform = |
165 layer->layer_animation_controller()->IsAnimatingProperty( | 177 layer->layer_animation_controller()->IsAnimatingProperty( |
166 Animation::TRANSFORM); | 178 Animation::TRANSFORM); |
167 | 179 |
168 const bool has_surface = !!layer->render_surface(); | 180 const bool has_surface = !!layer->render_surface(); |
169 | 181 |
170 bool requires_node = is_root || is_scrollable || has_significant_transform || | 182 bool requires_node = is_root || is_scrollable || has_significant_transform || |
171 has_potentially_animated_transform || has_surface || | 183 has_potentially_animated_transform || has_surface || |
172 is_page_scale_application_layer; | 184 is_page_scale_application_layer; |
173 | 185 |
174 Layer* transform_parent = GetTransformParent(data_from_ancestor, layer); | 186 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
175 | 187 |
176 gfx::Vector2dF parent_offset; | 188 gfx::Vector2dF parent_offset; |
177 if (transform_parent) { | 189 if (transform_parent) { |
178 if (layer->scroll_parent()) { | 190 if (layer->scroll_parent()) { |
179 gfx::Transform to_parent; | 191 gfx::Transform to_parent; |
180 Layer* source = layer->parent(); | 192 LayerType* source = layer->parent(); |
181 parent_offset += source->offset_to_transform_parent(); | 193 parent_offset += source->offset_to_transform_parent(); |
182 data_from_ancestor.transform_tree->ComputeTransform( | 194 data_from_ancestor.transform_tree->ComputeTransform( |
183 source->transform_tree_index(), | 195 source->transform_tree_index(), |
184 transform_parent->transform_tree_index(), &to_parent); | 196 transform_parent->transform_tree_index(), &to_parent); |
185 parent_offset += to_parent.To2dTranslation(); | 197 parent_offset += to_parent.To2dTranslation(); |
186 } else if (!is_fixed) { | 198 } else if (!is_fixed) { |
187 parent_offset = transform_parent->offset_to_transform_parent(); | 199 parent_offset = transform_parent->offset_to_transform_parent(); |
188 } else { | 200 } else { |
189 if (data_from_ancestor.transform_tree_parent != | 201 if (data_from_ancestor.transform_tree_parent != |
190 data_from_ancestor.transform_fixed_parent) { | 202 data_from_ancestor.transform_fixed_parent) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 layer->set_should_flatten_transform_from_property_tree(false); | 300 layer->set_should_flatten_transform_from_property_tree(false); |
289 | 301 |
290 data_for_children->scroll_compensation_adjustment += | 302 data_for_children->scroll_compensation_adjustment += |
291 layer->ScrollCompensationAdjustment() - node->data.scroll_snap; | 303 layer->ScrollCompensationAdjustment() - node->data.scroll_snap; |
292 | 304 |
293 node->owner_id = layer->id(); | 305 node->owner_id = layer->id(); |
294 | 306 |
295 return true; | 307 return true; |
296 } | 308 } |
297 | 309 |
298 void AddOpacityNodeIfNeeded(const DataForRecursion& data_from_ancestor, | 310 bool IsAnimatingOpacity(Layer* layer) { |
299 Layer* layer, | 311 return HasPotentiallyRunningAnimation(layer, Animation::OPACITY) || |
300 DataForRecursion* data_for_children) { | 312 layer->OpacityCanAnimateOnImplThread(); |
| 313 } |
| 314 |
| 315 bool IsAnimatingOpacity(LayerImpl* layer) { |
| 316 return HasPotentiallyRunningAnimation(layer, Animation::OPACITY); |
| 317 } |
| 318 |
| 319 template <typename LayerType> |
| 320 void AddOpacityNodeIfNeeded( |
| 321 const DataForRecursion<LayerType>& data_from_ancestor, |
| 322 LayerType* layer, |
| 323 DataForRecursion<LayerType>* data_for_children) { |
301 const bool is_root = !layer->parent(); | 324 const bool is_root = !layer->parent(); |
302 const bool has_transparency = layer->opacity() != 1.f; | 325 const bool has_transparency = layer->opacity() != 1.f; |
303 const bool has_animated_opacity = | 326 const bool has_animated_opacity = IsAnimatingOpacity(layer); |
304 HasPotentiallyRunningAnimation(layer, Animation::OPACITY) || | |
305 layer->OpacityCanAnimateOnImplThread(); | |
306 bool requires_node = is_root || has_transparency || has_animated_opacity; | 327 bool requires_node = is_root || has_transparency || has_animated_opacity; |
307 | 328 |
308 int parent_id = data_from_ancestor.opacity_tree_parent; | 329 int parent_id = data_from_ancestor.opacity_tree_parent; |
309 | 330 |
310 if (!requires_node) { | 331 if (!requires_node) { |
311 layer->set_opacity_tree_index(parent_id); | 332 layer->set_opacity_tree_index(parent_id); |
312 data_for_children->opacity_tree_parent = parent_id; | 333 data_for_children->opacity_tree_parent = parent_id; |
313 return; | 334 return; |
314 } | 335 } |
315 | 336 |
316 OpacityNode node; | 337 OpacityNode node; |
317 node.owner_id = layer->id(); | 338 node.owner_id = layer->id(); |
318 node.data = layer->opacity(); | 339 node.data = layer->opacity(); |
319 data_for_children->opacity_tree_parent = | 340 data_for_children->opacity_tree_parent = |
320 data_for_children->opacity_tree->Insert(node, parent_id); | 341 data_for_children->opacity_tree->Insert(node, parent_id); |
321 layer->set_opacity_tree_index(data_for_children->opacity_tree_parent); | 342 layer->set_opacity_tree_index(data_for_children->opacity_tree_parent); |
322 } | 343 } |
323 | 344 |
324 void BuildPropertyTreesInternal(Layer* layer, | 345 template <typename LayerType> |
325 const DataForRecursion& data_from_parent) { | 346 void BuildPropertyTreesInternal( |
326 DataForRecursion data_for_children(data_from_parent); | 347 LayerType* layer, |
| 348 const DataForRecursion<LayerType>& data_from_parent) { |
| 349 DataForRecursion<LayerType> data_for_children(data_from_parent); |
327 if (layer->render_surface()) | 350 if (layer->render_surface()) |
328 data_for_children.render_target = layer; | 351 data_for_children.render_target = layer; |
329 | 352 |
330 bool created_transform_node = | 353 bool created_transform_node = |
331 AddTransformNodeIfNeeded(data_from_parent, layer, &data_for_children); | 354 AddTransformNodeIfNeeded(data_from_parent, layer, &data_for_children); |
332 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node, | 355 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node, |
333 &data_for_children); | 356 &data_for_children); |
334 | 357 |
335 if (data_from_parent.opacity_tree) | 358 if (data_from_parent.opacity_tree) |
336 AddOpacityNodeIfNeeded(data_from_parent, layer, &data_for_children); | 359 AddOpacityNodeIfNeeded(data_from_parent, layer, &data_for_children); |
337 | 360 |
338 if (layer == data_from_parent.page_scale_layer) | 361 if (layer == data_from_parent.page_scale_layer) |
339 data_for_children.in_subtree_of_page_scale_application_layer = true; | 362 data_for_children.in_subtree_of_page_scale_application_layer = true; |
340 | 363 |
341 for (size_t i = 0; i < layer->children().size(); ++i) { | 364 for (size_t i = 0; i < layer->children().size(); ++i) { |
342 if (!layer->children()[i]->scroll_parent()) | 365 if (!layer->child_at(i)->scroll_parent()) |
343 BuildPropertyTreesInternal(layer->children()[i].get(), data_for_children); | 366 BuildPropertyTreesInternal(layer->child_at(i), data_for_children); |
344 } | 367 } |
345 | 368 |
346 if (layer->scroll_children()) { | 369 if (layer->scroll_children()) { |
347 for (Layer* scroll_child : *layer->scroll_children()) { | 370 for (LayerType* scroll_child : *layer->scroll_children()) { |
348 BuildPropertyTreesInternal(scroll_child, data_for_children); | 371 BuildPropertyTreesInternal(scroll_child, data_for_children); |
349 } | 372 } |
350 } | 373 } |
351 | 374 |
352 if (layer->has_replica()) | 375 if (layer->has_replica()) |
353 BuildPropertyTreesInternal(layer->replica_layer(), data_for_children); | 376 BuildPropertyTreesInternal(layer->replica_layer(), data_for_children); |
354 } | 377 } |
355 | 378 |
356 } // namespace | 379 } // namespace |
357 | 380 |
358 void PropertyTreeBuilder::BuildPropertyTrees( | 381 template <typename LayerType> |
359 Layer* root_layer, | 382 void BuildPropertyTreesTopLevelInternal(LayerType* root_layer, |
360 const Layer* page_scale_layer, | 383 const LayerType* page_scale_layer, |
361 float page_scale_factor, | 384 float page_scale_factor, |
362 float device_scale_factor, | 385 float device_scale_factor, |
363 const gfx::Rect& viewport, | 386 const gfx::Rect& viewport, |
364 const gfx::Transform& device_transform, | 387 const gfx::Transform& device_transform, |
365 PropertyTrees* property_trees) { | 388 PropertyTrees* property_trees) { |
366 if (!property_trees->needs_rebuild) | 389 DataForRecursion<LayerType> data_for_recursion; |
367 return; | |
368 | |
369 DataForRecursion data_for_recursion; | |
370 data_for_recursion.transform_tree = &property_trees->transform_tree; | 390 data_for_recursion.transform_tree = &property_trees->transform_tree; |
371 data_for_recursion.clip_tree = &property_trees->clip_tree; | 391 data_for_recursion.clip_tree = &property_trees->clip_tree; |
372 data_for_recursion.opacity_tree = &property_trees->opacity_tree; | 392 data_for_recursion.opacity_tree = &property_trees->opacity_tree; |
373 data_for_recursion.transform_tree_parent = nullptr; | 393 data_for_recursion.transform_tree_parent = nullptr; |
374 data_for_recursion.transform_fixed_parent = nullptr; | 394 data_for_recursion.transform_fixed_parent = nullptr; |
375 data_for_recursion.render_target = root_layer; | 395 data_for_recursion.render_target = root_layer; |
376 data_for_recursion.clip_tree_parent = 0; | 396 data_for_recursion.clip_tree_parent = 0; |
377 data_for_recursion.opacity_tree_parent = -1; | 397 data_for_recursion.opacity_tree_parent = -1; |
378 data_for_recursion.page_scale_layer = page_scale_layer; | 398 data_for_recursion.page_scale_layer = page_scale_layer; |
379 data_for_recursion.page_scale_factor = page_scale_factor; | 399 data_for_recursion.page_scale_factor = page_scale_factor; |
380 data_for_recursion.device_scale_factor = device_scale_factor; | 400 data_for_recursion.device_scale_factor = device_scale_factor; |
381 data_for_recursion.in_subtree_of_page_scale_application_layer = false; | 401 data_for_recursion.in_subtree_of_page_scale_application_layer = false; |
382 data_for_recursion.should_flatten = false; | 402 data_for_recursion.should_flatten = false; |
383 data_for_recursion.ancestor_clips_subtree = true; | 403 data_for_recursion.ancestor_clips_subtree = true; |
384 data_for_recursion.device_transform = &device_transform; | 404 data_for_recursion.device_transform = &device_transform; |
385 | 405 |
386 data_for_recursion.transform_tree->clear(); | 406 data_for_recursion.transform_tree->clear(); |
387 data_for_recursion.clip_tree->clear(); | 407 data_for_recursion.clip_tree->clear(); |
388 data_for_recursion.opacity_tree->clear(); | 408 data_for_recursion.opacity_tree->clear(); |
389 | 409 |
390 ClipNode root_clip; | 410 ClipNode root_clip; |
391 root_clip.data.clip = viewport; | 411 root_clip.data.clip = viewport; |
392 root_clip.data.transform_id = 0; | 412 root_clip.data.transform_id = 0; |
393 data_for_recursion.clip_tree_parent = | 413 data_for_recursion.clip_tree_parent = |
394 data_for_recursion.clip_tree->Insert(root_clip, 0); | 414 data_for_recursion.clip_tree->Insert(root_clip, 0); |
395 BuildPropertyTreesInternal(root_layer, data_for_recursion); | 415 BuildPropertyTreesInternal(root_layer, data_for_recursion); |
396 property_trees->needs_rebuild = false; | 416 property_trees->needs_rebuild = false; |
397 } | 417 } |
398 | 418 |
| 419 void PropertyTreeBuilder::BuildPropertyTrees( |
| 420 Layer* root_layer, |
| 421 const Layer* page_scale_layer, |
| 422 float page_scale_factor, |
| 423 float device_scale_factor, |
| 424 const gfx::Rect& viewport, |
| 425 const gfx::Transform& device_transform, |
| 426 PropertyTrees* property_trees) { |
| 427 // TODO(enne): hoist this out of here |
| 428 if (!property_trees->needs_rebuild) |
| 429 return; |
| 430 |
| 431 BuildPropertyTreesTopLevelInternal( |
| 432 root_layer, page_scale_layer, page_scale_factor, device_scale_factor, |
| 433 viewport, device_transform, property_trees); |
| 434 } |
| 435 |
| 436 void PropertyTreeBuilder::BuildPropertyTrees( |
| 437 LayerImpl* root_layer, |
| 438 const LayerImpl* page_scale_layer, |
| 439 float page_scale_factor, |
| 440 float device_scale_factor, |
| 441 const gfx::Rect& viewport, |
| 442 const gfx::Transform& device_transform, |
| 443 PropertyTrees* property_trees) { |
| 444 BuildPropertyTreesTopLevelInternal( |
| 445 root_layer, page_scale_layer, page_scale_factor, device_scale_factor, |
| 446 viewport, device_transform, property_trees); |
| 447 } |
| 448 |
399 } // namespace cc | 449 } // namespace cc |
OLD | NEW |