OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "SkIntersections.h" | 7 #include "SkIntersections.h" |
8 #include "SkLineParameters.h" | 8 #include "SkLineParameters.h" |
9 #include "SkPathOpsConic.h" | 9 #include "SkPathOpsConic.h" |
10 #include "SkPathOpsCubic.h" | 10 #include "SkPathOpsCubic.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 return 1; | 41 return 1; |
42 } | 42 } |
43 return 0; | 43 return 0; |
44 } | 44 } |
45 | 45 |
46 SkDVector SkDConic::dxdyAtT(double t) const { | 46 SkDVector SkDConic::dxdyAtT(double t) const { |
47 SkDVector result = { | 47 SkDVector result = { |
48 conic_eval_tan(&fPts[0].fX, fWeight, t), | 48 conic_eval_tan(&fPts[0].fX, fWeight, t), |
49 conic_eval_tan(&fPts[0].fY, fWeight, t) | 49 conic_eval_tan(&fPts[0].fY, fWeight, t) |
50 }; | 50 }; |
| 51 if (result.fX == 0 && result.fY == 0) { |
| 52 if (zero_or_one(t)) { |
| 53 result = fPts[2] - fPts[0]; |
| 54 } else { |
| 55 // incomplete |
| 56 SkDebugf("!k"); |
| 57 } |
| 58 } |
51 return result; | 59 return result; |
52 } | 60 } |
53 | 61 |
54 static double conic_eval_numerator(const double src[], SkScalar w, double t) { | 62 static double conic_eval_numerator(const double src[], SkScalar w, double t) { |
55 SkASSERT(src); | 63 SkASSERT(src); |
56 SkASSERT(t >= 0 && t <= 1); | 64 SkASSERT(t >= 0 && t <= 1); |
57 double src2w = src[2] * w; | 65 double src2w = src[2] * w; |
58 double C = src[0]; | 66 double C = src[0]; |
59 double A = src[4] - 2 * src2w + C; | 67 double A = src[4] - 2 * src2w + C; |
60 double B = 2 * (src2w - C); | 68 double B = 2 * (src2w - C); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}
}}, w }; | 140 SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}
}}, w }; |
133 return dst; | 141 return dst; |
134 } | 142 } |
135 | 143 |
136 SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do
uble t2, | 144 SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do
uble t2, |
137 SkScalar* weight) const { | 145 SkScalar* weight) const { |
138 SkDConic chopped = this->subDivide(t1, t2); | 146 SkDConic chopped = this->subDivide(t1, t2); |
139 *weight = chopped.fWeight; | 147 *weight = chopped.fWeight; |
140 return chopped[1]; | 148 return chopped[1]; |
141 } | 149 } |
OLD | NEW |