Chromium Code Reviews| Index: src/core/SkPath.cpp |
| diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
| index 1fb3e117663002984277987f75c3b6ac69019ceb..61ab862935fe5c288b11319c4b2e52c37824e49e 100644 |
| --- a/src/core/SkPath.cpp |
| +++ b/src/core/SkPath.cpp |
| @@ -1290,6 +1290,20 @@ void SkPath::arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, |
| angles_to_unit_vectors(startAngle, sweepAngle, &startV, &stopV, &dir); |
| SkPoint singlePt; |
| + |
| + // At this point, we know that the arc is not a lone point, but startV == stopV |
| + // indicates that the sweepAngle is too small such that angles_to_unit_vectors |
| + // cannot handle it. |
| + if (startV == stopV) { |
| + SkScalar endAngle = SkDegreesToRadians(startAngle + sweepAngle); |
| + SkScalar radiusX = oval.width() / 2; |
| + SkScalar radiusY = oval.height() / 2; |
| + singlePt.set(oval.centerX() + radiusX * cosf(endAngle), |
| + oval.centerY() + radiusY * sinf(endAngle)); |
|
caryclark
2016/10/05 14:08:11
SkScalarSinCos() is preferable
xidachen
2016/10/05 14:24:32
While I do agree that SkScalarSinCos() is preferab
caryclark
2016/10/05 14:47:03
A comment in the code to this effect would be help
xidachen
2016/10/05 16:33:51
comment added.
sk_float_sin and sk_float_cos work
|
| + forceMoveTo ? this->moveTo(singlePt) : this->lineTo(singlePt); |
|
caryclark
2016/10/05 14:08:11
Does your example GM trigger both sides of this ex
xidachen
2016/10/05 14:24:32
No, it only triggers lineTo. This line is basicall
caryclark
2016/10/05 14:47:03
It would be great if was possible to verify that t
xidachen
2016/10/05 16:33:51
I believe SkPath::addArc calls arcTo with forceMov
|
| + return; |
| + } |
| + |
| SkConic conics[SkConic::kMaxConicsForArc]; |
| int count = build_arc_conics(oval, startV, stopV, dir, conics, &singlePt); |
| if (count) { |