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> |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 | 219 |
220 static size_t NumUnclippedDescendants(Layer* layer) { | 220 static size_t NumUnclippedDescendants(Layer* layer) { |
221 return layer->num_unclipped_descendants(); | 221 return layer->num_unclipped_descendants(); |
222 } | 222 } |
223 | 223 |
224 static size_t NumUnclippedDescendants(LayerImpl* layer) { | 224 static size_t NumUnclippedDescendants(LayerImpl* layer) { |
225 return layer->test_properties()->num_unclipped_descendants; | 225 return layer->test_properties()->num_unclipped_descendants; |
226 } | 226 } |
227 | 227 |
| 228 static inline const FilterOperations& Filters(Layer* layer) { |
| 229 return layer->filters(); |
| 230 } |
| 231 |
| 232 static inline const FilterOperations& Filters(LayerImpl* layer) { |
| 233 return layer->test_properties()->filters; |
| 234 } |
| 235 |
228 static Layer* MaskLayer(Layer* layer) { | 236 static Layer* MaskLayer(Layer* layer) { |
229 return layer->mask_layer(); | 237 return layer->mask_layer(); |
230 } | 238 } |
231 | 239 |
232 static LayerImpl* MaskLayer(LayerImpl* layer) { | 240 static LayerImpl* MaskLayer(LayerImpl* layer) { |
233 return layer->test_properties()->mask_layer; | 241 return layer->test_properties()->mask_layer; |
234 } | 242 } |
235 | 243 |
236 static const gfx::Transform& Transform(Layer* layer) { | 244 static const gfx::Transform& Transform(Layer* layer) { |
237 return layer->transform(); | 245 return layer->transform(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // clipping state from ancestors must continue to get propagated. | 430 // clipping state from ancestors must continue to get propagated. |
423 node.layer_clipping_uses_only_local_clip = | 431 node.layer_clipping_uses_only_local_clip = |
424 (created_render_surface && NumUnclippedDescendants(layer) == 0) || | 432 (created_render_surface && NumUnclippedDescendants(layer) == 0) || |
425 !ancestor_clips_subtree; | 433 !ancestor_clips_subtree; |
426 } else { | 434 } else { |
427 // Otherwise, we're either unclipped, or exist only in order to apply our | 435 // Otherwise, we're either unclipped, or exist only in order to apply our |
428 // parent's clips in our space. | 436 // parent's clips in our space. |
429 node.layer_clipping_uses_only_local_clip = false; | 437 node.layer_clipping_uses_only_local_clip = false; |
430 } | 438 } |
431 | 439 |
432 if (layer_clips_subtree) | 440 if (layer_clips_subtree) { |
433 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; | 441 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; |
434 else | 442 } else if (Filters(layer).HasFilterThatMovesPixels()) { |
| 443 node.clip_type = ClipNode::ClipType::EXPANDS_CLIP; |
| 444 node.clip_expander = |
| 445 ClipExpander::CreateForFilter(layer->effect_tree_index()); |
| 446 } else { |
435 node.clip_type = ClipNode::ClipType::NONE; | 447 node.clip_type = ClipNode::ClipType::NONE; |
| 448 } |
436 node.resets_clip = has_unclipped_surface; | 449 node.resets_clip = has_unclipped_surface; |
437 node.target_is_clipped = data_for_children->target_is_clipped; | 450 node.target_is_clipped = data_for_children->target_is_clipped; |
438 node.layers_are_clipped = layers_are_clipped; | 451 node.layers_are_clipped = layers_are_clipped; |
439 node.layers_are_clipped_when_surfaces_disabled = | 452 node.layers_are_clipped_when_surfaces_disabled = |
440 layers_are_clipped_when_surfaces_disabled; | 453 layers_are_clipped_when_surfaces_disabled; |
441 | 454 |
442 data_for_children->clip_tree_parent = | 455 data_for_children->clip_tree_parent = |
443 data_for_children->property_trees->clip_tree.Insert(node, parent_id); | 456 data_for_children->property_trees->clip_tree.Insert(node, parent_id); |
444 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = | 457 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = |
445 data_for_children->clip_tree_parent; | 458 data_for_children->clip_tree_parent; |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 } | 806 } |
794 | 807 |
795 static inline SkXfermode::Mode BlendMode(Layer* layer) { | 808 static inline SkXfermode::Mode BlendMode(Layer* layer) { |
796 return layer->blend_mode(); | 809 return layer->blend_mode(); |
797 } | 810 } |
798 | 811 |
799 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) { | 812 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) { |
800 return layer->test_properties()->blend_mode; | 813 return layer->test_properties()->blend_mode; |
801 } | 814 } |
802 | 815 |
803 static inline const FilterOperations& Filters(Layer* layer) { | |
804 return layer->filters(); | |
805 } | |
806 | |
807 static inline const gfx::PointF FiltersOrigin(Layer* layer) { | 816 static inline const gfx::PointF FiltersOrigin(Layer* layer) { |
808 return layer->filters_origin(); | 817 return layer->filters_origin(); |
809 } | 818 } |
810 | 819 |
811 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { | 820 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { |
812 return layer->test_properties()->filters_origin; | 821 return layer->test_properties()->filters_origin; |
813 } | 822 } |
814 | 823 |
815 static inline const FilterOperations& Filters(LayerImpl* layer) { | |
816 return layer->test_properties()->filters; | |
817 } | |
818 | |
819 static inline const FilterOperations& BackgroundFilters(Layer* layer) { | 824 static inline const FilterOperations& BackgroundFilters(Layer* layer) { |
820 return layer->background_filters(); | 825 return layer->background_filters(); |
821 } | 826 } |
822 | 827 |
823 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { | 828 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { |
824 return layer->test_properties()->background_filters; | 829 return layer->test_properties()->background_filters; |
825 } | 830 } |
826 | 831 |
827 static inline bool HideLayerAndSubtree(Layer* layer) { | 832 static inline bool HideLayerAndSubtree(Layer* layer) { |
828 return layer->hide_layer_and_subtree(); | 833 return layer->hide_layer_and_subtree(); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 color = SkColorSetA(color, 255); | 1485 color = SkColorSetA(color, 255); |
1481 BuildPropertyTreesTopLevelInternal( | 1486 BuildPropertyTreesTopLevelInternal( |
1482 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1487 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
1483 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1488 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
1484 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1489 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
1485 device_transform, property_trees, color); | 1490 device_transform, property_trees, color); |
1486 property_trees->ResetCachedData(); | 1491 property_trees->ResetCachedData(); |
1487 } | 1492 } |
1488 | 1493 |
1489 } // namespace cc | 1494 } // namespace cc |
OLD | NEW |