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

Unified Diff: src/core/SkGeometry.cpp

Issue 2281953002: avoid generating degenerate conic from arc (Closed)
Patch Set: add isolated test case Created 4 years, 4 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 | « gm/circulararcs.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGeometry.cpp
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 03a63b2bdad93df6914210968284db92f061b4c9..8f270f9722c66f59bbad86c2168f291c0b760cb6 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1351,8 +1351,10 @@ int SkConic::BuildUnitArc(const SkVector& uStart, const SkVector& uStop, SkRotat
//
const SkScalar cosThetaOver2 = SkScalarSqrt((1 + dot) / 2);
offCurve.setLength(SkScalarInvert(cosThetaOver2));
- dst[conicCount].set(lastQ, offCurve, finalP, cosThetaOver2);
- conicCount += 1;
+ if (!lastQ.equalsWithinTolerance(offCurve)) {
+ dst[conicCount].set(lastQ, offCurve, finalP, cosThetaOver2);
+ conicCount += 1;
+ }
Mark Kilgard 2016/08/26 17:13:07 I don't like this epsilon handling here. It's jus
}
// now handle counter-clockwise and the initial unitStart rotation
« no previous file with comments | « gm/circulararcs.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698