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

Unified Diff: include/core/SkMatrix.h

Issue 806543002: add get9 and set9 to matrix, to aid in making keys (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « no previous file | src/core/SkMatrix.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkMatrix.h
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index d98830f8379f86b11b21d8d44a10628073b7eb2c..fbf8308290d07500137cf2276a4b6152dac53558 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -174,6 +174,23 @@ public:
this->setTypeMask(kUnknown_Mask);
}
+ /**
+ * Copy the 9 scalars for this matrix into buffer, in the same order as the kMScaleX
+ * enum... scalex, skewx, transx, skewy, scaley, transy, persp0, persp1, persp2
+ */
+ void get9(SkScalar buffer[9]) const {
+ memcpy(buffer, fMat, 9 * sizeof(SkScalar));
+ }
+
+ /**
+ * Set this matrix to the 9 scalars from the buffer, in the same order as the kMScaleX
+ * enum... scalex, skewx, transx, skewy, scaley, transy, persp0, persp1, persp2
+ *
+ * Note: calling set9 followed by get9 may not return the exact same values. Since the matrix
+ * is used to map non-homogeneous coordinates, it is free to rescale the 9 values as needed.
+ */
+ void set9(const SkScalar buffer[9]);
+
/** Set the matrix to identity
*/
void reset();
@@ -372,7 +389,12 @@ public:
and does not change the passed array.
@param affine The array to fill with affine values. Ignored if NULL.
*/
- bool asAffine(SkScalar affine[6]) const;
+ bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const;
+
+ /** Set the matrix to the specified affine values.
+ * Note: these are passed in column major order.
+ */
+ void setAffine(const SkScalar affine[6]);
/** Apply this matrix to the array of points specified by src, and write
the transformed points into the array of points specified by dst.
« no previous file with comments | « no previous file | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698