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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const FilterAnimationCurve* ToFilterAnimationCurve() const; | 41 const FilterAnimationCurve* ToFilterAnimationCurve() const; |
42 const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const; | 42 const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const; |
43 | 43 |
44 ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve(); | 44 ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve(); |
45 }; | 45 }; |
46 | 46 |
47 class CC_EXPORT ColorAnimationCurve : public AnimationCurve { | 47 class CC_EXPORT ColorAnimationCurve : public AnimationCurve { |
48 public: | 48 public: |
49 ~ColorAnimationCurve() override {} | 49 ~ColorAnimationCurve() override {} |
50 | 50 |
51 virtual SkColor GetValue(double t) const = 0; | 51 virtual SkColor GetValue(base::TimeDelta t) const = 0; |
52 | 52 |
53 // Partial Animation implementation. | 53 // Partial Animation implementation. |
54 CurveType Type() const override; | 54 CurveType Type() const override; |
55 }; | 55 }; |
56 | 56 |
57 class CC_EXPORT FloatAnimationCurve : public AnimationCurve { | 57 class CC_EXPORT FloatAnimationCurve : public AnimationCurve { |
58 public: | 58 public: |
59 ~FloatAnimationCurve() override {} | 59 ~FloatAnimationCurve() override {} |
60 | 60 |
61 virtual float GetValue(double t) const = 0; | 61 virtual float GetValue(base::TimeDelta t) const = 0; |
62 | 62 |
63 // Partial Animation implementation. | 63 // Partial Animation implementation. |
64 CurveType Type() const override; | 64 CurveType Type() const override; |
65 }; | 65 }; |
66 | 66 |
67 class CC_EXPORT TransformAnimationCurve : public AnimationCurve { | 67 class CC_EXPORT TransformAnimationCurve : public AnimationCurve { |
68 public: | 68 public: |
69 ~TransformAnimationCurve() override {} | 69 ~TransformAnimationCurve() override {} |
70 | 70 |
71 virtual gfx::Transform GetValue(double t) const = 0; | 71 virtual gfx::Transform GetValue(base::TimeDelta t) const = 0; |
72 | 72 |
73 // Sets |bounds| to be the bounding box for the region within which |box| | 73 // Sets |bounds| to be the bounding box for the region within which |box| |
74 // will move during this animation. If this region cannot be computed, | 74 // will move during this animation. If this region cannot be computed, |
75 // returns false. | 75 // returns false. |
76 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, | 76 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, |
77 gfx::BoxF* bounds) const = 0; | 77 gfx::BoxF* bounds) const = 0; |
78 | 78 |
79 // Returns true if this animation affects scale. | 79 // Returns true if this animation affects scale. |
80 virtual bool AffectsScale() const = 0; | 80 virtual bool AffectsScale() const = 0; |
81 | 81 |
82 // Returns true if this animation is a translation. | 82 // Returns true if this animation is a translation. |
83 virtual bool IsTranslation() const = 0; | 83 virtual bool IsTranslation() const = 0; |
84 | 84 |
85 // Set |max_scale| to the maximum scale along any dimension at the end of | 85 // Set |max_scale| to the maximum scale along any dimension at the end of |
86 // intermediate animation target points (eg keyframe end points). When | 86 // intermediate animation target points (eg keyframe end points). When |
87 // |forward_direction| is true, the animation curve assumes it plays from | 87 // |forward_direction| is true, the animation curve assumes it plays from |
88 // the first keyframe to the last, otherwise it assumes the opposite. Returns | 88 // the first keyframe to the last, otherwise it assumes the opposite. Returns |
89 // false if the maximum scale cannot be computed. | 89 // false if the maximum scale cannot be computed. |
90 virtual bool MaximumTargetScale(bool forward_direction, | 90 virtual bool MaximumTargetScale(bool forward_direction, |
91 float* max_scale) const = 0; | 91 float* max_scale) const = 0; |
92 | 92 |
93 // Partial Animation implementation. | 93 // Partial Animation implementation. |
94 CurveType Type() const override; | 94 CurveType Type() const override; |
95 }; | 95 }; |
96 | 96 |
97 class CC_EXPORT FilterAnimationCurve : public AnimationCurve { | 97 class CC_EXPORT FilterAnimationCurve : public AnimationCurve { |
98 public: | 98 public: |
99 ~FilterAnimationCurve() override {} | 99 ~FilterAnimationCurve() override {} |
100 | 100 |
101 virtual FilterOperations GetValue(double t) const = 0; | 101 virtual FilterOperations GetValue(base::TimeDelta t) const = 0; |
102 virtual bool HasFilterThatMovesPixels() const = 0; | 102 virtual bool HasFilterThatMovesPixels() const = 0; |
103 | 103 |
104 // Partial Animation implementation. | 104 // Partial Animation implementation. |
105 CurveType Type() const override; | 105 CurveType Type() const override; |
106 }; | 106 }; |
107 | 107 |
108 } // namespace cc | 108 } // namespace cc |
109 | 109 |
110 #endif // CC_ANIMATION_ANIMATION_CURVE_H_ | 110 #endif // CC_ANIMATION_ANIMATION_CURVE_H_ |
OLD | NEW |