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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 SkScalar x = SkScalarHalf(SkScalarSqrt(aminusc * aminusc + 4 * bSqd)); | 1481 SkScalar x = SkScalarHalf(SkScalarSqrt(aminusc * aminusc + 4 * bSqd)); |
1482 if (kMin_MinMaxOrBoth == MIN_MAX_OR_BOTH) { | 1482 if (kMin_MinMaxOrBoth == MIN_MAX_OR_BOTH) { |
1483 results[0] = apluscdiv2 - x; | 1483 results[0] = apluscdiv2 - x; |
1484 } else if (kMax_MinMaxOrBoth == MIN_MAX_OR_BOTH) { | 1484 } else if (kMax_MinMaxOrBoth == MIN_MAX_OR_BOTH) { |
1485 results[0] = apluscdiv2 + x; | 1485 results[0] = apluscdiv2 + x; |
1486 } else { | 1486 } else { |
1487 results[0] = apluscdiv2 - x; | 1487 results[0] = apluscdiv2 - x; |
1488 results[1] = apluscdiv2 + x; | 1488 results[1] = apluscdiv2 + x; |
1489 } | 1489 } |
1490 } | 1490 } |
| 1491 if (SkScalarIsNaN(results[0])) { |
| 1492 return false; |
| 1493 } |
1491 SkASSERT(results[0] >= 0); | 1494 SkASSERT(results[0] >= 0); |
1492 results[0] = SkScalarSqrt(results[0]); | 1495 results[0] = SkScalarSqrt(results[0]); |
1493 if (kBoth_MinMaxOrBoth == MIN_MAX_OR_BOTH) { | 1496 if (kBoth_MinMaxOrBoth == MIN_MAX_OR_BOTH) { |
| 1497 if (SkScalarIsNaN(results[1])) { |
| 1498 return false; |
| 1499 } |
1494 SkASSERT(results[1] >= 0); | 1500 SkASSERT(results[1] >= 0); |
1495 results[1] = SkScalarSqrt(results[1]); | 1501 results[1] = SkScalarSqrt(results[1]); |
1496 } | 1502 } |
1497 return true; | 1503 return true; |
1498 } | 1504 } |
1499 | 1505 |
1500 SkScalar SkMatrix::getMinScale() const { | 1506 SkScalar SkMatrix::getMinScale() const { |
1501 SkScalar factor; | 1507 SkScalar factor; |
1502 if (get_scale_factor<kMin_MinMaxOrBoth>(this->getType(), fMat, &factor)) { | 1508 if (get_scale_factor<kMin_MinMaxOrBoth>(this->getType(), fMat, &factor)) { |
1503 return factor; | 1509 return factor; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 const SkScalar m11 = m00; | 1792 const SkScalar m11 = m00; |
1787 const SkScalar m12 = fTy; | 1793 const SkScalar m12 = fTy; |
1788 | 1794 |
1789 quad[0].set(m02, m12); | 1795 quad[0].set(m02, m12); |
1790 quad[1].set(m00 * width + m02, m10 * width + m12); | 1796 quad[1].set(m00 * width + m02, m10 * width + m12); |
1791 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); | 1797 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); |
1792 quad[3].set(m01 * height + m02, m11 * height + m12); | 1798 quad[3].set(m01 * height + m02, m11 * height + m12); |
1793 #endif | 1799 #endif |
1794 } | 1800 } |
1795 | 1801 |
OLD | NEW |