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

Side by Side Diff: ui/gfx/compositor/layer_animation_element.h

Issue 8400059: Revert 107715 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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) 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_ANIMATION_ELEMENT_H_ 5 #ifndef UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "ui/gfx/compositor/compositor_export.h" 12 #include "ui/gfx/compositor/compositor_export.h"
13 #include "ui/gfx/rect.h" 13
14 #include "ui/gfx/transform.h" 14 namespace gfx {
15 class Rect;
16 } // gfx
15 17
16 namespace ui { 18 namespace ui {
17 19
18 class LayerAnimationDelegate; 20 class LayerAnimationDelegate;
19 class Transform; 21 class Transform;
20 22
21 // LayerAnimationElements represent one segment of an animation between two 23 // LayerAnimationElements represent one segment of an animation between two
22 // keyframes. They know how to update a LayerAnimationDelegate given a value 24 // keyframes. They know how to update a LayerAnimationDelegate given a value
23 // between 0 and 1 (0 for initial, and 1 for final). 25 // between 0 and 1 (0 for initial, and 1 for final).
24 class COMPOSITOR_EXPORT LayerAnimationElement { 26 class COMPOSITOR_EXPORT LayerAnimationElement {
25 public: 27 public:
26 enum AnimatableProperty { 28 enum AnimatableProperty {
27 TRANSFORM = 0, 29 TRANSFORM = 0,
28 BOUNDS, 30 BOUNDS,
29 OPACITY 31 OPACITY
30 }; 32 };
31 33
32 struct TargetValue {
33 public:
34 TargetValue();
35 gfx::Rect bounds;
36 Transform transform;
37 float opacity;
38 };
39
40 typedef std::set<AnimatableProperty> AnimatableProperties; 34 typedef std::set<AnimatableProperty> AnimatableProperties;
41 35
42 LayerAnimationElement(const AnimatableProperties& properties, 36 LayerAnimationElement(const AnimatableProperties& properties,
43 base::TimeDelta duration); 37 base::TimeDelta duration);
44 virtual ~LayerAnimationElement(); 38 virtual ~LayerAnimationElement();
45 39
46 // Creates an element that transitions to the given transform. The caller owns 40 // Creates an element that transitions to the given transform. The caller owns
47 // the return value. 41 // the return value.
48 static LayerAnimationElement* CreateTransformElement( 42 static LayerAnimationElement* CreateTransformElement(
49 const Transform& transform, 43 const Transform& transform,
(...skipping 20 matching lines...) Expand all
70 // Updates the delegate to the appropriate value for |t|, which is in the 64 // Updates the delegate to the appropriate value for |t|, which is in the
71 // range [0, 1] (0 for initial, and 1 for final). If the animation is not 65 // range [0, 1] (0 for initial, and 1 for final). If the animation is not
72 // aborted, it is guaranteed that Progress will eventually be called with 66 // aborted, it is guaranteed that Progress will eventually be called with
73 // t = 1.0. 67 // t = 1.0.
74 void Progress(double t, LayerAnimationDelegate* delegate); 68 void Progress(double t, LayerAnimationDelegate* delegate);
75 69
76 // Called if the animation is not allowed to complete. This may be called 70 // Called if the animation is not allowed to complete. This may be called
77 // before OnStarted or Progress. 71 // before OnStarted or Progress.
78 void Abort(); 72 void Abort();
79 73
80 // Assigns the target value to |target|.
81 void GetTargetValue(TargetValue* target) const;
82
83 // The properties that the element modifies. 74 // The properties that the element modifies.
84 const AnimatableProperties& properties() const { return properties_; } 75 const AnimatableProperties& properties() const { return properties_; }
85 76
86 // The duration of the animation 77 // The duration of the animation
87 base::TimeDelta duration() const { return duration_; } 78 base::TimeDelta duration() const { return duration_; }
88 79
89 protected: 80 protected:
90 // Called once each time the animation element is run before any call to 81 // Called once each time the animation element is run before any call to
91 // OnProgress. 82 // OnProgress.
92 virtual void OnStart(LayerAnimationDelegate* delegate) = 0; 83 virtual void OnStart(LayerAnimationDelegate* delegate) = 0;
93 virtual void OnProgress(double t, LayerAnimationDelegate* delegate) = 0; 84 virtual void OnProgress(double t, LayerAnimationDelegate* delegate) = 0;
94 virtual void OnGetTarget(TargetValue* target) const = 0;
95 virtual void OnAbort() = 0; 85 virtual void OnAbort() = 0;
96 86
97 private: 87 private:
98 bool first_frame_; 88 bool first_frame_;
99 const AnimatableProperties properties_; 89 const AnimatableProperties properties_;
100 const base::TimeDelta duration_; 90 const base::TimeDelta duration_;
101 91
102 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement); 92 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement);
103 }; 93 };
104 94
105 } // namespace ui 95 } // namespace ui
106 96
107 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 97 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW
« no previous file with comments | « ui/gfx/compositor/layer_animation_delegate.h ('k') | ui/gfx/compositor/layer_animation_element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698