Add isScale() helper function to SkMatrix44.
This will be used later in Chromium to cleanup gfx::Transform::IsScale2d().
BUG=408710,skia:997
TEST=None
R=bsalomon@google.com,danakj@chromium.org
Review URL: https://codereview.chromium.org/676583002
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index 553e8d7..90f29a9 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -225,6 +225,13 @@
return !(this->getType() & ~(kScale_Mask | kTranslate_Mask));
}
+ /**
+ * Returns true if the matrix only contains scale or is identity.
+ */
+ inline bool isScale() const {
+ return !(this->getType() & ~kScale_Mask);
+ }
+
inline bool hasPerspective() const {
return SkToBool(this->getType() & kPerspective_Mask);
}