| 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 void SkIntersections::append(const SkIntersections& i) { | 10 void SkIntersections::append(const SkIntersections& i) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 fMax = 2; | 145 fMax = 2; |
| 146 return intersectRay(quad, line); | 146 return intersectRay(quad, line); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void SkIntersections::quickRemoveOne(int index, int replace) { | 149 void SkIntersections::quickRemoveOne(int index, int replace) { |
| 150 if (index < replace) { | 150 if (index < replace) { |
| 151 fT[0][index] = fT[0][replace]; | 151 fT[0][index] = fT[0][replace]; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 #if 0 | |
| 156 void SkIntersections::remove(double one, double two, const SkDPoint& startPt, | |
| 157 const SkDPoint& endPt) { | |
| 158 for (int index = fUsed - 1; index >= 0; --index) { | |
| 159 if (!(fIsCoincident[0] & (1 << index)) && (between(one, fT[fSwap][index]
, two) | |
| 160 || startPt.approximatelyEqual(fPt[index]) | |
| 161 || endPt.approximatelyEqual(fPt[index]))) { | |
| 162 SkASSERT(fUsed > 0); | |
| 163 removeOne(index); | |
| 164 } | |
| 165 } | |
| 166 } | |
| 167 #endif | |
| 168 | |
| 169 void SkIntersections::removeOne(int index) { | 155 void SkIntersections::removeOne(int index) { |
| 170 int remaining = --fUsed - index; | 156 int remaining = --fUsed - index; |
| 171 if (remaining <= 0) { | 157 if (remaining <= 0) { |
| 172 return; | 158 return; |
| 173 } | 159 } |
| 174 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); | 160 memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); |
| 175 memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining); | 161 memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining); |
| 176 memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining); | 162 memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining); |
| 177 SkASSERT(fIsCoincident[0] == 0); | 163 SkASSERT(fIsCoincident[0] == 0); |
| 178 int coBit = fIsCoincident[0] & (1 << index); | 164 int coBit = fIsCoincident[0] & (1 << index); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 201 quad.set(a); | 187 quad.set(a); |
| 202 return vertical(quad, top, bottom, x, flipped); | 188 return vertical(quad, top, bottom, x, flipped); |
| 203 } | 189 } |
| 204 | 190 |
| 205 int SkIntersections::verticalCubic(const SkPoint a[4], SkScalar top, SkScalar bo
ttom, | 191 int SkIntersections::verticalCubic(const SkPoint a[4], SkScalar top, SkScalar bo
ttom, |
| 206 SkScalar x, bool flipped) { | 192 SkScalar x, bool flipped) { |
| 207 SkDCubic cubic; | 193 SkDCubic cubic; |
| 208 cubic.set(a); | 194 cubic.set(a); |
| 209 return vertical(cubic, top, bottom, x, flipped); | 195 return vertical(cubic, top, bottom, x, flipped); |
| 210 } | 196 } |
| OLD | NEW |