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

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

Issue 1968803002: cc : Use effect node data to determine which opacity wins at commit. (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
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 node->data.effect_changed = true; 714 node->data.effect_changed = true;
715 layer_tree_impl()->property_trees()->changed = true; 715 layer_tree_impl()->property_trees()->changed = true;
716 effect_tree.set_needs_update(true); 716 effect_tree.set_needs_update(true);
717 } 717 }
718 } 718 }
719 719
720 void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() { 720 void LayerImpl::UpdatePropertyTreeForScrollingAndAnimationIfNeeded() {
721 if (scrollable()) 721 if (scrollable())
722 UpdatePropertyTreeScrollOffset(); 722 UpdatePropertyTreeScrollOffset();
723 723
724 if (HasAnyAnimationTargetingProperty(TargetProperty::OPACITY))
725 UpdatePropertyTreeOpacity();
726
727 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) { 724 if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) {
728 UpdatePropertyTreeTransform(); 725 UpdatePropertyTreeTransform();
729 UpdatePropertyTreeTransformIsAnimated( 726 UpdatePropertyTreeTransformIsAnimated(
730 HasPotentiallyRunningTransformAnimation()); 727 HasPotentiallyRunningTransformAnimation());
731 } 728 }
732 } 729 }
733 730
734 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { 731 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const {
735 return CurrentScrollOffset(); 732 return CurrentScrollOffset();
736 } 733 }
(...skipping 10 matching lines...) Expand all
747 layer_tree_impl()->property_trees()->changed = true; 744 layer_tree_impl()->property_trees()->changed = true;
748 effect_tree.set_needs_update(true); 745 effect_tree.set_needs_update(true);
749 } 746 }
750 } 747 }
751 748
752 void LayerImpl::OnOpacityAnimated(float opacity) { 749 void LayerImpl::OnOpacityAnimated(float opacity) {
753 SetOpacity(opacity); 750 SetOpacity(opacity);
754 UpdatePropertyTreeOpacity(); 751 UpdatePropertyTreeOpacity();
755 SetNeedsPushProperties(); 752 SetNeedsPushProperties();
756 layer_tree_impl()->set_needs_update_draw_properties(); 753 layer_tree_impl()->set_needs_update_draw_properties();
754 layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity);
757 } 755 }
758 756
759 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) { 757 void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) {
760 gfx::Transform old_transform = transform_; 758 gfx::Transform old_transform = transform_;
761 SetTransform(transform); 759 SetTransform(transform);
762 UpdatePropertyTreeTransform(); 760 UpdatePropertyTreeTransform();
763 was_ever_ready_since_last_transform_animation_ = false; 761 was_ever_ready_since_last_transform_animation_ = false;
764 if (old_transform != transform) { 762 if (old_transform != transform) {
765 SetNeedsPushProperties(); 763 SetNeedsPushProperties();
766 layer_tree_impl()->set_needs_update_draw_properties(); 764 layer_tree_impl()->set_needs_update_draw_properties();
(...skipping 25 matching lines...) Expand all
792 790
793 if (node->owner_id == id()) 791 if (node->owner_id == id())
794 node->data.is_currently_animating_opacity = is_currently_animating; 792 node->data.is_currently_animating_opacity = is_currently_animating;
795 } 793 }
796 794
797 void LayerImpl::OnOpacityIsPotentiallyAnimatingChanged( 795 void LayerImpl::OnOpacityIsPotentiallyAnimatingChanged(
798 bool has_potential_animation) { 796 bool has_potential_animation) {
799 DCHECK(layer_tree_impl_); 797 DCHECK(layer_tree_impl_);
800 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; 798 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree;
801 EffectNode* node = effect_tree.Node(effect_tree_index()); 799 EffectNode* node = effect_tree.Node(effect_tree_index());
802 if (!node)
803 return;
804 if (node->owner_id == id()) { 800 if (node->owner_id == id()) {
805 node->data.has_potential_opacity_animation = has_potential_animation; 801 node->data.has_potential_opacity_animation = has_potential_animation;
806 effect_tree.set_needs_update(true); 802 effect_tree.set_needs_update(true);
807 } 803 }
808 } 804 }
809 805
810 bool LayerImpl::IsActive() const { 806 bool LayerImpl::IsActive() const {
811 return layer_tree_impl_->IsActiveTree(); 807 return layer_tree_impl_->IsActiveTree();
812 } 808 }
813 809
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 .layer_transforms_should_scale_layer_contents) { 1411 .layer_transforms_should_scale_layer_contents) {
1416 return default_scale; 1412 return default_scale;
1417 } 1413 }
1418 1414
1419 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1415 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1420 DrawTransform(), default_scale); 1416 DrawTransform(), default_scale);
1421 return std::max(transform_scales.x(), transform_scales.y()); 1417 return std::max(transform_scales.x(), transform_scales.y());
1422 } 1418 }
1423 1419
1424 } // namespace cc 1420 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698