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

Side by Side Diff: cc/animation/keyframed_animation_curve.h

Issue 598853003: CC: Add curve (whole animation) timing function to compositor animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 2 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
« no previous file with comments | « no previous file | cc/animation/keyframed_animation_curve.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ 5 #ifndef CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ 6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
7 7
8 #include "cc/animation/animation_curve.h" 8 #include "cc/animation/animation_curve.h"
9 #include "cc/animation/timing_function.h" 9 #include "cc/animation/timing_function.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 }; 114 };
115 115
116 class CC_EXPORT KeyframedColorAnimationCurve : public ColorAnimationCurve { 116 class CC_EXPORT KeyframedColorAnimationCurve : public ColorAnimationCurve {
117 public: 117 public:
118 // It is required that the keyframes be sorted by time. 118 // It is required that the keyframes be sorted by time.
119 static scoped_ptr<KeyframedColorAnimationCurve> Create(); 119 static scoped_ptr<KeyframedColorAnimationCurve> Create();
120 120
121 virtual ~KeyframedColorAnimationCurve(); 121 virtual ~KeyframedColorAnimationCurve();
122 122
123 void AddKeyframe(scoped_ptr<ColorKeyframe> keyframe); 123 void AddKeyframe(scoped_ptr<ColorKeyframe> keyframe);
124 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) {
125 timing_function_ = timing_function.Pass();
126 }
124 127
125 // AnimationCurve implementation 128 // AnimationCurve implementation
126 virtual double Duration() const OVERRIDE; 129 virtual double Duration() const OVERRIDE;
127 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 130 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
128 131
129 // BackgrounColorAnimationCurve implementation 132 // BackgrounColorAnimationCurve implementation
130 virtual SkColor GetValue(double t) const OVERRIDE; 133 virtual SkColor GetValue(double t) const OVERRIDE;
131 134
132 private: 135 private:
133 KeyframedColorAnimationCurve(); 136 KeyframedColorAnimationCurve();
134 137
135 // Always sorted in order of increasing time. No two keyframes have the 138 // Always sorted in order of increasing time. No two keyframes have the
136 // same time. 139 // same time.
137 ScopedPtrVector<ColorKeyframe> keyframes_; 140 ScopedPtrVector<ColorKeyframe> keyframes_;
141 scoped_ptr<TimingFunction> timing_function_;
138 142
139 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); 143 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve);
140 }; 144 };
141 145
142 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { 146 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve {
143 public: 147 public:
144 // It is required that the keyframes be sorted by time. 148 // It is required that the keyframes be sorted by time.
145 static scoped_ptr<KeyframedFloatAnimationCurve> Create(); 149 static scoped_ptr<KeyframedFloatAnimationCurve> Create();
146 150
147 virtual ~KeyframedFloatAnimationCurve(); 151 virtual ~KeyframedFloatAnimationCurve();
148 152
149 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe); 153 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe);
154 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) {
155 timing_function_ = timing_function.Pass();
156 }
150 157
151 // AnimationCurve implementation 158 // AnimationCurve implementation
152 virtual double Duration() const OVERRIDE; 159 virtual double Duration() const OVERRIDE;
153 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 160 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
154 161
155 // FloatAnimationCurve implementation 162 // FloatAnimationCurve implementation
156 virtual float GetValue(double t) const OVERRIDE; 163 virtual float GetValue(double t) const OVERRIDE;
157 164
158 private: 165 private:
159 KeyframedFloatAnimationCurve(); 166 KeyframedFloatAnimationCurve();
160 167
161 // Always sorted in order of increasing time. No two keyframes have the 168 // Always sorted in order of increasing time. No two keyframes have the
162 // same time. 169 // same time.
163 ScopedPtrVector<FloatKeyframe> keyframes_; 170 ScopedPtrVector<FloatKeyframe> keyframes_;
171 scoped_ptr<TimingFunction> timing_function_;
164 172
165 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); 173 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve);
166 }; 174 };
167 175
168 class CC_EXPORT KeyframedTransformAnimationCurve 176 class CC_EXPORT KeyframedTransformAnimationCurve
169 : public TransformAnimationCurve { 177 : public TransformAnimationCurve {
170 public: 178 public:
171 // It is required that the keyframes be sorted by time. 179 // It is required that the keyframes be sorted by time.
172 static scoped_ptr<KeyframedTransformAnimationCurve> Create(); 180 static scoped_ptr<KeyframedTransformAnimationCurve> Create();
173 181
174 virtual ~KeyframedTransformAnimationCurve(); 182 virtual ~KeyframedTransformAnimationCurve();
175 183
176 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe); 184 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe);
185 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) {
186 timing_function_ = timing_function.Pass();
187 }
177 188
178 // AnimationCurve implementation 189 // AnimationCurve implementation
179 virtual double Duration() const OVERRIDE; 190 virtual double Duration() const OVERRIDE;
180 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 191 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
181 192
182 // TransformAnimationCurve implementation 193 // TransformAnimationCurve implementation
183 virtual gfx::Transform GetValue(double t) const OVERRIDE; 194 virtual gfx::Transform GetValue(double t) const OVERRIDE;
184 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, 195 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
185 gfx::BoxF* bounds) const OVERRIDE; 196 gfx::BoxF* bounds) const OVERRIDE;
186 virtual bool AffectsScale() const OVERRIDE; 197 virtual bool AffectsScale() const OVERRIDE;
187 virtual bool IsTranslation() const OVERRIDE; 198 virtual bool IsTranslation() const OVERRIDE;
188 virtual bool MaximumScale(float* max_scale) const OVERRIDE; 199 virtual bool MaximumScale(float* max_scale) const OVERRIDE;
189 200
190 private: 201 private:
191 KeyframedTransformAnimationCurve(); 202 KeyframedTransformAnimationCurve();
192 203
193 // Always sorted in order of increasing time. No two keyframes have the 204 // Always sorted in order of increasing time. No two keyframes have the
194 // same time. 205 // same time.
195 ScopedPtrVector<TransformKeyframe> keyframes_; 206 ScopedPtrVector<TransformKeyframe> keyframes_;
207 scoped_ptr<TimingFunction> timing_function_;
196 208
197 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); 209 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve);
198 }; 210 };
199 211
200 class CC_EXPORT KeyframedFilterAnimationCurve 212 class CC_EXPORT KeyframedFilterAnimationCurve
201 : public FilterAnimationCurve { 213 : public FilterAnimationCurve {
202 public: 214 public:
203 // It is required that the keyframes be sorted by time. 215 // It is required that the keyframes be sorted by time.
204 static scoped_ptr<KeyframedFilterAnimationCurve> Create(); 216 static scoped_ptr<KeyframedFilterAnimationCurve> Create();
205 217
206 virtual ~KeyframedFilterAnimationCurve(); 218 virtual ~KeyframedFilterAnimationCurve();
207 219
208 void AddKeyframe(scoped_ptr<FilterKeyframe> keyframe); 220 void AddKeyframe(scoped_ptr<FilterKeyframe> keyframe);
221 void SetTimingFunction(scoped_ptr<TimingFunction> timing_function) {
222 timing_function_ = timing_function.Pass();
223 }
209 224
210 // AnimationCurve implementation 225 // AnimationCurve implementation
211 virtual double Duration() const OVERRIDE; 226 virtual double Duration() const OVERRIDE;
212 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 227 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
213 228
214 // FilterAnimationCurve implementation 229 // FilterAnimationCurve implementation
215 virtual FilterOperations GetValue(double t) const OVERRIDE; 230 virtual FilterOperations GetValue(double t) const OVERRIDE;
216 virtual bool HasFilterThatMovesPixels() const OVERRIDE; 231 virtual bool HasFilterThatMovesPixels() const OVERRIDE;
217 232
218 private: 233 private:
219 KeyframedFilterAnimationCurve(); 234 KeyframedFilterAnimationCurve();
220 235
221 // Always sorted in order of increasing time. No two keyframes have the 236 // Always sorted in order of increasing time. No two keyframes have the
222 // same time. 237 // same time.
223 ScopedPtrVector<FilterKeyframe> keyframes_; 238 ScopedPtrVector<FilterKeyframe> keyframes_;
239 scoped_ptr<TimingFunction> timing_function_;
224 240
225 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); 241 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve);
226 }; 242 };
227 243
228 } // namespace cc 244 } // namespace cc
229 245
230 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ 246 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/animation/keyframed_animation_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698