Optimization pass on Transform, to take advantage of SkMatrix44::getType()

Also use the 1 and 2 parameter constructors to avoid creating a default Transform, only to immediately set it.
Review URL: https://codereview.chromium.org/11442018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171819 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
index 6d1ce1e..2be72efd 100644
--- a/ui/gfx/transform.h
+++ b/ui/gfx/transform.h
@@ -21,6 +21,9 @@
 class UI_EXPORT Transform {
  public:
   Transform();
+  Transform(const Transform& rhs);
+  // Initialize with the concatenation of lhs * rhs.
+  Transform(const Transform& lhs, const Transform& rhs);
   ~Transform();
 
   bool operator==(const Transform& rhs) const;
@@ -68,10 +71,12 @@
   void ConcatTransform(const Transform& transform);
 
   // Returns true if this is the identity matrix.
-  bool IsIdentity() const;
+  bool IsIdentity() const { return matrix_.isIdentity(); }
 
   // Returns true if the matrix is either identity or pure translation.
-  bool IsIdentityOrTranslation() const;
+  bool IsIdentityOrTranslation() const {
+    return !(matrix_.getType() & ~SkMatrix44::kTranslate_Mask);
+  }
 
   // Returns true if the matrix is either identity or pure, non-fractional
   // translation.
@@ -136,7 +141,9 @@
   bool Blend(const Transform& from, double progress);
 
   // Returns |this| * |other|.
-  Transform operator*(const Transform& other) const;
+  Transform operator*(const Transform& other) const {
+    return Transform(*this, other);
+  }
 
   // Sets |this| = |this| * |other|
   Transform& operator*=(const Transform& other);