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 virtual ~FakeFloatAnimationCurve(); | 27 virtual ~FakeFloatAnimationCurve(); |
28 | 28 |
29 virtual double Duration() const OVERRIDE; | 29 virtual double Duration() const override; |
30 virtual float GetValue(double now) const OVERRIDE; | 30 virtual float GetValue(double now) const override; |
31 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; | 31 virtual scoped_ptr<AnimationCurve> Clone() const override; |
32 | 32 |
33 private: | 33 private: |
34 double duration_; | 34 double 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 virtual ~FakeTransformTransition(); | 40 virtual ~FakeTransformTransition(); |
41 | 41 |
42 virtual double Duration() const OVERRIDE; | 42 virtual double Duration() const override; |
43 virtual gfx::Transform GetValue(double time) const OVERRIDE; | 43 virtual gfx::Transform GetValue(double time) const override; |
44 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, | 44 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, |
45 gfx::BoxF* bounds) const OVERRIDE; | 45 gfx::BoxF* bounds) const override; |
46 virtual bool AffectsScale() const OVERRIDE; | 46 virtual bool AffectsScale() const override; |
47 virtual bool IsTranslation() const OVERRIDE; | 47 virtual bool IsTranslation() const override; |
48 virtual bool MaximumScale(float* max_scale) const OVERRIDE; | 48 virtual bool MaximumScale(float* max_scale) const override; |
49 | 49 |
50 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; | 50 virtual scoped_ptr<AnimationCurve> Clone() const override; |
51 | 51 |
52 private: | 52 private: |
53 double duration_; | 53 double duration_; |
54 }; | 54 }; |
55 | 55 |
56 class FakeFloatTransition : public FloatAnimationCurve { | 56 class FakeFloatTransition : public FloatAnimationCurve { |
57 public: | 57 public: |
58 FakeFloatTransition(double duration, float from, float to); | 58 FakeFloatTransition(double duration, float from, float to); |
59 virtual ~FakeFloatTransition(); | 59 virtual ~FakeFloatTransition(); |
60 | 60 |
61 virtual double Duration() const OVERRIDE; | 61 virtual double Duration() const override; |
62 virtual float GetValue(double time) const OVERRIDE; | 62 virtual float GetValue(double time) const override; |
63 | 63 |
64 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; | 64 virtual scoped_ptr<AnimationCurve> Clone() const override; |
65 | 65 |
66 private: | 66 private: |
67 double duration_; | 67 double duration_; |
68 float from_; | 68 float from_; |
69 float to_; | 69 float to_; |
70 }; | 70 }; |
71 | 71 |
72 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver { | 72 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver { |
73 public: | 73 public: |
74 FakeLayerAnimationValueObserver(); | 74 FakeLayerAnimationValueObserver(); |
75 virtual ~FakeLayerAnimationValueObserver(); | 75 virtual ~FakeLayerAnimationValueObserver(); |
76 | 76 |
77 // LayerAnimationValueObserver implementation | 77 // LayerAnimationValueObserver implementation |
78 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE; | 78 virtual void OnFilterAnimated(const FilterOperations& filters) override; |
79 virtual void OnOpacityAnimated(float opacity) OVERRIDE; | 79 virtual void OnOpacityAnimated(float opacity) override; |
80 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; | 80 virtual void OnTransformAnimated(const gfx::Transform& transform) override; |
81 virtual void OnScrollOffsetAnimated( | 81 virtual void OnScrollOffsetAnimated( |
82 const gfx::ScrollOffset& scroll_offset) OVERRIDE; | 82 const gfx::ScrollOffset& scroll_offset) override; |
83 virtual void OnAnimationWaitingForDeletion() OVERRIDE; | 83 virtual void OnAnimationWaitingForDeletion() override; |
84 virtual bool IsActive() const OVERRIDE; | 84 virtual bool IsActive() const override; |
85 | 85 |
86 const FilterOperations& filters() const { return filters_; } | 86 const FilterOperations& filters() const { return filters_; } |
87 float opacity() const { return opacity_; } | 87 float opacity() const { return opacity_; } |
88 const gfx::Transform& transform() const { return transform_; } | 88 const gfx::Transform& transform() const { return transform_; } |
89 gfx::ScrollOffset scroll_offset() { return scroll_offset_; } | 89 gfx::ScrollOffset scroll_offset() { return scroll_offset_; } |
90 | 90 |
91 bool animation_waiting_for_deletion() { | 91 bool animation_waiting_for_deletion() { |
92 return animation_waiting_for_deletion_; | 92 return animation_waiting_for_deletion_; |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 FilterOperations filters_; | 96 FilterOperations filters_; |
97 float opacity_; | 97 float opacity_; |
98 gfx::Transform transform_; | 98 gfx::Transform transform_; |
99 gfx::ScrollOffset scroll_offset_; | 99 gfx::ScrollOffset scroll_offset_; |
100 bool animation_waiting_for_deletion_; | 100 bool animation_waiting_for_deletion_; |
101 }; | 101 }; |
102 | 102 |
103 class FakeInactiveLayerAnimationValueObserver | 103 class FakeInactiveLayerAnimationValueObserver |
104 : public FakeLayerAnimationValueObserver { | 104 : public FakeLayerAnimationValueObserver { |
105 public: | 105 public: |
106 virtual bool IsActive() const OVERRIDE; | 106 virtual bool IsActive() const override; |
107 }; | 107 }; |
108 | 108 |
109 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider { | 109 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider { |
110 public: | 110 public: |
111 virtual gfx::ScrollOffset ScrollOffsetForAnimation() const OVERRIDE; | 111 virtual gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
112 | 112 |
113 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { | 113 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { |
114 scroll_offset_ = scroll_offset; | 114 scroll_offset_ = scroll_offset; |
115 } | 115 } |
116 | 116 |
117 private: | 117 private: |
118 gfx::ScrollOffset scroll_offset_; | 118 gfx::ScrollOffset scroll_offset_; |
119 }; | 119 }; |
120 | 120 |
121 int AddOpacityTransitionToController(LayerAnimationController* controller, | 121 int AddOpacityTransitionToController(LayerAnimationController* controller, |
(...skipping 50 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 |