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

Side by Side Diff: src/pathops/SkPathOpsQuad.h

Issue 1654883003: add helper to create fancy underlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: correct comment to multiply by two Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/pathops/SkDQuadLineIntersection.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPathOpsQuad_DEFINED 8 #ifndef SkPathOpsQuad_DEFINED
9 #define SkPathOpsQuad_DEFINED 9 #define SkPathOpsQuad_DEFINED
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; } 57 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount ); return fPts[n]; }
58 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; } 58 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP ts[n]; }
59 59
60 static int AddValidTs(double s[], int realRoots, double* t); 60 static int AddValidTs(double s[], int realRoots, double* t);
61 void align(int endIndex, SkDPoint* dstPt) const; 61 void align(int endIndex, SkDPoint* dstPt) const;
62 SkDQuadPair chopAt(double t) const; 62 SkDQuadPair chopAt(double t) const;
63 SkDVector dxdyAtT(double t) const; 63 SkDVector dxdyAtT(double t) const;
64 static int FindExtrema(const double src[], double tValue[1]); 64 static int FindExtrema(const double src[], double tValue[1]);
65
66 /**
67 * Return the number of valid roots (0 < root < 1) for this cubic intersect ing the
68 * specified horizontal line.
69 */
70 int horizontalIntersect(double yIntercept, double roots[2]) const;
71
65 bool hullIntersects(const SkDQuad& , bool* isLinear) const; 72 bool hullIntersects(const SkDQuad& , bool* isLinear) const;
66 bool hullIntersects(const SkDConic& , bool* isLinear) const; 73 bool hullIntersects(const SkDConic& , bool* isLinear) const;
67 bool hullIntersects(const SkDCubic& , bool* isLinear) const; 74 bool hullIntersects(const SkDCubic& , bool* isLinear) const;
68 bool isLinear(int startIndex, int endIndex) const; 75 bool isLinear(int startIndex, int endIndex) const;
69 bool monotonicInX() const; 76 bool monotonicInX() const;
70 bool monotonicInY() const; 77 bool monotonicInY() const;
71 void otherPts(int oddMan, const SkDPoint* endPt[2]) const; 78 void otherPts(int oddMan, const SkDPoint* endPt[2]) const;
72 SkDPoint ptAtT(double t) const; 79 SkDPoint ptAtT(double t) const;
73 static int RootsReal(double A, double B, double C, double t[2]); 80 static int RootsReal(double A, double B, double C, double t[2]);
74 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]); 81 static int RootsValidT(const double A, const double B, const double C, doubl e s[2]);
75 static void SetABC(const double* quad, double* a, double* b, double* c); 82 static void SetABC(const double* quad, double* a, double* b, double* c);
76 SkDQuad subDivide(double t1, double t2) const; 83 SkDQuad subDivide(double t1, double t2) const;
77 static SkDQuad SubDivide(const SkPoint a[kPointCount], double t1, double t2) { 84 static SkDQuad SubDivide(const SkPoint a[kPointCount], double t1, double t2) {
78 SkDQuad quad; 85 SkDQuad quad;
79 quad.set(a); 86 quad.set(a);
80 return quad.subDivide(t1, t2); 87 return quad.subDivide(t1, t2);
81 } 88 }
82 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t 2) const; 89 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t 2) const;
83 static SkDPoint SubDivide(const SkPoint pts[kPointCount], const SkDPoint& a, const SkDPoint& c, 90 static SkDPoint SubDivide(const SkPoint pts[kPointCount], const SkDPoint& a, const SkDPoint& c,
84 double t1, double t2) { 91 double t1, double t2) {
85 SkDQuad quad; 92 SkDQuad quad;
86 quad.set(pts); 93 quad.set(pts);
87 return quad.subDivide(a, c, t1, t2); 94 return quad.subDivide(a, c, t1, t2);
88 } 95 }
89 96
97 /**
98 * Return the number of valid roots (0 < root < 1) for this cubic intersect ing the
99 * specified vertical line.
100 */
101 int verticalIntersect(double xIntercept, double roots[2]) const;
102
90 SkDCubic debugToCubic() const; 103 SkDCubic debugToCubic() const;
91 // utilities callable by the user from the debugger when the implementation code is linked in 104 // utilities callable by the user from the debugger when the implementation code is linked in
92 void dump() const; 105 void dump() const;
93 void dumpID(int id) const; 106 void dumpID(int id) const;
94 void dumpInner() const; 107 void dumpInner() const;
95 108
96 private: 109 private:
97 // static double Tangent(const double* quadratic, double t); // uncalled 110 // static double Tangent(const double* quadratic, double t); // uncalled
98 }; 111 };
99 112
100 #endif 113 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkDQuadLineIntersection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698