| 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 "SkPathOpsCurve.h" | 9 #include "SkPathOpsCurve.h" |
| 10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 fIntersections->setCoincident(index); | 116 fIntersections->setCoincident(index); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 // see parallel routine in line quadratic intersections | 120 // see parallel routine in line quadratic intersections |
| 121 int intersectRay(double roots[3]) { | 121 int intersectRay(double roots[3]) { |
| 122 double adj = fLine[1].fX - fLine[0].fX; | 122 double adj = fLine[1].fX - fLine[0].fX; |
| 123 double opp = fLine[1].fY - fLine[0].fY; | 123 double opp = fLine[1].fY - fLine[0].fY; |
| 124 SkDCubic c; | 124 SkDCubic c; |
| 125 SkDEBUGCODE(c.fDebugGlobalState = fIntersections->globalState()); |
| 125 for (int n = 0; n < 4; ++n) { | 126 for (int n = 0; n < 4; ++n) { |
| 126 c[n].fX = (fCubic[n].fY - fLine[0].fY) * adj - (fCubic[n].fX - fLine
[0].fX) * opp; | 127 c[n].fX = (fCubic[n].fY - fLine[0].fY) * adj - (fCubic[n].fX - fLine
[0].fX) * opp; |
| 127 } | 128 } |
| 128 double A, B, C, D; | 129 double A, B, C, D; |
| 129 SkDCubic::Coefficients(&c[0].fX, &A, &B, &C, &D); | 130 SkDCubic::Coefficients(&c[0].fX, &A, &B, &C, &D); |
| 130 int count = SkDCubic::RootsValidT(A, B, C, D, roots); | 131 int count = SkDCubic::RootsValidT(A, B, C, D, roots); |
| 131 for (int index = 0; index < count; ++index) { | 132 for (int index = 0; index < count; ++index) { |
| 132 SkDPoint calcPt = c.ptAtT(roots[index]); | 133 SkDPoint calcPt = c.ptAtT(roots[index]); |
| 133 if (!approximately_zero(calcPt.fX)) { | 134 if (!approximately_zero(calcPt.fX)) { |
| 134 for (int n = 0; n < 4; ++n) { | 135 for (int n = 0; n < 4; ++n) { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 446 |
| 446 // SkDCubic accessors to Intersection utilities | 447 // SkDCubic accessors to Intersection utilities |
| 447 | 448 |
| 448 int SkDCubic::horizontalIntersect(double yIntercept, double roots[3]) const { | 449 int SkDCubic::horizontalIntersect(double yIntercept, double roots[3]) const { |
| 449 return LineCubicIntersections::HorizontalIntersect(*this, yIntercept, roots)
; | 450 return LineCubicIntersections::HorizontalIntersect(*this, yIntercept, roots)
; |
| 450 } | 451 } |
| 451 | 452 |
| 452 int SkDCubic::verticalIntersect(double xIntercept, double roots[3]) const { | 453 int SkDCubic::verticalIntersect(double xIntercept, double roots[3]) const { |
| 453 return LineCubicIntersections::VerticalIntersect(*this, xIntercept, roots); | 454 return LineCubicIntersections::VerticalIntersect(*this, xIntercept, roots); |
| 454 } | 455 } |
| OLD | NEW |