
This method exists in Skia, but is not publicly consumable/linkable with a component build. Skia will expose this (or a similar) method through a proper public API, and we should use it. But in the meantime, we make a copy of the method in timing_function.cc, and use it there in place of WebCore's UnitBezier class. Tests: cc_unittests:TimingFunctionTest.CubicBezierTimingFunction This test compares the output of the timing function against baseline values recorded with WebCore's UnitBezier class. If new methods are able to come closer to those values, we should decrease the epsilon used in the test accordingly. R=jamesr BUG=147395 Review URL: https://chromiumcodereview.appspot.com/11359077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166362 0039d316-1c4b-4281-b951-d872f2087c98
67 lines
1.6 KiB
C++
67 lines
1.6 KiB
C++
// 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 CC_TIMING_FUNCTION_H_
|
|
#define CC_TIMING_FUNCTION_H_
|
|
|
|
#include "cc/animation_curve.h"
|
|
#include "cc/cc_export.h"
|
|
#include "third_party/skia/include/core/SkScalar.h"
|
|
|
|
namespace cc {
|
|
|
|
// See http://www.w3.org/TR/css3-transitions/.
|
|
class CC_EXPORT TimingFunction : public FloatAnimationCurve {
|
|
public:
|
|
virtual ~TimingFunction();
|
|
|
|
// Partial implementation of FloatAnimationCurve.
|
|
virtual double duration() const OVERRIDE;
|
|
|
|
protected:
|
|
TimingFunction();
|
|
};
|
|
|
|
class CC_EXPORT CubicBezierTimingFunction : public TimingFunction {
|
|
public:
|
|
static scoped_ptr<CubicBezierTimingFunction> create(double x1, double y1, double x2, double y2);
|
|
virtual ~CubicBezierTimingFunction();
|
|
|
|
// Partial implementation of FloatAnimationCurve.
|
|
virtual float getValue(double time) const OVERRIDE;
|
|
virtual scoped_ptr<AnimationCurve> clone() const OVERRIDE;
|
|
|
|
protected:
|
|
CubicBezierTimingFunction(double x1, double y1, double x2, double y2);
|
|
|
|
SkScalar m_x1;
|
|
SkScalar m_y1;
|
|
SkScalar m_x2;
|
|
SkScalar m_y2;
|
|
};
|
|
|
|
class CC_EXPORT EaseTimingFunction {
|
|
public:
|
|
static scoped_ptr<TimingFunction> create();
|
|
};
|
|
|
|
class CC_EXPORT EaseInTimingFunction {
|
|
public:
|
|
static scoped_ptr<TimingFunction> create();
|
|
};
|
|
|
|
class CC_EXPORT EaseOutTimingFunction {
|
|
public:
|
|
static scoped_ptr<TimingFunction> create();
|
|
};
|
|
|
|
class CC_EXPORT EaseInOutTimingFunction {
|
|
public:
|
|
static scoped_ptr<TimingFunction> create();
|
|
};
|
|
|
|
} // namespace cc
|
|
|
|
#endif // CC_TIMING_FUNCTION_H_
|