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

Unified Diff: src/pathops/SkPathOpsCubic.cpp

Issue 1920663002: pathops: Split loop type cubics only when there is a self-intersection. (Closed) Base URL: https://skia.googlesource.com/skia.git/@master
Patch Set: Remove documentation change of complex break in edge builder. Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsCubic.cpp
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index 2542ca58848c9e7da4834b165473c1f71ed3bc83..6b74fb00efac83990703727eb207997f3460c467 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -240,12 +240,12 @@ bool SkDCubic::ComplexBreak(const SkPoint pointsPtr[4], SkScalar* t) {
SkScalar lt = 2.f * d[0];
SkScalar ms = d[1] + tempSqrt;
SkScalar mt = 2.f * d[0];
- if (between(0, ls, lt) || between(0, ms, mt)) {
+ if (roughly_between(0, ls, lt) && roughly_between(0, ms, mt)) {
ls = ls / lt;
ms = ms / mt;
- SkScalar smaller = SkTMax(0.f, SkTMin(ls, ms));
- SkScalar larger = SkTMin(1.f, SkTMax(ls, ms));
- *t = (smaller + larger) / 2;
+ SkASSERT(roughly_between(0, ls, 1) && roughly_between(0, ms, 1));
+ *t = (ls + ms) / 2;
+ SkASSERT(roughly_between(0, *t, 1));
return *t > 0 && *t < 1;
}
} else if (kSerpentine_SkCubicType == cubicType || kCusp_SkCubicType == cubicType) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698