| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return true; | 146 return true; |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool SVGPathParser::parseCurveToCubicSmoothSegment() | 149 bool SVGPathParser::parseCurveToCubicSmoothSegment() |
| 150 { | 150 { |
| 151 FloatPoint point2; | 151 FloatPoint point2; |
| 152 FloatPoint targetPoint; | 152 FloatPoint targetPoint; |
| 153 if (!m_source->parseCurveToCubicSmoothSegment(point2, targetPoint)) | 153 if (!m_source->parseCurveToCubicSmoothSegment(point2, targetPoint)) |
| 154 return false; | 154 return false; |
| 155 | 155 |
| 156 if (m_pathParsingMode == UnalteredParsing) { |
| 157 m_consumer->curveToCubicSmooth(point2, targetPoint, m_mode); |
| 158 return true; |
| 159 } |
| 156 if (m_lastCommand != PathSegCurveToCubicAbs | 160 if (m_lastCommand != PathSegCurveToCubicAbs |
| 157 && m_lastCommand != PathSegCurveToCubicRel | 161 && m_lastCommand != PathSegCurveToCubicRel |
| 158 && m_lastCommand != PathSegCurveToCubicSmoothAbs | 162 && m_lastCommand != PathSegCurveToCubicSmoothAbs |
| 159 && m_lastCommand != PathSegCurveToCubicSmoothRel) | 163 && m_lastCommand != PathSegCurveToCubicSmoothRel) |
| 160 m_controlPoint = m_currentPoint; | 164 m_controlPoint = m_currentPoint; |
| 161 | 165 |
| 162 if (m_pathParsingMode == UnalteredParsing) { | |
| 163 m_consumer->curveToCubicSmooth(point2, targetPoint, m_mode); | |
| 164 return true; | |
| 165 } | |
| 166 FloatPoint point1 = m_currentPoint; | 166 FloatPoint point1 = m_currentPoint; |
| 167 point1.scale(2, 2); | 167 point1.scale(2, 2); |
| 168 point1.move(-m_controlPoint.x(), -m_controlPoint.y()); | 168 point1.move(-m_controlPoint.x(), -m_controlPoint.y()); |
| 169 if (m_mode == RelativeCoordinates) { | 169 if (m_mode == RelativeCoordinates) { |
| 170 point2 += m_currentPoint; | 170 point2 += m_currentPoint; |
| 171 targetPoint += m_currentPoint; | 171 targetPoint += m_currentPoint; |
| 172 } | 172 } |
| 173 | 173 |
| 174 m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates); | 174 m_consumer->curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates); |
| 175 | 175 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 m_currentPoint = targetPoint; | 208 m_currentPoint = targetPoint; |
| 209 return true; | 209 return true; |
| 210 } | 210 } |
| 211 | 211 |
| 212 bool SVGPathParser::parseCurveToQuadraticSmoothSegment() | 212 bool SVGPathParser::parseCurveToQuadraticSmoothSegment() |
| 213 { | 213 { |
| 214 FloatPoint targetPoint; | 214 FloatPoint targetPoint; |
| 215 if (!m_source->parseCurveToQuadraticSmoothSegment(targetPoint)) | 215 if (!m_source->parseCurveToQuadraticSmoothSegment(targetPoint)) |
| 216 return false; | 216 return false; |
| 217 | 217 |
| 218 if (m_pathParsingMode == UnalteredParsing) { |
| 219 m_consumer->curveToQuadraticSmooth(targetPoint, m_mode); |
| 220 return true; |
| 221 } |
| 218 if (m_lastCommand != PathSegCurveToQuadraticAbs | 222 if (m_lastCommand != PathSegCurveToQuadraticAbs |
| 219 && m_lastCommand != PathSegCurveToQuadraticRel | 223 && m_lastCommand != PathSegCurveToQuadraticRel |
| 220 && m_lastCommand != PathSegCurveToQuadraticSmoothAbs | 224 && m_lastCommand != PathSegCurveToQuadraticSmoothAbs |
| 221 && m_lastCommand != PathSegCurveToQuadraticSmoothRel) | 225 && m_lastCommand != PathSegCurveToQuadraticSmoothRel) |
| 222 m_controlPoint = m_currentPoint; | 226 m_controlPoint = m_currentPoint; |
| 223 | 227 |
| 224 if (m_pathParsingMode == UnalteredParsing) { | |
| 225 m_consumer->curveToQuadraticSmooth(targetPoint, m_mode); | |
| 226 return true; | |
| 227 } | |
| 228 FloatPoint cubicPoint = m_currentPoint; | 228 FloatPoint cubicPoint = m_currentPoint; |
| 229 cubicPoint.scale(2, 2); | 229 cubicPoint.scale(2, 2); |
| 230 cubicPoint.move(-m_controlPoint.x(), -m_controlPoint.y()); | 230 cubicPoint.move(-m_controlPoint.x(), -m_controlPoint.y()); |
| 231 FloatPoint point1(m_currentPoint.x() + 2 * cubicPoint.x(), m_currentPoint.y(
) + 2 * cubicPoint.y()); | 231 FloatPoint point1(m_currentPoint.x() + 2 * cubicPoint.x(), m_currentPoint.y(
) + 2 * cubicPoint.y()); |
| 232 FloatPoint point2(targetPoint.x() + 2 * cubicPoint.x(), targetPoint.y() + 2
* cubicPoint.y()); | 232 FloatPoint point2(targetPoint.x() + 2 * cubicPoint.x(), targetPoint.y() + 2
* cubicPoint.y()); |
| 233 if (m_mode == RelativeCoordinates) { | 233 if (m_mode == RelativeCoordinates) { |
| 234 point2 += m_currentPoint; | 234 point2 += m_currentPoint; |
| 235 targetPoint += m_currentPoint; | 235 targetPoint += m_currentPoint; |
| 236 } | 236 } |
| 237 point1.scale(gOneOverThree, gOneOverThree); | 237 point1.scale(gOneOverThree, gOneOverThree); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 point2 = targetPoint; | 476 point2 = targetPoint; |
| 477 point2.move(t * sinEndTheta, -t * cosEndTheta); | 477 point2.move(t * sinEndTheta, -t * cosEndTheta); |
| 478 | 478 |
| 479 m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform
.mapPoint(point2), | 479 m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform
.mapPoint(point2), |
| 480 pointTransform.mapPoint(targetPoint), AbsoluteC
oordinates); | 480 pointTransform.mapPoint(targetPoint), AbsoluteC
oordinates); |
| 481 } | 481 } |
| 482 return true; | 482 return true; |
| 483 } | 483 } |
| 484 | 484 |
| 485 } | 485 } |
| OLD | NEW |