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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 | 11 |
| 12 #include "base/memory/ptr_util.h" |
12 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
13 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
14 #include "cc/layers/layer_impl.h" | 15 #include "cc/layers/layer_impl.h" |
15 #include "cc/output/copy_output_request.h" | 16 #include "cc/output/copy_output_request.h" |
16 #include "cc/trees/clip_node.h" | 17 #include "cc/trees/clip_node.h" |
17 #include "cc/trees/draw_property_utils.h" | 18 #include "cc/trees/draw_property_utils.h" |
18 #include "cc/trees/effect_node.h" | 19 #include "cc/trees/effect_node.h" |
19 #include "cc/trees/layer_tree_impl.h" | 20 #include "cc/trees/layer_tree_impl.h" |
20 #include "cc/trees/layer_tree_settings.h" | 21 #include "cc/trees/layer_tree_settings.h" |
21 #include "cc/trees/mutable_properties.h" | 22 #include "cc/trees/mutable_properties.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 219 } |
219 | 220 |
220 static size_t NumUnclippedDescendants(Layer* layer) { | 221 static size_t NumUnclippedDescendants(Layer* layer) { |
221 return layer->num_unclipped_descendants(); | 222 return layer->num_unclipped_descendants(); |
222 } | 223 } |
223 | 224 |
224 static size_t NumUnclippedDescendants(LayerImpl* layer) { | 225 static size_t NumUnclippedDescendants(LayerImpl* layer) { |
225 return layer->test_properties()->num_unclipped_descendants; | 226 return layer->test_properties()->num_unclipped_descendants; |
226 } | 227 } |
227 | 228 |
| 229 static inline const FilterOperations& Filters(Layer* layer) { |
| 230 return layer->filters(); |
| 231 } |
| 232 |
| 233 static inline const FilterOperations& Filters(LayerImpl* layer) { |
| 234 return layer->test_properties()->filters; |
| 235 } |
| 236 |
228 static Layer* MaskLayer(Layer* layer) { | 237 static Layer* MaskLayer(Layer* layer) { |
229 return layer->mask_layer(); | 238 return layer->mask_layer(); |
230 } | 239 } |
231 | 240 |
232 static LayerImpl* MaskLayer(LayerImpl* layer) { | 241 static LayerImpl* MaskLayer(LayerImpl* layer) { |
233 return layer->test_properties()->mask_layer; | 242 return layer->test_properties()->mask_layer; |
234 } | 243 } |
235 | 244 |
236 static const gfx::Transform& Transform(Layer* layer) { | 245 static const gfx::Transform& Transform(Layer* layer) { |
237 return layer->transform(); | 246 return layer->transform(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // clipping state from ancestors must continue to get propagated. | 439 // clipping state from ancestors must continue to get propagated. |
431 node.layer_clipping_uses_only_local_clip = | 440 node.layer_clipping_uses_only_local_clip = |
432 (created_render_surface && NumUnclippedDescendants(layer) == 0) || | 441 (created_render_surface && NumUnclippedDescendants(layer) == 0) || |
433 !apply_ancestor_clip; | 442 !apply_ancestor_clip; |
434 } else { | 443 } else { |
435 // Otherwise, we're either unclipped, or exist only in order to apply our | 444 // Otherwise, we're either unclipped, or exist only in order to apply our |
436 // parent's clips in our space. | 445 // parent's clips in our space. |
437 node.layer_clipping_uses_only_local_clip = false; | 446 node.layer_clipping_uses_only_local_clip = false; |
438 } | 447 } |
439 | 448 |
440 if (layer_clips_subtree) | 449 if (layer_clips_subtree) { |
441 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; | 450 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; |
442 else | 451 } else if (Filters(layer).HasFilterThatMovesPixels()) { |
| 452 node.clip_type = ClipNode::ClipType::EXPANDS_CLIP; |
| 453 node.clip_expander = |
| 454 base::MakeUnique<ClipExpander>(layer->effect_tree_index()); |
| 455 } else { |
443 node.clip_type = ClipNode::ClipType::NONE; | 456 node.clip_type = ClipNode::ClipType::NONE; |
| 457 } |
444 node.resets_clip = has_unclipped_surface; | 458 node.resets_clip = has_unclipped_surface; |
445 node.layers_are_clipped = layers_are_clipped; | 459 node.layers_are_clipped = layers_are_clipped; |
446 node.layers_are_clipped_when_surfaces_disabled = | 460 node.layers_are_clipped_when_surfaces_disabled = |
447 layers_are_clipped_when_surfaces_disabled; | 461 layers_are_clipped_when_surfaces_disabled; |
448 | 462 |
449 data_for_children->clip_tree_parent = | 463 data_for_children->clip_tree_parent = |
450 data_for_children->property_trees->clip_tree.Insert(node, parent_id); | 464 data_for_children->property_trees->clip_tree.Insert(node, parent_id); |
451 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = | 465 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = |
452 data_for_children->clip_tree_parent; | 466 data_for_children->clip_tree_parent; |
453 } | 467 } |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 } | 841 } |
828 | 842 |
829 static inline SkBlendMode BlendMode(Layer* layer) { | 843 static inline SkBlendMode BlendMode(Layer* layer) { |
830 return layer->blend_mode(); | 844 return layer->blend_mode(); |
831 } | 845 } |
832 | 846 |
833 static inline SkBlendMode BlendMode(LayerImpl* layer) { | 847 static inline SkBlendMode BlendMode(LayerImpl* layer) { |
834 return layer->test_properties()->blend_mode; | 848 return layer->test_properties()->blend_mode; |
835 } | 849 } |
836 | 850 |
837 static inline const FilterOperations& Filters(Layer* layer) { | |
838 return layer->filters(); | |
839 } | |
840 | |
841 static inline const gfx::PointF FiltersOrigin(Layer* layer) { | 851 static inline const gfx::PointF FiltersOrigin(Layer* layer) { |
842 return layer->filters_origin(); | 852 return layer->filters_origin(); |
843 } | 853 } |
844 | 854 |
845 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { | 855 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { |
846 return layer->test_properties()->filters_origin; | 856 return layer->test_properties()->filters_origin; |
847 } | 857 } |
848 | 858 |
849 static inline const FilterOperations& Filters(LayerImpl* layer) { | |
850 return layer->test_properties()->filters; | |
851 } | |
852 | |
853 static inline const FilterOperations& BackgroundFilters(Layer* layer) { | 859 static inline const FilterOperations& BackgroundFilters(Layer* layer) { |
854 return layer->background_filters(); | 860 return layer->background_filters(); |
855 } | 861 } |
856 | 862 |
857 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { | 863 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { |
858 return layer->test_properties()->background_filters; | 864 return layer->test_properties()->background_filters; |
859 } | 865 } |
860 | 866 |
861 static inline bool HideLayerAndSubtree(Layer* layer) { | 867 static inline bool HideLayerAndSubtree(Layer* layer) { |
862 return layer->hide_layer_and_subtree(); | 868 return layer->hide_layer_and_subtree(); |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 color = SkColorSetA(color, 255); | 1523 color = SkColorSetA(color, 255); |
1518 BuildPropertyTreesTopLevelInternal( | 1524 BuildPropertyTreesTopLevelInternal( |
1519 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1525 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1520 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1526 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1521 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1527 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1522 device_transform, property_trees, color); | 1528 device_transform, property_trees, color); |
1523 property_trees->ResetCachedData(); | 1529 property_trees->ResetCachedData(); |
1524 } | 1530 } |
1525 | 1531 |
1526 } // namespace cc | 1532 } // namespace cc |
OLD | NEW |