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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { | 535 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { |
536 UpdatePropertyTreeTransformIsAnimated( | 536 UpdatePropertyTreeTransformIsAnimated( |
537 HasPotentiallyRunningTransformAnimation()); | 537 HasPotentiallyRunningTransformAnimation()); |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
541 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { | 541 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { |
542 return CurrentScrollOffset(); | 542 return CurrentScrollOffset(); |
543 } | 543 } |
544 | 544 |
545 void LayerImpl::OnTransformIsCurrentlyAnimatingChanged( | 545 void LayerImpl::OnIsAnimatingChanged(const PropertyAnimationState& mask, |
546 bool is_currently_animating) { | 546 const PropertyAnimationState& state) { |
547 DCHECK(layer_tree_impl_); | 547 DCHECK(layer_tree_impl_); |
548 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 548 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); |
549 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, | |
550 id())) | |
551 return; | |
552 TransformNode* node = property_trees->transform_tree.Node( | |
553 property_trees->transform_id_to_index_map[id()]); | |
554 node->is_currently_animating = is_currently_animating; | |
555 } | |
556 | 549 |
557 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged( | 550 TransformNode* transform_node = nullptr; |
558 bool has_potential_animation) { | 551 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, |
559 UpdatePropertyTreeTransformIsAnimated(has_potential_animation); | 552 id())) { |
560 was_ever_ready_since_last_transform_animation_ = false; | 553 transform_node = property_trees->transform_tree.Node( |
561 } | 554 property_trees->transform_id_to_index_map[id()]); |
| 555 } |
562 | 556 |
563 void LayerImpl::OnOpacityIsCurrentlyAnimatingChanged( | 557 EffectNode* effect_node = nullptr; |
564 bool is_currently_animating) { | 558 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) { |
565 DCHECK(layer_tree_impl_); | 559 effect_node = property_trees->effect_tree.Node( |
566 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 560 property_trees->effect_id_to_index_map[id()]); |
567 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) | 561 } |
568 return; | |
569 EffectNode* node = property_trees->effect_tree.Node( | |
570 property_trees->effect_id_to_index_map[id()]); | |
571 | 562 |
572 node->is_currently_animating_opacity = is_currently_animating; | 563 for (int property = TargetProperty::FIRST_TARGET_PROPERTY; |
573 } | 564 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { |
574 | 565 switch (property) { |
575 void LayerImpl::OnOpacityIsPotentiallyAnimatingChanged( | 566 case TargetProperty::TRANSFORM: |
576 bool has_potential_animation) { | 567 if (transform_node) { |
577 DCHECK(layer_tree_impl_); | 568 if (mask.currently_running[property]) |
578 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 569 transform_node->is_currently_animating = |
579 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) | 570 state.currently_running[property]; |
580 return; | 571 if (mask.potentially_animating[property]) { |
581 EffectNode* node = property_trees->effect_tree.Node( | 572 UpdatePropertyTreeTransformIsAnimated( |
582 property_trees->effect_id_to_index_map[id()]); | 573 state.potentially_animating[property]); |
583 node->has_potential_opacity_animation = has_potential_animation; | 574 was_ever_ready_since_last_transform_animation_ = false; |
584 property_trees->effect_tree.set_needs_update(true); | 575 } |
585 } | 576 } |
586 | 577 break; |
587 void LayerImpl::OnFilterIsCurrentlyAnimatingChanged( | 578 case TargetProperty::OPACITY: |
588 bool is_currently_animating) { | 579 if (effect_node) { |
589 DCHECK(layer_tree_impl_); | 580 if (mask.currently_running[property]) |
590 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 581 effect_node->is_currently_animating_opacity = |
591 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) | 582 state.currently_running[property]; |
592 return; | 583 if (mask.potentially_animating[property]) { |
593 EffectNode* node = property_trees->effect_tree.Node( | 584 effect_node->has_potential_opacity_animation = |
594 property_trees->effect_id_to_index_map[id()]); | 585 state.potentially_animating[property]; |
595 | 586 property_trees->effect_tree.set_needs_update(true); |
596 node->is_currently_animating_filter = is_currently_animating; | 587 } |
597 } | 588 } |
598 | 589 break; |
599 void LayerImpl::OnFilterIsPotentiallyAnimatingChanged( | 590 case TargetProperty::FILTER: |
600 bool has_potential_animation) { | 591 if (effect_node) { |
601 DCHECK(layer_tree_impl_); | 592 if (mask.currently_running[property]) |
602 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | 593 effect_node->is_currently_animating_filter = |
603 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) | 594 state.currently_running[property]; |
604 return; | 595 if (mask.potentially_animating[property]) |
605 EffectNode* node = property_trees->effect_tree.Node( | 596 effect_node->has_potential_filter_animation = |
606 property_trees->effect_id_to_index_map[id()]); | 597 state.potentially_animating[property]; |
607 node->has_potential_filter_animation = has_potential_animation; | 598 } |
| 599 break; |
| 600 default: |
| 601 break; |
| 602 } |
| 603 } |
608 } | 604 } |
609 | 605 |
610 bool LayerImpl::IsActive() const { | 606 bool LayerImpl::IsActive() const { |
611 return layer_tree_impl_->IsActiveTree(); | 607 return layer_tree_impl_->IsActiveTree(); |
612 } | 608 } |
613 | 609 |
614 gfx::Size LayerImpl::bounds() const { | 610 gfx::Size LayerImpl::bounds() const { |
615 gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); | 611 gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); |
616 return gfx::Size(bounds_.width() + delta.x(), | 612 return gfx::Size(bounds_.width() + delta.x(), |
617 bounds_.height() + delta.y()); | 613 bounds_.height() + delta.y()); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 .layer_transforms_should_scale_layer_contents) { | 1088 .layer_transforms_should_scale_layer_contents) { |
1093 return default_scale; | 1089 return default_scale; |
1094 } | 1090 } |
1095 | 1091 |
1096 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1092 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
1097 ScreenSpaceTransform(), default_scale); | 1093 ScreenSpaceTransform(), default_scale); |
1098 return std::max(transform_scales.x(), transform_scales.y()); | 1094 return std::max(transform_scales.x(), transform_scales.y()); |
1099 } | 1095 } |
1100 | 1096 |
1101 } // namespace cc | 1097 } // namespace cc |
OLD | NEW |