| 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 "SkPathOpsLine.h" | 8 #include "SkPathOpsLine.h" |
| 9 #include "SkPathOpsQuad.h" | 9 #include "SkPathOpsQuad.h" |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 enum PinTPoint { | 92 enum PinTPoint { |
| 93 kPointUninitialized, | 93 kPointUninitialized, |
| 94 kPointInitialized | 94 kPointInitialized |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 LineQuadraticIntersections(const SkDQuad& q, const SkDLine& l, SkIntersectio
ns* i) | 97 LineQuadraticIntersections(const SkDQuad& q, const SkDLine& l, SkIntersectio
ns* i) |
| 98 : fQuad(q) | 98 : fQuad(q) |
| 99 , fLine(l) | 99 , fLine(l) |
| 100 , fIntersections(i) | 100 , fIntersections(i) |
| 101 , fAllowNear(true) { | 101 , fAllowNear(true) { |
| 102 i->setMax(2); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void allowNear(bool allow) { | 105 void allowNear(bool allow) { |
| 105 fAllowNear = allow; | 106 fAllowNear = allow; |
| 106 } | 107 } |
| 107 | 108 |
| 108 int intersectRay(double roots[2]) { | 109 int intersectRay(double roots[2]) { |
| 109 /* | 110 /* |
| 110 solve by rotating line+quad so line is horizontal, then finding the root
s | 111 solve by rotating line+quad so line is horizontal, then finding the root
s |
| 111 set up matrix to rotate quad to x-axis | 112 set up matrix to rotate quad to x-axis |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 405 } |
| 405 | 406 |
| 406 int SkIntersections::intersectRay(const SkDQuad& quad, const SkDLine& line) { | 407 int SkIntersections::intersectRay(const SkDQuad& quad, const SkDLine& line) { |
| 407 LineQuadraticIntersections q(quad, line, this); | 408 LineQuadraticIntersections q(quad, line, this); |
| 408 fUsed = q.intersectRay(fT[0]); | 409 fUsed = q.intersectRay(fT[0]); |
| 409 for (int index = 0; index < fUsed; ++index) { | 410 for (int index = 0; index < fUsed; ++index) { |
| 410 fPt[index] = quad.ptAtT(fT[0][index]); | 411 fPt[index] = quad.ptAtT(fT[0][index]); |
| 411 } | 412 } |
| 412 return fUsed; | 413 return fUsed; |
| 413 } | 414 } |
| OLD | NEW |