Pass CreateDirectory errors up to IndexedDB.
[chromium-blink-merge.git] / cc / animation / keyframed_animation_curve.h
blob6d775c9e3c88a319dc208e1de6cdc4335a9913f5
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
3 // found in the LICENSE file.
5 #ifndef CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
8 #include "cc/animation/animation_curve.h"
9 #include "cc/animation/timing_function.h"
10 #include "cc/animation/transform_operations.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/base/scoped_ptr_vector.h"
14 namespace cc {
16 class CC_EXPORT Keyframe {
17 public:
18 double Time() const;
19 const TimingFunction* timing_function() const {
20 return timing_function_.get();
23 protected:
24 Keyframe(double time, scoped_ptr<TimingFunction> timing_function);
25 virtual ~Keyframe();
27 private:
28 double time_;
29 scoped_ptr<TimingFunction> timing_function_;
31 DISALLOW_COPY_AND_ASSIGN(Keyframe);
34 class CC_EXPORT FloatKeyframe : public Keyframe {
35 public:
36 static scoped_ptr<FloatKeyframe> Create(
37 double time,
38 float value,
39 scoped_ptr<TimingFunction> timing_function);
40 virtual ~FloatKeyframe();
42 float Value() const;
44 scoped_ptr<FloatKeyframe> Clone() const;
46 private:
47 FloatKeyframe(double time,
48 float value,
49 scoped_ptr<TimingFunction> timing_function);
51 float value_;
54 class CC_EXPORT TransformKeyframe : public Keyframe {
55 public:
56 static scoped_ptr<TransformKeyframe> Create(
57 double time,
58 const TransformOperations& value,
59 scoped_ptr<TimingFunction> timing_function);
60 virtual ~TransformKeyframe();
62 const TransformOperations& Value() const;
64 scoped_ptr<TransformKeyframe> Clone() const;
66 private:
67 TransformKeyframe(
68 double time,
69 const TransformOperations& value,
70 scoped_ptr<TimingFunction> timing_function);
72 TransformOperations value_;
75 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve {
76 public:
77 // It is required that the keyframes be sorted by time.
78 static scoped_ptr<KeyframedFloatAnimationCurve> Create();
80 virtual ~KeyframedFloatAnimationCurve();
82 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe);
84 // AnimationCurve implementation
85 virtual double Duration() const OVERRIDE;
86 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
88 // FloatAnimationCurve implementation
89 virtual float GetValue(double t) const OVERRIDE;
91 private:
92 KeyframedFloatAnimationCurve();
94 // Always sorted in order of increasing time. No two keyframes have the
95 // same time.
96 ScopedPtrVector<FloatKeyframe> keyframes_;
98 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve);
101 class CC_EXPORT KeyframedTransformAnimationCurve
102 : public TransformAnimationCurve {
103 public:
104 // It is required that the keyframes be sorted by time.
105 static scoped_ptr<KeyframedTransformAnimationCurve> Create();
107 virtual ~KeyframedTransformAnimationCurve();
109 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe);
111 // AnimationCurve implementation
112 virtual double Duration() const OVERRIDE;
113 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
115 // TransformAnimationCurve implementation
116 virtual gfx::Transform GetValue(double t) const OVERRIDE;
118 private:
119 KeyframedTransformAnimationCurve();
121 // Always sorted in order of increasing time. No two keyframes have the
122 // same time.
123 ScopedPtrVector<TransformKeyframe> keyframes_;
125 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve);
128 } // namespace cc
130 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_