OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 // iterating more times than that. | 1127 // iterating more times than that. |
1128 const int kMaxIter = 23; | 1128 const int kMaxIter = 23; |
1129 SkPoint eval; | 1129 SkPoint eval; |
1130 int iter = 0; | 1130 int iter = 0; |
1131 SkScalar upper_t; | 1131 SkScalar upper_t; |
1132 SkScalar lower_t; | 1132 SkScalar lower_t; |
1133 // Need to invert direction of t parameter if cubic goes up | 1133 // Need to invert direction of t parameter if cubic goes up |
1134 // instead of down | 1134 // instead of down |
1135 if (cubic[3].fY > cubic[0].fY) { | 1135 if (cubic[3].fY > cubic[0].fY) { |
1136 upper_t = SK_Scalar1; | 1136 upper_t = SK_Scalar1; |
1137 lower_t = SkFloatToScalar(0); | 1137 lower_t = 0; |
1138 } else { | 1138 } else { |
1139 upper_t = SkFloatToScalar(0); | 1139 upper_t = 0; |
1140 lower_t = SK_Scalar1; | 1140 lower_t = SK_Scalar1; |
1141 } | 1141 } |
1142 do { | 1142 do { |
1143 SkScalar t = SkScalarAve(upper_t, lower_t); | 1143 SkScalar t = SkScalarAve(upper_t, lower_t); |
1144 SkEvalCubicAt(cubic, t, &eval, NULL, NULL); | 1144 SkEvalCubicAt(cubic, t, &eval, NULL, NULL); |
1145 if (pt.fY > eval.fY) { | 1145 if (pt.fY > eval.fY) { |
1146 lower_t = t; | 1146 lower_t = t; |
1147 } else { | 1147 } else { |
1148 upper_t = t; | 1148 upper_t = t; |
1149 } | 1149 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 } | 1641 } |
1642 if (this->findYExtrema(&t)) { | 1642 if (this->findYExtrema(&t)) { |
1643 this->evalAt(t, &pts[count++]); | 1643 this->evalAt(t, &pts[count++]); |
1644 } | 1644 } |
1645 bounds->set(pts, count); | 1645 bounds->set(pts, count); |
1646 } | 1646 } |
1647 | 1647 |
1648 void SkConic::computeFastBounds(SkRect* bounds) const { | 1648 void SkConic::computeFastBounds(SkRect* bounds) const { |
1649 bounds->set(fPts, 3); | 1649 bounds->set(fPts, 3); |
1650 } | 1650 } |
OLD | NEW |