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" |
11 #include "SkPathOpsPoint.h" | 11 #include "SkPathOpsPoint.h" |
12 #include "SkPathOpsQuad.h" | 12 #include "SkPathOpsQuad.h" |
13 #include "SkPathOpsRect.h" | 13 #include "SkPathOpsRect.h" |
14 #include "SkReduceOrder.h" | 14 #include "SkReduceOrder.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
16 #include "TSearch.h" | 16 #include "SkTSort.h" |
17 | 17 |
18 #if ONE_OFF_DEBUG | 18 #if ONE_OFF_DEBUG |
19 static const double tLimits1[2][2] = {{0.36, 0.37}, {0.63, 0.64}}; | 19 static const double tLimits1[2][2] = {{0.36, 0.37}, {0.63, 0.64}}; |
20 static const double tLimits2[2][2] = {{-0.865211397, -0.865215212}, {-0.86520769
6, -0.865208078}}; | 20 static const double tLimits2[2][2] = {{-0.865211397, -0.865215212}, {-0.86520769
6, -0.865208078}}; |
21 #endif | 21 #endif |
22 | 22 |
23 #define DEBUG_QUAD_PART 0 | 23 #define DEBUG_QUAD_PART 0 |
24 #define SWAP_TOP_DEBUG 0 | 24 #define SWAP_TOP_DEBUG 0 |
25 | 25 |
26 static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO
rder* reducer) { | 26 static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO
rder* reducer) { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 i.insert(start ? 0 : 1, foundT, line[0]); | 335 i.insert(start ? 0 : 1, foundT, line[0]); |
336 } | 336 } |
337 } else { | 337 } else { |
338 *tVals.append() = local[0][idx2]; | 338 *tVals.append() = local[0][idx2]; |
339 } | 339 } |
340 } | 340 } |
341 } | 341 } |
342 if (tVals.count() == 0) { | 342 if (tVals.count() == 0) { |
343 return; | 343 return; |
344 } | 344 } |
345 QSort<double>(tVals.begin(), tVals.end() - 1); | 345 SkTQSort<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<double>(tVals[tIdx] - LINE_FRACTION, 0.0); |
355 double tMax2 = SkTMin<double>(tVals[tLast] + LINE_FRACTION, 1.0); | 355 double tMax2 = SkTMin<double>(tVals[tLast] + LINE_FRACTION, 1.0); |
(...skipping 84 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 |