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_TEST_ANIMATION_TEST_COMMON_H_ | 5 #ifndef CC_TEST_ANIMATION_TEST_COMMON_H_ |
6 #define CC_TEST_ANIMATION_TEST_COMMON_H_ | 6 #define CC_TEST_ANIMATION_TEST_COMMON_H_ |
7 | 7 |
8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
9 #include "cc/animation/animation_curve.h" | 9 #include "cc/animation/animation_curve.h" |
10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
11 #include "cc/animation/layer_animation_value_observer.h" | 11 #include "cc/animation/layer_animation_value_observer.h" |
12 #include "cc/animation/layer_animation_value_provider.h" | 12 #include "cc/animation/layer_animation_value_provider.h" |
13 #include "cc/output/filter_operations.h" | 13 #include "cc/output/filter_operations.h" |
14 #include "cc/test/geometry_test_utils.h" | 14 #include "cc/test/geometry_test_utils.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 class LayerImpl; | 17 class LayerImpl; |
18 class Layer; | 18 class Layer; |
19 } | 19 } |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 class FakeFloatAnimationCurve : public FloatAnimationCurve { | 23 class FakeFloatAnimationCurve : public FloatAnimationCurve { |
24 public: | 24 public: |
25 FakeFloatAnimationCurve(); | 25 FakeFloatAnimationCurve(); |
26 explicit FakeFloatAnimationCurve(double duration); | 26 explicit FakeFloatAnimationCurve(double duration); |
27 ~FakeFloatAnimationCurve() override; | 27 ~FakeFloatAnimationCurve() override; |
28 | 28 |
29 double Duration() const override; | 29 base::TimeDelta Duration() const override; |
30 float GetValue(double now) const override; | 30 float GetValue(double now) const override; |
31 scoped_ptr<AnimationCurve> Clone() const override; | 31 scoped_ptr<AnimationCurve> Clone() const override; |
32 | 32 |
33 private: | 33 private: |
34 double duration_; | 34 base::TimeDelta duration_; |
35 }; | 35 }; |
36 | 36 |
37 class FakeTransformTransition : public TransformAnimationCurve { | 37 class FakeTransformTransition : public TransformAnimationCurve { |
38 public: | 38 public: |
39 explicit FakeTransformTransition(double duration); | 39 explicit FakeTransformTransition(double duration); |
40 ~FakeTransformTransition() override; | 40 ~FakeTransformTransition() override; |
41 | 41 |
42 double Duration() const override; | 42 base::TimeDelta Duration() const override; |
43 gfx::Transform GetValue(double time) const override; | 43 gfx::Transform GetValue(double time) const override; |
44 bool AnimatedBoundsForBox(const gfx::BoxF& box, | 44 bool AnimatedBoundsForBox(const gfx::BoxF& box, |
45 gfx::BoxF* bounds) const override; | 45 gfx::BoxF* bounds) const override; |
46 bool AffectsScale() const override; | 46 bool AffectsScale() const override; |
47 bool IsTranslation() const override; | 47 bool IsTranslation() const override; |
48 bool MaximumTargetScale(bool forward_direction, | 48 bool MaximumTargetScale(bool forward_direction, |
49 float* max_scale) const override; | 49 float* max_scale) const override; |
50 | 50 |
51 scoped_ptr<AnimationCurve> Clone() const override; | 51 scoped_ptr<AnimationCurve> Clone() const override; |
52 | 52 |
53 private: | 53 private: |
54 double duration_; | 54 base::TimeDelta duration_; |
55 }; | 55 }; |
56 | 56 |
57 class FakeFloatTransition : public FloatAnimationCurve { | 57 class FakeFloatTransition : public FloatAnimationCurve { |
58 public: | 58 public: |
59 FakeFloatTransition(double duration, float from, float to); | 59 FakeFloatTransition(double duration, float from, float to); |
60 ~FakeFloatTransition() override; | 60 ~FakeFloatTransition() override; |
61 | 61 |
62 double Duration() const override; | 62 base::TimeDelta Duration() const override; |
63 float GetValue(double time) const override; | 63 float GetValue(double time) const override; |
64 | 64 |
65 scoped_ptr<AnimationCurve> Clone() const override; | 65 scoped_ptr<AnimationCurve> Clone() const override; |
66 | 66 |
67 private: | 67 private: |
68 double duration_; | 68 base::TimeDelta duration_; |
69 float from_; | 69 float from_; |
70 float to_; | 70 float to_; |
71 }; | 71 }; |
72 | 72 |
73 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver { | 73 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver { |
74 public: | 74 public: |
75 FakeLayerAnimationValueObserver(); | 75 FakeLayerAnimationValueObserver(); |
76 ~FakeLayerAnimationValueObserver() override; | 76 ~FakeLayerAnimationValueObserver() override; |
77 | 77 |
78 // LayerAnimationValueObserver implementation | 78 // LayerAnimationValueObserver implementation |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 float end_brightness); | 172 float end_brightness); |
173 | 173 |
174 int AddAnimatedFilterToLayer(LayerImpl* layer, | 174 int AddAnimatedFilterToLayer(LayerImpl* layer, |
175 double duration, | 175 double duration, |
176 float start_brightness, | 176 float start_brightness, |
177 float end_brightness); | 177 float end_brightness); |
178 | 178 |
179 } // namespace cc | 179 } // namespace cc |
180 | 180 |
181 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_ | 181 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_ |
OLD | NEW |