| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ |
| 6 #define CC_ANIMATION_ANIMATION_PLAYER_H_ | 6 #define CC_ANIMATION_ANIMATION_PLAYER_H_ |
| 7 | 7 |
| 8 #include <bitset> | |
| 9 #include <vector> | 8 #include <vector> |
| 10 | 9 |
| 11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 14 #include "cc/animation/animation.h" | 13 #include "cc/animation/animation.h" |
| 15 #include "cc/animation/animation_curve.h" | 14 #include "cc/animation/animation_curve.h" |
| 16 #include "cc/animation/element_animations.h" | 15 #include "cc/animation/element_animations.h" |
| 17 #include "cc/animation/element_id.h" | 16 #include "cc/animation/element_id.h" |
| 18 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void PromoteStartedAnimations(base::TimeTicks monotonic_time, | 100 void PromoteStartedAnimations(base::TimeTicks monotonic_time, |
| 102 AnimationEvents* events); | 101 AnimationEvents* events); |
| 103 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, | 102 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time, |
| 104 AnimationEvents* events); | 103 AnimationEvents* events); |
| 105 void TickAnimations(base::TimeTicks monotonic_time); | 104 void TickAnimations(base::TimeTicks monotonic_time); |
| 106 void MarkFinishedAnimations(base::TimeTicks monotonic_time); | 105 void MarkFinishedAnimations(base::TimeTicks monotonic_time); |
| 107 | 106 |
| 108 // Make animations affect active elements if and only if they affect | 107 // Make animations affect active elements if and only if they affect |
| 109 // pending elements. Any animations that no longer affect any elements | 108 // pending elements. Any animations that no longer affect any elements |
| 110 // are deleted. | 109 // are deleted. |
| 111 void ActivateAnimations(bool* changed_transform_animation, | 110 void ActivateAnimations(); |
| 112 bool* changed_opacity_animation, | |
| 113 bool* changed_filter_animation); | |
| 114 | 111 |
| 115 bool HasFilterAnimationThatInflatesBounds() const; | 112 bool HasFilterAnimationThatInflatesBounds() const; |
| 116 bool HasTransformAnimationThatInflatesBounds() const; | 113 bool HasTransformAnimationThatInflatesBounds() const; |
| 117 | 114 |
| 118 bool TransformAnimationBoundsForBox(const gfx::BoxF& box, | 115 bool TransformAnimationBoundsForBox(const gfx::BoxF& box, |
| 119 gfx::BoxF* bounds) const; | 116 gfx::BoxF* bounds) const; |
| 120 bool HasOnlyTranslationTransforms(ElementListType list_type) const; | 117 bool HasOnlyTranslationTransforms(ElementListType list_type) const; |
| 121 bool AnimationsPreserveAxisAlignment() const; | 118 bool AnimationsPreserveAxisAlignment() const; |
| 122 | 119 |
| 123 // Sets |start_scale| to the maximum of starting animation scale along any | 120 // Sets |start_scale| to the maximum of starting animation scale along any |
| (...skipping 20 matching lines...) Expand all Loading... |
| 144 bool HasElementInActiveList() const; | 141 bool HasElementInActiveList() const; |
| 145 gfx::ScrollOffset ScrollOffsetForAnimation() const; | 142 gfx::ScrollOffset ScrollOffsetForAnimation() const; |
| 146 | 143 |
| 147 // Returns the active animation animating the given property that is either | 144 // Returns the active animation animating the given property that is either |
| 148 // running, or is next to run, if such an animation exists. | 145 // running, or is next to run, if such an animation exists. |
| 149 Animation* GetAnimation(TargetProperty::Type target_property) const; | 146 Animation* GetAnimation(TargetProperty::Type target_property) const; |
| 150 | 147 |
| 151 // Returns the active animation for the given unique animation id. | 148 // Returns the active animation for the given unique animation id. |
| 152 Animation* GetAnimationById(int animation_id) const; | 149 Animation* GetAnimationById(int animation_id) const; |
| 153 | 150 |
| 154 void GetPropertyAnimationStateFor(TargetProperty::Type property, | 151 void GetPropertyAnimationState(PropertyAnimationState* pending_state, |
| 155 PropertyAnimationState* state) const; | 152 PropertyAnimationState* active_state) const; |
| 156 | 153 |
| 157 private: | 154 private: |
| 158 friend class base::RefCounted<AnimationPlayer>; | 155 friend class base::RefCounted<AnimationPlayer>; |
| 159 | 156 |
| 160 explicit AnimationPlayer(int id); | 157 explicit AnimationPlayer(int id); |
| 161 ~AnimationPlayer(); | 158 ~AnimationPlayer(); |
| 162 | 159 |
| 163 // A set of target properties. TargetProperty must be 0-based enum. | |
| 164 using TargetProperties = | |
| 165 std::bitset<TargetProperty::LAST_TARGET_PROPERTY + 1>; | |
| 166 | |
| 167 void SetNeedsCommit(); | 160 void SetNeedsCommit(); |
| 168 | 161 |
| 169 void RegisterPlayer(); | 162 void RegisterPlayer(); |
| 170 void UnregisterPlayer(); | 163 void UnregisterPlayer(); |
| 171 | 164 |
| 172 void BindElementAnimations(); | 165 void BindElementAnimations(); |
| 173 void UnbindElementAnimations(); | 166 void UnbindElementAnimations(); |
| 174 | 167 |
| 175 void AnimationAddedForProperty(TargetProperty::Type target_property); | 168 void AnimationAdded(); |
| 176 | 169 |
| 177 void MarkAbortedAnimationsForDeletion( | 170 void MarkAbortedAnimationsForDeletion( |
| 178 AnimationPlayer* animation_player_impl) const; | 171 AnimationPlayer* animation_player_impl) const; |
| 179 void PurgeAnimationsMarkedForDeletion(); | 172 void PurgeAnimationsMarkedForDeletion(); |
| 180 void PushNewAnimationsToImplThread( | 173 void PushNewAnimationsToImplThread( |
| 181 AnimationPlayer* animation_player_impl) const; | 174 AnimationPlayer* animation_player_impl) const; |
| 182 void RemoveAnimationsCompletedOnMainThread( | 175 void RemoveAnimationsCompletedOnMainThread( |
| 183 AnimationPlayer* animation_player_impl) const; | 176 AnimationPlayer* animation_player_impl) const; |
| 184 void PushPropertiesToImplThread(AnimationPlayer* animation_player_impl); | 177 void PushPropertiesToImplThread(AnimationPlayer* animation_player_impl); |
| 185 | 178 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 200 // Only try to start animations when new animations are added or when the | 193 // Only try to start animations when new animations are added or when the |
| 201 // previous attempt at starting animations failed to start all animations. | 194 // previous attempt at starting animations failed to start all animations. |
| 202 bool needs_to_start_animations_; | 195 bool needs_to_start_animations_; |
| 203 | 196 |
| 204 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); | 197 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
| 205 }; | 198 }; |
| 206 | 199 |
| 207 } // namespace cc | 200 } // namespace cc |
| 208 | 201 |
| 209 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ | 202 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |
| OLD | NEW |