Enabling tests which should be fixed by r173829.
[chromium-blink-merge.git] / cc / keyframed_animation_curve.h
blob5685eb87bdc8bfb912831ea6728e9d78395262f8
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_KEYFRAMED_ANIMATION_CURVE_H_
6 #define CC_KEYFRAMED_ANIMATION_CURVE_H_
8 #include "cc/animation_curve.h"
9 #include "cc/cc_export.h"
10 #include "cc/scoped_ptr_vector.h"
11 #include "cc/timing_function.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
14 namespace cc {
16 class CC_EXPORT Keyframe {
17 public:
18 double time() const;
19 const TimingFunction* timingFunction() const;
21 protected:
22 Keyframe(double time, scoped_ptr<TimingFunction>);
23 virtual ~Keyframe();
25 private:
26 double m_time;
27 scoped_ptr<TimingFunction> m_timingFunction;
29 DISALLOW_COPY_AND_ASSIGN(Keyframe);
32 class CC_EXPORT FloatKeyframe : public Keyframe {
33 public:
34 static scoped_ptr<FloatKeyframe> create(double time, float value, scoped_ptr<TimingFunction>);
35 virtual ~FloatKeyframe();
37 float value() const;
39 scoped_ptr<FloatKeyframe> clone() const;
41 private:
42 FloatKeyframe(double time, float value, scoped_ptr<TimingFunction>);
44 float m_value;
47 class CC_EXPORT TransformKeyframe : public Keyframe {
48 public:
49 static scoped_ptr<TransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction>);
50 virtual ~TransformKeyframe();
52 const WebKit::WebTransformOperations& value() const;
54 scoped_ptr<TransformKeyframe> clone() const;
56 private:
57 TransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<TimingFunction>);
59 WebKit::WebTransformOperations m_value;
62 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve {
63 public:
64 // It is required that the keyframes be sorted by time.
65 static scoped_ptr<KeyframedFloatAnimationCurve> create();
67 virtual ~KeyframedFloatAnimationCurve();
69 void addKeyframe(scoped_ptr<FloatKeyframe>);
71 // AnimationCurve implementation
72 virtual double duration() const OVERRIDE;
73 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE;
75 // FloatAnimationCurve implementation
76 virtual float getValue(double t) const OVERRIDE;
78 private:
79 KeyframedFloatAnimationCurve();
81 // Always sorted in order of increasing time. No two keyframes have the
82 // same time.
83 ScopedPtrVector<FloatKeyframe> m_keyframes;
85 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve);
88 class CC_EXPORT KeyframedTransformAnimationCurve : public TransformAnimationCurve {
89 public:
90 // It is required that the keyframes be sorted by time.
91 static scoped_ptr<KeyframedTransformAnimationCurve> create();
93 virtual ~KeyframedTransformAnimationCurve();
95 void addKeyframe(scoped_ptr<TransformKeyframe>);
97 // AnimationCurve implementation
98 virtual double duration() const OVERRIDE;
99 virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE;
101 // TransformAnimationCurve implementation
102 virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE;
104 private:
105 KeyframedTransformAnimationCurve();
107 // Always sorted in order of increasing time. No two keyframes have the
108 // same time.
109 ScopedPtrVector<TransformKeyframe> m_keyframes;
111 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve);
114 } // namespace cc
116 #endif // CC_KEYFRAMED_ANIMATION_CURVE_H_