| Index: src/core/SkMatrix.cpp
|
| diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
|
| index b47770a23b2b02968279c0c5b7137d5feecd26df..49cffa45f577d7ead8d88316312400c0bddc51df 100644
|
| --- a/src/core/SkMatrix.cpp
|
| +++ b/src/core/SkMatrix.cpp
|
| @@ -7,6 +7,7 @@
|
|
|
| #include "SkMatrix.h"
|
| #include "SkFloatBits.h"
|
| +#include "SkRSXform.h"
|
| #include "SkString.h"
|
| #include "SkNx.h"
|
|
|
| @@ -440,6 +441,22 @@ void SkMatrix::setSinCos(SkScalar sinV, SkScalar cosV, SkScalar px, SkScalar py)
|
| this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask);
|
| }
|
|
|
| +SkMatrix& SkMatrix::setRSXform(const SkRSXform& xform) {
|
| + fMat[kMScaleX] = xform.fSCos;
|
| + fMat[kMSkewX] = -xform.fSSin;
|
| + fMat[kMTransX] = xform.fTx;
|
| +
|
| + fMat[kMSkewY] = xform.fSSin;
|
| + fMat[kMScaleY] = xform.fSCos;
|
| + fMat[kMTransY] = xform.fTy;
|
| +
|
| + fMat[kMPersp0] = fMat[kMPersp1] = 0;
|
| + fMat[kMPersp2] = 1;
|
| +
|
| + this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask);
|
| + return *this;
|
| +}
|
| +
|
| void SkMatrix::setSinCos(SkScalar sinV, SkScalar cosV) {
|
| fMat[kMScaleX] = cosV;
|
| fMat[kMSkewX] = -sinV;
|
| @@ -1823,3 +1840,15 @@ bool SkDecomposeUpper2x2(const SkMatrix& matrix,
|
|
|
| return true;
|
| }
|
| +
|
| +//////////////////////////////////////////////////////////////////////////////////////////////////
|
| +
|
| +void SkRSXform::toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const {
|
| + quad[0].set(0, 0);
|
| + quad[1].set(width, 0);
|
| + quad[2].set(width, height);
|
| + quad[3].set(0, height);
|
| + SkMatrix m;
|
| + m.setRSXform(*this).mapPoints(quad, quad, 4);
|
| +}
|
| +
|
|
|