| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // it owns a TransformNode, since this depends on the state of the | 672 // it owns a TransformNode, since this depends on the state of the |
| 673 // corresponding Layer at the time of the last commit. For example, if | 673 // corresponding Layer at the time of the last commit. For example, if |
| 674 // |is_animated| is false, this might mean a transform animation just ticked | 674 // |is_animated| is false, this might mean a transform animation just ticked |
| 675 // past its finish point (so the LayerImpl still owns a TransformNode) or it | 675 // past its finish point (so the LayerImpl still owns a TransformNode) or it |
| 676 // might mean that a transform animation was removed during commit or | 676 // might mean that a transform animation was removed during commit or |
| 677 // activation (and, in that case, the LayerImpl will no longer own a | 677 // activation (and, in that case, the LayerImpl will no longer own a |
| 678 // TransformNode, unless it has non-animation-related reasons for owning a | 678 // TransformNode, unless it has non-animation-related reasons for owning a |
| 679 // node). | 679 // node). |
| 680 if (node->owner_id != id()) | 680 if (node->owner_id != id()) |
| 681 return; | 681 return; |
| 682 if (node->data.is_animated != is_animated) { | 682 if (node->data.has_potential_animation != is_animated) { |
| 683 node->data.is_animated = is_animated; | 683 node->data.has_potential_animation = is_animated; |
| 684 if (is_animated) { | 684 if (is_animated) { |
| 685 float maximum_target_scale = 0.f; | 685 float maximum_target_scale = 0.f; |
| 686 node->data.local_maximum_animation_target_scale = | 686 node->data.local_maximum_animation_target_scale = |
| 687 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale | 687 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale |
| 688 : 0.f; | 688 : 0.f; |
| 689 | 689 |
| 690 float animation_start_scale = 0.f; | 690 float animation_start_scale = 0.f; |
| 691 node->data.local_starting_animation_scale = | 691 node->data.local_starting_animation_scale = |
| 692 AnimationStartScale(&animation_start_scale) ? animation_start_scale | 692 AnimationStartScale(&animation_start_scale) ? animation_start_scale |
| 693 : 0.f; | 693 : 0.f; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 // layers in the pending tree will find out about these changes as a | 779 // layers in the pending tree will find out about these changes as a |
| 780 // result of the shared SyncedProperty. | 780 // result of the shared SyncedProperty. |
| 781 if (!IsActive()) | 781 if (!IsActive()) |
| 782 return; | 782 return; |
| 783 | 783 |
| 784 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset)); | 784 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset)); |
| 785 | 785 |
| 786 layer_tree_impl_->DidAnimateScrollOffset(); | 786 layer_tree_impl_->DidAnimateScrollOffset(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { | 789 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged( |
| 790 UpdatePropertyTreeTransformIsAnimated(is_animating); | 790 bool is_currently_animating) { |
| 791 DCHECK(layer_tree_impl_); |
| 792 TransformTree& transform_tree = |
| 793 layer_tree_impl_->property_trees()->transform_tree; |
| 794 TransformNode* node = transform_tree.Node(transform_tree_index()); |
| 795 if (!node) |
| 796 return; |
| 797 |
| 798 if (node->owner_id == id()) |
| 799 node->data.is_currently_animating = is_currently_animating; |
| 800 } |
| 801 |
| 802 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged( |
| 803 bool has_potential_animation) { |
| 804 UpdatePropertyTreeTransformIsAnimated(has_potential_animation); |
| 791 was_ever_ready_since_last_transform_animation_ = false; | 805 was_ever_ready_since_last_transform_animation_ = false; |
| 792 } | 806 } |
| 793 | 807 |
| 794 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged( | 808 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged( |
| 795 bool is_currently_animating) { | 809 bool is_currently_animating) { |
| 796 DCHECK(layer_tree_impl_); | 810 DCHECK(layer_tree_impl_); |
| 797 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; | 811 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; |
| 798 EffectNode* node = effect_tree.Node(effect_tree_index()); | 812 EffectNode* node = effect_tree.Node(effect_tree_index()); |
| 799 | 813 |
| 800 if (node->owner_id == id()) | 814 if (node->owner_id == id()) |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 .layer_transforms_should_scale_layer_contents) { | 1425 .layer_transforms_should_scale_layer_contents) { |
| 1412 return default_scale; | 1426 return default_scale; |
| 1413 } | 1427 } |
| 1414 | 1428 |
| 1415 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1429 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1416 DrawTransform(), default_scale); | 1430 DrawTransform(), default_scale); |
| 1417 return std::max(transform_scales.x(), transform_scales.y()); | 1431 return std::max(transform_scales.x(), transform_scales.y()); |
| 1418 } | 1432 } |
| 1419 | 1433 |
| 1420 } // namespace cc | 1434 } // namespace cc |
| OLD | NEW |