Chromium Code Reviews| 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 "cc/animation/animation_host.h" | 12 #include "cc/animation/animation_host.h" |
| 13 #include "cc/animation/mutable_properties.h" | |
| 13 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
| 14 #include "cc/layers/layer.h" | 15 #include "cc/layers/layer.h" |
| 15 #include "cc/layers/layer_impl.h" | 16 #include "cc/layers/layer_impl.h" |
| 16 #include "cc/output/copy_output_request.h" | 17 #include "cc/output/copy_output_request.h" |
| 17 #include "cc/trees/clip_node.h" | 18 #include "cc/trees/clip_node.h" |
| 18 #include "cc/trees/draw_property_utils.h" | 19 #include "cc/trees/draw_property_utils.h" |
| 19 #include "cc/trees/effect_node.h" | 20 #include "cc/trees/effect_node.h" |
| 20 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.h" |
| 21 #include "cc/trees/layer_tree_impl.h" | 22 #include "cc/trees/layer_tree_impl.h" |
| 22 #include "cc/trees/scroll_node.h" | 23 #include "cc/trees/scroll_node.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 const bool has_potentially_animated_transform = | 492 const bool has_potentially_animated_transform = |
| 492 HasPotentiallyRunningTransformAnimation(layer); | 493 HasPotentiallyRunningTransformAnimation(layer); |
| 493 | 494 |
| 494 // A transform node is needed even for a finished animation, since differences | 495 // A transform node is needed even for a finished animation, since differences |
| 495 // in the timing of animation state updates can mean that an animation that's | 496 // in the timing of animation state updates can mean that an animation that's |
| 496 // in the Finished state at tree-building time on the main thread is still in | 497 // in the Finished state at tree-building time on the main thread is still in |
| 497 // the Running state right after commit on the compositor thread. | 498 // the Running state right after commit on the compositor thread. |
| 498 const bool has_any_transform_animation = | 499 const bool has_any_transform_animation = |
| 499 HasAnyAnimationTargetingProperty(layer, TargetProperty::TRANSFORM); | 500 HasAnyAnimationTargetingProperty(layer, TargetProperty::TRANSFORM); |
| 500 | 501 |
| 502 const bool has_proxied_transform_related_property = | |
| 503 layer->mutable_properties() & MutableProperty::kTransformRelated; | |
|
jaydasika
2016/08/17 02:38:43
Should this be && ?
Ian Vollick
2016/08/17 02:40:28
Ah, mutable_properties is a bitfield.
| |
| 504 | |
| 501 const bool has_surface = created_render_surface; | 505 const bool has_surface = created_render_surface; |
| 502 | 506 |
| 503 // A transform node is needed to change the render target for subtree when | 507 // A transform node is needed to change the render target for subtree when |
| 504 // a scroll child's render target is different from the scroll parent's render | 508 // a scroll child's render target is different from the scroll parent's render |
| 505 // target. | 509 // target. |
| 506 const bool scroll_child_has_different_target = | 510 const bool scroll_child_has_different_target = |
| 507 ScrollParent(layer) && | 511 ScrollParent(layer) && |
| 508 Parent(layer)->effect_tree_index() != | 512 Parent(layer)->effect_tree_index() != |
| 509 ScrollParent(layer)->effect_tree_index(); | 513 ScrollParent(layer)->effect_tree_index(); |
| 510 | 514 |
| 511 const bool is_at_boundary_of_3d_rendering_context = | 515 const bool is_at_boundary_of_3d_rendering_context = |
| 512 IsAtBoundaryOf3dRenderingContext(layer); | 516 IsAtBoundaryOf3dRenderingContext(layer); |
| 513 | 517 |
| 514 bool requires_node = is_root || is_scrollable || has_significant_transform || | 518 bool requires_node = is_root || is_scrollable || has_significant_transform || |
| 515 has_any_transform_animation || has_surface || is_fixed || | 519 has_any_transform_animation || has_surface || is_fixed || |
| 516 is_page_scale_layer || is_overscroll_elasticity_layer || | 520 is_page_scale_layer || is_overscroll_elasticity_layer || |
| 521 has_proxied_transform_related_property || | |
| 517 scroll_child_has_different_target || | 522 scroll_child_has_different_target || |
| 518 is_at_boundary_of_3d_rendering_context; | 523 is_at_boundary_of_3d_rendering_context; |
| 519 | 524 |
| 520 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); | 525 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); |
| 521 DCHECK(is_root || transform_parent); | 526 DCHECK(is_root || transform_parent); |
| 522 | 527 |
| 523 int parent_index = kRootPropertyTreeNodeId; | 528 int parent_index = kRootPropertyTreeNodeId; |
| 524 if (transform_parent) | 529 if (transform_parent) |
| 525 parent_index = transform_parent->transform_tree_index(); | 530 parent_index = transform_parent->transform_tree_index(); |
| 526 | 531 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 bool AddEffectNodeIfNeeded( | 939 bool AddEffectNodeIfNeeded( |
| 935 const DataForRecursion<LayerType>& data_from_ancestor, | 940 const DataForRecursion<LayerType>& data_from_ancestor, |
| 936 LayerType* layer, | 941 LayerType* layer, |
| 937 DataForRecursion<LayerType>* data_for_children) { | 942 DataForRecursion<LayerType>* data_for_children) { |
| 938 const bool is_root = !Parent(layer); | 943 const bool is_root = !Parent(layer); |
| 939 const bool has_transparency = EffectiveOpacity(layer) != 1.f; | 944 const bool has_transparency = EffectiveOpacity(layer) != 1.f; |
| 940 const bool has_potential_opacity_animation = | 945 const bool has_potential_opacity_animation = |
| 941 HasPotentialOpacityAnimation(layer); | 946 HasPotentialOpacityAnimation(layer); |
| 942 const bool has_potential_filter_animation = | 947 const bool has_potential_filter_animation = |
| 943 HasPotentiallyRunningFilterAnimation(layer); | 948 HasPotentiallyRunningFilterAnimation(layer); |
| 949 const bool has_proxied_opacity = | |
| 950 layer->mutable_properties() & MutableProperty::kOpacity; | |
|
jaydasika
2016/08/17 02:38:43
same comment as above
| |
| 944 const bool should_create_render_surface = ShouldCreateRenderSurface( | 951 const bool should_create_render_surface = ShouldCreateRenderSurface( |
| 945 layer, data_from_ancestor.compound_transform_since_render_target, | 952 layer, data_from_ancestor.compound_transform_since_render_target, |
| 946 data_from_ancestor.axis_align_since_render_target); | 953 data_from_ancestor.axis_align_since_render_target); |
| 947 data_for_children->axis_align_since_render_target &= | 954 data_for_children->axis_align_since_render_target &= |
| 948 AnimationsPreserveAxisAlignment(layer); | 955 AnimationsPreserveAxisAlignment(layer); |
| 949 | 956 |
| 950 bool requires_node = is_root || has_transparency || | 957 bool requires_node = is_root || has_transparency || |
| 951 has_potential_opacity_animation || | 958 has_potential_opacity_animation || has_proxied_opacity || |
| 952 should_create_render_surface; | 959 should_create_render_surface; |
| 953 | 960 |
| 954 int parent_id = data_from_ancestor.effect_tree_parent; | 961 int parent_id = data_from_ancestor.effect_tree_parent; |
| 955 | 962 |
| 956 if (!requires_node) { | 963 if (!requires_node) { |
| 957 layer->SetEffectTreeIndex(parent_id); | 964 layer->SetEffectTreeIndex(parent_id); |
| 958 data_for_children->effect_tree_parent = parent_id; | 965 data_for_children->effect_tree_parent = parent_id; |
| 959 data_for_children->compound_transform_since_render_target *= | 966 data_for_children->compound_transform_since_render_target *= |
| 960 layer->transform(); | 967 layer->transform(); |
| 961 return false; | 968 return false; |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1457 color = SkColorSetA(color, 255); | 1464 color = SkColorSetA(color, 255); |
| 1458 BuildPropertyTreesTopLevelInternal( | 1465 BuildPropertyTreesTopLevelInternal( |
| 1459 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 1466 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 1460 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 1467 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 1461 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, | 1468 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, |
| 1462 device_transform, property_trees, color); | 1469 device_transform, property_trees, color); |
| 1463 property_trees->ResetCachedData(); | 1470 property_trees->ResetCachedData(); |
| 1464 } | 1471 } |
| 1465 | 1472 |
| 1466 } // namespace cc | 1473 } // namespace cc |
| OLD | NEW |