optimize translate and scale
add map2() to optimize for mapping an array of 2D points into homogeneous 4-vector
Review URL: https://codereview.appspot.com/6874064

git-svn-id: http://skia.googlecode.com/svn/trunk@6685 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index f63f0df..565fcf5 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -37,7 +37,7 @@
 #endif
     typedef float SkMScalar;
     typedef int32_t SkMIntScalar;
-
+    
     static inline float SkFloatToMScalar(float x) {
         return x;
     }
@@ -134,7 +134,7 @@
         kAffine_Mask        = 0x04,  //!< set if the matrix skews or rotates
         kPerspective_Mask   = 0x08   //!< set if the matrix is in perspective
     };
-
+    
     /**
      *  Returns a bitfield describing the transformations the matrix may
      *  perform. The bitfield is computed conservatively, so it may include
@@ -153,7 +153,7 @@
     inline bool isIdentity() const {
         return 0 == this->getType();
     }
-
+    
     void setIdentity();
     inline void reset() { this->setIdentity();}
 
@@ -309,6 +309,17 @@
         return dst;
     }
 
+    /**
+     *  map an array of [x, y, 0, 1] through the matrix, returning an array
+     *  of [x', y', z', w'].
+     *
+     *  @param src2     array of [x, y] pairs, with implied z=0 and w=1
+     *  @param count    number of [x, y] pairs in src2
+     *  @param dst4     array of [x', y', z', w'] quads as the output.
+     */
+    void map2(const float src2[], int count, float dst4[]) const;
+    void map2(const double src2[], int count, double dst4[]) const;
+
     void dump() const;
 
     double determinant() const;
@@ -319,7 +330,7 @@
     // we are always packed with no extra bits, allowing us to call memcpy
     // without fear of copying uninitialized bits.
     mutable SkMIntScalar    fTypeMask;
-
+    
     enum {
         kUnknown_Mask = 0x80,
 
@@ -333,7 +344,7 @@
     SkMScalar scaleX() const { return fMat[0][0]; }
     SkMScalar scaleY() const { return fMat[1][1]; }
     SkMScalar scaleZ() const { return fMat[2][2]; }
-
+    
     SkMScalar perspX() const { return fMat[0][3]; }
     SkMScalar perspY() const { return fMat[1][3]; }
     SkMScalar perspZ() const { return fMat[2][3]; }