| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  139                     } |  139                     } | 
|  140                 } |  140                 } | 
|  141                 fIntersections->insert(cubicT, lineT, pt); |  141                 fIntersections->insert(cubicT, lineT, pt); | 
|  142         skipInsert: |  142         skipInsert: | 
|  143                 ; |  143                 ; | 
|  144             } |  144             } | 
|  145         } |  145         } | 
|  146         return fIntersections->used(); |  146         return fIntersections->used(); | 
|  147     } |  147     } | 
|  148  |  148  | 
|  149     int horizontalIntersect(double axisIntercept, double roots[3]) { |  149     int horizontalIntersect(double axisIntercept, double validRoots[3]) { | 
|  150         double A, B, C, D; |  150         double A, B, C, D; | 
|  151         SkDCubic::Coefficients(&fCubic[0].fY, &A, &B, &C, &D); |  151         SkDCubic::Coefficients(&fCubic[0].fY, &A, &B, &C, &D); | 
|  152         D -= axisIntercept; |  152         D -= axisIntercept; | 
|  153         return SkDCubic::RootsValidT(A, B, C, D, roots); |  153         int realCount; | 
 |  154         double allRoots[3]; | 
 |  155         int validCount = SkDCubic::RootsValidT(A, B, C, D, allRoots, &realCount,
      validRoots); | 
 |  156         if (validCount >= 0) { | 
 |  157             return validCount; | 
 |  158         } | 
 |  159         SkDPoint calcPt = fCubic.ptAtT(validRoots[0]); | 
 |  160         if (approximately_equal(calcPt.fY, axisIntercept)) { | 
 |  161             return 1; | 
 |  162         } | 
 |  163         fCubic.searchRoots(allRoots, realCount, &validRoots[0], axisIntercept, f
     alse); | 
 |  164         return 1; | 
|  154     } |  165     } | 
|  155  |  166  | 
|  156     int horizontalIntersect(double axisIntercept, double left, double right, boo
     l flipped) { |  167     int horizontalIntersect(double axisIntercept, double left, double right, boo
     l flipped) { | 
|  157         addExactHorizontalEndPoints(left, right, axisIntercept); |  168         addExactHorizontalEndPoints(left, right, axisIntercept); | 
|  158         if (fAllowNear) { |  169         if (fAllowNear) { | 
|  159             addNearHorizontalEndPoints(left, right, axisIntercept); |  170             addNearHorizontalEndPoints(left, right, axisIntercept); | 
|  160         } |  171         } | 
|  161         double rootVals[3]; |  172         double rootVals[3]; | 
|  162         int roots = horizontalIntersect(axisIntercept, rootVals); |  173         int roots = horizontalIntersect(axisIntercept, rootVals); | 
|  163         for (int index = 0; index < roots; ++index) { |  174         for (int index = 0; index < roots; ++index) { | 
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  356 } |  367 } | 
|  357  |  368  | 
|  358 int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) { |  369 int SkIntersections::intersectRay(const SkDCubic& cubic, const SkDLine& line) { | 
|  359     LineCubicIntersections c(cubic, line, this); |  370     LineCubicIntersections c(cubic, line, this); | 
|  360     fUsed = c.intersectRay(fT[0]); |  371     fUsed = c.intersectRay(fT[0]); | 
|  361     for (int index = 0; index < fUsed; ++index) { |  372     for (int index = 0; index < fUsed; ++index) { | 
|  362         fPt[index] = cubic.ptAtT(fT[0][index]); |  373         fPt[index] = cubic.ptAtT(fT[0][index]); | 
|  363     } |  374     } | 
|  364     return fUsed; |  375     return fUsed; | 
|  365 } |  376 } | 
| OLD | NEW |