OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CompositorAnimation_h | 5 #ifndef CompositorAnimation_h |
6 #define CompositorAnimation_h | 6 #define CompositorAnimation_h |
7 | 7 |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
10 #include "platform/animation/CompositorTargetProperty.h" | 10 #include "platform/animation/CompositorTargetProperty.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
| 12 #include "wtf/PassOwnPtr.h" |
12 | 13 |
13 #include <memory> | 14 #include <memory> |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 class Animation; | 17 class Animation; |
17 } | 18 } |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 | 21 |
21 class CompositorAnimationCurve; | 22 class CompositorAnimationCurve; |
| 23 class CompositorFloatAnimationCurve; |
22 | 24 |
23 // A compositor driven animation. | 25 // A compositor driven animation. |
24 class PLATFORM_EXPORT CompositorAnimation { | 26 class PLATFORM_EXPORT CompositorAnimation { |
25 WTF_MAKE_NONCOPYABLE(CompositorAnimation); | 27 WTF_MAKE_NONCOPYABLE(CompositorAnimation); |
26 public: | 28 public: |
27 using Direction = cc::Animation::Direction; | 29 using Direction = cc::Animation::Direction; |
28 using FillMode = cc::Animation::FillMode; | 30 using FillMode = cc::Animation::FillMode; |
29 | 31 |
30 CompositorAnimation(const CompositorAnimationCurve&, CompositorTargetPropert
y::Type, int animationId, int groupId); | 32 CompositorAnimation(const CompositorAnimationCurve&, CompositorTargetPropert
y::Type, int animationId, int groupId); |
31 virtual ~CompositorAnimation(); | 33 ~CompositorAnimation(); |
32 | 34 |
33 // An id must be unique. | 35 // An id must be unique. |
34 virtual int id(); | 36 int id() const; |
35 virtual int group(); | 37 int group() const; |
36 | 38 |
37 virtual CompositorTargetProperty::Type targetProperty() const; | 39 CompositorTargetProperty::Type targetProperty() const; |
38 | 40 |
39 // This is the number of times that the animation will play. If this | 41 // This is the number of times that the animation will play. If this |
40 // value is zero the animation will not play. If it is negative, then | 42 // value is zero the animation will not play. If it is negative, then |
41 // the animation will loop indefinitely. | 43 // the animation will loop indefinitely. |
42 virtual double iterations() const; | 44 double iterations() const; |
43 virtual void setIterations(double); | 45 void setIterations(double); |
44 | 46 |
45 virtual double startTime() const; | 47 double startTime() const; |
46 virtual void setStartTime(double monotonicTime); | 48 void setStartTime(double monotonicTime); |
47 | 49 |
48 virtual double timeOffset() const; | 50 double timeOffset() const; |
49 virtual void setTimeOffset(double monotonicTime); | 51 void setTimeOffset(double monotonicTime); |
50 | 52 |
51 virtual Direction getDirection() const; | 53 Direction getDirection() const; |
52 virtual void setDirection(Direction); | 54 void setDirection(Direction); |
53 | 55 |
54 virtual double playbackRate() const; | 56 double playbackRate() const; |
55 virtual void setPlaybackRate(double); | 57 void setPlaybackRate(double); |
56 | 58 |
57 virtual FillMode getFillMode() const; | 59 FillMode getFillMode() const; |
58 virtual void setFillMode(FillMode); | 60 void setFillMode(FillMode); |
59 | 61 |
60 virtual double iterationStart() const; | 62 double iterationStart() const; |
61 virtual void setIterationStart(double); | 63 void setIterationStart(double); |
62 | 64 |
63 std::unique_ptr<cc::Animation> passAnimation(); | 65 std::unique_ptr<cc::Animation> passAnimation(); |
64 | 66 |
65 protected: | 67 PassOwnPtr<CompositorFloatAnimationCurve> floatCurveForTesting() const; |
66 CompositorAnimation(); | |
67 | 68 |
68 private: | 69 private: |
69 std::unique_ptr<cc::Animation> m_animation; | 70 std::unique_ptr<cc::Animation> m_animation; |
70 }; | 71 }; |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
73 | 74 |
74 #endif // CompositorAnimation_h | 75 #endif // CompositorAnimation_h |
OLD | NEW |