| 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" | |
| 13 #include "cc/animation/animation_host.h" | 12 #include "cc/animation/animation_host.h" |
| 14 #include "cc/animation/mutable_properties.h" | 13 #include "cc/animation/mutable_properties.h" |
| 15 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
| 16 #include "cc/layers/layer.h" | 15 #include "cc/layers/layer.h" |
| 17 #include "cc/layers/layer_impl.h" | 16 #include "cc/layers/layer_impl.h" |
| 18 #include "cc/output/copy_output_request.h" | 17 #include "cc/output/copy_output_request.h" |
| 19 #include "cc/trees/clip_node.h" | 18 #include "cc/trees/clip_node.h" |
| 20 #include "cc/trees/draw_property_utils.h" | 19 #include "cc/trees/draw_property_utils.h" |
| 21 #include "cc/trees/effect_node.h" | 20 #include "cc/trees/effect_node.h" |
| 22 #include "cc/trees/layer_tree_impl.h" | 21 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 218 } |
| 220 | 219 |
| 221 static size_t NumUnclippedDescendants(Layer* layer) { | 220 static size_t NumUnclippedDescendants(Layer* layer) { |
| 222 return layer->num_unclipped_descendants(); | 221 return layer->num_unclipped_descendants(); |
| 223 } | 222 } |
| 224 | 223 |
| 225 static size_t NumUnclippedDescendants(LayerImpl* layer) { | 224 static size_t NumUnclippedDescendants(LayerImpl* layer) { |
| 226 return layer->test_properties()->num_unclipped_descendants; | 225 return layer->test_properties()->num_unclipped_descendants; |
| 227 } | 226 } |
| 228 | 227 |
| 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 | |
| 237 static Layer* MaskLayer(Layer* layer) { | 228 static Layer* MaskLayer(Layer* layer) { |
| 238 return layer->mask_layer(); | 229 return layer->mask_layer(); |
| 239 } | 230 } |
| 240 | 231 |
| 241 static LayerImpl* MaskLayer(LayerImpl* layer) { | 232 static LayerImpl* MaskLayer(LayerImpl* layer) { |
| 242 return layer->test_properties()->mask_layer; | 233 return layer->test_properties()->mask_layer; |
| 243 } | 234 } |
| 244 | 235 |
| 245 static const gfx::Transform& Transform(Layer* layer) { | 236 static const gfx::Transform& Transform(Layer* layer) { |
| 246 return layer->transform(); | 237 return layer->transform(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // clipping state from ancestors must continue to get propagated. | 422 // clipping state from ancestors must continue to get propagated. |
| 432 node.layer_clipping_uses_only_local_clip = | 423 node.layer_clipping_uses_only_local_clip = |
| 433 (created_render_surface && NumUnclippedDescendants(layer) == 0) || | 424 (created_render_surface && NumUnclippedDescendants(layer) == 0) || |
| 434 !ancestor_clips_subtree; | 425 !ancestor_clips_subtree; |
| 435 } else { | 426 } else { |
| 436 // Otherwise, we're either unclipped, or exist only in order to apply our | 427 // Otherwise, we're either unclipped, or exist only in order to apply our |
| 437 // parent's clips in our space. | 428 // parent's clips in our space. |
| 438 node.layer_clipping_uses_only_local_clip = false; | 429 node.layer_clipping_uses_only_local_clip = false; |
| 439 } | 430 } |
| 440 | 431 |
| 441 if (layer_clips_subtree) { | 432 if (layer_clips_subtree) |
| 442 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; | 433 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; |
| 443 } else if (Filters(layer).HasFilterThatMovesPixels()) { | 434 else |
| 444 node.clip_type = ClipNode::ClipType::EXPANDS_CLIP; | |
| 445 node.clip_expander = | |
| 446 base::MakeUnique<ClipExpander>(layer->effect_tree_index()); | |
| 447 } else { | |
| 448 node.clip_type = ClipNode::ClipType::NONE; | 435 node.clip_type = ClipNode::ClipType::NONE; |
| 449 } | |
| 450 node.resets_clip = has_unclipped_surface; | 436 node.resets_clip = has_unclipped_surface; |
| 451 node.target_is_clipped = data_for_children->target_is_clipped; | 437 node.target_is_clipped = data_for_children->target_is_clipped; |
| 452 node.layers_are_clipped = layers_are_clipped; | 438 node.layers_are_clipped = layers_are_clipped; |
| 453 node.layers_are_clipped_when_surfaces_disabled = | 439 node.layers_are_clipped_when_surfaces_disabled = |
| 454 layers_are_clipped_when_surfaces_disabled; | 440 layers_are_clipped_when_surfaces_disabled; |
| 455 | 441 |
| 456 data_for_children->clip_tree_parent = | 442 data_for_children->clip_tree_parent = |
| 457 data_for_children->property_trees->clip_tree.Insert(node, parent_id); | 443 data_for_children->property_trees->clip_tree.Insert(node, parent_id); |
| 458 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = | 444 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = |
| 459 data_for_children->clip_tree_parent; | 445 data_for_children->clip_tree_parent; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 803 } |
| 818 | 804 |
| 819 static inline SkXfermode::Mode BlendMode(Layer* layer) { | 805 static inline SkXfermode::Mode BlendMode(Layer* layer) { |
| 820 return layer->blend_mode(); | 806 return layer->blend_mode(); |
| 821 } | 807 } |
| 822 | 808 |
| 823 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) { | 809 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) { |
| 824 return layer->test_properties()->blend_mode; | 810 return layer->test_properties()->blend_mode; |
| 825 } | 811 } |
| 826 | 812 |
| 813 static inline const FilterOperations& Filters(Layer* layer) { |
| 814 return layer->filters(); |
| 815 } |
| 816 |
| 827 static inline const gfx::PointF FiltersOrigin(Layer* layer) { | 817 static inline const gfx::PointF FiltersOrigin(Layer* layer) { |
| 828 return layer->filters_origin(); | 818 return layer->filters_origin(); |
| 829 } | 819 } |
| 830 | 820 |
| 831 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { | 821 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { |
| 832 return layer->test_properties()->filters_origin; | 822 return layer->test_properties()->filters_origin; |
| 833 } | 823 } |
| 834 | 824 |
| 825 static inline const FilterOperations& Filters(LayerImpl* layer) { |
| 826 return layer->test_properties()->filters; |
| 827 } |
| 828 |
| 835 static inline const FilterOperations& BackgroundFilters(Layer* layer) { | 829 static inline const FilterOperations& BackgroundFilters(Layer* layer) { |
| 836 return layer->background_filters(); | 830 return layer->background_filters(); |
| 837 } | 831 } |
| 838 | 832 |
| 839 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { | 833 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { |
| 840 return layer->test_properties()->background_filters; | 834 return layer->test_properties()->background_filters; |
| 841 } | 835 } |
| 842 | 836 |
| 843 static inline bool HideLayerAndSubtree(Layer* layer) { | 837 static inline bool HideLayerAndSubtree(Layer* layer) { |
| 844 return layer->hide_layer_and_subtree(); | 838 return layer->hide_layer_and_subtree(); |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 color = SkColorSetA(color, 255); | 1491 color = SkColorSetA(color, 255); |
| 1498 BuildPropertyTreesTopLevelInternal( | 1492 BuildPropertyTreesTopLevelInternal( |
| 1499 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1493 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1500 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1494 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1501 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1495 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1502 device_transform, property_trees, color); | 1496 device_transform, property_trees, color); |
| 1503 property_trees->ResetCachedData(); | 1497 property_trees->ResetCachedData(); |
| 1504 } | 1498 } |
| 1505 | 1499 |
| 1506 } // namespace cc | 1500 } // namespace cc |
| OLD | NEW |