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

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

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: More change and typo fix Created 4 years 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 typedef uint32_t AnimatableProperties; 64 typedef uint32_t AnimatableProperties;
65 65
66 LayerAnimationElement(AnimatableProperties properties, 66 LayerAnimationElement(AnimatableProperties properties,
67 base::TimeDelta duration); 67 base::TimeDelta duration);
68 68
69 virtual ~LayerAnimationElement(); 69 virtual ~LayerAnimationElement();
70 70
71 // Creates an element that transitions to the given transform. The caller owns 71 // Creates an element that transitions to the given transform. The caller owns
72 // the return value. 72 // the return value.
73 static LayerAnimationElement* CreateTransformElement( 73 static std::unique_ptr<LayerAnimationElement> CreateTransformElement(
74 const gfx::Transform& transform, 74 const gfx::Transform& transform,
75 base::TimeDelta duration); 75 base::TimeDelta duration);
76 76
77 // Creates an element that transitions to another in a way determined by an 77 // Creates an element that transitions to another in a way determined by an
78 // interpolated transform. The element accepts ownership of the interpolated 78 // interpolated transform. The element accepts ownership of the interpolated
79 // transform. NB: at every step, the interpolated transform clobbers the 79 // transform. NB: at every step, the interpolated transform clobbers the
80 // existing transform. That is, it does not interpolate between the existing 80 // existing transform. That is, it does not interpolate between the existing
81 // transform and the last value the interpolated transform will assume. It is 81 // 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 82 // therefore important that the value of the interpolated at time 0 matches
83 // the current transform. 83 // the current transform.
84 static LayerAnimationElement* CreateInterpolatedTransformElement( 84 static std::unique_ptr<LayerAnimationElement>
85 InterpolatedTransform* interpolated_transform, 85 CreateInterpolatedTransformElement(
86 std::unique_ptr<InterpolatedTransform> interpolated_transform,
86 base::TimeDelta duration); 87 base::TimeDelta duration);
87 88
88 // Creates an element that transitions to the given bounds. The caller owns 89 // Creates an element that transitions to the given bounds. The caller owns
89 // the return value. 90 // the return value.
90 static LayerAnimationElement* CreateBoundsElement( 91 static std::unique_ptr<LayerAnimationElement> CreateBoundsElement(
91 const gfx::Rect& bounds, 92 const gfx::Rect& bounds,
92 base::TimeDelta duration); 93 base::TimeDelta duration);
93 94
94 // Creates an element that transitions to the given opacity. The caller owns 95 // Creates an element that transitions to the given opacity. The caller owns
95 // the return value. 96 // the return value.
96 static LayerAnimationElement* CreateOpacityElement( 97 static std::unique_ptr<LayerAnimationElement> CreateOpacityElement(
97 float opacity, 98 float opacity,
98 base::TimeDelta duration); 99 base::TimeDelta duration);
99 100
100 // Creates an element that sets visibily following a delay. The caller owns 101 // Creates an element that sets visibily following a delay. The caller owns
101 // the return value. 102 // the return value.
102 static LayerAnimationElement* CreateVisibilityElement( 103 static std::unique_ptr<LayerAnimationElement> CreateVisibilityElement(
103 bool visibility, 104 bool visibility,
104 base::TimeDelta duration); 105 base::TimeDelta duration);
105 106
106 // Creates an element that transitions to the given brightness. 107 // Creates an element that transitions to the given brightness.
107 // The caller owns the return value. 108 // The caller owns the return value.
108 static LayerAnimationElement* CreateBrightnessElement( 109 static std::unique_ptr<LayerAnimationElement> CreateBrightnessElement(
109 float brightness, 110 float brightness,
110 base::TimeDelta duration); 111 base::TimeDelta duration);
111 112
112 // Creates an element that transitions to the given grayscale value. 113 // Creates an element that transitions to the given grayscale value.
113 // The caller owns the return value. 114 // The caller owns the return value.
114 static LayerAnimationElement* CreateGrayscaleElement( 115 static std::unique_ptr<LayerAnimationElement> CreateGrayscaleElement(
115 float grayscale, 116 float grayscale,
116 base::TimeDelta duration); 117 base::TimeDelta duration);
117 118
118 // Creates an element that pauses the given properties. The caller owns the 119 // Creates an element that pauses the given properties. The caller owns the
119 // return value. 120 // return value.
120 static LayerAnimationElement* CreatePauseElement( 121 static std::unique_ptr<LayerAnimationElement> CreatePauseElement(
121 AnimatableProperties properties, 122 AnimatableProperties properties,
122 base::TimeDelta duration); 123 base::TimeDelta duration);
123 124
124 // Creates an element that transitions to the given color. The caller owns the 125 // Creates an element that transitions to the given color. The caller owns the
125 // return value. 126 // return value.
126 static LayerAnimationElement* CreateColorElement( 127 static std::unique_ptr<LayerAnimationElement> CreateColorElement(
127 SkColor color, 128 SkColor color,
128 base::TimeDelta duration); 129 base::TimeDelta duration);
129 130
130 // Sets the start time for the animation. This must be called before the first 131 // Sets the start time for the animation. This must be called before the first
131 // call to {Start, IsFinished}. Once the animation is finished, this must 132 // call to {Start, IsFinished}. Once the animation is finished, this must
132 // be called again in order to restart the animation. 133 // be called again in order to restart the animation.
133 void set_requested_start_time(base::TimeTicks start_time) { 134 void set_requested_start_time(base::TimeTicks start_time) {
134 requested_start_time_ = start_time; 135 requested_start_time_ = start_time;
135 } 136 }
136 base::TimeTicks requested_start_time() const { return requested_start_time_; } 137 base::TimeTicks requested_start_time() const { return requested_start_time_; }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 double last_progressed_fraction_; 228 double last_progressed_fraction_;
228 229
229 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_; 230 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_;
230 231
231 DISALLOW_ASSIGN(LayerAnimationElement); 232 DISALLOW_ASSIGN(LayerAnimationElement);
232 }; 233 };
233 234
234 } // namespace ui 235 } // namespace ui
235 236
236 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 237 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698