aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-05 01:16:30 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-05 01:16:30 +0000
commit722555bebbe9128783b8dbe0e897c09c9ccb88ce (patch)
treed780741ca0bfdb69da7791df65574bcd5e734e8f /include/utils
parent851af07b11ad1d5482958dcef5689bd8841b4a94 (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. Previously committed and reverted, second attempt with fix for incorrect use of SkMScalar/SkScalar. BUG= R=reed@google.com, caryclark@google.com Author: aelias@chromium.org Review URL: https://codereview.chromium.org/25484006 git-svn-id: http://skia.googlecode.com/svn/trunk@11624 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils')
-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);