Replace GrMatrix with SkMatrix.
Review URL: https://codereview.appspot.com/6814067

git-svn-id: http://skia.googlecode.com/svn/trunk@6247 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 14c550c..08de94f 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -13,7 +13,7 @@
 #include "GrColor.h"
 #include "GrAARectRenderer.h"
 #include "GrClipData.h"
-#include "GrMatrix.h"
+#include "SkMatrix.h"
 #include "GrPaint.h"
 // not strictly needed but requires WK change in LayerTextureUpdaterCanvas to
 // remove.
@@ -322,13 +322,13 @@
      * Gets the current transformation matrix.
      * @return the current matrix.
      */
-    const GrMatrix& getMatrix() const;
+    const SkMatrix& getMatrix() const;
 
     /**
      * Sets the transformation matrix.
      * @param m the matrix to set.
      */
-    void setMatrix(const GrMatrix& m);
+    void setMatrix(const SkMatrix& m);
 
     /**
      * Sets the current transformation matrix to identity.
@@ -340,7 +340,7 @@
      * current matrix.
      * @param m the matrix to concat.
      */
-    void concatMatrix(const GrMatrix& m) const;
+    void concatMatrix(const SkMatrix& m) const;
 
 
     ///////////////////////////////////////////////////////////////////////////
@@ -389,7 +389,7 @@
     void drawRect(const GrPaint& paint,
                   const GrRect&,
                   SkScalar strokeWidth = -1,
-                  const GrMatrix* matrix = NULL);
+                  const SkMatrix* matrix = NULL);
 
     /**
      * Maps a rect of paint coordinates onto the a rect of destination
@@ -409,8 +409,8 @@
     void drawRectToRect(const GrPaint& paint,
                         const GrRect& dstRect,
                         const GrRect& srcRect,
-                        const GrMatrix* dstMatrix = NULL,
-                        const GrMatrix* srcMatrix = NULL);
+                        const SkMatrix* dstMatrix = NULL,
+                        const SkMatrix* srcMatrix = NULL);
 
     /**
      * Draws a path.
@@ -693,7 +693,7 @@
         /**
          * Initializes by pre-concat'ing the context's current matrix with the preConcat param.
          */
