OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 fPts[2] = pts[2]; | 53 fPts[2] = pts[2]; |
54 return *this; | 54 return *this; |
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 static bool Clockwise(const SkOpCurve& edge, bool* swap); | |
64 SkDVector dxdyAtT(double t) const; | 63 SkDVector dxdyAtT(double t) const; |
65 static int FindExtrema(const double src[], double tValue[1]); | 64 static int FindExtrema(const double src[], double tValue[1]); |
66 bool hullIntersects(const SkDQuad& , bool* isLinear) const; | 65 bool hullIntersects(const SkDQuad& , bool* isLinear) const; |
67 bool hullIntersects(const SkDConic& , bool* isLinear) const; | 66 bool hullIntersects(const SkDConic& , bool* isLinear) const; |
68 bool hullIntersects(const SkDCubic& , bool* isLinear) const; | 67 bool hullIntersects(const SkDCubic& , bool* isLinear) const; |
69 bool isLinear(int startIndex, int endIndex) const; | 68 bool isLinear(int startIndex, int endIndex) const; |
70 bool monotonicInX() const; | 69 bool monotonicInX() const; |
71 bool monotonicInY() const; | 70 bool monotonicInY() const; |
72 double nearestT(const SkDPoint&) const; | |
73 void otherPts(int oddMan, const SkDPoint* endPt[2]) const; | 71 void otherPts(int oddMan, const SkDPoint* endPt[2]) const; |
74 SkDPoint ptAtT(double t) const; | 72 SkDPoint ptAtT(double t) const; |
75 static int RootsReal(double A, double B, double C, double t[2]); | 73 static int RootsReal(double A, double B, double C, double t[2]); |
76 static int RootsValidT(const double A, const double B, const double C, doubl
e s[2]); | 74 static int RootsValidT(const double A, const double B, const double C, doubl
e s[2]); |
77 static void SetABC(const double* quad, double* a, double* b, double* c); | 75 static void SetABC(const double* quad, double* a, double* b, double* c); |
78 SkDQuad subDivide(double t1, double t2) const; | 76 SkDQuad subDivide(double t1, double t2) const; |
79 static SkDQuad SubDivide(const SkPoint a[kPointCount], double t1, double t2)
{ | 77 static SkDQuad SubDivide(const SkPoint a[kPointCount], double t1, double t2)
{ |
80 SkDQuad quad; | 78 SkDQuad quad; |
81 quad.set(a); | 79 quad.set(a); |
82 return quad.subDivide(t1, t2); | 80 return quad.subDivide(t1, t2); |
83 } | 81 } |
84 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t
2) const; | 82 SkDPoint subDivide(const SkDPoint& a, const SkDPoint& c, double t1, double t
2) const; |
85 static SkDPoint SubDivide(const SkPoint pts[kPointCount], const SkDPoint& a,
const SkDPoint& c, | 83 static SkDPoint SubDivide(const SkPoint pts[kPointCount], const SkDPoint& a,
const SkDPoint& c, |
86 double t1, double t2) { | 84 double t1, double t2) { |
87 SkDQuad quad; | 85 SkDQuad quad; |
88 quad.set(pts); | 86 quad.set(pts); |
89 return quad.subDivide(a, c, t1, t2); | 87 return quad.subDivide(a, c, t1, t2); |
90 } | 88 } |
91 SkDConic toConic() const; | |
92 SkDCubic toCubic() const; | |
93 | 89 |
| 90 SkDCubic debugToCubic() const; |
94 // utilities callable by the user from the debugger when the implementation
code is linked in | 91 // utilities callable by the user from the debugger when the implementation
code is linked in |
95 void dump() const; | 92 void dump() const; |
96 void dumpID(int id) const; | 93 void dumpID(int id) const; |
97 void dumpInner() const; | 94 void dumpInner() const; |
98 | 95 |
99 private: | 96 private: |
100 // static double Tangent(const double* quadratic, double t); // uncalled | 97 // static double Tangent(const double* quadratic, double t); // uncalled |
101 }; | 98 }; |
102 | 99 |
103 #endif | 100 #endif |
OLD | NEW |