| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_ANIMATION_ANIMATION_CURVE_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_CURVE_H_ |
| 6 #define CC_ANIMATION_ANIMATION_CURVE_H_ | 6 #define CC_ANIMATION_ANIMATION_CURVE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "cc/animation/animation_export.h" | 11 #include "cc/animation/animation_export.h" |
| 12 #include "cc/base/filter_operations.h" | 12 #include "cc/base/filter_operations.h" |
| 13 #include "ui/gfx/geometry/size_f.h" |
| 13 #include "ui/gfx/transform.h" | 14 #include "ui/gfx/transform.h" |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class BoxF; | 17 class BoxF; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace cc { | 20 namespace cc { |
| 20 | 21 |
| 21 class ColorAnimationCurve; | 22 class ColorAnimationCurve; |
| 22 class FilterAnimationCurve; | 23 class FilterAnimationCurve; |
| 23 class FloatAnimationCurve; | 24 class FloatAnimationCurve; |
| 24 class ScrollOffsetAnimationCurve; | 25 class ScrollOffsetAnimationCurve; |
| 26 class SizeAnimationCurve; |
| 25 class TransformAnimationCurve; | 27 class TransformAnimationCurve; |
| 26 | 28 |
| 27 // An animation curve is a function that returns a value given a time. | 29 // An animation curve is a function that returns a value given a time. |
| 28 class CC_ANIMATION_EXPORT AnimationCurve { | 30 class CC_ANIMATION_EXPORT AnimationCurve { |
| 29 public: | 31 public: |
| 30 enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET }; | 32 enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET, SIZE }; |
| 31 | 33 |
| 32 virtual ~AnimationCurve() {} | 34 virtual ~AnimationCurve() {} |
| 33 | 35 |
| 34 virtual base::TimeDelta Duration() const = 0; | 36 virtual base::TimeDelta Duration() const = 0; |
| 35 virtual CurveType Type() const = 0; | 37 virtual CurveType Type() const = 0; |
| 36 virtual std::unique_ptr<AnimationCurve> Clone() const = 0; | 38 virtual std::unique_ptr<AnimationCurve> Clone() const = 0; |
| 37 | 39 |
| 38 const ColorAnimationCurve* ToColorAnimationCurve() const; | 40 const ColorAnimationCurve* ToColorAnimationCurve() const; |
| 39 const FloatAnimationCurve* ToFloatAnimationCurve() const; | 41 const FloatAnimationCurve* ToFloatAnimationCurve() const; |
| 40 const TransformAnimationCurve* ToTransformAnimationCurve() const; | 42 const TransformAnimationCurve* ToTransformAnimationCurve() const; |
| 41 const FilterAnimationCurve* ToFilterAnimationCurve() const; | 43 const FilterAnimationCurve* ToFilterAnimationCurve() const; |
| 42 const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const; | 44 const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const; |
| 45 const SizeAnimationCurve* ToSizeAnimationCurve() const; |
| 43 | 46 |
| 44 ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve(); | 47 ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve(); |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 class CC_ANIMATION_EXPORT ColorAnimationCurve : public AnimationCurve { | 50 class CC_ANIMATION_EXPORT ColorAnimationCurve : public AnimationCurve { |
| 48 public: | 51 public: |
| 49 ~ColorAnimationCurve() override {} | 52 ~ColorAnimationCurve() override {} |
| 50 | 53 |
| 51 virtual SkColor GetValue(base::TimeDelta t) const = 0; | 54 virtual SkColor GetValue(base::TimeDelta t) const = 0; |
| 52 | 55 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 public: | 105 public: |
| 103 ~FilterAnimationCurve() override {} | 106 ~FilterAnimationCurve() override {} |
| 104 | 107 |
| 105 virtual FilterOperations GetValue(base::TimeDelta t) const = 0; | 108 virtual FilterOperations GetValue(base::TimeDelta t) const = 0; |
| 106 virtual bool HasFilterThatMovesPixels() const = 0; | 109 virtual bool HasFilterThatMovesPixels() const = 0; |
| 107 | 110 |
| 108 // Partial Animation implementation. | 111 // Partial Animation implementation. |
| 109 CurveType Type() const override; | 112 CurveType Type() const override; |
| 110 }; | 113 }; |
| 111 | 114 |
| 115 class CC_ANIMATION_EXPORT SizeAnimationCurve : public AnimationCurve { |
| 116 public: |
| 117 ~SizeAnimationCurve() override {} |
| 118 |
| 119 virtual gfx::SizeF GetValue(base::TimeDelta t) const = 0; |
| 120 |
| 121 // Partial Animation implementation. |
| 122 CurveType Type() const override; |
| 123 }; |
| 124 |
| 112 } // namespace cc | 125 } // namespace cc |
| 113 | 126 |
| 114 #endif // CC_ANIMATION_ANIMATION_CURVE_H_ | 127 #endif // CC_ANIMATION_ANIMATION_CURVE_H_ |
| OLD | NEW |