OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 m_hasToPointAtEndOfDuration = false; | 224 m_hasToPointAtEndOfDuration = false; |
225 if (animationMode() == ByAnimation && !isAdditive()) | 225 if (animationMode() == ByAnimation && !isAdditive()) |
226 return false; | 226 return false; |
227 parsePoint(fromString, m_fromPoint); | 227 parsePoint(fromString, m_fromPoint); |
228 FloatPoint byPoint; | 228 FloatPoint byPoint; |
229 parsePoint(byString, byPoint); | 229 parsePoint(byString, byPoint); |
230 m_toPoint = FloatPoint(m_fromPoint.x() + byPoint.x(), m_fromPoint.y() + byPo int.y()); | 230 m_toPoint = FloatPoint(m_fromPoint.x() + byPoint.x(), m_fromPoint.y() + byPo int.y()); |
231 return true; | 231 return true; |
232 } | 232 } |
233 | 233 |
234 void SVGAnimateMotionElement::buildTransformForProgress(AffineTransform* transfo rm, float percentage) | |
235 { | |
236 ASSERT(!m_animationPath.isEmpty()); | |
237 | |
238 bool ok = false; | |
239 float positionOnPath = m_animationPath.length() * percentage; | |
240 FloatPoint position = m_animationPath.pointAtLength(positionOnPath, ok); | |
241 if (!ok) | |
242 return; | |
243 transform->translate(position.x(), position.y()); | |
244 } | |
245 | |
246 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*) | 234 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*) |
247 { | 235 { |
248 SVGElement* targetElement = this->targetElement(); | 236 SVGElement* targetElement = this->targetElement(); |
249 if (!targetElement) | 237 if (!targetElement) |
250 return; | 238 return; |
251 AffineTransform* transform = targetElement->supplementalTransform(); | 239 AffineTransform* transform = targetElement->supplementalTransform(); |
252 if (!transform) | 240 if (!transform) |
253 return; | 241 return; |
254 | 242 |
255 if (RenderObject* targetRenderer = targetElement->renderer()) | 243 if (RenderObject* targetRenderer = targetElement->renderer()) |
(...skipping 10 matching lines...) Expand all Loading... | |
266 float animatedX = 0; | 254 float animatedX = 0; |
267 animateAdditiveNumber(percentage, repeatCount, m_fromPoint.x(), m_toPoin t.x(), toPointAtEndOfDuration.x(), animatedX); | 255 animateAdditiveNumber(percentage, repeatCount, m_fromPoint.x(), m_toPoin t.x(), toPointAtEndOfDuration.x(), animatedX); |
268 | 256 |
269 float animatedY = 0; | 257 float animatedY = 0; |
270 animateAdditiveNumber(percentage, repeatCount, m_fromPoint.y(), m_toPoin t.y(), toPointAtEndOfDuration.y(), animatedY); | 258 animateAdditiveNumber(percentage, repeatCount, m_fromPoint.y(), m_toPoin t.y(), toPointAtEndOfDuration.y(), animatedY); |
271 | 259 |
272 transform->translate(animatedX, animatedY); | 260 transform->translate(animatedX, animatedY); |
273 return; | 261 return; |
274 } | 262 } |
275 | 263 |
276 buildTransformForProgress(transform, percentage); | 264 ASSERT(!m_animationPath.isEmpty()); |
265 | |
266 bool ok = false; | |
267 float positionOnPath = m_animationPath.length() * percentage; | |
268 FloatPoint position; | |
269 float angle; | |
270 ok = m_animationPath.pointAndNormalAtLength(positionOnPath, position, angle) ; | |
271 if (!ok) | |
272 return; | |
277 | 273 |
278 // Handle accumulate="sum". | 274 // Handle accumulate="sum". |
279 if (isAccumulated() && repeatCount) { | 275 if (isAccumulated() && repeatCount) { |
280 for (unsigned i = 0; i < repeatCount; ++i) | 276 FloatPoint positionAtEndOfDuration; |
281 buildTransformForProgress(transform, 1); | 277 float angleAtEndOfDuration; |
278 ok = m_animationPath.pointAndNormalAtLength(m_animationPath.length(), po sitionAtEndOfDuration, angleAtEndOfDuration); | |
pdr.
2013/07/17 20:58:50
angleAtEndOfDuration doesn't look like it's used.
pavane
2013/07/17 21:32:45
Done
| |
279 if (ok) | |
pdr.
2013/07/17 20:58:50
I think this would be better:
if (!ok)
return;
pavane
2013/07/17 21:32:45
I don't want it to return here if calculation of '
| |
280 position.move(positionAtEndOfDuration.x() * repeatCount, positionAtE ndOfDuration.y() * repeatCount); | |
282 } | 281 } |
283 | 282 |
284 bool ok = false; | 283 transform->translate(position.x(), position.y()); |
285 float positionOnPath = m_animationPath.length() * percentage; | |
286 float angle = m_animationPath.normalAngleAtLength(positionOnPath, ok); | |
287 if (!ok) | |
288 return; | |
289 RotateMode rotateMode = this->rotateMode(); | 284 RotateMode rotateMode = this->rotateMode(); |
290 if (rotateMode != RotateAuto && rotateMode != RotateAutoReverse) | 285 if (rotateMode != RotateAuto && rotateMode != RotateAutoReverse) |
291 return; | 286 return; |
292 if (rotateMode == RotateAutoReverse) | 287 if (rotateMode == RotateAutoReverse) |
293 angle += 180; | 288 angle += 180; |
294 transform->rotate(angle); | 289 transform->rotate(angle); |
295 } | 290 } |
296 | 291 |
297 void SVGAnimateMotionElement::applyResultsToTarget() | 292 void SVGAnimateMotionElement::applyResultsToTarget() |
298 { | 293 { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 | 334 |
340 void SVGAnimateMotionElement::updateAnimationMode() | 335 void SVGAnimateMotionElement::updateAnimationMode() |
341 { | 336 { |
342 if (!m_animationPath.isEmpty()) | 337 if (!m_animationPath.isEmpty()) |
343 setAnimationMode(PathAnimation); | 338 setAnimationMode(PathAnimation); |
344 else | 339 else |
345 SVGAnimationElement::updateAnimationMode(); | 340 SVGAnimationElement::updateAnimationMode(); |
346 } | 341 } |
347 | 342 |
348 } | 343 } |
OLD | NEW |