Index: src/core/SkMatrix.cpp |
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp |
index 9658177ec913e3b3e091104d31224e798532df70..0c7f110b13dc16cd9e549e59af7261c1b6a46df5 100644 |
--- a/src/core/SkMatrix.cpp |
+++ b/src/core/SkMatrix.cpp |
@@ -1603,6 +1603,27 @@ 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 (0 == sx || 0 == sy) { |
+ return false; |
+ } |
+ |
+ if (scale) { |
+ scale->set(sx, sy); |
+ } |
+ if (remaining) { |
+ *remaining = *this; |
+ remaining->postScale(SkScalarInvert(sx), SkScalarInvert(sy)); |
Stephen White
2015/03/19 18:27:50
Hmm.. for my uses, I was also extracting the trans
|
+ } |
+ return true; |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
size_t SkMatrix::writeToMemory(void* buffer) const { |