// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CCKeyframedAnimationCurve_h #define CCKeyframedAnimationCurve_h #include "CCAnimationCurve.h" #include "CCTimingFunction.h" #include "cc/own_ptr_vector.h" #include #include #include namespace cc { class CCKeyframe { public: double time() const; const CCTimingFunction* timingFunction() const; protected: CCKeyframe(double time, PassOwnPtr); virtual ~CCKeyframe(); private: double m_time; OwnPtr m_timingFunction; }; class CCFloatKeyframe : public CCKeyframe { public: static PassOwnPtr create(double time, float value, PassOwnPtr); virtual ~CCFloatKeyframe(); float value() const; PassOwnPtr clone() const; private: CCFloatKeyframe(double time, float value, PassOwnPtr); float m_value; }; class CCTransformKeyframe : public CCKeyframe { public: static PassOwnPtr create(double time, const WebKit::WebTransformOperations& value, PassOwnPtr); virtual ~CCTransformKeyframe(); const WebKit::WebTransformOperations& value() const; PassOwnPtr clone() const; private: CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, PassOwnPtr); WebKit::WebTransformOperations m_value; }; class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve { public: // It is required that the keyframes be sorted by time. static PassOwnPtr create(); virtual ~CCKeyframedFloatAnimationCurve(); void addKeyframe(PassOwnPtr); // CCAnimationCurve implementation virtual double duration() const OVERRIDE; virtual PassOwnPtr clone() const OVERRIDE; // CCFloatAnimationCurve implementation virtual float getValue(double t) const OVERRIDE; private: CCKeyframedFloatAnimationCurve(); // Always sorted in order of increasing time. No two keyframes have the // same time. OwnPtrVector m_keyframes; }; class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve { public: // It is required that the keyframes be sorted by time. static PassOwnPtr create(); virtual ~CCKeyframedTransformAnimationCurve(); void addKeyframe(PassOwnPtr); // CCAnimationCurve implementation virtual double duration() const OVERRIDE; virtual PassOwnPtr clone() const OVERRIDE; // CCTransformAnimationCurve implementation virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE; private: CCKeyframedTransformAnimationCurve(); // Always sorted in order of increasing time. No two keyframes have the // same time. OwnPtrVector m_keyframes; }; } // namespace cc #endif // CCKeyframedAnimationCurve_h