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

Side by Side Diff: trunk/src/ui/compositor/layer_animation_element.h

Issue 23809002: Revert 220479 "Add support for inverse transform animations." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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_ANIMATION_ELEMENT_H_ 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 bool visibility; 50 bool visibility;
51 float brightness; 51 float brightness;
52 float grayscale; 52 float grayscale;
53 SkColor color; 53 SkColor color;
54 }; 54 };
55 55
56 typedef std::set<AnimatableProperty> AnimatableProperties; 56 typedef std::set<AnimatableProperty> AnimatableProperties;
57 57
58 LayerAnimationElement(const AnimatableProperties& properties, 58 LayerAnimationElement(const AnimatableProperties& properties,
59 base::TimeDelta duration); 59 base::TimeDelta duration);
60
61 virtual ~LayerAnimationElement(); 60 virtual ~LayerAnimationElement();
62 61
63 // Creates an element that transitions to the given transform. The caller owns 62 // Creates an element that transitions to the given transform. The caller owns
64 // the return value. 63 // the return value.
65 static LayerAnimationElement* CreateTransformElement( 64 static LayerAnimationElement* CreateTransformElement(
66 const gfx::Transform& transform, 65 const gfx::Transform& transform,
67 base::TimeDelta duration); 66 base::TimeDelta duration);
68 67
69 // Creates an element that counters a transition to the given transform.
70 // This element maintains the invariant uninverted_transition->at(t) *
71 // this->at(t) == base_transform * this->at(t_start) for any t. The caller
72 // owns the return value.
73 static LayerAnimationElement* CreateInverseTransformElement(
74 const gfx::Transform& base_transform,
75 const LayerAnimationElement* uninverted_transition);
76
77 // Creates an element that transitions to another in a way determined by an 68 // Creates an element that transitions to another in a way determined by an
78 // interpolated transform. The element accepts ownership of the interpolated 69 // interpolated transform. The element accepts ownership of the interpolated
79 // transform. NB: at every step, the interpolated transform clobbers the 70 // transform. NB: at every step, the interpolated transform clobbers the
80 // existing transform. That is, it does not interpolate between the existing 71 // existing transform. That is, it does not interpolate between the existing
81 // transform and the last value the interpolated transform will assume. It is 72 // transform and the last value the interpolated transform will assume. It is
82 // therefore important that the value of the interpolated at time 0 matches 73 // therefore important that the value of the interpolated at time 0 matches
83 // the current transform. 74 // the current transform.
84 static LayerAnimationElement* CreateInterpolatedTransformElement( 75 static LayerAnimationElement* CreateInterpolatedTransformElement(
85 InterpolatedTransform* interpolated_transform, 76 InterpolatedTransform* interpolated_transform,
86 base::TimeDelta duration); 77 base::TimeDelta duration);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Tween::Type tween_type() const { return tween_type_; } 171 Tween::Type tween_type() const { return tween_type_; }
181 void set_tween_type(Tween::Type tween_type) { tween_type_ = tween_type; } 172 void set_tween_type(Tween::Type tween_type) { tween_type_ = tween_type; }
182 173
183 // Each LayerAnimationElement has a unique animation_id. Elements belonging 174 // Each LayerAnimationElement has a unique animation_id. Elements belonging
184 // to sequences that are supposed to start together have the same 175 // to sequences that are supposed to start together have the same
185 // animation_group_id. 176 // animation_group_id.
186 int animation_id() const { return animation_id_; } 177 int animation_id() const { return animation_id_; }
187 int animation_group_id() const { return animation_group_id_; } 178 int animation_group_id() const { return animation_group_id_; }
188 void set_animation_group_id(int id) { animation_group_id_ = id; } 179 void set_animation_group_id(int id) { animation_group_id_ = id; }
189 180
190 base::TimeDelta duration() const { return duration_; }
191
192 // The fraction of the animation that has been completed after the last 181 // The fraction of the animation that has been completed after the last
193 // call made to {Progress, ProgressToEnd}. 182 // call made to {Progress, ProgressToEnd}.
194 double last_progressed_fraction() const { return last_progressed_fraction_; } 183 double last_progressed_fraction() const { return last_progressed_fraction_; }
195 184
196 protected: 185 protected:
197 // Called once each time the animation element is run before any call to 186 // Called once each time the animation element is run before any call to
198 // OnProgress. 187 // OnProgress.
199 virtual void OnStart(LayerAnimationDelegate* delegate) = 0; 188 virtual void OnStart(LayerAnimationDelegate* delegate) = 0;
200 virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) = 0; 189 virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) = 0;
201 virtual void OnGetTarget(TargetValue* target) const = 0; 190 virtual void OnGetTarget(TargetValue* target) const = 0;
202 virtual void OnAbort(LayerAnimationDelegate* delegate) = 0; 191 virtual void OnAbort(LayerAnimationDelegate* delegate) = 0;
203 192
193 base::TimeDelta duration() const { return duration_; }
194
204 // Actually start the animation, dispatching to another thread if needed. 195 // Actually start the animation, dispatching to another thread if needed.
205 virtual void RequestEffectiveStart(LayerAnimationDelegate* delegate); 196 virtual void RequestEffectiveStart(LayerAnimationDelegate* delegate);
206 197
207 LayerAnimationElement(const LayerAnimationElement& element);
208
209 private: 198 private:
210 // For debugging purposes, we sometimes alter the duration we actually use. 199 // For debugging purposes, we sometimes alter the duration we actually use.
211 // For example, during tests we often set duration = 0, and it is sometimes 200 // For example, during tests we often set duration = 0, and it is sometimes
212 // useful to slow animations down to see them more clearly. 201 // useful to slow animations down to see them more clearly.
213 base::TimeDelta GetEffectiveDuration(const base::TimeDelta& delta); 202 base::TimeDelta GetEffectiveDuration(const base::TimeDelta& delta);
214 203
215 bool first_frame_; 204 bool first_frame_;
216 const AnimatableProperties properties_; 205 const AnimatableProperties properties_;
217 base::TimeTicks requested_start_time_; 206 base::TimeTicks requested_start_time_;
218 207
219 // When the animation actually started, taking into account queueing delays. 208 // When the animation actually started, taking into account queueing delays.
220 base::TimeTicks effective_start_time_; 209 base::TimeTicks effective_start_time_;
221 const base::TimeDelta duration_; 210 const base::TimeDelta duration_;
222 Tween::Type tween_type_; 211 Tween::Type tween_type_;
223 212
224 const int animation_id_; 213 const int animation_id_;
225 int animation_group_id_; 214 int animation_group_id_;
226 215
227 double last_progressed_fraction_; 216 double last_progressed_fraction_;
228 217
229 DISALLOW_ASSIGN(LayerAnimationElement); 218 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement);
230 }; 219 };
231 220
232 } // namespace ui 221 } // namespace ui
233 222
234 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 223 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW
« no previous file with comments | « trunk/src/ui/compositor/compositor.gyp ('k') | trunk/src/ui/compositor/layer_animation_element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698