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 "SkString.h" | 10 #include "SkString.h" |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 if (length < sizeInMemory) { | 1585 if (length < sizeInMemory) { |
1586 return 0; | 1586 return 0; |
1587 } | 1587 } |
1588 if (buffer) { | 1588 if (buffer) { |
1589 memcpy(fMat, buffer, sizeInMemory); | 1589 memcpy(fMat, buffer, sizeInMemory); |
1590 this->setTypeMask(kUnknown_Mask); | 1590 this->setTypeMask(kUnknown_Mask); |
1591 } | 1591 } |
1592 return sizeInMemory; | 1592 return sizeInMemory; |
1593 } | 1593 } |
1594 | 1594 |
1595 #ifdef SK_DEVELOPER | |
1596 void SkMatrix::dump() const { | 1595 void SkMatrix::dump() const { |
1597 SkString str; | 1596 SkString str; |
1598 this->toString(&str); | 1597 this->toString(&str); |
1599 SkDebugf("%s\n", str.c_str()); | 1598 SkDebugf("%s\n", str.c_str()); |
1600 } | 1599 } |
1601 #endif | |
1602 | 1600 |
1603 #ifndef SK_IGNORE_TO_STRING | |
1604 void SkMatrix::toString(SkString* str) const { | 1601 void SkMatrix::toString(SkString* str) const { |
1605 str->appendf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]", | 1602 str->appendf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]", |
1606 fMat[0], fMat[1], fMat[2], fMat[3], fMat[4], fMat[5], | 1603 fMat[0], fMat[1], fMat[2], fMat[3], fMat[4], fMat[5], |
1607 fMat[6], fMat[7], fMat[8]); | 1604 fMat[6], fMat[7], fMat[8]); |
1608 } | 1605 } |
1609 #endif | |
1610 | 1606 |
1611 /////////////////////////////////////////////////////////////////////////////// | 1607 /////////////////////////////////////////////////////////////////////////////// |
1612 | 1608 |
1613 #include "SkMatrixUtils.h" | 1609 #include "SkMatrixUtils.h" |
1614 | 1610 |
1615 bool SkTreatAsSprite(const SkMatrix& mat, int width, int height, | 1611 bool SkTreatAsSprite(const SkMatrix& mat, int width, int height, |
1616 unsigned subpixelBits) { | 1612 unsigned subpixelBits) { |
1617 // quick reject on affine or perspective | 1613 // quick reject on affine or perspective |
1618 if (mat.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask)) { | 1614 if (mat.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask)) { |
1619 return false; | 1615 return false; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 rotation1->fX = cos1; | 1750 rotation1->fX = cos1; |
1755 rotation1->fY = sin1; | 1751 rotation1->fY = sin1; |
1756 } | 1752 } |
1757 if (rotation2) { | 1753 if (rotation2) { |
1758 rotation2->fX = cos2; | 1754 rotation2->fX = cos2; |
1759 rotation2->fY = sin2; | 1755 rotation2->fY = sin2; |
1760 } | 1756 } |
1761 | 1757 |
1762 return true; | 1758 return true; |
1763 } | 1759 } |
OLD | NEW |