Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: src/core/SkMatrixUtils.h

Issue 19569007: Add basic SVD support to SkMatrix. Allows you to pull out the x- and y-scale factors, sandwiched by… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove trailing white space; replace fabs() with SkScalarAbs() Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkMatrix.cpp ('k') | tests/MatrixTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrixUtils.h
diff --git a/src/core/SkMatrixUtils.h b/src/core/SkMatrixUtils.h
index 2074267b7df471b2ae02b7d86b1752a3ebf3f223..ee952b6f58296cc190756b947003e2c6200db4b0 100644
--- a/src/core/SkMatrixUtils.h
+++ b/src/core/SkMatrixUtils.h
@@ -40,4 +40,15 @@ static inline bool SkTreatAsSpriteFilter(const SkMatrix& matrix,
return SkTreatAsSprite(matrix, width, height, kSkSubPixelBitsForBilerp);
}
+/** Decomposes the upper-left 2x2 of the matrix into a rotation, followed by a non-uniform scale,
+ followed by another rotation. Returns true if successful.
+ If the scale factors are uniform, then rotation1 will be 0.
+ If there is a reflection, yScale will be negative.
+ Returns false if the matrix is degenerate.
+ */
+bool SkDecomposeUpper2x2(const SkMatrix& matrix,
+ SkScalar* rotation0,
+ SkScalar* xScale, SkScalar* yScale,
+ SkScalar* rotation1);
+
#endif
« no previous file with comments | « src/core/SkMatrix.cpp ('k') | tests/MatrixTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698