Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1987123002: cc : Track transform animation changes on transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // it owns a TransformNode, since this depends on the state of the 662 // it owns a TransformNode, since this depends on the state of the
663 // corresponding Layer at the time of the last commit. For example, if 663 // corresponding Layer at the time of the last commit. For example, if
664 // |is_animated| is false, this might mean a transform animation just ticked 664 // |is_animated| is false, this might mean a transform animation just ticked
665 // past its finish point (so the LayerImpl still owns a TransformNode) or it 665 // past its finish point (so the LayerImpl still owns a TransformNode) or it
666 // might mean that a transform animation was removed during commit or 666 // might mean that a transform animation was removed during commit or
667 // activation (and, in that case, the LayerImpl will no longer own a 667 // activation (and, in that case, the LayerImpl will no longer own a
668 // TransformNode, unless it has non-animation-related reasons for owning a 668 // TransformNode, unless it has non-animation-related reasons for owning a
669 // node). 669 // node).
670 if (node->owner_id != id()) 670 if (node->owner_id != id())
671 return; 671 return;
672 if (node->data.is_animated != is_animated) { 672 if (node->data.has_potential_animation != is_animated) {
673 node->data.is_animated = is_animated; 673 node->data.has_potential_animation = is_animated;
674 if (is_animated) { 674 if (is_animated) {
675 float maximum_target_scale = 0.f; 675 float maximum_target_scale = 0.f;
676 node->data.local_maximum_animation_target_scale = 676 node->data.local_maximum_animation_target_scale =
677 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale 677 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale
678 : 0.f; 678 : 0.f;
679 679
680 float animation_start_scale = 0.f; 680 float animation_start_scale = 0.f;
681 node->data.local_starting_animation_scale = 681 node->data.local_starting_animation_scale =
682 AnimationStartScale(&animation_start_scale) ? animation_start_scale 682 AnimationStartScale(&animation_start_scale) ? animation_start_scale
683 : 0.f; 683 : 0.f;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // layers in the pending tree will find out about these changes as a 769 // layers in the pending tree will find out about these changes as a
770 // result of the shared SyncedProperty. 770 // result of the shared SyncedProperty.
771 if (!IsActive()) 771 if (!IsActive())
772 return; 772 return;
773 773
774 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset)); 774 SetCurrentScrollOffset(ClampScrollOffsetToLimits(scroll_offset));
775 775
776 layer_tree_impl_->DidAnimateScrollOffset(); 776 layer_tree_impl_->DidAnimateScrollOffset();
777 } 777 }
778 778
779 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { 779 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged(
780 UpdatePropertyTreeTransformIsAnimated(is_animating); 780 bool is_currently_animating) {
781 DCHECK(layer_tree_impl_);
782 TransformTree& transform_tree =
783 layer_tree_impl_->property_trees()->transform_tree;
784 TransformNode* node = transform_tree.Node(transform_tree_index());
785 if (!node)
786 return;
787
788 if (node->owner_id == id())
789 node->data.is_currently_animating = is_currently_animating;
790 }
791
792 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(
793 bool has_potential_animation) {
794 UpdatePropertyTreeTransformIsAnimated(has_potential_animation);
781 was_ever_ready_since_last_transform_animation_ = false; 795 was_ever_ready_since_last_transform_animation_ = false;
782 } 796 }
783 797
784 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged( 798 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged(
785 bool is_currently_animating) { 799 bool is_currently_animating) {
786 DCHECK(layer_tree_impl_); 800 DCHECK(layer_tree_impl_);
787 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; 801 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree;
788 EffectNode* node = effect_tree.Node(effect_tree_index()); 802 EffectNode* node = effect_tree.Node(effect_tree_index());
789 803
790 if (node->owner_id == id()) 804 if (node->owner_id == id())
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 .layer_transforms_should_scale_layer_contents) { 1424 .layer_transforms_should_scale_layer_contents) {
1411 return default_scale; 1425 return default_scale;
1412 } 1426 }
1413 1427
1414 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1428 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1415 DrawTransform(), default_scale); 1429 DrawTransform(), default_scale);
1416 return std::max(transform_scales.x(), transform_scales.y()); 1430 return std::max(transform_scales.x(), transform_scales.y());
1417 } 1431 }
1418 1432
1419 } // namespace cc 1433 } // namespace cc
OLDNEW
« cc/layers/layer.cc ('K') | « cc/layers/layer_impl.h ('k') | cc/proto/property_tree.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698