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

Side by Side Diff: cc/trees/layer_tree.cc

Issue 2357533002: CC Animation: Use std::bitset to update animation state. (Closed)
Patch Set: Reparent. Created 4 years, 2 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/trees/layer_tree.h ('k') | cc/trees/layer_tree_host_impl.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/layer_tree.h" 5 #include "cc/trees/layer_tree.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/input/page_scale_animation.h" 10 #include "cc/input/page_scale_animation.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 void LayerTree::SetElementScrollOffsetMutated( 646 void LayerTree::SetElementScrollOffsetMutated(
647 ElementId element_id, 647 ElementId element_id,
648 ElementListType list_type, 648 ElementListType list_type,
649 const gfx::ScrollOffset& scroll_offset) { 649 const gfx::ScrollOffset& scroll_offset) {
650 Layer* layer = LayerByElementId(element_id); 650 Layer* layer = LayerByElementId(element_id);
651 DCHECK(layer); 651 DCHECK(layer);
652 layer->OnScrollOffsetAnimated(scroll_offset); 652 layer->OnScrollOffsetAnimated(scroll_offset);
653 } 653 }
654 654
655 void LayerTree::ElementTransformIsAnimatingChanged( 655 void LayerTree::ElementIsAnimatingChanged(ElementId element_id,
656 ElementId element_id, 656 ElementListType list_type,
657 ElementListType list_type, 657 const PropertyAnimationState& mask,
658 AnimationChangeType change_type, 658 const PropertyAnimationState& state) {
659 bool is_animating) {
660 Layer* layer = LayerByElementId(element_id); 659 Layer* layer = LayerByElementId(element_id);
661 if (layer) { 660 if (layer)
662 switch (change_type) { 661 layer->OnIsAnimatingChanged(mask, state);
663 case AnimationChangeType::POTENTIAL:
664 layer->OnTransformIsPotentiallyAnimatingChanged(is_animating);
665 break;
666 case AnimationChangeType::RUNNING:
667 layer->OnTransformIsCurrentlyAnimatingChanged(is_animating);
668 break;
669 case AnimationChangeType::BOTH:
670 layer->OnTransformIsPotentiallyAnimatingChanged(is_animating);
671 layer->OnTransformIsCurrentlyAnimatingChanged(is_animating);
672 break;
673 }
674 }
675 }
676
677 void LayerTree::ElementOpacityIsAnimatingChanged(
678 ElementId element_id,
679 ElementListType list_type,
680 AnimationChangeType change_type,
681 bool is_animating) {
682 Layer* layer = LayerByElementId(element_id);
683 if (layer) {
684 switch (change_type) {
685 case AnimationChangeType::POTENTIAL:
686 layer->OnOpacityIsPotentiallyAnimatingChanged(is_animating);
687 break;
688 case AnimationChangeType::RUNNING:
689 layer->OnOpacityIsCurrentlyAnimatingChanged(is_animating);
690 break;
691 case AnimationChangeType::BOTH:
692 layer->OnOpacityIsPotentiallyAnimatingChanged(is_animating);
693 layer->OnOpacityIsCurrentlyAnimatingChanged(is_animating);
694 break;
695 }
696 }
697 }
698
699 void LayerTree::ElementFilterIsAnimatingChanged(ElementId element_id,
700 ElementListType list_type,
701 AnimationChangeType change_type,
702 bool is_animating) {
703 Layer* layer = LayerByElementId(element_id);
704 if (layer) {
705 switch (change_type) {
706 case AnimationChangeType::POTENTIAL:
707 layer->OnFilterIsPotentiallyAnimatingChanged(is_animating);
708 break;
709 case AnimationChangeType::RUNNING:
710 layer->OnFilterIsCurrentlyAnimatingChanged(is_animating);
711 break;
712 case AnimationChangeType::BOTH:
713 layer->OnFilterIsPotentiallyAnimatingChanged(is_animating);
714 layer->OnFilterIsCurrentlyAnimatingChanged(is_animating);
715 break;
716 }
717 }
718 } 662 }
719 663
720 gfx::ScrollOffset LayerTree::GetScrollOffsetForAnimation( 664 gfx::ScrollOffset LayerTree::GetScrollOffsetForAnimation(
721 ElementId element_id) const { 665 ElementId element_id) const {
722 Layer* layer = LayerByElementId(element_id); 666 Layer* layer = LayerByElementId(element_id);
723 DCHECK(layer); 667 DCHECK(layer);
724 return layer->ScrollOffsetForAnimation(); 668 return layer->ScrollOffsetForAnimation();
725 } 669 }
726 670
727 LayerListIterator<Layer> LayerTree::begin() const { 671 LayerListIterator<Layer> LayerTree::begin() const {
(...skipping 11 matching lines...) Expand all
739 LayerListReverseIterator<Layer> LayerTree::rend() { 683 LayerListReverseIterator<Layer> LayerTree::rend() {
740 return LayerListReverseIterator<Layer>(nullptr); 684 return LayerListReverseIterator<Layer>(nullptr);
741 } 685 }
742 686
743 void LayerTree::SetNeedsDisplayOnAllLayers() { 687 void LayerTree::SetNeedsDisplayOnAllLayers() {
744 for (auto* layer : *this) 688 for (auto* layer : *this)
745 layer->SetNeedsDisplay(); 689 layer->SetNeedsDisplay();
746 } 690 }
747 691
748 } // namespace cc 692 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698