-        void setPreConcat(GrContext* context, const GrMatrix& preConcat, GrPaint* paint = NULL) {
+        void setPreConcat(GrContext* context, const SkMatrix& preConcat, GrPaint* paint = NULL) {
             GrAssert(NULL != context);
 
             this->restore();
@@ -727,7 +727,7 @@
          * Replaces the context's matrix with a new matrix. Returns false if the inverse matrix is
          * required to update a paint but the matrix cannot be inverted.
          */
-        bool set(GrContext* context, const GrMatrix& newMatrix, GrPaint* paint = NULL) {
+        bool set(GrContext* context, const SkMatrix& newMatrix, GrPaint* paint = NULL) {
             if (NULL != paint) {
                 if (!this->setIdentity(context, paint)) {
                     return false;
@@ -749,7 +749,7 @@
          * made, not the matrix at the time AutoMatrix was first initialized. In other words, this
          * performs an incremental update of the paint.
          */
-        void preConcat(const GrMatrix& preConcat, GrPaint* paint = NULL) {
+        void preConcat(const SkMatrix& preConcat, GrPaint* paint = NULL) {
             if (NULL != paint) {
                 paint->sourceCoordChange(preConcat);
             }
@@ -774,7 +774,7 @@
 
     private:
         GrContext*  fContext;
-        GrMatrix    fMatrix;
+        SkMatrix    fMatrix;
     };
 
     class AutoClip : GrNoncopyable {
@@ -930,11 +930,11 @@
 
     bool installPMToUPMEffect(GrTexture* texture,
                               bool swapRAndB,
-                              const GrMatrix& matrix,
+                              const SkMatrix& matrix,
                               GrEffectStage* stage);
     bool installUPMToPMEffect(GrTexture* texture,
                               bool swapRAndB,
-                              const GrMatrix& matrix,
+                              const SkMatrix& matrix,
                               GrEffectStage* stage);
 
     typedef GrRefCnt INHERITED;
diff --git a/include/gpu/GrEffectStage.h b/include/gpu/GrEffectStage.h
index 5cd0af3..f62faee 100644
--- a/include/gpu/GrEffectStage.h
+++ b/include/gpu/GrEffectStage.h
@@ -13,7 +13,7 @@
 
 #include "GrBackendEffectFactory.h"
 #include "GrEffect.h"
-#include "GrMatrix.h"
+#include "SkMatrix.h"
 #include "GrTypes.h"
 
 #include "SkShader.h"
@@ -66,11 +66,11 @@
      *
      * @param matrix    The transformation from the old coord system to the new one.
      */
-    void preConcatCoordChange(const GrMatrix& matrix) { fCoordChangeMatrix.preConcat(matrix); }
+    void preConcatCoordChange(const SkMatrix& matrix) { fCoordChangeMatrix.preConcat(matrix); }
 
     class SavedCoordChange {
     private:
-        GrMatrix fCoordChangeMatrix;
+        SkMatrix fCoordChangeMatrix;
         GR_DEBUGCODE(mutable SkAutoTUnref<const GrEffect> fEffect;)
 
         friend class GrEffectStage;
@@ -103,13 +103,13 @@
     /**
      * Gets the texture matrix. This is will be removed soon and be managed by GrEffect.
      */
-    const GrMatrix& getMatrix() const { return fMatrix; }
+    const SkMatrix& getMatrix() const { return fMatrix; }
 
     /**
      * Gets the matrix to apply at draw time. This is the original texture matrix combined with
      * any coord system changes. This will be removed when the matrix is managed by GrEffect.
      */
-    void getTotalMatrix(GrMatrix* matrix) const {
+    void getTotalMatrix(SkMatrix* matrix) const {
         *matrix = fMatrix;
         matrix->preConcat(fCoordChangeMatrix);
     }
@@ -118,7 +118,7 @@
      * Gets the matrix representing all changes of coordinate system since the GrEffect was
      * installed in the stage.
      */
-    const GrMatrix& getCoordChangeMatrix() const { return fCoordChangeMatrix; }
+    const SkMatrix& getCoordChangeMatrix() const { return fCoordChangeMatrix; }
 
     void reset() {
         GrSafeSetNull(fEffect);
@@ -132,7 +132,7 @@
         return effect;
     }
 
-    const GrEffect* setEffect(const GrEffect* effect, const GrMatrix& matrix) {
+    const GrEffect* setEffect(const GrEffect* effect, const SkMatrix& matrix) {
         GrAssert(0 == fSavedCoordChangeCnt);
         GrSafeAssign(fEffect, effect);
         fMatrix = matrix;
@@ -143,8 +143,8 @@
     const GrEffect* getEffect() const { return fEffect; }
 
 private:
-    GrMatrix            fCoordChangeMatrix;
-    GrMatrix            fMatrix; // TODO: remove this, store in GrEffect
+    SkMatrix            fCoordChangeMatrix;
+    SkMatrix            fMatrix; // TODO: remove this, store in GrEffect
     const GrEffect*     fEffect;
 
     GR_DEBUGCODE(mutable int fSavedCoordChangeCnt;)
diff --git a/include/gpu/GrMatrix.h b/include/gpu/GrMatrix.h
deleted file mode 100644
index 055680a..0000000
--- a/include/gpu/GrMatrix.h
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#ifndef GrMatrix_DEFINED
-#define GrMatrix_DEFINED
-
-#include "GrRect.h"
-#include "SkMatrix.h"
-
-typedef SkMatrix GrMatrix;
-
-#endif
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index efafd7f..0fd42f9 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -174,8 +174,8 @@
      * transformation from the old coord system to the new coord system. Returns false if the matrix
      * cannot be inverted.
      */
-    bool sourceCoordChangeByInverse(const GrMatrix& preConcatInverse) {
-        GrMatrix inv;
+    bool sourceCoordChangeByInverse(const SkMatrix& preConcatInverse) {
+        SkMatrix inv;
         bool computed = false;
         for (int i = 0; i < kMaxColorStages; ++i) {
             if (this->isColorStageEnabled(i)) {
@@ -204,7 +204,7 @@
      * Called when the source coord system is changing. preConcat gives the transformation from the
      * old coord system to the new coord system.
      */
-    void sourceCoordChange(const GrMatrix& preConcat) {
+    void sourceCoordChange(const SkMatrix& preConcat) {
         for (int i = 0; i < kMaxColorStages; ++i) {
             if (this->isColorStageEnabled(i)) {
                 fColorStages[i].preConcatCoordChange(preConcat);
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 65950a6..d41be11 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -151,8 +151,8 @@
     , fRenderTarget(NULL) {
 
         // only make sense if alloc size is pow2
-        fShiftFixedX = 31 - Gr_clz(fDesc.fWidth);
-        fShiftFixedY = 31 - Gr_clz(fDesc.fHeight);
+        fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
+        fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
     }
 
     // GrResource overrides
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 9723868..3c730df 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -13,6 +13,7 @@
 
 #include "SkTypes.h"
 #include "GrConfig.h"
+#include "SkMath.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -137,11 +138,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
- *  Return the number of leading zeros in n
- */
-extern int Gr_clz(uint32_t n);
-
-/**
  *  Return true if n is a power of 2
  */
 static inline bool GrIsPow2(unsigned n) {
@@ -152,12 +148,12 @@
  *  Return the next power of 2 >= n.
  */
 static inline uint32_t GrNextPow2(uint32_t n) {
-    return n ? (1 << (32 - Gr_clz(n - 1))) : 1;
+    return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
 }
 
 static inline int GrNextPow2(int n) {
     GrAssert(n >= 0); // this impl only works for non-neg.
-    return n ? (1 << (32 - Gr_clz(n - 1))) : 1;
+    return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
 }
 
 ///////////////////////////////////////////////////////////////////////////////