Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 | 7 |
| 8 #include "SkGeometry.h" | 8 #include "SkGeometry.h" |
| 9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 } | 95 } |
| 96 | 96 |
| 97 if (denom == 0 || numer == 0 || numer >= denom) { | 97 if (denom == 0 || numer == 0 || numer >= denom) { |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| 100 | 100 |
| 101 SkScalar r = SkScalarDiv(numer, denom); | 101 SkScalar r = SkScalarDiv(numer, denom); |
| 102 if (SkScalarIsNaN(r)) { | 102 if (SkScalarIsNaN(r)) { |
| 103 return 0; | 103 return 0; |
| 104 } | 104 } |
| 105 SkASSERT(r >= 0 && r < SK_Scalar1); | 105 SkASSERTF(r >= 0 && r < SK_Scalar1, "numer %f, denom %f, r %f", numer, denom , r); |
|
tfarina
2014/09/12 17:16:23
lgtm (rubber-stamp).
| |
| 106 if (r == 0) { // catch underflow if numer <<<< denom | 106 if (r == 0) { // catch underflow if numer <<<< denom |
| 107 return 0; | 107 return 0; |
| 108 } | 108 } |
| 109 *ratio = r; | 109 *ratio = r; |
| 110 return 1; | 110 return 1; |
| 111 } | 111 } |
| 112 | 112 |
| 113 /** From Numerical Recipes in C. | 113 /** From Numerical Recipes in C. |
| 114 | 114 |
| 115 Q = -1/2 (B + sign(B) sqrt[B*B - 4*A*C]) | 115 Q = -1/2 (B + sign(B) sqrt[B*B - 4*A*C]) |
| (...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 void SkConic::computeFastBounds(SkRect* bounds) const { | 1461 void SkConic::computeFastBounds(SkRect* bounds) const { |
| 1462 bounds->set(fPts, 3); | 1462 bounds->set(fPts, 3); |
| 1463 } | 1463 } |
| 1464 | 1464 |
| 1465 bool SkConic::findMaxCurvature(SkScalar* t) const { | 1465 bool SkConic::findMaxCurvature(SkScalar* t) const { |
| 1466 // TODO: Implement me | 1466 // TODO: Implement me |
| 1467 return false; | 1467 return false; |
| 1468 } | 1468 } |
| OLD | NEW |