Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: cc/animation/animation_curve.h

Issue 2506093003: CC Animation: Make cc/animation an independent GN component. (Closed)
Patch Set: Let test_support publicly depends on cc/animation. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/cc_export.h" 11 #include "cc/animation/animation_export.h"
12 #include "cc/output/filter_operations.h" 12 #include "cc/output/filter_operations.h"
13 #include "ui/gfx/transform.h" 13 #include "ui/gfx/transform.h"
14 14
15 namespace gfx { 15 namespace gfx {
16 class BoxF; 16 class BoxF;
17 } 17 }
18 18
19 namespace cc { 19 namespace cc {
20 20
21 class ColorAnimationCurve; 21 class ColorAnimationCurve;
22 class FilterAnimationCurve; 22 class FilterAnimationCurve;
23 class FloatAnimationCurve; 23 class FloatAnimationCurve;
24 class ScrollOffsetAnimationCurve; 24 class ScrollOffsetAnimationCurve;
25 class TransformAnimationCurve; 25 class TransformAnimationCurve;
26 class TransformOperations; 26 class TransformOperations;
27 27
28 // An animation curve is a function that returns a value given a time. 28 // An animation curve is a function that returns a value given a time.
29 class CC_EXPORT AnimationCurve { 29 class CC_ANIMATION_EXPORT AnimationCurve {
30 public: 30 public:
31 enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET }; 31 enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET };
32 32
33 virtual ~AnimationCurve() {} 33 virtual ~AnimationCurve() {}
34 34
35 virtual base::TimeDelta Duration() const = 0; 35 virtual base::TimeDelta Duration() const = 0;
36 virtual CurveType Type() const = 0; 36 virtual CurveType Type() const = 0;
37 virtual std::unique_ptr<AnimationCurve> Clone() const = 0; 37 virtual std::unique_ptr<AnimationCurve> Clone() const = 0;
38 38
39 const ColorAnimationCurve* ToColorAnimationCurve() const; 39 const ColorAnimationCurve* ToColorAnimationCurve() const;
40 const FloatAnimationCurve* ToFloatAnimationCurve() const; 40 const FloatAnimationCurve* ToFloatAnimationCurve() const;
41 const TransformAnimationCurve* ToTransformAnimationCurve() const; 41 const TransformAnimationCurve* ToTransformAnimationCurve() const;
42 const FilterAnimationCurve* ToFilterAnimationCurve() const; 42 const FilterAnimationCurve* ToFilterAnimationCurve() const;
43 const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const; 43 const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const;
44 44
45 ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve(); 45 ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve();
46 }; 46 };
47 47
48 class CC_EXPORT ColorAnimationCurve : public AnimationCurve { 48 class CC_ANIMATION_EXPORT ColorAnimationCurve : public AnimationCurve {
49 public: 49 public:
50 ~ColorAnimationCurve() override {} 50 ~ColorAnimationCurve() override {}
51 51
52 virtual SkColor GetValue(base::TimeDelta t) const = 0; 52 virtual SkColor GetValue(base::TimeDelta t) const = 0;
53 53
54 // Partial Animation implementation. 54 // Partial Animation implementation.
55 CurveType Type() const override; 55 CurveType Type() const override;
56 }; 56 };
57 57
58 class CC_EXPORT FloatAnimationCurve : public AnimationCurve { 58 class CC_ANIMATION_EXPORT FloatAnimationCurve : public AnimationCurve {
59 public: 59 public:
60 ~FloatAnimationCurve() override {} 60 ~FloatAnimationCurve() override {}
61 61
62 virtual float GetValue(base::TimeDelta t) const = 0; 62 virtual float GetValue(base::TimeDelta t) const = 0;
63 63
64 // Partial Animation implementation. 64 // Partial Animation implementation.
65 CurveType Type() const override; 65 CurveType Type() const override;
66 }; 66 };
67 67
68 class CC_EXPORT TransformAnimationCurve : public AnimationCurve { 68 class CC_ANIMATION_EXPORT TransformAnimationCurve : public AnimationCurve {
69 public: 69 public:
70 ~TransformAnimationCurve() override {} 70 ~TransformAnimationCurve() override {}
71 71
72 virtual gfx::Transform GetValue(base::TimeDelta t) const = 0; 72 virtual gfx::Transform GetValue(base::TimeDelta t) const = 0;
73 73
74 // Sets |bounds| to be the bounding box for the region within which |box| 74 // Sets |bounds| to be the bounding box for the region within which |box|
75 // will move during this animation. If this region cannot be computed, 75 // will move during this animation. If this region cannot be computed,
76 // returns false. 76 // returns false.
77 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, 77 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
78 gfx::BoxF* bounds) const = 0; 78 gfx::BoxF* bounds) const = 0;
(...skipping 13 matching lines...) Expand all
92 // |forward_direction| is true, the animation curve assumes it plays from 92 // |forward_direction| is true, the animation curve assumes it plays from
93 // the first keyframe to the last, otherwise it assumes the opposite. Returns 93 // the first keyframe to the last, otherwise it assumes the opposite. Returns
94 // false if the maximum scale cannot be computed. 94 // false if the maximum scale cannot be computed.
95 virtual bool MaximumTargetScale(bool forward_direction, 95 virtual bool MaximumTargetScale(bool forward_direction,
96 float* max_scale) const = 0; 96 float* max_scale) const = 0;
97 97
98 // Partial Animation implementation. 98 // Partial Animation implementation.
99 CurveType Type() const override; 99 CurveType Type() const override;
100 }; 100 };
101 101
102 class CC_EXPORT FilterAnimationCurve : public AnimationCurve { 102 class CC_ANIMATION_EXPORT FilterAnimationCurve : public AnimationCurve {
103 public: 103 public:
104 ~FilterAnimationCurve() override {} 104 ~FilterAnimationCurve() override {}
105 105
106 virtual FilterOperations GetValue(base::TimeDelta t) const = 0; 106 virtual FilterOperations GetValue(base::TimeDelta t) const = 0;
107 virtual bool HasFilterThatMovesPixels() const = 0; 107 virtual bool HasFilterThatMovesPixels() const = 0;
108 108
109 // Partial Animation implementation. 109 // Partial Animation implementation.
110 CurveType Type() const override; 110 CurveType Type() const override;
111 }; 111 };
112 112
113 } // namespace cc 113 } // namespace cc
114 114
115 #endif // CC_ANIMATION_ANIMATION_CURVE_H_ 115 #endif // CC_ANIMATION_ANIMATION_CURVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698