OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2002, 2003 The Karbon Developers | 2 * Copyright (C) 2002, 2003 The Karbon Developers |
3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> |
5 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 5 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 25 matching lines...) Expand all Loading... |
36 { | 36 { |
37 visitor->trace(m_source); | 37 visitor->trace(m_source); |
38 visitor->trace(m_consumer); | 38 visitor->trace(m_consumer); |
39 } | 39 } |
40 | 40 |
41 void SVGPathParser::parseClosePathSegment() | 41 void SVGPathParser::parseClosePathSegment() |
42 { | 42 { |
43 // Reset m_currentPoint for the next path. | 43 // Reset m_currentPoint for the next path. |
44 if (m_pathParsingMode == NormalizedParsing) | 44 if (m_pathParsingMode == NormalizedParsing) |
45 m_currentPoint = m_subPathPoint; | 45 m_currentPoint = m_subPathPoint; |
46 m_closePath = true; | |
47 m_consumer->closePath(); | 46 m_consumer->closePath(); |
48 } | 47 } |
49 | 48 |
50 bool SVGPathParser::parseMoveToSegment() | 49 bool SVGPathParser::parseMoveToSegment() |
51 { | 50 { |
52 FloatPoint targetPoint; | 51 FloatPoint targetPoint; |
53 if (!m_source->parseMoveToSegment(targetPoint)) | 52 if (!m_source->parseMoveToSegment(targetPoint)) |
54 return false; | 53 return false; |
55 | 54 |
56 if (m_pathParsingMode == UnalteredParsing) { | 55 if (m_pathParsingMode == UnalteredParsing) { |
57 m_consumer->moveTo(targetPoint, m_closePath, m_mode); | 56 m_consumer->moveTo(targetPoint, m_mode); |
58 m_closePath = false; | |
59 return true; | 57 return true; |
60 } | 58 } |
61 if (m_mode == RelativeCoordinates) | 59 if (m_mode == RelativeCoordinates) |
62 m_currentPoint += targetPoint; | 60 m_currentPoint += targetPoint; |
63 else | 61 else |
64 m_currentPoint = targetPoint; | 62 m_currentPoint = targetPoint; |
65 m_subPathPoint = m_currentPoint; | 63 m_subPathPoint = m_currentPoint; |
66 m_consumer->moveTo(m_currentPoint, m_closePath, AbsoluteCoordinates); | 64 m_consumer->moveTo(m_currentPoint, AbsoluteCoordinates); |
67 m_closePath = false; | |
68 return true; | 65 return true; |
69 } | 66 } |
70 | 67 |
71 bool SVGPathParser::parseLineToSegment() | 68 bool SVGPathParser::parseLineToSegment() |
72 { | 69 { |
73 FloatPoint targetPoint; | 70 FloatPoint targetPoint; |
74 if (!m_source->parseLineToSegment(targetPoint)) | 71 if (!m_source->parseLineToSegment(targetPoint)) |
75 return false; | 72 return false; |
76 | 73 |
77 if (m_pathParsingMode == UnalteredParsing) { | 74 if (m_pathParsingMode == UnalteredParsing) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode, boo
l checkForInitialMoveTo) | 281 bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode, boo
l checkForInitialMoveTo) |
285 { | 282 { |
286 ASSERT(m_source); | 283 ASSERT(m_source); |
287 ASSERT(m_consumer); | 284 ASSERT(m_consumer); |
288 | 285 |
289 m_pathParsingMode = pathParsingMode; | 286 m_pathParsingMode = pathParsingMode; |
290 | 287 |
291 m_controlPoint = FloatPoint(); | 288 m_controlPoint = FloatPoint(); |
292 m_currentPoint = FloatPoint(); | 289 m_currentPoint = FloatPoint(); |
293 m_subPathPoint = FloatPoint(); | 290 m_subPathPoint = FloatPoint(); |
294 m_closePath = true; | |
295 | 291 |
296 // Skip any leading spaces. | 292 // Skip any leading spaces. |
297 if (!m_source->moveToNextToken()) | 293 if (!m_source->moveToNextToken()) |
298 return true; | 294 return true; |
299 | 295 |
300 SVGPathSegType command; | 296 SVGPathSegType command; |
301 m_source->parseSVGSegmentType(command); | 297 m_source->parseSVGSegmentType(command); |
302 m_lastCommand = PathSegUnknown; | 298 m_lastCommand = PathSegUnknown; |
303 | 299 |
304 // Path must start with moveto. | 300 // Path must start with moveto. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 point2 = targetPoint; | 472 point2 = targetPoint; |
477 point2.move(t * sinEndTheta, -t * cosEndTheta); | 473 point2.move(t * sinEndTheta, -t * cosEndTheta); |
478 | 474 |
479 m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform
.mapPoint(point2), | 475 m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform
.mapPoint(point2), |
480 pointTransform.mapPoint(targetPoint), AbsoluteC
oordinates); | 476 pointTransform.mapPoint(targetPoint), AbsoluteC
oordinates); |
481 } | 477 } |
482 return true; | 478 return true; |
483 } | 479 } |
484 | 480 |
485 } | 481 } |
OLD | NEW |