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 "SkPathOpsCubic.h" | 8 #include "SkPathOpsCubic.h" |
9 #include "SkPathOpsLine.h" | 9 #include "SkPathOpsLine.h" |
10 | 10 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 /* Note that this does not look for endpoints of the line that are near the
cubic. | 256 /* Note that this does not look for endpoints of the line that are near the
cubic. |
257 These points are found later when check ends looks for missing points */ | 257 These points are found later when check ends looks for missing points */ |
258 void addNearEndPoints() { | 258 void addNearEndPoints() { |
259 for (int cIndex = 0; cIndex < 4; cIndex += 3) { | 259 for (int cIndex = 0; cIndex < 4; cIndex += 3) { |
260 double cubicT = (double) (cIndex >> 1); | 260 double cubicT = (double) (cIndex >> 1); |
261 if (fIntersections->hasT(cubicT)) { | 261 if (fIntersections->hasT(cubicT)) { |
262 continue; | 262 continue; |
263 } | 263 } |
264 double lineT = fLine.nearPoint(fCubic[cIndex]); | 264 double lineT = fLine.nearPoint(fCubic[cIndex], NULL); |
265 if (lineT < 0) { | 265 if (lineT < 0) { |
266 continue; | 266 continue; |
267 } | 267 } |
268 fIntersections->insert(cubicT, lineT, fCubic[cIndex]); | 268 fIntersections->insert(cubicT, lineT, fCubic[cIndex]); |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 void addExactHorizontalEndPoints(double left, double right, double y) { | 272 void addExactHorizontalEndPoints(double left, double right, double y) { |
273 for (int cIndex = 0; cIndex < 4; cIndex += 3) { | 273 for (int cIndex = 0; cIndex < 4; cIndex += 3) { |
274 double lineT = SkDLine::ExactPointH(fCubic[cIndex], left, right, y); | 274 double lineT = SkDLine::ExactPointH(fCubic[cIndex], left, right, y); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 } | 394 } |
395 | 395 |
396 int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) { | 396 int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) { |
397 LineCubicIntersections c(cubic, line, this); | 397 LineCubicIntersections c(cubic, line, this); |
398 fUsed = c.intersectRay(fT[0]); | 398 fUsed = c.intersectRay(fT[0]); |
399 for (int index = 0; index < fUsed; ++index) { | 399 for (int index = 0; index < fUsed; ++index) { |
400 fPt[index] = cubic.ptAtT(fT[0][index]); | 400 fPt[index] = cubic.ptAtT(fT[0][index]); |
401 } | 401 } |
402 return fUsed; | 402 return fUsed; |
403 } | 403 } |
OLD | NEW |