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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 int clearMask = ~((1 << index) - 1); | 80 int clearMask = ~((1 << index) - 1); |
81 fIsCoincident[0] += fIsCoincident[0] & clearMask; | 81 fIsCoincident[0] += fIsCoincident[0] & clearMask; |
82 fIsCoincident[1] += fIsCoincident[1] & clearMask; | 82 fIsCoincident[1] += fIsCoincident[1] & clearMask; |
83 } | 83 } |
84 fPt[index] = pt; | 84 fPt[index] = pt; |
85 SkASSERT(one >= 0 && one <= 1); | 85 SkASSERT(one >= 0 && one <= 1); |
86 SkASSERT(two >= 0 && two <= 1); | 86 SkASSERT(two >= 0 && two <= 1); |
87 fT[0][index] = one; | 87 fT[0][index] = one; |
88 fT[1][index] = two; | 88 fT[1][index] = two; |
89 ++fUsed; | 89 ++fUsed; |
| 90 SkASSERT(fUsed <= SK_ARRAY_COUNT(fPt)); |
90 return index; | 91 return index; |
91 } | 92 } |
92 | 93 |
93 void SkIntersections::insertNear(double one, double two, const SkDPoint& pt1, co
nst SkDPoint& pt2) { | 94 void SkIntersections::insertNear(double one, double two, const SkDPoint& pt1, co
nst SkDPoint& pt2) { |
94 SkASSERT(one == 0 || one == 1); | 95 SkASSERT(one == 0 || one == 1); |
95 SkASSERT(two == 0 || two == 1); | 96 SkASSERT(two == 0 || two == 1); |
96 SkASSERT(pt1 != pt2); | 97 SkASSERT(pt1 != pt2); |
97 fNearlySame[one ? 1 : 0] = true; | 98 fNearlySame[one ? 1 : 0] = true; |
98 (void) insert(one, two, pt1); | 99 (void) insert(one, two, pt1); |
99 fPt2[one ? 1 : 0] = pt2; | 100 fPt2[one ? 1 : 0] = pt2; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 151 } |
151 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); | 152 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); |
152 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); |
153 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); |
154 // SkASSERT(fIsCoincident[0] == 0); | 155 // SkASSERT(fIsCoincident[0] == 0); |
155 int coBit = fIsCoincident[0] & (1 << index); | 156 int coBit = fIsCoincident[0] & (1 << index); |
156 fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit; | 157 fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit; |
157 SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index)))); | 158 SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index)))); |
158 fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit; | 159 fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit; |
159 } | 160 } |
OLD | NEW |