OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBuffer.h" | 8 #include "SkBuffer.h" |
9 #include "SkCubicClipper.h" | 9 #include "SkCubicClipper.h" |
10 #include "SkErrorInternals.h" | 10 #include "SkErrorInternals.h" |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 } | 1258 } |
1259 | 1259 |
1260 // This converts the SVG arc to conics. | 1260 // This converts the SVG arc to conics. |
1261 // Partly adapted from Niko's code in kdelibs/kdecore/svgicons. | 1261 // Partly adapted from Niko's code in kdelibs/kdecore/svgicons. |
1262 // Then transcribed from webkit/chrome's SVGPathNormalizer::decomposeArcToCubic(
) | 1262 // Then transcribed from webkit/chrome's SVGPathNormalizer::decomposeArcToCubic(
) |
1263 // See also SVG implementation notes: | 1263 // See also SVG implementation notes: |
1264 // http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter | 1264 // http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter |
1265 // Note that arcSweep bool value is flipped from the original implementation. | 1265 // Note that arcSweep bool value is flipped from the original implementation. |
1266 void SkPath::arcTo(SkScalar rx, SkScalar ry, SkScalar angle, SkPath::ArcSize arc
Large, | 1266 void SkPath::arcTo(SkScalar rx, SkScalar ry, SkScalar angle, SkPath::ArcSize arc
Large, |
1267 SkPath::Direction arcSweep, SkScalar x, SkScalar y) { | 1267 SkPath::Direction arcSweep, SkScalar x, SkScalar y) { |
| 1268 this->injectMoveToIfNeeded(); |
1268 SkPoint srcPts[2]; | 1269 SkPoint srcPts[2]; |
1269 this->getLastPt(&srcPts[0]); | 1270 this->getLastPt(&srcPts[0]); |
1270 // If rx = 0 or ry = 0 then this arc is treated as a straight line segment (
a "lineto") | 1271 // If rx = 0 or ry = 0 then this arc is treated as a straight line segment (
a "lineto") |
1271 // joining the endpoints. | 1272 // joining the endpoints. |
1272 // http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters | 1273 // http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters |
1273 if (!rx || !ry) { | 1274 if (!rx || !ry) { |
1274 this->lineTo(x, y); | 1275 this->lineTo(x, y); |
1275 return; | 1276 return; |
1276 } | 1277 } |
1277 // If the current point and target point for the arc are identical, it shoul
d be treated as a | 1278 // If the current point and target point for the arc are identical, it shoul
d be treated as a |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 } | 3175 } |
3175 } while (!done); | 3176 } while (!done); |
3176 return SkToBool(tangents.count()) ^ isInverse; | 3177 return SkToBool(tangents.count()) ^ isInverse; |
3177 } | 3178 } |
3178 | 3179 |
3179 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, | 3180 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, |
3180 SkScalar w, SkPoint pts[], int pow2) { | 3181 SkScalar w, SkPoint pts[], int pow2) { |
3181 const SkConic conic(p0, p1, p2, w); | 3182 const SkConic conic(p0, p1, p2, w); |
3182 return conic.chopIntoQuadsPOW2(pts, pow2); | 3183 return conic.chopIntoQuadsPOW2(pts, pow2); |
3183 } | 3184 } |
OLD | NEW |