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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCAnimationTestCommon.h" | 7 #include "CCAnimationTestCommon.h" |
8 | 8 |
9 #include "CCKeyframedAnimationCurve.h" | 9 #include "CCKeyframedAnimationCurve.h" |
10 #include "CCLayerAnimationController.h" | 10 #include "CCLayerAnimationController.h" |
11 #include "CCLayerImpl.h" | 11 #include "CCLayerImpl.h" |
12 #include "LayerChromium.h" | 12 #include "LayerChromium.h" |
13 #include <public/WebTransformOperations.h> | 13 #include <public/WebTransformOperations.h> |
14 | 14 |
15 using namespace WebCore; | 15 using namespace cc; |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 template <class Target> | 19 template <class Target> |
20 void addOpacityTransition(Target& target, double duration, float startOpacity, f
loat endOpacity, bool useTimingFunction) | 20 void addOpacityTransition(Target& target, double duration, float startOpacity, f
loat endOpacity, bool useTimingFunction) |
21 { | 21 { |
22 OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve:
:create()); | 22 OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve:
:create()); |
23 | 23 |
24 if (duration > 0) | 24 if (duration > 0) |
25 curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, useTimingFun
ction ? nullptr : CCEaseTimingFunction::create())); | 25 curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, useTimingFun
ction ? nullptr : CCEaseTimingFunction::create())); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 double FakeFloatAnimationCurve::duration() const | 68 double FakeFloatAnimationCurve::duration() const |
69 { | 69 { |
70 return 1; | 70 return 1; |
71 } | 71 } |
72 | 72 |
73 float FakeFloatAnimationCurve::getValue(double now) const | 73 float FakeFloatAnimationCurve::getValue(double now) const |
74 { | 74 { |
75 return 0; | 75 return 0; |
76 } | 76 } |
77 | 77 |
78 PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatAnimationCurve::clone() const | 78 PassOwnPtr<cc::CCAnimationCurve> FakeFloatAnimationCurve::clone() const |
79 { | 79 { |
80 return adoptPtr(new FakeFloatAnimationCurve); | 80 return adoptPtr(new FakeFloatAnimationCurve); |
81 } | 81 } |
82 | 82 |
83 FakeTransformTransition::FakeTransformTransition(double duration) | 83 FakeTransformTransition::FakeTransformTransition(double duration) |
84 : m_duration(duration) | 84 : m_duration(duration) |
85 { | 85 { |
86 } | 86 } |
87 | 87 |
88 FakeTransformTransition::~FakeTransformTransition() | 88 FakeTransformTransition::~FakeTransformTransition() |
89 { | 89 { |
90 } | 90 } |
91 | 91 |
92 double FakeTransformTransition::duration() const | 92 double FakeTransformTransition::duration() const |
93 { | 93 { |
94 return m_duration; | 94 return m_duration; |
95 } | 95 } |
96 | 96 |
97 WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c
onst | 97 WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c
onst |
98 { | 98 { |
99 return WebKit::WebTransformationMatrix(); | 99 return WebKit::WebTransformationMatrix(); |
100 } | 100 } |
101 | 101 |
102 PassOwnPtr<WebCore::CCAnimationCurve> FakeTransformTransition::clone() const | 102 PassOwnPtr<cc::CCAnimationCurve> FakeTransformTransition::clone() const |
103 { | 103 { |
104 return adoptPtr(new FakeTransformTransition(*this)); | 104 return adoptPtr(new FakeTransformTransition(*this)); |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 FakeFloatTransition::FakeFloatTransition(double duration, float from, float to) | 108 FakeFloatTransition::FakeFloatTransition(double duration, float from, float to) |
109 : m_duration(duration) | 109 : m_duration(duration) |
110 , m_from(from) | 110 , m_from(from) |
111 , m_to(to) | 111 , m_to(to) |
112 { | 112 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit:
:WebTransformationMatrix& transform) | 156 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit:
:WebTransformationMatrix& transform) |
157 { | 157 { |
158 m_transform = transform; | 158 m_transform = transform; |
159 } | 159 } |
160 | 160 |
161 const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans
form() const | 161 const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans
form() const |
162 { | 162 { |
163 return m_transform; | 163 return m_transform; |
164 } | 164 } |
165 | 165 |
166 PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatTransition::clone() const | 166 PassOwnPtr<cc::CCAnimationCurve> FakeFloatTransition::clone() const |
167 { | 167 { |
168 return adoptPtr(new FakeFloatTransition(*this)); | 168 return adoptPtr(new FakeFloatTransition(*this)); |
169 } | 169 } |
170 | 170 |
171 void addOpacityTransitionToController(WebCore::CCLayerAnimationController& contr
oller, double duration, float startOpacity, float endOpacity, bool useTimingFunc
tion) | 171 void addOpacityTransitionToController(cc::CCLayerAnimationController& controller
, double duration, float startOpacity, float endOpacity, bool useTimingFunction) |
172 { | 172 { |
173 addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimi
ngFunction); | 173 addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimi
ngFunction); |
174 } | 174 } |
175 | 175 |
176 void addAnimatedTransformToController(WebCore::CCLayerAnimationController& contr
oller, double duration, int deltaX, int deltaY) | 176 void addAnimatedTransformToController(cc::CCLayerAnimationController& controller
, double duration, int deltaX, int deltaY) |
177 { | 177 { |
178 addAnimatedTransform(controller, duration, deltaX, deltaY); | 178 addAnimatedTransform(controller, duration, deltaX, deltaY); |
179 } | 179 } |
180 | 180 |
181 void addOpacityTransitionToLayer(WebCore::LayerChromium& layer, double duration,
float startOpacity, float endOpacity, bool useTimingFunction) | 181 void addOpacityTransitionToLayer(cc::LayerChromium& layer, double duration, floa
t startOpacity, float endOpacity, bool useTimingFunction) |
182 { | 182 { |
183 addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFun
ction); | 183 addOpacityTransition(layer, duration, startOpacity, endOpacity, useTimingFun
ction); |
184 } | 184 } |
185 | 185 |
186 void addOpacityTransitionToLayer(WebCore::CCLayerImpl& layer, double duration, f
loat startOpacity, float endOpacity, bool useTimingFunction) | 186 void addOpacityTransitionToLayer(cc::CCLayerImpl& layer, double duration, float
startOpacity, float endOpacity, bool useTimingFunction) |
187 { | 187 { |
188 addOpacityTransition(*layer.layerAnimationController(), duration, startOpaci
ty, endOpacity, useTimingFunction); | 188 addOpacityTransition(*layer.layerAnimationController(), duration, startOpaci
ty, endOpacity, useTimingFunction); |
189 } | 189 } |
190 | 190 |
191 void addAnimatedTransformToLayer(WebCore::LayerChromium& layer, double duration,
int deltaX, int deltaY) | 191 void addAnimatedTransformToLayer(cc::LayerChromium& layer, double duration, int
deltaX, int deltaY) |
192 { | 192 { |
193 addAnimatedTransform(layer, duration, deltaX, deltaY); | 193 addAnimatedTransform(layer, duration, deltaX, deltaY); |
194 } | 194 } |
195 | 195 |
196 void addAnimatedTransformToLayer(WebCore::CCLayerImpl& layer, double duration, i
nt deltaX, int deltaY) | 196 void addAnimatedTransformToLayer(cc::CCLayerImpl& layer, double duration, int de
ltaX, int deltaY) |
197 { | 197 { |
198 addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, de
ltaY); | 198 addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, de
ltaY); |
199 } | 199 } |
200 | 200 |
201 } // namespace WebKitTests | 201 } // namespace WebKitTests |
OLD | NEW |