OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ | 5 #ifndef UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ |
6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ | 6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <vector> | 10 #include <vector> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 virtual ~LayerAnimator(); | 43 virtual ~LayerAnimator(); |
44 | 44 |
45 // No implicit animations when properties are set. | 45 // No implicit animations when properties are set. |
46 static LayerAnimator* CreateDefaultAnimator(); | 46 static LayerAnimator* CreateDefaultAnimator(); |
47 | 47 |
48 // Implicitly animates when properties are set. | 48 // Implicitly animates when properties are set. |
49 static LayerAnimator* CreateImplicitAnimator(); | 49 static LayerAnimator* CreateImplicitAnimator(); |
50 | 50 |
51 // Sets the transform on the delegate. May cause an implicit animation. | 51 // Sets the transform on the delegate. May cause an implicit animation. |
52 virtual void SetTransform(const Transform& transform); | 52 virtual void SetTransform(const Transform& transform); |
| 53 Transform GetTargetTransform() const; |
53 | 54 |
54 // Sets the bounds on the delegate. May cause an implicit animation. | 55 // Sets the bounds on the delegate. May cause an implicit animation. |
55 virtual void SetBounds(const gfx::Rect& bounds); | 56 virtual void SetBounds(const gfx::Rect& bounds); |
| 57 gfx::Rect GetTargetBounds() const; |
56 | 58 |
57 // Sets the opacity on the delegate. May cause an implicit animation. | 59 // Sets the opacity on the delegate. May cause an implicit animation. |
58 virtual void SetOpacity(float opacity); | 60 virtual void SetOpacity(float opacity); |
| 61 float GetTargetOpacity() const; |
59 | 62 |
60 // Sets the layer animation delegate the animator is associated with. The | 63 // Sets the layer animation delegate the animator is associated with. The |
61 // animator does not own the delegate. | 64 // animator does not own the delegate. |
62 void SetDelegate(LayerAnimationDelegate* delegate); | 65 void SetDelegate(LayerAnimationDelegate* delegate); |
63 | 66 |
64 // Sets the animation preemption strategy. This determines the behaviour if | 67 // Sets the animation preemption strategy. This determines the behaviour if |
65 // a property is set during an animation. The default is | 68 // a property is set during an animation. The default is |
66 // IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). | 69 // IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). |
67 void set_preemption_strategy(PreemptionStrategy strategy) { | 70 void set_preemption_strategy(PreemptionStrategy strategy) { |
68 preemption_strategy_ = strategy; | 71 preemption_strategy_ = strategy; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // If there's an animation in the queue that doesn't animate the same property | 172 // If there's an animation in the queue that doesn't animate the same property |
170 // as a running animation, or an animation schedule to run before it, start it | 173 // as a running animation, or an animation schedule to run before it, start it |
171 // up. Repeat until there are no such animations. | 174 // up. Repeat until there are no such animations. |
172 void ProcessQueue(); | 175 void ProcessQueue(); |
173 | 176 |
174 // Attempts to add the sequence to the list of running animations. Returns | 177 // Attempts to add the sequence to the list of running animations. Returns |
175 // false if there is an animation running that already animates one of the | 178 // false if there is an animation running that already animates one of the |
176 // properties affected by |sequence|. | 179 // properties affected by |sequence|. |
177 bool StartSequenceImmediately(LayerAnimationSequence* sequence); | 180 bool StartSequenceImmediately(LayerAnimationSequence* sequence); |
178 | 181 |
| 182 // Sets the value of delegate as if all the running and queued animations were |
| 183 // allowed to finish. |
| 184 void SetTarget(LayerAnimationDelegate* delegate) const; |
| 185 |
179 // This is the queue of animations to run. | 186 // This is the queue of animations to run. |
180 AnimationQueue animation_queue_; | 187 AnimationQueue animation_queue_; |
181 | 188 |
182 // The target of all layer animations. | 189 // The target of all layer animations. |
183 LayerAnimationDelegate* delegate_; | 190 LayerAnimationDelegate* delegate_; |
184 | 191 |
185 // The currently running animations. | 192 // The currently running animations. |
186 RunningAnimations running_animations_; | 193 RunningAnimations running_animations_; |
187 | 194 |
188 // Determines how animations are replaced. | 195 // Determines how animations are replaced. |
(...skipping 11 matching lines...) Expand all Loading... |
200 // This prevents the animator from automatically stepping through animations | 207 // This prevents the animator from automatically stepping through animations |
201 // and allows for manual stepping. | 208 // and allows for manual stepping. |
202 bool disable_timer_for_test_; | 209 bool disable_timer_for_test_; |
203 | 210 |
204 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 211 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
205 }; | 212 }; |
206 | 213 |
207 } // namespace ui | 214 } // namespace ui |
208 | 215 |
209 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ | 216 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATOR_H_ |
OLD | NEW |