| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 float GetTargetBrightness() const; | 81 float GetTargetBrightness() const; |
| 82 | 82 |
| 83 // Sets the grayscale on the delegate. May cause an implicit animation. | 83 // Sets the grayscale on the delegate. May cause an implicit animation. |
| 84 virtual void SetGrayscale(float grayscale); | 84 virtual void SetGrayscale(float grayscale); |
| 85 float GetTargetGrayscale() const; | 85 float GetTargetGrayscale() const; |
| 86 | 86 |
| 87 // Sets the color on the delegate. May cause an implicit animation. | 87 // Sets the color on the delegate. May cause an implicit animation. |
| 88 virtual void SetColor(SkColor color); | 88 virtual void SetColor(SkColor color); |
| 89 SkColor GetTargetColor() const; | 89 SkColor GetTargetColor() const; |
| 90 | 90 |
| 91 // Returns the default length of animations, including adjustment for slow |
| 92 // animation mode if set. |
| 93 base::TimeDelta GetTransitionDuration() const; |
| 94 |
| 91 // Sets the layer animation delegate the animator is associated with. The | 95 // Sets the layer animation delegate the animator is associated with. The |
| 92 // animator does not own the delegate. The layer animator expects a non-NULL | 96 // animator does not own the delegate. The layer animator expects a non-NULL |
| 93 // delegate for most of its operations, so do not call any methods without | 97 // delegate for most of its operations, so do not call any methods without |
| 94 // a valid delegate installed. | 98 // a valid delegate installed. |
| 95 void SetDelegate(LayerAnimationDelegate* delegate); | 99 void SetDelegate(LayerAnimationDelegate* delegate); |
| 96 | 100 |
| 97 // Sets the animation preemption strategy. This determines the behaviour if | 101 // Sets the animation preemption strategy. This determines the behaviour if |
| 98 // a property is set during an animation. The default is | 102 // a property is set during an animation. The default is |
| 99 // IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). | 103 // IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). |
| 100 void set_preemption_strategy(PreemptionStrategy strategy) { | 104 void set_preemption_strategy(PreemptionStrategy strategy) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 bool StartSequenceImmediately(LayerAnimationSequence* sequence); | 290 bool StartSequenceImmediately(LayerAnimationSequence* sequence); |
| 287 | 291 |
| 288 // Sets the value of target as if all the running and queued animations were | 292 // Sets the value of target as if all the running and queued animations were |
| 289 // allowed to finish. | 293 // allowed to finish. |
| 290 void GetTargetValue(LayerAnimationElement::TargetValue* target) const; | 294 void GetTargetValue(LayerAnimationElement::TargetValue* target) const; |
| 291 | 295 |
| 292 // Called whenever an animation is added to the animation queue. Either by | 296 // Called whenever an animation is added to the animation queue. Either by |
| 293 // starting the animation or adding to the queue. | 297 // starting the animation or adding to the queue. |
| 294 void OnScheduled(LayerAnimationSequence* sequence); | 298 void OnScheduled(LayerAnimationSequence* sequence); |
| 295 | 299 |
| 296 // Returns the default length of animations, including adjustment for slow | 300 // Sets |transition_duration_| unless |is_transition_duration_locked_| is set. |
| 297 // animation mode if set. | |
| 298 base::TimeDelta GetTransitionDuration() const; | |
| 299 | |
| 300 // Sets |transition_duration_|. | |
| 301 void SetTransitionDuration(base::TimeDelta duration); | 301 void SetTransitionDuration(base::TimeDelta duration); |
| 302 | 302 |
| 303 // Clears the animation queues and notifies any running animations that they | 303 // Clears the animation queues and notifies any running animations that they |
| 304 // have been aborted. | 304 // have been aborted. |
| 305 void ClearAnimationsInternal(); | 305 void ClearAnimationsInternal(); |
| 306 | 306 |
| 307 // Cleans up any running animations that may have been deleted. | 307 // Cleans up any running animations that may have been deleted. |
| 308 void PurgeDeletedAnimations(); | 308 void PurgeDeletedAnimations(); |
| 309 | 309 |
| 310 // This is the queue of animations to run. | 310 // This is the queue of animations to run. |
| 311 AnimationQueue animation_queue_; | 311 AnimationQueue animation_queue_; |
| 312 | 312 |
| 313 // The target of all layer animations. | 313 // The target of all layer animations. |
| 314 LayerAnimationDelegate* delegate_; | 314 LayerAnimationDelegate* delegate_; |
| 315 | 315 |
| 316 // The currently running animations. | 316 // The currently running animations. |
| 317 RunningAnimations running_animations_; | 317 RunningAnimations running_animations_; |
| 318 | 318 |
| 319 // Determines how animations are replaced. | 319 // Determines how animations are replaced. |
| 320 PreemptionStrategy preemption_strategy_; | 320 PreemptionStrategy preemption_strategy_; |
| 321 | 321 |
| 322 // Whether the length of animations is locked. While it is locked |
| 323 // SetTransitionDuration does not set |transition_duration_|. |
| 324 bool is_transition_duration_locked_; |
| 325 |
| 322 // The default length of animations. | 326 // The default length of animations. |
| 323 base::TimeDelta transition_duration_; | 327 base::TimeDelta transition_duration_; |
| 324 | 328 |
| 325 // The default tween type for implicit transitions | 329 // The default tween type for implicit transitions |
| 326 gfx::Tween::Type tween_type_; | 330 gfx::Tween::Type tween_type_; |
| 327 | 331 |
| 328 // Used for coordinating the starting of animations. | 332 // Used for coordinating the starting of animations. |
| 329 base::TimeTicks last_step_time_; | 333 base::TimeTicks last_step_time_; |
| 330 | 334 |
| 331 // True if we are being stepped by our container. | 335 // True if we are being stepped by our container. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 342 // Observers are notified when layer animations end, are scheduled or are | 346 // Observers are notified when layer animations end, are scheduled or are |
| 343 // aborted. | 347 // aborted. |
| 344 ObserverList<LayerAnimationObserver> observers_; | 348 ObserverList<LayerAnimationObserver> observers_; |
| 345 | 349 |
| 346 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 350 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
| 347 }; | 351 }; |
| 348 | 352 |
| 349 } // namespace ui | 353 } // namespace ui |
| 350 | 354 |
| 351 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 355 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| OLD | NEW |