remove SkScalarMul macro

git-svn-id: http://skia.googlecode.com/svn/trunk@13145 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/utils/SkCamera.h b/include/utils/SkCamera.h
index 2e5e342..b515be9 100644
--- a/include/utils/SkCamera.h
+++ b/include/utils/SkCamera.h
@@ -14,27 +14,20 @@
 
 class SkCanvas;
 
-typedef float   SkUnitScalar;
-#define SK_UnitScalar1          SK_Scalar1
-#define SkUnitScalarMul(a, b)   SkScalarMul(a, b)
-#define SkUnitScalarDiv(a, b)   SkScalarDiv(a, b)
-
 struct SkUnit3D {
-    SkUnitScalar    fX, fY, fZ;
+    SkScalar fX, fY, fZ;
 
-    void set(SkUnitScalar x, SkUnitScalar y, SkUnitScalar z)
-    {
+    void set(SkScalar x, SkScalar y, SkScalar z) {
         fX = x; fY = y; fZ = z;
     }
-    static SkUnitScalar Dot(const SkUnit3D&, const SkUnit3D&);
+    static SkScalar Dot(const SkUnit3D&, const SkUnit3D&);
     static void Cross(const SkUnit3D&, const SkUnit3D&, SkUnit3D* cross);
 };
 
 struct SkPoint3D {
     SkScalar    fX, fY, fZ;
 
-    void set(SkScalar x, SkScalar y, SkScalar z)
-    {
+    void set(SkScalar x, SkScalar y, SkScalar z) {
         fX = x; fY = y; fZ = z;
     }
     SkScalar    normalize(SkUnit3D*) const;
@@ -46,8 +39,7 @@
 
     void reset();
 
-    void setRow(int row, SkScalar a, SkScalar b, SkScalar c, SkScalar d = 0)
-    {
+    void setRow(int row, SkScalar a, SkScalar b, SkScalar c, SkScalar d = 0) {
         SkASSERT((unsigned)row < 3);
         fMat[row][0] = a;
         fMat[row][1] = b;
@@ -69,12 +61,11 @@
     void mapPoint(const SkPoint3D& src, SkPoint3D* dst) const;
     void mapVector(const SkVector3D& src, SkVector3D* dst) const;
 
-    void mapPoint(SkPoint3D* v) const
-    {
+    void mapPoint(SkPoint3D* v) const {
         this->mapPoint(*v, v);
     }
-    void mapVector(SkVector3D* v) const
-    {
+
+    void mapVector(SkVector3D* v) const {
         this->mapVector(*v, v);
     }
 };
@@ -88,8 +79,7 @@
 
     // dot a unit vector with the patch's normal
     SkScalar dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const;
-    SkScalar dotWith(const SkVector3D& v) const
-    {
+    SkScalar dotWith(const SkVector3D& v) const {
         return this->dotWith(v.fX, v.fY, v.fZ);
     }
 
diff --git a/include/utils/SkRandom.h b/include/utils/SkRandom.h
index e71be3a..d083fc6 100644
--- a/include/utils/SkRandom.h
+++ b/include/utils/SkRandom.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2006 The Android Open Source Project
  *
@@ -6,7 +5,6 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef SkRandom_DEFINED
 #define SkRandom_DEFINED
 
@@ -103,7 +101,7 @@
         in the range [min..max).
     */
     SkScalar nextRangeScalar(SkScalar min, SkScalar max) {
-        return SkScalarMul(this->nextUScalar1(), (max - min)) + min;
+        return this->nextUScalar1() * (max - min) + min;
     }
 
     /** Return the next pseudo random number expressed as a SkScalar
@@ -257,7 +255,7 @@
      in the range [min..max).
      */
     SkScalar nextRangeScalar(SkScalar min, SkScalar max) {
-        return SkScalarMul(this->nextUScalar1(), (max - min)) + min;
+        return this->nextUScalar1() * (max - min) + min;
     }
 
     /** Return the next pseudo random number expressed as a SkScalar
diff --git a/samplecode/SampleCamera.cpp b/samplecode/SampleCamera.cpp
index e864528..c700ee4 100644
--- a/samplecode/SampleCamera.cpp
+++ b/samplecode/SampleCamera.cpp
@@ -1,10 +1,10 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+
 #include "SampleCode.h"
 #include "SkView.h"
 #include "SkCanvas.h"
@@ -57,8 +57,7 @@
 protected:
     // overrides from SkEventSink
     virtual bool onQuery(SkEvent* evt) {
-        if (SampleCode::TitleQ(*evt))
-        {
+        if (SampleCode::TitleQ(*evt)) {
             SampleCode::TitleR(evt, "Camera");
             return true;
         }
@@ -83,6 +82,7 @@
 
             paint.setAntiAlias(true);
             paint.setShader(fShaders[fShaderIndex]);
+            paint.setFilterLevel(SkPaint::kLow_FilterLevel);
             SkRect r = { -150, -150, 150, 150 };
             canvas->drawRoundRect(r, 30, 30, paint);
         }
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp
index 2e2031e..d9f9cf5 100644
--- a/src/utils/SkCamera.cpp
+++ b/src/utils/SkCamera.cpp
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2006 The Android Open Source Project
  *
@@ -6,13 +5,12 @@
  * found in the LICENSE file.
  */
 
-
 #include "SkCamera.h"
 
 static SkScalar SkScalarDotDiv(int count, const SkScalar a[], int step_a,
                                const SkScalar b[], int step_b,
                                SkScalar denom) {
-    float prod = 0;
+    SkScalar prod = 0;
     for (int i = 0; i < count; i++) {
         prod += a[0] * b[0];
         a += step_a;
@@ -23,7 +21,7 @@
 
 static SkScalar SkScalarDot(int count, const SkScalar a[], int step_a,
                                        const SkScalar b[], int step_b) {
-    float prod = 0;
+    SkScalar prod = 0;
     for (int i = 0; i < count; i++) {
         prod += a[0] * b[0];
         a += step_a;
@@ -34,10 +32,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkUnitScalar SkPoint3D::normalize(SkUnit3D* unit) const {
-    float mag = sk_float_sqrt(fX*fX + fY*fY + fZ*fZ);
+SkScalar SkPoint3D::normalize(SkUnit3D* unit) const {
+    SkScalar mag = SkScalarSqrt(fX*fX + fY*fY + fZ*fZ);
     if (mag) {
-        float scale = 1.0f / mag;
+        SkScalar scale = SkScalarInvert(mag);
         unit->fX = fX * scale;
         unit->fY = fY * scale;
         unit->fZ = fZ * scale;
@@ -47,10 +45,8 @@
     return mag;
 }
 
-SkUnitScalar SkUnit3D::Dot(const SkUnit3D& a, const SkUnit3D& b) {
-    return  SkUnitScalarMul(a.fX, b.fX) +
-            SkUnitScalarMul(a.fY, b.fY) +
-            SkUnitScalarMul(a.fZ, b.fZ);
+SkScalar SkUnit3D::Dot(const SkUnit3D& a, const SkUnit3D& b) {
+    return a.fX * b.fX + a.fY * b.fY + a.fZ * b.fZ;
 }
 
 void SkUnit3D::Cross(const SkUnit3D& a, const SkUnit3D& b, SkUnit3D* cross) {
@@ -58,9 +54,9 @@
 
     // use x,y,z, in case &a == cross or &b == cross
 
-    SkScalar x = SkUnitScalarMul(a.fY, b.fZ) - SkUnitScalarMul(a.fZ, b.fY);
-    SkScalar y = SkUnitScalarMul(a.fZ, b.fX) - SkUnitScalarMul(a.fX, b.fY);
-    SkScalar z = SkUnitScalarMul(a.fX, b.fY) - SkUnitScalarMul(a.fY, b.fX);
+    SkScalar x = a.fY * b.fZ - a.fZ * b.fY;
+    SkScalar y = a.fZ * b.fX - a.fX * b.fY;
+    SkScalar z = a.fX * b.fY - a.fY * b.fX;
 
     cross->set(x, y, z);
 }
@@ -223,9 +219,9 @@
     {
         SkScalar dot = SkUnit3D::Dot(*SkTCast<const SkUnit3D*>(&fZenith), axis);
 
-        zenith.fX = fZenith.fX - SkUnitScalarMul(dot, axis.fX);
-        zenith.fY = fZenith.fY - SkUnitScalarMul(dot, axis.fY);
-        zenith.fZ = fZenith.fZ - SkUnitScalarMul(dot, axis.fZ);
+        zenith.fX = fZenith.fX - dot * axis.fX;
+        zenith.fY = fZenith.fY - dot * axis.fY;
+        zenith.fZ = fZenith.fZ - dot * axis.fZ;
 
         SkTCast<SkPoint3D*>(&zenith)->normalize(&zenith);
     }
@@ -238,12 +234,12 @@
         SkScalar y = fObserver.fY;
         SkScalar z = fObserver.fZ;
 
-        orien->set(SkMatrix::kMScaleX, SkUnitScalarMul(x, axis.fX) - SkUnitScalarMul(z, cross.fX));
-        orien->set(SkMatrix::kMSkewX,  SkUnitScalarMul(x, axis.fY) - SkUnitScalarMul(z, cross.fY));
-        orien->set(SkMatrix::kMTransX, SkUnitScalarMul(x, axis.fZ) - SkUnitScalarMul(z, cross.fZ));
-        orien->set(SkMatrix::kMSkewY,  SkUnitScalarMul(y, axis.fX) - SkUnitScalarMul(z, zenith.fX));
-        orien->set(SkMatrix::kMScaleY, SkUnitScalarMul(y, axis.fY) - SkUnitScalarMul(z, zenith.fY));
-        orien->set(SkMatrix::kMTransY, SkUnitScalarMul(y, axis.fZ) - SkUnitScalarMul(z, zenith.fZ));
+        orien->set(SkMatrix::kMScaleX, x * axis.fX - z * cross.fX);
+        orien->set(SkMatrix::kMSkewX,  x * axis.fY - z * cross.fY);
+        orien->set(SkMatrix::kMTransX, x * axis.fZ - z * cross.fZ);
+        orien->set(SkMatrix::kMSkewY,  y * axis.fX - z * zenith.fX);
+        orien->set(SkMatrix::kMScaleY, y * axis.fY - z * zenith.fY);
+        orien->set(SkMatrix::kMTransY, y * axis.fZ - z * zenith.fZ);
         orien->set(SkMatrix::kMPersp0, axis.fX);
         orien->set(SkMatrix::kMPersp1, axis.fY);
         orien->set(SkMatrix::kMPersp2, axis.fZ);
@@ -281,7 +277,7 @@
     patchPtr = (const SkScalar*)(const void*)&diff;
     matrix->set(SkMatrix::kMTransX, SkScalarDotDiv(3, patchPtr, 1, mapPtr, 1, dot));
     matrix->set(SkMatrix::kMTransY, SkScalarDotDiv(3, patchPtr, 1, mapPtr+3, 1, dot));
-    matrix->set(SkMatrix::kMPersp2, SK_UnitScalar1);
+    matrix->set(SkMatrix::kMPersp2, SK_Scalar1);
 }
 
 ///////////////////////////////////////////////////////////////////////////////