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

Unified Diff: src/pathops/SkPathOpsCubic.h

Issue 266063003: cubicline intersection binary search (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: typing cleanup Created 6 years, 7 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/SkDCubicLineIntersection.cpp ('k') | src/pathops/SkPathOpsCubic.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsCubic.h
diff --git a/src/pathops/SkPathOpsCubic.h b/src/pathops/SkPathOpsCubic.h
index 500319607dc0c29b3a78acf63a5b80fbd1baa382..1037cae4f759f94e5c01a3bd3784a44c16ceb3d5 100644
--- a/src/pathops/SkPathOpsCubic.h
+++ b/src/pathops/SkPathOpsCubic.h
@@ -19,21 +19,16 @@ struct SkDCubicPair {
};
struct SkDCubic {
- SkDPoint fPts[4];
-
- void set(const SkPoint pts[4]) {
- fPts[0] = pts[0];
- fPts[1] = pts[1];
- fPts[2] = pts[2];
- fPts[3] = pts[3];
- }
-
- static const int gPrecisionUnit;
+ enum SearchAxis {
+ kXAxis,
+ kYAxis
+ };
const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 4); return fPts[n]; }
SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 4); return fPts[n]; }
void align(int endIndex, int ctrlIndex, SkDPoint* dstPt) const;
+ double binarySearch(double min, double max, double axisIntercept, SearchAxis xAxis) const;
double calcPrecision() const;
SkDCubicPair chopAt(double t) const;
bool clockwise() const;
@@ -42,9 +37,9 @@ struct SkDCubic {
SkDVector dxdyAtT(double t) const;
bool endsAreExtremaInXOrY() const;
static int FindExtrema(double a, double b, double c, double d, double tValue[2]);
- int findInflections(double tValues[]) const;
+ int findInflections(double tValues[2]) const;
- static int FindInflections(const SkPoint a[4], double tValues[]) {
+ static int FindInflections(const SkPoint a[4], double tValues[2]) {
SkDCubic cubic;
cubic.set(a);
return cubic.findInflections(tValues);
@@ -56,7 +51,18 @@ struct SkDCubic {
SkDPoint ptAtT(double t) const;
static int RootsReal(double A, double B, double C, double D, double t[3]);
static int RootsValidT(const double A, const double B, const double C, double D, double s[3]);
+
+ int searchRoots(double extremes[6], int extrema, double axisIntercept,
+ SearchAxis xAxis, double* validRoots) const;
bool serpentine() const;
+
+ void set(const SkPoint pts[4]) {
+ fPts[0] = pts[0];
+ fPts[1] = pts[1];
+ fPts[2] = pts[2];
+ fPts[3] = pts[3];
+ }
+
SkDCubic subDivide(double t1, double t2) const;
static SkDCubic SubDivide(const SkPoint a[4], double t1, double t2) {
@@ -81,6 +87,10 @@ struct SkDCubic {
// utilities callable by the user from the debugger when the implementation code is linked in
void dump() const;
void dumpNumber() const;
+
+ static const int gPrecisionUnit;
+
+ SkDPoint fPts[4];
};
#endif
« no previous file with comments | « src/pathops/SkDCubicLineIntersection.cpp ('k') | src/pathops/SkPathOpsCubic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698