| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkPathOpsConic.h" | 8 #include "SkPathOpsConic.h" |
| 9 #include "SkPathOpsCurve.h" | 9 #include "SkPathOpsCurve.h" |
| 10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
| 11 | 11 |
| 12 class LineConicIntersections { | 12 class LineConicIntersections { |
| 13 public: | 13 public: |
| 14 enum PinTPoint { | 14 enum PinTPoint { |
| 15 kPointUninitialized, | 15 kPointUninitialized, |
| 16 kPointInitialized | 16 kPointInitialized |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 LineConicIntersections(const SkDConic& c, const SkDLine& l, SkIntersections*
i) | 19 LineConicIntersections(const SkDConic& c, const SkDLine& l, SkIntersections*
i) |
| 20 : fConic(c) | 20 : fConic(c) |
| 21 , fLine(&l) | 21 , fLine(&l) |
| 22 , fIntersections(i) | 22 , fIntersections(i) |
| 23 , fAllowNear(true) { | 23 , fAllowNear(true) { |
| 24 i->setMax(3); // allow short partial coincidence plus discrete intersec
tion | 24 i->setMax(4); // allow short partial coincidence plus discrete intersec
tion |
| 25 } | 25 } |
| 26 | 26 |
| 27 LineConicIntersections(const SkDConic& c) | 27 LineConicIntersections(const SkDConic& c) |
| 28 : fConic(c) | 28 : fConic(c) |
| 29 SkDEBUGPARAMS(fLine(nullptr)) | 29 SkDEBUGPARAMS(fLine(nullptr)) |
| 30 SkDEBUGPARAMS(fIntersections(nullptr)) | 30 SkDEBUGPARAMS(fIntersections(nullptr)) |
| 31 SkDEBUGPARAMS(fAllowNear(false)) { | 31 SkDEBUGPARAMS(fAllowNear(false)) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void allowNear(bool allow) { | 34 void allowNear(bool allow) { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub
le* roots) { | 376 int SkIntersections::HorizontalIntercept(const SkDConic& conic, SkScalar y, doub
le* roots) { |
| 377 LineConicIntersections c(conic); | 377 LineConicIntersections c(conic); |
| 378 return c.horizontalIntersect(y, roots); | 378 return c.horizontalIntersect(y, roots); |
| 379 } | 379 } |
| 380 | 380 |
| 381 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double
* roots) { | 381 int SkIntersections::VerticalIntercept(const SkDConic& conic, SkScalar x, double
* roots) { |
| 382 LineConicIntersections c(conic); | 382 LineConicIntersections c(conic); |
| 383 return c.verticalIntersect(x, roots); | 383 return c.verticalIntersect(x, roots); |
| 384 } | 384 } |
| OLD | NEW |