| Index: src/core/SkMatrix.cpp
|
| diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
|
| index 9658177ec913e3b3e091104d31224e798532df70..753c4dc61e0c8c7f50032c7e2d6d9be613977b51 100644
|
| --- a/src/core/SkMatrix.cpp
|
| +++ b/src/core/SkMatrix.cpp
|
| @@ -1603,6 +1603,28 @@ const SkMatrix& SkMatrix::InvalidMatrix() {
|
| return invalid.asSkMatrix();
|
| }
|
|
|
| +bool SkMatrix::decomposeScale(SkSize* scale, SkMatrix* remaining) const {
|
| + if (this->hasPerspective()) {
|
| + return false;
|
| + }
|
| +
|
| + const SkScalar sx = SkVector::Length(this->getScaleX(), this->getSkewY());
|
| + const SkScalar sy = SkVector::Length(this->getSkewX(), this->getScaleY());
|
| + if (!SkScalarIsFinite(sx) || !SkScalarIsFinite(sy) ||
|
| + SkScalarNearlyZero(sx) || SkScalarNearlyZero(sy)) {
|
| + return false;
|
| + }
|
| +
|
| + if (scale) {
|
| + scale->set(sx, sy);
|
| + }
|
| + if (remaining) {
|
| + *remaining = *this;
|
| + remaining->postScale(SkScalarInvert(sx), SkScalarInvert(sy));
|
| + }
|
| + return true;
|
| +}
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| size_t SkMatrix::writeToMemory(void* buffer) const {
|
|
|