Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: src/core/SkPath.cpp

Issue 1612543003: replace arcto quads with a conic (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 4af2dad5262c97fa15e1717eabd93debfeaa718f..6927bedeab5ff7ff66d067977a3c602e94d57b50 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1293,13 +1293,16 @@ void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar
return;
}
- SkScalar dist = SkScalarMulDiv(radius, SK_Scalar1 - cosh, sinh);
- if (dist < 0) {
- dist = -dist;
- }
+ SkScalar dist = SkScalarAbs(SkScalarMulDiv(radius, SK_Scalar1 - cosh, sinh));
SkScalar xx = x1 - SkScalarMul(dist, before.fX);
SkScalar yy = y1 - SkScalarMul(dist, before.fY);
+#ifndef SK_SUPPORT_LEGACY_ARCTO
+ after.setLength(dist);
+ this->lineTo(xx, yy);
+ SkScalar weight = SkScalarSqrt(SK_ScalarHalf + cosh * SK_ScalarHalf);
+ this->conicTo(x1, y1, x1 + after.fX, y1 + after.fY, weight);
+#else
SkRotationDirection arcDir;
// now turn before/after into normals
@@ -1328,6 +1331,7 @@ void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar
for (int i = 1; i < count; i += 2) {
this->quadTo(pts[i], pts[i+1]);
}
+#endif
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698