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

Unified Diff: src/pathops/SkPathOpsConic.cpp

Issue 1096923003: working on initial winding for cubics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « src/pathops/SkPathOpsConic.h ('k') | src/pathops/SkPathOpsCubic.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsConic.cpp
diff --git a/src/pathops/SkPathOpsConic.cpp b/src/pathops/SkPathOpsConic.cpp
index 1b544e405f5eb3aae75350ed1ab2fd26237f7e89..869a406dceb00b41209cba3b88b142481d119658 100644
--- a/src/pathops/SkPathOpsConic.cpp
+++ b/src/pathops/SkPathOpsConic.cpp
@@ -82,25 +82,6 @@ SkDPoint SkDConic::ptAtT(double t) const {
return result;
}
-SkDPoint SkDConic::top(double startT, double endT) const {
- SkDConic sub = subDivide(startT, endT);
- SkDPoint topPt = sub[0];
- if (topPt.fY > sub[2].fY || (topPt.fY == sub[2].fY && topPt.fX > sub[2].fX)) {
- topPt = sub[2];
- }
- if (!between(sub[0].fY, sub[1].fY, sub[2].fY)) {
- double extremeT;
- if (FindExtrema(&sub[0].fY, sub.fWeight, &extremeT)) {
- extremeT = startT + (endT - startT) * extremeT;
- SkDPoint test = ptAtT(extremeT);
- if (topPt.fY > test.fY || (topPt.fY == test.fY && topPt.fX > test.fX)) {
- topPt = test;
- }
- }
- }
- return topPt;
-}
-
/* see quad subdivide for rationale */
SkDConic SkDConic::subDivide(double t1, double t2) const {
double ax = conic_eval_numerator(&fPts[0].fX, fWeight, t1);
@@ -130,3 +111,25 @@ SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do
*weight = chopped.fWeight;
return chopped[1];
}
+
+SkDPoint SkDConic::top(double startT, double endT, double* topT) const {
+ SkDConic sub = subDivide(startT, endT);
+ SkDPoint topPt = sub[0];
+ *topT = startT;
+ if (topPt.fY > sub[2].fY || (topPt.fY == sub[2].fY && topPt.fX > sub[2].fX)) {
+ *topT = endT;
+ topPt = sub[2];
+ }
+ if (!between(sub[0].fY, sub[1].fY, sub[2].fY)) {
+ double extremeT;
+ if (FindExtrema(&sub[0].fY, sub.fWeight, &extremeT)) {
+ extremeT = startT + (endT - startT) * extremeT;
+ SkDPoint test = ptAtT(extremeT);
+ if (topPt.fY > test.fY || (topPt.fY == test.fY && topPt.fX > test.fX)) {
+ *topT = extremeT;
+ topPt = test;
+ }
+ }
+ }
+ return topPt;
+}
« no previous file with comments | « src/pathops/SkPathOpsConic.h ('k') | src/pathops/SkPathOpsCubic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698