| 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 #include "SkIntersections.h" | 8 #include "SkIntersections.h" |
| 9 #include "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" |
| 10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 i.insert(to2, to1, p1); | 134 i.insert(to2, to1, p1); |
| 135 } else { | 135 } else { |
| 136 i.insert(to1, to2, p1); | 136 i.insert(to1, to2, p1); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } else { | 139 } else { |
| 140 double offset = precisionScale / 16; // FIME: const is arbi
trary: test, refine | 140 double offset = precisionScale / 16; // FIME: const is arbi
trary: test, refine |
| 141 #if 1 | 141 #if 1 |
| 142 double c1Bottom = tIdx == 0 ? 0 : | 142 double c1Bottom = tIdx == 0 ? 0 : |
| 143 (t1Start + (t1 - t1Start) * locals[0][tIdx - 1] + to
1) / 2; | 143 (t1Start + (t1 - t1Start) * locals[0][tIdx - 1] + to
1) / 2; |
| 144 double c1Min = SkTMax<double>(c1Bottom, to1 - offset); | 144 double c1Min = SkTMax(c1Bottom, to1 - offset); |
| 145 double c1Top = tIdx == tCount - 1 ? 1 : | 145 double c1Top = tIdx == tCount - 1 ? 1 : |
| 146 (t1Start + (t1 - t1Start) * locals[0][tIdx + 1] + to
1) / 2; | 146 (t1Start + (t1 - t1Start) * locals[0][tIdx + 1] + to
1) / 2; |
| 147 double c1Max = SkTMin<double>(c1Top, to1 + offset); | 147 double c1Max = SkTMin(c1Top, to1 + offset); |
| 148 double c2Min = SkTMax<double>(0., to2 - offset); | 148 double c2Min = SkTMax(0., to2 - offset); |
| 149 double c2Max = SkTMin<double>(1., to2 + offset); | 149 double c2Max = SkTMin(1., to2 + offset); |
| 150 #if ONE_OFF_DEBUG | 150 #if ONE_OFF_DEBUG |
| 151 SkDebugf("%.*s %s 1 contains1=%d/%d contains2=%d/%d\n", i.de
pth()*2, tab, | 151 SkDebugf("%.*s %s 1 contains1=%d/%d contains2=%d/%d\n", i.de
pth()*2, tab, |
| 152 __FUNCTION__, | 152 __FUNCTION__, |
| 153 c1Min <= tLimits1[0][1] && tLimits1[0][0] <= c1Max | 153 c1Min <= tLimits1[0][1] && tLimits1[0][0] <= c1Max |
| 154 && c2Min <= tLimits1[1][1] && tLimits1[1][0] <= c2Max, | 154 && c2Min <= tLimits1[1][1] && tLimits1[1][0] <= c2Max, |
| 155 to1 - offset <= tLimits1[0][1] && tLimits1[0][0] <=
to1 + offset | 155 to1 - offset <= tLimits1[0][1] && tLimits1[0][0] <=
to1 + offset |
| 156 && to2 - offset <= tLimits1[1][1] && tLimits1[1][0] <=
to2 + offset, | 156 && to2 - offset <= tLimits1[1][1] && tLimits1[1][0] <=
to2 + offset, |
| 157 c1Min <= tLimits2[0][1] && tLimits2[0][0] <= c1Max | 157 c1Min <= tLimits2[0][1] && tLimits2[0][0] <= c1Max |
| 158 && c2Min <= tLimits2[1][1] && tLimits2[1][0] <= c2Max, | 158 && c2Min <= tLimits2[1][1] && tLimits2[1][0] <= c2Max, |
| 159 to1 - offset <= tLimits2[0][1] && tLimits2[0][0] <=
to1 + offset | 159 to1 - offset <= tLimits2[0][1] && tLimits2[0][0] <=
to1 + offset |
| 160 && to2 - offset <= tLimits2[1][1] && tLimits2[1][0] <=
to2 + offset); | 160 && to2 - offset <= tLimits2[1][1] && tLimits2[1][0] <=
to2 + offset); |
| 161 SkDebugf("%.*s %s 1 c1Bottom=%1.9g c1Top=%1.9g c2Bottom=%1.9
g c2Top=%1.9g" | 161 SkDebugf("%.*s %s 1 c1Bottom=%1.9g c1Top=%1.9g c2Bottom=%1.9
g c2Top=%1.9g" |
| 162 " 1-o=%1.9g 1+o=%1.9g 2-o=%1.9g 2+o=%1.9g offset=%1.
9g\n", | 162 " 1-o=%1.9g 1+o=%1.9g 2-o=%1.9g 2+o=%1.9g offset=%1.
9g\n", |
| 163 i.depth()*2, tab, __FUNCTION__, c1Bottom, c1Top, 0.,
1., | 163 i.depth()*2, tab, __FUNCTION__, c1Bottom, c1Top, 0.,
1., |
| 164 to1 - offset, to1 + offset, to2 - offset, to2 + offs
et, offset); | 164 to1 - offset, to1 + offset, to2 - offset, to2 + offs
et, offset); |
| 165 SkDebugf("%.*s %s 1 to1=%1.9g to2=%1.9g c1Min=%1.9g c1Max=%1
.9g c2Min=%1.9g" | 165 SkDebugf("%.*s %s 1 to1=%1.9g to2=%1.9g c1Min=%1.9g c1Max=%1
.9g c2Min=%1.9g" |
| 166 " c2Max=%1.9g\n", i.depth()*2, tab, __FUNCTION__, to
1, to2, c1Min, | 166 " c2Max=%1.9g\n", i.depth()*2, tab, __FUNCTION__, to
1, to2, c1Min, |
| 167 c1Max, c2Min, c2Max); | 167 c1Max, c2Min, c2Max); |
| 168 #endif | 168 #endif |
| 169 intersect(cubic1, c1Min, c1Max, cubic2, c2Min, c2Max, offset
, i); | 169 intersect(cubic1, c1Min, c1Max, cubic2, c2Min, c2Max, offset
, i); |
| 170 #if ONE_OFF_DEBUG | 170 #if ONE_OFF_DEBUG |
| 171 SkDebugf("%.*s %s 1 i.used=%d t=%1.9g\n", i.depth()*2, tab,
__FUNCTION__, | 171 SkDebugf("%.*s %s 1 i.used=%d t=%1.9g\n", i.depth()*2, tab,
__FUNCTION__, |
| 172 i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1); | 172 i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1); |
| 173 #endif | 173 #endif |
| 174 if (tCount > 1) { | 174 if (tCount > 1) { |
| 175 c1Min = SkTMax<double>(0., to1 - offset); | 175 c1Min = SkTMax(0., to1 - offset); |
| 176 c1Max = SkTMin<double>(1., to1 + offset); | 176 c1Max = SkTMin(1., to1 + offset); |
| 177 double c2Bottom = tIdx == 0 ? to2 : | 177 double c2Bottom = tIdx == 0 ? to2 : |
| 178 (t2Start + (t2 - t2Start) * locals[1][tIdx - 1]
+ to2) / 2; | 178 (t2Start + (t2 - t2Start) * locals[1][tIdx - 1]
+ to2) / 2; |
| 179 double c2Top = tIdx == tCount - 1 ? to2 : | 179 double c2Top = tIdx == tCount - 1 ? to2 : |
| 180 (t2Start + (t2 - t2Start) * locals[1][tIdx + 1]
+ to2) / 2; | 180 (t2Start + (t2 - t2Start) * locals[1][tIdx + 1]
+ to2) / 2; |
| 181 if (c2Bottom > c2Top) { | 181 if (c2Bottom > c2Top) { |
| 182 SkTSwap(c2Bottom, c2Top); | 182 SkTSwap(c2Bottom, c2Top); |
| 183 } | 183 } |
| 184 if (c2Bottom == to2) { | 184 if (c2Bottom == to2) { |
| 185 c2Bottom = 0; | 185 c2Bottom = 0; |
| 186 } | 186 } |
| 187 if (c2Top == to2) { | 187 if (c2Top == to2) { |
| 188 c2Top = 1; | 188 c2Top = 1; |
| 189 } | 189 } |
| 190 c2Min = SkTMax<double>(c2Bottom, to2 - offset); | 190 c2Min = SkTMax(c2Bottom, to2 - offset); |
| 191 c2Max = SkTMin<double>(c2Top, to2 + offset); | 191 c2Max = SkTMin(c2Top, to2 + offset); |
| 192 #if ONE_OFF_DEBUG | 192 #if ONE_OFF_DEBUG |
| 193 SkDebugf("%.*s %s 2 contains1=%d/%d contains2=%d/%d\n",
i.depth()*2, tab, | 193 SkDebugf("%.*s %s 2 contains1=%d/%d contains2=%d/%d\n",
i.depth()*2, tab, |
| 194 __FUNCTION__, | 194 __FUNCTION__, |
| 195 c1Min <= tLimits1[0][1] && tLimits1[0][0] <= c1Max | 195 c1Min <= tLimits1[0][1] && tLimits1[0][0] <= c1Max |
| 196 && c2Min <= tLimits1[1][1] && tLimits1[1][0] <= c2Max, | 196 && c2Min <= tLimits1[1][1] && tLimits1[1][0] <= c2Max, |
| 197 to1 - offset <= tLimits1[0][1] && tLimits1[0][0] <=
to1 + offset | 197 to1 - offset <= tLimits1[0][1] && tLimits1[0][0] <=
to1 + offset |
| 198 && to2 - offset <= tLimits1[1][1] && tLimits1[1][0] <=
to2 + offset, | 198 && to2 - offset <= tLimits1[1][1] && tLimits1[1][0] <=
to2 + offset, |
| 199 c1Min <= tLimits2[0][1] && tLimits2[0][0] <= c1Max | 199 c1Min <= tLimits2[0][1] && tLimits2[0][0] <= c1Max |
| 200 && c2Min <= tLimits2[1][1] && tLimits2[1][0] <= c2Max, | 200 && c2Min <= tLimits2[1][1] && tLimits2[1][0] <= c2Max, |
| 201 to1 - offset <= tLimits2[0][1] && tLimits2[0][0] <=
to1 + offset | 201 to1 - offset <= tLimits2[0][1] && tLimits2[0][0] <=
to1 + offset |
| 202 && to2 - offset <= tLimits2[1][1] && tLimits2[1][0] <=
to2 + offset); | 202 && to2 - offset <= tLimits2[1][1] && tLimits2[1][0] <=
to2 + offset); |
| 203 SkDebugf("%.*s %s 2 c1Bottom=%1.9g c1Top=%1.9g c2Bottom=
%1.9g c2Top=%1.9g" | 203 SkDebugf("%.*s %s 2 c1Bottom=%1.9g c1Top=%1.9g c2Bottom=
%1.9g c2Top=%1.9g" |
| 204 " 1-o=%1.9g 1+o=%1.9g 2-o=%1.9g 2+o=%1.9g offset
=%1.9g\n", | 204 " 1-o=%1.9g 1+o=%1.9g 2-o=%1.9g 2+o=%1.9g offset
=%1.9g\n", |
| 205 i.depth()*2, tab, __FUNCTION__, 0., 1., c2Bottom
, c2Top, | 205 i.depth()*2, tab, __FUNCTION__, 0., 1., c2Bottom
, c2Top, |
| 206 to1 - offset, to1 + offset, to2 - offset, to2 +
offset, offset); | 206 to1 - offset, to1 + offset, to2 - offset, to2 +
offset, offset); |
| 207 SkDebugf("%.*s %s 2 to1=%1.9g to2=%1.9g c1Min=%1.9g c1Ma
x=%1.9g c2Min=%1.9g" | 207 SkDebugf("%.*s %s 2 to1=%1.9g to2=%1.9g c1Min=%1.9g c1Ma
x=%1.9g c2Min=%1.9g" |
| 208 " c2Max=%1.9g\n", i.depth()*2, tab, __FUNCTION__
, to1, to2, c1Min, | 208 " c2Max=%1.9g\n", i.depth()*2, tab, __FUNCTION__
, to1, to2, c1Min, |
| 209 c1Max, c2Min, c2Max); | 209 c1Max, c2Min, c2Max); |
| 210 #endif | 210 #endif |
| 211 intersect(cubic1, c1Min, c1Max, cubic2, c2Min, c2Max, of
fset, i); | 211 intersect(cubic1, c1Min, c1Max, cubic2, c2Min, c2Max, of
fset, i); |
| 212 #if ONE_OFF_DEBUG | 212 #if ONE_OFF_DEBUG |
| 213 SkDebugf("%.*s %s 2 i.used=%d t=%1.9g\n", i.depth()*2, tab,
__FUNCTION__, | 213 SkDebugf("%.*s %s 2 i.used=%d t=%1.9g\n", i.depth()*2, tab,
__FUNCTION__, |
| 214 i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1); | 214 i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1); |
| 215 #endif | 215 #endif |
| 216 c1Min = SkTMax<double>(c1Bottom, to1 - offset); | 216 c1Min = SkTMax(c1Bottom, to1 - offset); |
| 217 c1Max = SkTMin<double>(c1Top, to1 + offset); | 217 c1Max = SkTMin(c1Top, to1 + offset); |
| 218 #if ONE_OFF_DEBUG | 218 #if ONE_OFF_DEBUG |
| 219 SkDebugf("%.*s %s 3 contains1=%d/%d contains2=%d/%d\n",
i.depth()*2, tab, | 219 SkDebugf("%.*s %s 3 contains1=%d/%d contains2=%d/%d\n",
i.depth()*2, tab, |
| 220 __FUNCTION__, | 220 __FUNCTION__, |
| 221 c1Min <= tLimits1[0][1] && tLimits1[0][0] <= c1Max | 221 c1Min <= tLimits1[0][1] && tLimits1[0][0] <= c1Max |
| 222 && c2Min <= tLimits1[1][1] && tLimits1[1][0] <= c2Max, | 222 && c2Min <= tLimits1[1][1] && tLimits1[1][0] <= c2Max, |
| 223 to1 - offset <= tLimits1[0][1] && tLimits1[0][0] <=
to1 + offset | 223 to1 - offset <= tLimits1[0][1] && tLimits1[0][0] <=
to1 + offset |
| 224 && to2 - offset <= tLimits1[1][1] && tLimits1[1][0] <=
to2 + offset, | 224 && to2 - offset <= tLimits1[1][1] && tLimits1[1][0] <=
to2 + offset, |
| 225 c1Min <= tLimits2[0][1] && tLimits2[0][0] <= c1Max | 225 c1Min <= tLimits2[0][1] && tLimits2[0][0] <= c1Max |
| 226 && c2Min <= tLimits2[1][1] && tLimits2[1][0] <= c2Max, | 226 && c2Min <= tLimits2[1][1] && tLimits2[1][0] <= c2Max, |
| 227 to1 - offset <= tLimits2[0][1] && tLimits2[0][0] <=
to1 + offset | 227 to1 - offset <= tLimits2[0][1] && tLimits2[0][0] <=
to1 + offset |
| 228 && to2 - offset <= tLimits2[1][1] && tLimits2[1][0] <=
to2 + offset); | 228 && to2 - offset <= tLimits2[1][1] && tLimits2[1][0] <=
to2 + offset); |
| 229 SkDebugf("%.*s %s 3 c1Bottom=%1.9g c1Top=%1.9g c2Bottom=
%1.9g c2Top=%1.9g" | 229 SkDebugf("%.*s %s 3 c1Bottom=%1.9g c1Top=%1.9g c2Bottom=
%1.9g c2Top=%1.9g" |
| 230 " 1-o=%1.9g 1+o=%1.9g 2-o=%1.9g 2+o=%1.9g offset
=%1.9g\n", | 230 " 1-o=%1.9g 1+o=%1.9g 2-o=%1.9g 2+o=%1.9g offset
=%1.9g\n", |
| 231 i.depth()*2, tab, __FUNCTION__, 0., 1., c2Bottom
, c2Top, | 231 i.depth()*2, tab, __FUNCTION__, 0., 1., c2Bottom
, c2Top, |
| 232 to1 - offset, to1 + offset, to2 - offset, to2 +
offset, offset); | 232 to1 - offset, to1 + offset, to2 - offset, to2 +
offset, offset); |
| 233 SkDebugf("%.*s %s 3 to1=%1.9g to2=%1.9g c1Min=%1.9g c1Ma
x=%1.9g c2Min=%1.9g" | 233 SkDebugf("%.*s %s 3 to1=%1.9g to2=%1.9g c1Min=%1.9g c1Ma
x=%1.9g c2Min=%1.9g" |
| 234 " c2Max=%1.9g\n", i.depth()*2, tab, __FUNCTION__
, to1, to2, c1Min, | 234 " c2Max=%1.9g\n", i.depth()*2, tab, __FUNCTION__
, to1, to2, c1Min, |
| 235 c1Max, c2Min, c2Max); | 235 c1Max, c2Min, c2Max); |
| 236 #endif | 236 #endif |
| 237 intersect(cubic1, c1Min, c1Max, cubic2, c2Min, c2Max, of
fset, i); | 237 intersect(cubic1, c1Min, c1Max, cubic2, c2Min, c2Max, of
fset, i); |
| 238 #if ONE_OFF_DEBUG | 238 #if ONE_OFF_DEBUG |
| 239 SkDebugf("%.*s %s 3 i.used=%d t=%1.9g\n", i.depth()*2, tab,
__FUNCTION__, | 239 SkDebugf("%.*s %s 3 i.used=%d t=%1.9g\n", i.depth()*2, tab,
__FUNCTION__, |
| 240 i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1); | 240 i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1); |
| 241 #endif | 241 #endif |
| 242 } | 242 } |
| 243 #else | 243 #else |
| 244 double c1Bottom = tIdx == 0 ? 0 : | 244 double c1Bottom = tIdx == 0 ? 0 : |
| 245 (t1Start + (t1 - t1Start) * locals.fT[0][tIdx - 1] +
to1) / 2; | 245 (t1Start + (t1 - t1Start) * locals.fT[0][tIdx - 1] +
to1) / 2; |
| 246 double c1Min = SkTMax<double>(c1Bottom, to1 - offset); | 246 double c1Min = SkTMax(c1Bottom, to1 - offset); |
| 247 double c1Top = tIdx == tCount - 1 ? 1 : | 247 double c1Top = tIdx == tCount - 1 ? 1 : |
| 248 (t1Start + (t1 - t1Start) * locals.fT[0][tIdx + 1] +
to1) / 2; | 248 (t1Start + (t1 - t1Start) * locals.fT[0][tIdx + 1] +
to1) / 2; |
| 249 double c1Max = SkTMin<double>(c1Top, to1 + offset); | 249 double c1Max = SkTMin(c1Top, to1 + offset); |
| 250 double c2Bottom = tIdx == 0 ? to2 : | 250 double c2Bottom = tIdx == 0 ? to2 : |
| 251 (t2Start + (t2 - t2Start) * locals.fT[1][tIdx - 1] +
to2) / 2; | 251 (t2Start + (t2 - t2Start) * locals.fT[1][tIdx - 1] +
to2) / 2; |
| 252 double c2Top = tIdx == tCount - 1 ? to2 : | 252 double c2Top = tIdx == tCount - 1 ? to2 : |
| 253 (t2Start + (t2 - t2Start) * locals.fT[1][tIdx + 1] +
to2) / 2; | 253 (t2Start + (t2 - t2Start) * locals.fT[1][tIdx + 1] +
to2) / 2; |
| 254 if (c2Bottom > c2Top) { | 254 if (c2Bottom > c2Top) { |
| 255 SkTSwap(c2Bottom, c2Top); | 255 SkTSwap(c2Bottom, c2Top); |
| 256 } | 256 } |
| 257 if (c2Bottom == to2) { | 257 if (c2Bottom == to2) { |
| 258 c2Bottom = 0; | 258 c2Bottom = 0; |
| 259 } | 259 } |
| 260 if (c2Top == to2) { | 260 if (c2Top == to2) { |
| 261 c2Top = 1; | 261 c2Top = 1; |
| 262 } | 262 } |
| 263 double c2Min = SkTMax<double>(c2Bottom, to2 - offset); | 263 double c2Min = SkTMax(c2Bottom, to2 - offset); |
| 264 double c2Max = SkTMin<double>(c2Top, to2 + offset); | 264 double c2Max = SkTMin(c2Top, to2 + offset); |
| 265 #if ONE_OFF_DEBUG | 265 #if ONE_OFF_DEBUG |
| 266 SkDebugf("%s contains1=%d/%d contains2=%d/%d\n", __FUNCTION_
_, | 266 SkDebugf("%s contains1=%d/%d contains2=%d/%d\n", __FUNCTION_
_, |
| 267 c1Min <= 0.210357794 && 0.210357794 <= c1Max | 267 c1Min <= 0.210357794 && 0.210357794 <= c1Max |
| 268 && c2Min <= 0.223476406 && 0.223476406 <= c2Max, | 268 && c2Min <= 0.223476406 && 0.223476406 <= c2Max, |
| 269 to1 - offset <= 0.210357794 && 0.210357794 <= to1 +
offset | 269 to1 - offset <= 0.210357794 && 0.210357794 <= to1 +
offset |
| 270 && to2 - offset <= 0.223476406 && 0.223476406 <= to2 +
offset, | 270 && to2 - offset <= 0.223476406 && 0.223476406 <= to2 +
offset, |
| 271 c1Min <= 0.211324707 && 0.211324707 <= c1Max | 271 c1Min <= 0.211324707 && 0.211324707 <= c1Max |
| 272 && c2Min <= 0.211327209 && 0.211327209 <= c2Max, | 272 && c2Min <= 0.211327209 && 0.211327209 <= c2Max, |
| 273 to1 - offset <= 0.211324707 && 0.211324707 <= to1 +
offset | 273 to1 - offset <= 0.211324707 && 0.211324707 <= to1 +
offset |
| 274 && to2 - offset <= 0.211327209 && 0.211327209 <= to2 +
offset); | 274 && to2 - offset <= 0.211327209 && 0.211327209 <= to2 +
offset); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 QSort<double>(tVals.begin(), tVals.end() - 1); | 345 QSort<double>(tVals.begin(), tVals.end() - 1); |
| 346 double tMin1 = start ? 0 : 1 - LINE_FRACTION; | 346 double tMin1 = start ? 0 : 1 - LINE_FRACTION; |
| 347 double tMax1 = start ? LINE_FRACTION : 1; | 347 double tMax1 = start ? LINE_FRACTION : 1; |
| 348 int tIdx = 0; | 348 int tIdx = 0; |
| 349 do { | 349 do { |
| 350 int tLast = tIdx; | 350 int tLast = tIdx; |
| 351 while (tLast + 1 < tVals.count() && roughly_equal(tVals[tLast + 1], tVal
s[tIdx])) { | 351 while (tLast + 1 < tVals.count() && roughly_equal(tVals[tLast + 1], tVal
s[tIdx])) { |
| 352 ++tLast; | 352 ++tLast; |
| 353 } | 353 } |
| 354 double tMin2 = SkTMax<double>(tVals[tIdx] - LINE_FRACTION, 0.0); | 354 double tMin2 = SkTMax(tVals[tIdx] - LINE_FRACTION, 0.0); |
| 355 double tMax2 = SkTMin<double>(tVals[tLast] + LINE_FRACTION, 1.0); | 355 double tMax2 = SkTMin(tVals[tLast] + LINE_FRACTION, 1.0); |
| 356 int lastUsed = i.used(); | 356 int lastUsed = i.used(); |
| 357 intersect(cubic1, tMin1, tMax1, cubic2, tMin2, tMax2, 1, i); | 357 intersect(cubic1, tMin1, tMax1, cubic2, tMin2, tMax2, 1, i); |
| 358 if (lastUsed == i.used()) { | 358 if (lastUsed == i.used()) { |
| 359 tMin2 = SkTMax<double>(tVals[tIdx] - (1.0 / SkDCubic::gPrecisionUnit
), 0.0); | 359 tMin2 = SkTMax(tVals[tIdx] - (1.0 / SkDCubic::gPrecisionUnit), 0.0); |
| 360 tMax2 = SkTMin<double>(tVals[tLast] + (1.0 / SkDCubic::gPrecisionUni
t), 1.0); | 360 tMax2 = SkTMin(tVals[tLast] + (1.0 / SkDCubic::gPrecisionUnit), 1.0)
; |
| 361 intersect(cubic1, tMin1, tMax1, cubic2, tMin2, tMax2, 1, i); | 361 intersect(cubic1, tMin1, tMax1, cubic2, tMin2, tMax2, 1, i); |
| 362 } | 362 } |
| 363 tIdx = tLast + 1; | 363 tIdx = tLast + 1; |
| 364 } while (tIdx < tVals.count()); | 364 } while (tIdx < tVals.count()); |
| 365 return; | 365 return; |
| 366 } | 366 } |
| 367 | 367 |
| 368 const double CLOSE_ENOUGH = 0.001; | 368 const double CLOSE_ENOUGH = 0.001; |
| 369 | 369 |
| 370 static bool closeStart(const SkDCubic& cubic, int cubicIndex, SkIntersections& i
, SkDPoint& pt) { | 370 static bool closeStart(const SkDCubic& cubic, int cubicIndex, SkIntersections& i
, SkDPoint& pt) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 } | 440 } |
| 441 (void) intersect(c, c); | 441 (void) intersect(c, c); |
| 442 if (used() > 0) { | 442 if (used() > 0) { |
| 443 SkASSERT(used() == 1); | 443 SkASSERT(used() == 1); |
| 444 if (fT[0][0] > fT[1][0]) { | 444 if (fT[0][0] > fT[1][0]) { |
| 445 swapPts(); | 445 swapPts(); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 return used(); | 448 return used(); |
| 449 } | 449 } |
| OLD | NEW |