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

Unified Diff: include/core/SkMatrix44.h

Issue 2098583002: SkMatrix44 clarifications and clean-ups (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkMatrix44.h
diff --git a/include/core/SkMatrix44.h b/include/core/SkMatrix44.h
index 715ee782c868d6b1b65525860934a7a4e8f73e70..6b5e65d072b451c4b6d51f7e4b9d5b5dd889a8a9 100644
--- a/include/core/SkMatrix44.h
+++ b/include/core/SkMatrix44.h
@@ -136,8 +136,15 @@ public:
kIdentity_Constructor
};
- SkMatrix44(Uninitialized_Constructor) { }
- SkMatrix44(Identity_Constructor) { this->setIdentity(); }
+ SkMatrix44(Uninitialized_Constructor) {}
+
+ constexpr SkMatrix44(Identity_Constructor)
+ : fMat{{ 1, 0, 0, 0, },
+ { 0, 1, 0, 0, },
+ { 0, 0, 1, 0, },
+ { 0, 0, 0, 1, }}
+ , fTypeMask(kIdentity_Mask)
+ {}
SK_ATTR_DEPRECATED("use the constructors that take an enum")
SkMatrix44() { this->setIdentity(); }
@@ -281,6 +288,10 @@ public:
* array. The given array must have room for exactly 16 entries. Whenever
* possible, they will try to use memcpy rather than an entry-by-entry
* copy.
+ *
+ * Col major indicates that consecutive elements of columns will be stored
+ * contiguously in memory. Row major indicates that consecutive elements
+ * of rows will be stored contiguously in memory.
*/
void asColMajorf(float[]) const;
void asColMajord(double[]) const;
@@ -291,6 +302,11 @@ public:
* array. The given array must have room for exactly 16 entries. Whenever
* possible, they will try to use memcpy rather than an entry-by-entry
* copy.
+ *
+ * Col major indicates that input memory will be treated as if consecutive
+ * elements of columns are stored contiguously in memory. Row major
+ * indicates that input memory will be treated as if consecutive elements
+ * of rows are stored contiguously in memory.
*/
void setColMajorf(const float[]);
void setColMajord(const double[]);
@@ -306,11 +322,12 @@ public:
#endif
/* This sets the top-left of the matrix and clears the translation and
- * perspective components (with [3][3] set to 1). */
+ * perspective components (with [3][3] set to 1). mXY is interpreted
+ * as the matrix entry at col = X, row = Y. */
void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02,
SkMScalar m10, SkMScalar m11, SkMScalar m12,
SkMScalar m20, SkMScalar m21, SkMScalar m22);
- void set3x3ColMajorf(const float[]);
+ void set3x3RowMajorf(const float[]);
void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz);
void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz);
@@ -430,6 +447,7 @@ public:
double determinant() const;
private:
+ /* This is indexed by [col][row]. */
SkMScalar fMat[4][4];
mutable unsigned fTypeMask;
@@ -439,13 +457,7 @@ private:
kAllPublic_Masks = 0xF
};
- /** Efficiently reads 12 matrix entries, ignoring the last col.
- * This is typically useful when we know the last col is (0, 0, 0, 1).
- */
void as4x3ColMajorf(float[]) const;
-
- /* This sets the top-left of the matrix and clears the
- * perspective components (with [3][3] set to 1). */
void set4x3ColMajorf(const float[]);
SkMScalar transX() const { return fMat[3][0]; }
« no previous file with comments | « no previous file | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698