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 "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
10 #include "SkRSXform.h" | 10 #include "SkRSXform.h" |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 SkScalar x = SkScalarHalf(SkScalarSqrt(aminusc * aminusc + 4 * bSqd)); | 1468 SkScalar x = SkScalarHalf(SkScalarSqrt(aminusc * aminusc + 4 * bSqd)); |
1469 if (kMin_MinMaxOrBoth == MIN_MAX_OR_BOTH) { | 1469 if (kMin_MinMaxOrBoth == MIN_MAX_OR_BOTH) { |
1470 results[0] = apluscdiv2 - x; | 1470 results[0] = apluscdiv2 - x; |
1471 } else if (kMax_MinMaxOrBoth == MIN_MAX_OR_BOTH) { | 1471 } else if (kMax_MinMaxOrBoth == MIN_MAX_OR_BOTH) { |
1472 results[0] = apluscdiv2 + x; | 1472 results[0] = apluscdiv2 + x; |
1473 } else { | 1473 } else { |
1474 results[0] = apluscdiv2 - x; | 1474 results[0] = apluscdiv2 - x; |
1475 results[1] = apluscdiv2 + x; | 1475 results[1] = apluscdiv2 + x; |
1476 } | 1476 } |
1477 } | 1477 } |
| 1478 if (SkScalarIsNaN(results[0])) { |
| 1479 return false; |
| 1480 } |
1478 SkASSERT(results[0] >= 0); | 1481 SkASSERT(results[0] >= 0); |
1479 results[0] = SkScalarSqrt(results[0]); | 1482 results[0] = SkScalarSqrt(results[0]); |
1480 if (kBoth_MinMaxOrBoth == MIN_MAX_OR_BOTH) { | 1483 if (kBoth_MinMaxOrBoth == MIN_MAX_OR_BOTH) { |
| 1484 if (SkScalarIsNaN(results[1])) { |
| 1485 return false; |
| 1486 } |
1481 SkASSERT(results[1] >= 0); | 1487 SkASSERT(results[1] >= 0); |
1482 results[1] = SkScalarSqrt(results[1]); | 1488 results[1] = SkScalarSqrt(results[1]); |
1483 } | 1489 } |
1484 return true; | 1490 return true; |
1485 } | 1491 } |
1486 | 1492 |
1487 SkScalar SkMatrix::getMinScale() const { | 1493 SkScalar SkMatrix::getMinScale() const { |
1488 SkScalar factor; | 1494 SkScalar factor; |
1489 if (get_scale_factor<kMin_MinMaxOrBoth>(this->getType(), fMat, &factor)) { | 1495 if (get_scale_factor<kMin_MinMaxOrBoth>(this->getType(), fMat, &factor)) { |
1490 return factor; | 1496 return factor; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 const SkScalar m11 = m00; | 1779 const SkScalar m11 = m00; |
1774 const SkScalar m12 = fTy; | 1780 const SkScalar m12 = fTy; |
1775 | 1781 |
1776 quad[0].set(m02, m12); | 1782 quad[0].set(m02, m12); |
1777 quad[1].set(m00 * width + m02, m10 * width + m12); | 1783 quad[1].set(m00 * width + m02, m10 * width + m12); |
1778 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); | 1784 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); |
1779 quad[3].set(m01 * height + m02, m11 * height + m12); | 1785 quad[3].set(m01 * height + m02, m11 * height + m12); |
1780 #endif | 1786 #endif |
1781 } | 1787 } |
1782 | 1788 |
OLD | NEW |