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 SkPathOpsCubic_DEFINED | 8 #ifndef SkPathOpsCubic_DEFINED |
9 #define SkPathOpsCubic_DEFINED | 9 #define SkPathOpsCubic_DEFINED |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 int findInflections(double tValues[2]) const; | 63 int findInflections(double tValues[2]) const; |
64 | 64 |
65 static int FindInflections(const SkPoint a[kPointCount], double tValues[2])
{ | 65 static int FindInflections(const SkPoint a[kPointCount], double tValues[2])
{ |
66 SkDCubic cubic; | 66 SkDCubic cubic; |
67 cubic.set(a); | 67 cubic.set(a); |
68 return cubic.findInflections(tValues); | 68 return cubic.findInflections(tValues); |
69 } | 69 } |
70 | 70 |
71 int findMaxCurvature(double tValues[]) const; | 71 int findMaxCurvature(double tValues[]) const; |
72 bool hullIntersects(const SkDCubic& c2, bool* isLinear) const; | 72 bool hullIntersects(const SkDCubic& c2, bool* isLinear) const; |
| 73 bool hullIntersects(const SkDConic& c, bool* isLinear) const; |
| 74 bool hullIntersects(const SkDQuad& c2, bool* isLinear) const; |
| 75 bool hullIntersects(const SkDPoint* pts, int ptCount, bool* isLinear) const; |
73 bool isLinear(int startIndex, int endIndex) const; | 76 bool isLinear(int startIndex, int endIndex) const; |
74 bool monotonicInY() const; | 77 bool monotonicInY() const; |
75 void otherPts(int index, const SkDPoint* o1Pts[kPointCount - 1]) const; | 78 void otherPts(int index, const SkDPoint* o1Pts[kPointCount - 1]) const; |
76 SkDPoint ptAtT(double t) const; | 79 SkDPoint ptAtT(double t) const; |
77 static int RootsReal(double A, double B, double C, double D, double t[3]); | 80 static int RootsReal(double A, double B, double C, double D, double t[3]); |
78 static int RootsValidT(const double A, const double B, const double C, doubl
e D, double s[3]); | 81 static int RootsValidT(const double A, const double B, const double C, doubl
e D, double s[3]); |
79 | 82 |
80 int searchRoots(double extremes[6], int extrema, double axisIntercept, | 83 int searchRoots(double extremes[6], int extrema, double axisIntercept, |
81 SearchAxis xAxis, double* validRoots) const; | 84 SearchAxis xAxis, double* validRoots) const; |
82 | 85 |
83 void set(const SkPoint pts[kPointCount]) { | 86 const SkDCubic& set(const SkPoint pts[kPointCount]) { |
84 fPts[0] = pts[0]; | 87 fPts[0] = pts[0]; |
85 fPts[1] = pts[1]; | 88 fPts[1] = pts[1]; |
86 fPts[2] = pts[2]; | 89 fPts[2] = pts[2]; |
87 fPts[3] = pts[3]; | 90 fPts[3] = pts[3]; |
| 91 return *this; |
88 } | 92 } |
89 | 93 |
90 SkDCubic subDivide(double t1, double t2) const; | 94 SkDCubic subDivide(double t1, double t2) const; |
91 | 95 |
92 static SkDCubic SubDivide(const SkPoint a[kPointCount], double t1, double t2
) { | 96 static SkDCubic SubDivide(const SkPoint a[kPointCount], double t1, double t2
) { |
93 SkDCubic cubic; | 97 SkDCubic cubic; |
94 cubic.set(a); | 98 cubic.set(a); |
95 return cubic.subDivide(t1, t2); | 99 return cubic.subDivide(t1, t2); |
96 } | 100 } |
97 | 101 |
(...skipping 26 matching lines...) Expand all Loading... |
124 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3) | 128 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3) |
125 given that: | 129 given that: |
126 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0) | 130 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0) |
127 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3
-> (1, 0) | 131 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3
-> (1, 0) |
128 */ | 132 */ |
129 inline int other_two(int one, int two) { | 133 inline int other_two(int one, int two) { |
130 return 1 >> (3 - (one ^ two)) ^ 3; | 134 return 1 >> (3 - (one ^ two)) ^ 3; |
131 } | 135 } |
132 | 136 |
133 #endif | 137 #endif |
OLD | NEW |