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 | 9 |
10 int SkIntersections::closestTo(double rangeStart, double rangeEnd, const SkDPoin
t& testPt, | 10 int SkIntersections::closestTo(double rangeStart, double rangeEnd, const SkDPoin
t& testPt, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #if ONE_OFF_DEBUG | 60 #if ONE_OFF_DEBUG |
61 if (pt.roughlyEqual(fPt[index])) { | 61 if (pt.roughlyEqual(fPt[index])) { |
62 SkDebugf("%s t=%1.9g pts roughly equal\n", __FUNCTION__, one); | 62 SkDebugf("%s t=%1.9g pts roughly equal\n", __FUNCTION__, one); |
63 } | 63 } |
64 #endif | 64 #endif |
65 if (fT[0][index] > one) { | 65 if (fT[0][index] > one) { |
66 break; | 66 break; |
67 } | 67 } |
68 } | 68 } |
69 if (fUsed >= fMax) { | 69 if (fUsed >= fMax) { |
70 SkASSERT(0); // FIXME : this error, if it is to be handled at runtime i
n release, must | 70 SkOPASSERT(0); // FIXME : this error, if it is to be handled at runtime
in release, must |
71 // be propagated all the way back down to the caller, and
return failure. | 71 // be propagated all the way back down to the caller, and
return failure. |
72 fUsed = 0; | 72 fUsed = 0; |
73 return 0; | 73 return 0; |
74 } | 74 } |
75 int remaining = fUsed - index; | 75 int remaining = fUsed - index; |
76 if (remaining > 0) { | 76 if (remaining > 0) { |
77 memmove(&fPt[index + 1], &fPt[index], sizeof(fPt[0]) * remaining); | 77 memmove(&fPt[index + 1], &fPt[index], sizeof(fPt[0]) * remaining); |
78 memmove(&fT[0][index + 1], &fT[0][index], sizeof(fT[0][0]) * remaining); | 78 memmove(&fT[0][index + 1], &fT[0][index], sizeof(fT[0][0]) * remaining); |
79 memmove(&fT[1][index + 1], &fT[1][index], sizeof(fT[1][0]) * remaining); | 79 memmove(&fT[1][index + 1], &fT[1][index], sizeof(fT[1][0]) * remaining); |
80 int clearMask = ~((1 << index) - 1); | 80 int clearMask = ~((1 << index) - 1); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); | 152 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); |
153 memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining); | 153 memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining); |
154 memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining); | 154 memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining); |
155 // SkASSERT(fIsCoincident[0] == 0); | 155 // SkASSERT(fIsCoincident[0] == 0); |
156 int coBit = fIsCoincident[0] & (1 << index); | 156 int coBit = fIsCoincident[0] & (1 << index); |
157 fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit; | 157 fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit; |
158 SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index)))); | 158 SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index)))); |
159 fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit; | 159 fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit; |
160 } | 160 } |
OLD | NEW |