aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 03:27:47 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 03:27:47 +0000
commitf8b1ebc35b6872c2805a22481b7c23b85486fb46 (patch)
tree727b21c8d9bbd2bda8bfd0778f696cd21ef5beb6 /include/utils
parentc1f224ac07b1310211e0219a4d6bda41e49abe90 (diff)
add helpers for isTranslate and isScaleTranslate
special-case determinant for isScaleTranslate git-svn-id: http://skia.googlecode.com/svn/trunk@6725 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/SkMatrix44.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index 2e1872e644..af61a11c68 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -150,8 +150,25 @@ public:
return (TypeMask)fTypeMask;
}
+ /**
+ * Return true if the matrix is identity.
+ */
inline bool isIdentity() const {
- return 0 == this->getType();
+ return kIdentity_Mask == this->getType();
+ }
+
+ /**
+ * Return true if the matrix contains translate or is identity.
+ */
+ inline bool isTranslate() const {
+ return !(this->getType() & ~kTranslate_Mask);
+ }
+
+ /**
+ * Return true if the matrix only contains scale or translate or is identity.
+ */
+ inline bool isScaleTranslate() const {
+ return !(this->getType() & ~(kScale_Mask | kTranslate_Mask));
}
void setIdentity();