add explicit mapScalars and mapMScalars entry-points, instead of just map()



git-svn-id: http://skia.googlecode.com/svn/trunk@6373 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index c59aa75..9926b79 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -186,9 +186,29 @@
     /** Apply the matrix to the src vector, returning the new vector in dst.
         It is legal for src and dst to point to the same memory.
      */
-    void map(const SkScalar src[4], SkScalar dst[4]) const;
+    void mapScalars(const SkScalar src[4], SkScalar dst[4]) const;
+    void mapScalars(SkScalar vec[4]) const {
+        this->mapScalars(vec, vec);
+    }
+
+    // DEPRECATED: call mapScalars()
+    void map(const SkScalar src[4], SkScalar dst[4]) const {
+        this->mapScalars(src, dst);
+    }
+    // DEPRECATED: call mapScalars()
     void map(SkScalar vec[4]) const {
-        this->map(vec, vec);
+        this->mapScalars(vec, vec);
+    }
+
+#ifdef SK_MSCALAR_IS_DOUBLE
+    void mapMScalars(SkMScalar src[4], SkMScalar dst[4]) const;
+#else
+    void mapMScalars(SkMScalar src[4], SkMScalar dst[4]) const {
+        this->mapScalars(src, dst);
+    }
+#endif
+    void mapMScalars(SkMScalar vec[4]) const {
+        this->mapMScalars(vec, vec);
     }
 
     friend SkVector4 operator*(const SkMatrix44& m, const SkVector4& src) {
diff --git a/src/utils/SkMatrix44.cpp b/src/utils/SkMatrix44.cpp
index f00e399..4fe82de 100644
--- a/src/utils/SkMatrix44.cpp
+++ b/src/utils/SkMatrix44.cpp
@@ -323,7 +323,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void SkMatrix44::map(const SkScalar src[4], SkScalar dst[4]) const {
+void SkMatrix44::mapScalars(const SkScalar src[4], SkScalar dst[4]) const {
     SkScalar result[4];
     for (int i = 0; i < 4; i++) {
         SkMScalar value = 0;
@@ -335,6 +335,20 @@
     memcpy(dst, result, sizeof(result));
 }
 
+#ifdef SK_MSCALAR_IS_DOUBLE
+void SkMatrix44::mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const {
+    SkMScalar result[4];
+    for (int i = 0; i < 4; i++) {
+        SkMScalar value = 0;
+        for (int j = 0; j < 4; j++) {
+            value += fMat[j][i] * src[j];
+        }
+        result[i] = SkMScalarToScalar(value);
+    }
+    memcpy(dst, result, sizeof(result));
+}
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 
 void SkMatrix44::dump() const {
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index 6e70c5f..9065358 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -95,7 +95,7 @@
     d.preConcat(b);
     REPORTER_ASSERT(reporter, d == c);
     
-    c.map(src, dst); c.map(src + 4, dst + 4);
+    c.mapScalars(src, dst); c.mapScalars(src + 4, dst + 4);
     for (i = 0; i < 3; ++i) {
         REPORTER_ASSERT(reporter, 10 == dst[i]);
         REPORTER_ASSERT(reporter, 12 == dst[i + 4]);
@@ -107,7 +107,7 @@
     d.postConcat(b);
     REPORTER_ASSERT(reporter, d == c);
 
-    c.map(src, dst); c.map(src + 4, dst + 4);
+    c.mapScalars(src, dst); c.mapScalars(src + 4, dst + 4);
     for (i = 0; i < 3; ++i) {
         REPORTER_ASSERT(reporter, 20 == dst[i]);
         REPORTER_ASSERT(reporter, 22 == dst[i + 4]);