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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) | 234 void SVGAnimateMotionElement::buildTransformForProgress(AffineTransform* transfo
rm, float percentage) |
235 { | 235 { |
236 ASSERT(!m_animationPath.isEmpty()); | 236 ASSERT(!m_animationPath.isEmpty()); |
237 | 237 |
238 bool ok = false; | 238 bool ok = false; |
239 float positionOnPath = m_animationPath.length() * percentage; | 239 float positionOnPath = m_animationPath.length() * percentage; |
240 FloatPoint position; | 240 FloatPoint position = m_animationPath.pointAtLength(positionOnPath, ok); |
241 float angle; | |
242 ok = m_animationPath.pointAndNormalAtLength(positionOnPath, position, angle)
; | |
243 if (!ok) | 241 if (!ok) |
244 return; | 242 return; |
245 transform->translate(position.x(), position.y()); | 243 transform->translate(position.x(), position.y()); |
246 RotateMode rotateMode = this->rotateMode(); | |
247 if (rotateMode != RotateAuto && rotateMode != RotateAutoReverse) | |
248 return; | |
249 if (rotateMode == RotateAutoReverse) | |
250 angle += 180; | |
251 transform->rotate(angle); | |
252 } | 244 } |
253 | 245 |
254 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned
repeatCount, SVGSMILElement*) | 246 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned
repeatCount, SVGSMILElement*) |
255 { | 247 { |
256 SVGElement* targetElement = this->targetElement(); | 248 SVGElement* targetElement = this->targetElement(); |
257 if (!targetElement) | 249 if (!targetElement) |
258 return; | 250 return; |
259 AffineTransform* transform = targetElement->supplementalTransform(); | 251 AffineTransform* transform = targetElement->supplementalTransform(); |
260 if (!transform) | 252 if (!transform) |
261 return; | 253 return; |
(...skipping 19 matching lines...) Expand all Loading... |
281 return; | 273 return; |
282 } | 274 } |
283 | 275 |
284 buildTransformForProgress(transform, percentage); | 276 buildTransformForProgress(transform, percentage); |
285 | 277 |
286 // Handle accumulate="sum". | 278 // Handle accumulate="sum". |
287 if (isAccumulated() && repeatCount) { | 279 if (isAccumulated() && repeatCount) { |
288 for (unsigned i = 0; i < repeatCount; ++i) | 280 for (unsigned i = 0; i < repeatCount; ++i) |
289 buildTransformForProgress(transform, 1); | 281 buildTransformForProgress(transform, 1); |
290 } | 282 } |
| 283 |
| 284 bool ok = false; |
| 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(); |
| 290 if (rotateMode != RotateAuto && rotateMode != RotateAutoReverse) |
| 291 return; |
| 292 if (rotateMode == RotateAutoReverse) |
| 293 angle += 180; |
| 294 transform->rotate(angle); |
291 } | 295 } |
292 | 296 |
293 void SVGAnimateMotionElement::applyResultsToTarget() | 297 void SVGAnimateMotionElement::applyResultsToTarget() |
294 { | 298 { |
295 // We accumulate to the target element transform list so there is not much t
o do here. | 299 // We accumulate to the target element transform list so there is not much t
o do here. |
296 SVGElement* targetElement = this->targetElement(); | 300 SVGElement* targetElement = this->targetElement(); |
297 if (!targetElement) | 301 if (!targetElement) |
298 return; | 302 return; |
299 | 303 |
300 if (RenderObject* renderer = targetElement->renderer()) | 304 if (RenderObject* renderer = targetElement->renderer()) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 339 |
336 void SVGAnimateMotionElement::updateAnimationMode() | 340 void SVGAnimateMotionElement::updateAnimationMode() |
337 { | 341 { |
338 if (!m_animationPath.isEmpty()) | 342 if (!m_animationPath.isEmpty()) |
339 setAnimationMode(PathAnimation); | 343 setAnimationMode(PathAnimation); |
340 else | 344 else |
341 SVGAnimationElement::updateAnimationMode(); | 345 SVGAnimationElement::updateAnimationMode(); |
342 } | 346 } |
343 | 347 |
344 } | 348 } |
OLD | NEW |