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 #include "SkIntersections.h" | 7 #include "SkIntersections.h" |
8 #include "SkPathOpsLine.h" | 8 #include "SkPathOpsLine.h" |
9 | 9 |
10 void SkIntersections::cleanUpParallelLines(bool parallel) { | 10 void SkIntersections::cleanUpParallelLines(bool parallel) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 for (int index = 0; index < result; ++index) { | 228 for (int index = 0; index < result; ++index) { |
229 fT[1][index] = 1 - fT[1][index]; | 229 fT[1][index] = 1 - fT[1][index]; |
230 } | 230 } |
231 } | 231 } |
232 fPt[0].fX = xIntercept; | 232 fPt[0].fX = xIntercept; |
233 fPt[0].fY = y; | 233 fPt[0].fY = y; |
234 fUsed = 1; | 234 fUsed = 1; |
235 } | 235 } |
236 } | 236 } |
237 if (fAllowNear || result == 2) { | 237 if (fAllowNear || result == 2) { |
238 if ((t = line.nearPoint(leftPt, NULL)) >= 0) { | 238 if ((t = line.nearPoint(leftPt, nullptr)) >= 0) { |
239 insert(t, (double) flipped, leftPt); | 239 insert(t, (double) flipped, leftPt); |
240 } | 240 } |
241 if (left != right) { | 241 if (left != right) { |
242 const SkDPoint rightPt = { right, y }; | 242 const SkDPoint rightPt = { right, y }; |
243 if ((t = line.nearPoint(rightPt, NULL)) >= 0) { | 243 if ((t = line.nearPoint(rightPt, nullptr)) >= 0) { |
244 insert(t, (double) !flipped, rightPt); | 244 insert(t, (double) !flipped, rightPt); |
245 } | 245 } |
246 for (int index = 0; index < 2; ++index) { | 246 for (int index = 0; index < 2; ++index) { |
247 if ((t = SkDLine::NearPointH(line[index], left, right, y)) >= 0)
{ | 247 if ((t = SkDLine::NearPointH(line[index], left, right, y)) >= 0)
{ |
248 insert((double) index, flipped ? 1 - t : t, line[index]); | 248 insert((double) index, flipped ? 1 - t : t, line[index]); |
249 } | 249 } |
250 } | 250 } |
251 } | 251 } |
252 } | 252 } |
253 cleanUpParallelLines(result == 2); | 253 cleanUpParallelLines(result == 2); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 for (int index = 0; index < result; ++index) { | 304 for (int index = 0; index < result; ++index) { |
305 fT[1][index] = 1 - fT[1][index]; | 305 fT[1][index] = 1 - fT[1][index]; |
306 } | 306 } |
307 } | 307 } |
308 fPt[0].fX = x; | 308 fPt[0].fX = x; |
309 fPt[0].fY = yIntercept; | 309 fPt[0].fY = yIntercept; |
310 fUsed = 1; | 310 fUsed = 1; |
311 } | 311 } |
312 } | 312 } |
313 if (fAllowNear || result == 2) { | 313 if (fAllowNear || result == 2) { |
314 if ((t = line.nearPoint(topPt, NULL)) >= 0) { | 314 if ((t = line.nearPoint(topPt, nullptr)) >= 0) { |
315 insert(t, (double) flipped, topPt); | 315 insert(t, (double) flipped, topPt); |
316 } | 316 } |
317 if (top != bottom) { | 317 if (top != bottom) { |
318 SkDPoint bottomPt = { x, bottom }; | 318 SkDPoint bottomPt = { x, bottom }; |
319 if ((t = line.nearPoint(bottomPt, NULL)) >= 0) { | 319 if ((t = line.nearPoint(bottomPt, nullptr)) >= 0) { |
320 insert(t, (double) !flipped, bottomPt); | 320 insert(t, (double) !flipped, bottomPt); |
321 } | 321 } |
322 for (int index = 0; index < 2; ++index) { | 322 for (int index = 0; index < 2; ++index) { |
323 if ((t = SkDLine::NearPointV(line[index], top, bottom, x)) >= 0)
{ | 323 if ((t = SkDLine::NearPointV(line[index], top, bottom, x)) >= 0)
{ |
324 insert((double) index, flipped ? 1 - t : t, line[index]); | 324 insert((double) index, flipped ? 1 - t : t, line[index]); |
325 } | 325 } |
326 } | 326 } |
327 } | 327 } |
328 } | 328 } |
329 cleanUpParallelLines(result == 2); | 329 cleanUpParallelLines(result == 2); |
330 SkASSERT(fUsed <= 2); | 330 SkASSERT(fUsed <= 2); |
331 return fUsed; | 331 return fUsed; |
332 } | 332 } |
333 | 333 |
OLD | NEW |