aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils/SkMatrix44.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-04 20:38:08 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-04 20:38:08 +0000
commit761f860a427e9ebb088c4d1e5fba04deb29b5a6f (patch)
tree3a90988245495b04d8bc2095a017df75c320d642 /include/utils/SkMatrix44.h
parent6b30e457409f37c91c301cd82040e733e2930286 (diff)
Add perspective support to SkMatrix44 initializers.
I noticed SkMatrix <-> SkMatrix44 conversions were dropping the perspective values on the floor. As we use SkMatrix44 heavily in Chromium, I'm concerned this missing code will cause a bug eventually. It should be correct to simply use the bottom row of the 4x4 matrix excluding the third column. BUG= R=reed@google.com Author: aelias@chromium.org Review URL: https://codereview.chromium.org/25484006 git-svn-id: http://skia.googlecode.com/svn/trunk@11622 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils/SkMatrix44.h')
-rw-r--r--include/utils/SkMatrix44.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index 6e85bb56f4..9282770588 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -137,6 +137,14 @@ public:
return !(other == *this);
}
+ /* When converting from SkMatrix44 to SkMatrix, the third row and
+ * column is dropped. When converting from SkMatrix to SkMatrix44
+ * the third row and column remain as identity:
+ * [ a b c ] [ a b 0 c ]
+ * [ d e f ] -> [ d e 0 f ]
+ * [ g h i ] [ 0 0 1 0 ]
+ * [ g h 0 i ]
+ */
SkMatrix44(const SkMatrix&);
SkMatrix44& operator=(const SkMatrix& src);
operator SkMatrix() const;
@@ -259,6 +267,8 @@ public:
void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); }
#endif
+ /* This sets the top-left of the matrix and clears the translation and
+ * perspective components (with [3][3] set to 1). */
void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02,
SkMScalar m10, SkMScalar m11, SkMScalar m12,
SkMScalar m20, SkMScalar m21, SkMScalar m22);