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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkPoint srcPts[2]; | 1268 SkPoint srcPts[2]; |
1269 this->getLastPt(&srcPts[0]); | 1269 this->getLastPt(&srcPts[0]); |
1270 // If rx = 0 or ry = 0 then this arc is treated as a straight line segment (
a "lineto") | 1270 // If rx = 0 or ry = 0 then this arc is treated as a straight line segment (
a "lineto") |
1271 // joining the endpoints. | 1271 // joining the endpoints. |
1272 // http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters | 1272 // http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters |
1273 if (!rx || !ry) { | 1273 if (!rx || !ry) { |
| 1274 this->lineTo(x, y); |
1274 return; | 1275 return; |
1275 } | 1276 } |
1276 // If the current point and target point for the arc are identical, it shoul
d be treated as a | 1277 // If the current point and target point for the arc are identical, it shoul
d be treated as a |
1277 // zero length path. This ensures continuity in animations. | 1278 // zero length path. This ensures continuity in animations. |
1278 srcPts[1].set(x, y); | 1279 srcPts[1].set(x, y); |
1279 if (srcPts[0] == srcPts[1]) { | 1280 if (srcPts[0] == srcPts[1]) { |
| 1281 this->lineTo(x, y); |
1280 return; | 1282 return; |
1281 } | 1283 } |
1282 rx = SkScalarAbs(rx); | 1284 rx = SkScalarAbs(rx); |
1283 ry = SkScalarAbs(ry); | 1285 ry = SkScalarAbs(ry); |
1284 SkVector midPointDistance = srcPts[0] - srcPts[1]; | 1286 SkVector midPointDistance = srcPts[0] - srcPts[1]; |
1285 midPointDistance *= 0.5f; | 1287 midPointDistance *= 0.5f; |
1286 | 1288 |
1287 SkMatrix pointTransform; | 1289 SkMatrix pointTransform; |
1288 pointTransform.setRotate(-angle); | 1290 pointTransform.setRotate(-angle); |
1289 | 1291 |
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3203 } | 3205 } |
3204 } while (!done); | 3206 } while (!done); |
3205 return SkToBool(tangents.count()) ^ isInverse; | 3207 return SkToBool(tangents.count()) ^ isInverse; |
3206 } | 3208 } |
3207 | 3209 |
3208 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, | 3210 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo
int& p2, |
3209 SkScalar w, SkPoint pts[], int pow2) { | 3211 SkScalar w, SkPoint pts[], int pow2) { |
3210 const SkConic conic(p0, p1, p2, w); | 3212 const SkConic conic(p0, p1, p2, w); |
3211 return conic.chopIntoQuadsPOW2(pts, pow2); | 3213 return conic.chopIntoQuadsPOW2(pts, pow2); |
3212 } | 3214 } |
OLD | NEW |