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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 bool controlsInside() const { | 35 bool controlsInside() const { |
36 SkDVector v01 = fPts[0] - fPts[1]; | 36 SkDVector v01 = fPts[0] - fPts[1]; |
37 SkDVector v02 = fPts[0] - fPts[2]; | 37 SkDVector v02 = fPts[0] - fPts[2]; |
38 SkDVector v03 = fPts[0] - fPts[3]; | 38 SkDVector v03 = fPts[0] - fPts[3]; |
39 SkDVector v13 = fPts[1] - fPts[3]; | 39 SkDVector v13 = fPts[1] - fPts[3]; |
40 SkDVector v23 = fPts[2] - fPts[3]; | 40 SkDVector v23 = fPts[2] - fPts[3]; |
41 return v03.dot(v01) > 0 && v03.dot(v02) > 0 && v03.dot(v13) > 0 && v03.d
ot(v23) > 0; | 41 return v03.dot(v01) > 0 && v03.dot(v02) > 0 && v03.dot(v13) > 0 && v03.d
ot(v23) > 0; |
42 } | 42 } |
43 | 43 |
44 static bool IsCubic() { return true; } | 44 static bool IsConic() { return false; } |
45 | 45 |
46 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount
); return fPts[n]; } | 46 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < kPointCount
); return fPts[n]; } |
47 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP
ts[n]; } | 47 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < kPointCount); return fP
ts[n]; } |
48 | 48 |
49 void align(int endIndex, int ctrlIndex, SkDPoint* dstPt) const; | 49 void align(int endIndex, int ctrlIndex, SkDPoint* dstPt) const; |
50 double binarySearch(double min, double max, double axisIntercept, SearchAxis
xAxis) const; | 50 double binarySearch(double min, double max, double axisIntercept, SearchAxis
xAxis) const; |
51 double calcPrecision() const; | 51 double calcPrecision() const; |
52 SkDCubicPair chopAt(double t) const; | 52 SkDCubicPair chopAt(double t) const; |
53 static void Coefficients(const double* cubic, double* A, double* B, double*
C, double* D); | 53 static void Coefficients(const double* cubic, double* A, double* B, double*
C, double* D); |
54 static bool ComplexBreak(const SkPoint pts[4], SkScalar* t); | 54 static bool ComplexBreak(const SkPoint pts[4], SkScalar* t); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3) | 141 returned == 3 for (0, 1), (0, 2), (1, 3), (2, 3) |
142 given that: | 142 given that: |
143 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0) | 143 (0, 3) ^ 2 -> (2, 1) (1, 2) ^ 2 -> (3, 0) |
144 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3
-> (1, 0) | 144 (0, 1) ^ 3 -> (3, 2) (0, 2) ^ 3 -> (3, 1) (1, 3) ^ 3 -> (2, 0) (2, 3) ^ 3
-> (1, 0) |
145 */ | 145 */ |
146 inline int other_two(int one, int two) { | 146 inline int other_two(int one, int two) { |
147 return 1 >> (3 - (one ^ two)) ^ 3; | 147 return 1 >> (3 - (one ^ two)) ^ 3; |
148 } | 148 } |
149 | 149 |
150 #endif | 150 #endif |
OLD | NEW |