| 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 "SkLineParameters.h" |    8 #include "SkLineParameters.h" | 
|    9 #include "SkPathOpsConic.h" |    9 #include "SkPathOpsConic.h" | 
|   10 #include "SkPathOpsCubic.h" |   10 #include "SkPathOpsCubic.h" | 
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  104     SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}
     }}, w }; |  104     SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}
     }}, w }; | 
|  105     return dst; |  105     return dst; | 
|  106 } |  106 } | 
|  107  |  107  | 
|  108 SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do
     uble t2, |  108 SkDPoint SkDConic::subDivide(const SkDPoint& a, const SkDPoint& c, double t1, do
     uble t2, | 
|  109         SkScalar* weight) const { |  109         SkScalar* weight) const { | 
|  110     SkDConic chopped = this->subDivide(t1, t2); |  110     SkDConic chopped = this->subDivide(t1, t2); | 
|  111     *weight = chopped.fWeight; |  111     *weight = chopped.fWeight; | 
|  112     return chopped[1]; |  112     return chopped[1]; | 
|  113 } |  113 } | 
|  114  |  | 
|  115 SkDPoint SkDConic::top(double startT, double endT, double* topT) const { |  | 
|  116     SkDConic sub = subDivide(startT, endT); |  | 
|  117     SkDPoint topPt = sub[0]; |  | 
|  118     *topT = startT; |  | 
|  119     if (topPt.fY > sub[2].fY || (topPt.fY == sub[2].fY && topPt.fX > sub[2].fX))
      { |  | 
|  120         *topT = endT; |  | 
|  121         topPt = sub[2]; |  | 
|  122     } |  | 
|  123     if (!between(sub[0].fY, sub[1].fY, sub[2].fY)) { |  | 
|  124         double extremeT; |  | 
|  125         if (FindExtrema(&sub[0].fY, sub.fWeight, &extremeT)) { |  | 
|  126             extremeT = startT + (endT - startT) * extremeT; |  | 
|  127             SkDPoint test = ptAtT(extremeT); |  | 
|  128             if (topPt.fY > test.fY || (topPt.fY == test.fY && topPt.fX > test.fX
     )) { |  | 
|  129                 *topT = extremeT; |  | 
|  130                 topPt = test; |  | 
|  131             } |  | 
|  132         } |  | 
|  133     } |  | 
|  134     return topPt; |  | 
|  135 } |  | 
| OLD | NEW |