From 12076fa6270fda6ea535da61cafe7116ec2e6f00 Mon Sep 17 00:00:00 2001 From: "avallee@chromium.org" Date: Thu, 24 Oct 2013 22:51:36 +0000 Subject: Add Color animation curves. Implement animation curves for colors. This is the first step towards accelerating background-color animations. + Add ColorValueBetween to gfx::Tween. + Add test/color_utils which gives EXPECT_COLOR_EQ to check SkColors and print in a sane format. ~ Fixed discrepancy between two methods of interpolating ints. ~ Factored out GetProgress into template function to simplify code in the implementations of GetValue(double), there was a lot of duplication there. TESTED: Added tests for the new KeyframedColorAnimations and AnimatedColor classes. Added tests to tweening. R=ajuma BUG=290234 Review URL: https://codereview.chromium.org/25901002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230856 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/animation/animation_curve.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cc/animation/animation_curve.h') diff --git a/cc/animation/animation_curve.h b/cc/animation/animation_curve.h index f4cdb10..f84bb1a 100644 --- a/cc/animation/animation_curve.h +++ b/cc/animation/animation_curve.h @@ -16,6 +16,7 @@ class BoxF; namespace cc { +class ColorAnimationCurve; class FilterAnimationCurve; class FloatAnimationCurve; class TransformAnimationCurve; @@ -24,7 +25,7 @@ class TransformOperations; // An animation curve is a function that returns a value given a time. class CC_EXPORT AnimationCurve { public: - enum CurveType { Float, Transform, Filter }; + enum CurveType { Color, Float, Transform, Filter }; virtual ~AnimationCurve() {} @@ -32,11 +33,22 @@ class CC_EXPORT AnimationCurve { virtual CurveType Type() const = 0; virtual scoped_ptr Clone() const = 0; + const ColorAnimationCurve* ToColorAnimationCurve() const; const FloatAnimationCurve* ToFloatAnimationCurve() const; const TransformAnimationCurve* ToTransformAnimationCurve() const; const FilterAnimationCurve* ToFilterAnimationCurve() const; }; +class CC_EXPORT ColorAnimationCurve : public AnimationCurve { + public: + virtual ~ColorAnimationCurve() {} + + virtual SkColor GetValue(double t) const = 0; + + // Partial Animation implementation. + virtual CurveType Type() const OVERRIDE; +}; + class CC_EXPORT FloatAnimationCurve : public AnimationCurve { public: virtual ~FloatAnimationCurve() {} -- cgit v1.1