| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 bool StartSequenceImmediately(LayerAnimationSequence* sequence); | 291 bool StartSequenceImmediately(LayerAnimationSequence* sequence); |
| 288 | 292 |
| 289 // Sets the value of target as if all the running and queued animations were | 293 // Sets the value of target as if all the running and queued animations were |
| 290 // allowed to finish. | 294 // allowed to finish. |
| 291 void GetTargetValue(LayerAnimationElement::TargetValue* target) const; | 295 void GetTargetValue(LayerAnimationElement::TargetValue* target) const; |
| 292 | 296 |
| 293 // Called whenever an animation is added to the animation queue. Either by | 297 // Called whenever an animation is added to the animation queue. Either by |
| 294 // starting the animation or adding to the queue. | 298 // starting the animation or adding to the queue. |
| 295 void OnScheduled(LayerAnimationSequence* sequence); | 299 void OnScheduled(LayerAnimationSequence* sequence); |
| 296 | 300 |
| 297 // Returns the default length of animations, including adjustment for slow | 301 // Sets |transition_duration_| unless |is_transition_duration_locked_| is set. |
| 298 // animation mode if set. | 302 void SetTransitionDuration(base::TimeDelta duration); |
| 299 base::TimeDelta GetTransitionDuration() const; | |
| 300 | 303 |
| 301 // Clears the animation queues and notifies any running animations that they | 304 // Clears the animation queues and notifies any running animations that they |
| 302 // have been aborted. | 305 // have been aborted. |
| 303 void ClearAnimationsInternal(); | 306 void ClearAnimationsInternal(); |
| 304 | 307 |
| 305 // Cleans up any running animations that may have been deleted. | 308 // Cleans up any running animations that may have been deleted. |
| 306 void PurgeDeletedAnimations(); | 309 void PurgeDeletedAnimations(); |
| 307 | 310 |
| 308 // This is the queue of animations to run. | 311 // This is the queue of animations to run. |
| 309 AnimationQueue animation_queue_; | 312 AnimationQueue animation_queue_; |
| 310 | 313 |
| 311 // The target of all layer animations. | 314 // The target of all layer animations. |
| 312 LayerAnimationDelegate* delegate_; | 315 LayerAnimationDelegate* delegate_; |
| 313 | 316 |
| 314 // The currently running animations. | 317 // The currently running animations. |
| 315 RunningAnimations running_animations_; | 318 RunningAnimations running_animations_; |
| 316 | 319 |
| 317 // Determines how animations are replaced. | 320 // Determines how animations are replaced. |
| 318 PreemptionStrategy preemption_strategy_; | 321 PreemptionStrategy preemption_strategy_; |
| 319 | 322 |
| 323 // Whether the length of animations is locked. While it is locked |
| 324 // SetTransitionDuration does not set |transition_duration_|. |
| 325 bool is_transition_duration_locked_; |
| 326 |
| 320 // The default length of animations. | 327 // The default length of animations. |
| 321 base::TimeDelta transition_duration_; | 328 base::TimeDelta transition_duration_; |
| 322 | 329 |
| 323 // The default tween type for implicit transitions | 330 // The default tween type for implicit transitions |
| 324 gfx::Tween::Type tween_type_; | 331 gfx::Tween::Type tween_type_; |
| 325 | 332 |
| 326 // Used for coordinating the starting of animations. | 333 // Used for coordinating the starting of animations. |
| 327 base::TimeTicks last_step_time_; | 334 base::TimeTicks last_step_time_; |
| 328 | 335 |
| 329 // True if we are being stepped by our container. | 336 // True if we are being stepped by our container. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 340 // Observers are notified when layer animations end, are scheduled or are | 347 // Observers are notified when layer animations end, are scheduled or are |
| 341 // aborted. | 348 // aborted. |
| 342 ObserverList<LayerAnimationObserver> observers_; | 349 ObserverList<LayerAnimationObserver> observers_; |
| 343 | 350 |
| 344 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 351 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
| 345 }; | 352 }; |
| 346 | 353 |
| 347 } // namespace ui | 354 } // namespace ui |
| 348 | 355 |
| 349 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 356 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| OLD | NEW |