Replace uses of GrAssert by SkASSERT.

R=bsalomon@google.com

Review URL: https://codereview.chromium.org/22850006

git-svn-id: http://skia.googlecode.com/svn/trunk@10789 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrBackendEffectFactory.h b/include/gpu/GrBackendEffectFactory.h
index 2811443..6a18169 100644
--- a/include/gpu/GrBackendEffectFactory.h
+++ b/include/gpu/GrBackendEffectFactory.h
@@ -73,7 +73,7 @@
         // atomic inc returns the old value not the incremented value. So we add
         // 1 to the returned value.
         int32_t id = sk_atomic_inc(&fCurrEffectClassID) + 1;
-        GrAssert(id < (1 << kClassIDBits));
+        SkASSERT(id < (1 << kClassIDBits));
         return static_cast<EffectKey>(id);
     }
 
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
index 3ded8fb..cf7e7df 100644
--- a/include/gpu/GrColor.h
+++ b/include/gpu/GrColor.h
@@ -35,10 +35,10 @@
  */
 static inline GrColor GrColorPackRGBA(unsigned r, unsigned g,
                                       unsigned b, unsigned a) {
-    GrAssert((uint8_t)r == r);
-    GrAssert((uint8_t)g == g);
-    GrAssert((uint8_t)b == b);
-    GrAssert((uint8_t)a == a);
+    SkASSERT((uint8_t)r == r);
+    SkASSERT((uint8_t)g == g);
+    SkASSERT((uint8_t)b == b);
+    SkASSERT((uint8_t)a == a);
     return  (r << GrColor_SHIFT_R) |
             (g << GrColor_SHIFT_G) |
             (b << GrColor_SHIFT_B) |
@@ -85,7 +85,7 @@
 };
 
 static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) {
-    GrAssert(GrIsPow2(component));
+    SkASSERT(GrIsPow2(component));
     switch (component) {
         case kR_GrColorComponentFlag:
             return 'r';
@@ -102,7 +102,7 @@
 }
 
 static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
-    GrAssert(config >= 0 && config < kGrPixelConfigCnt);
+    SkASSERT(config >= 0 && config < kGrPixelConfigCnt);
     static const uint32_t kFlags[] = {
         0,                              // kUnknown_GrPixelConfig
         kA_GrColorComponentFlag,        // kAlpha_8_GrPixelConfig
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index 95e518a..df53fa2 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -276,7 +276,6 @@
 /**
  *  Prettier forms of the above macros.
  */
-#define GrAssert(COND) GR_DEBUGASSERT(COND)
 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND)
 
 /**
@@ -285,8 +284,8 @@
  */
 inline void GrCrash() { GrAlwaysAssert(false); }
 inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
-inline void GrDebugCrash() { GrAssert(false); }
-inline void GrDebugCrash(const char* msg) { GrPrintf(msg); GrAssert(false); }
+inline void GrDebugCrash() { SkASSERT(false); }
+inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); }
 
 /**
  *  GR_DEBUGCODE compiles the code X in debug builds only
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 13df5ce..759c7e4 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -678,7 +678,7 @@
          * Initializes by pre-concat'ing the context's current matrix with the preConcat param.
          */
         void setPreConcat(GrContext* context, const SkMatrix& preConcat, GrPaint* paint = NULL) {
-            GrAssert(NULL != context);
+            SkASSERT(NULL != context);
 
             this->restore();
 
@@ -692,7 +692,7 @@
          * update a paint but the matrix cannot be inverted.
          */
         bool setIdentity(GrContext* context, GrPaint* paint = NULL) {
-            GrAssert(NULL != context);
+            SkASSERT(NULL != context);
 
             this->restore();
 
@@ -772,7 +772,7 @@
 
         AutoClip(GrContext* context, InitialClip initialState)
         : fContext(context) {
-            GrAssert(kWideOpen_InitialClip == initialState);
+            SkASSERT(kWideOpen_InitialClip == initialState);
             fNewClipData.fClipStack = &fNewClipStack;
 
             fOldClip = context->getClip();
@@ -808,7 +808,7 @@
             , fAutoRT(ctx, rt) {
             fAutoMatrix.setIdentity(ctx);
             // should never fail with no paint param.
-            GrAssert(fAutoMatrix.succeeded());
+            SkASSERT(fAutoMatrix.succeeded());
         }
 
     private:
@@ -987,10 +987,10 @@
         // The cache also has a ref which we are lending to the caller of detach(). When the caller
         // lets go of the ref and the ref count goes to 0 internal_dispose will see this flag is
         // set and re-ref the texture, thereby restoring the cache's ref.
-        GrAssert(texture->getRefCnt() > 1);
+        SkASSERT(texture->getRefCnt() > 1);
         texture->setFlag((GrTextureFlags) GrTexture::kReturnToCache_FlagBit);
         texture->unref();
-        GrAssert(NULL != texture->getCacheEntry());
+        SkASSERT(NULL != texture->getCacheEntry());
 
         return texture;
     }
diff --git a/include/gpu/GrDrawEffect.h b/include/gpu/GrDrawEffect.h
index 005de41..8dae646 100644
--- a/include/gpu/GrDrawEffect.h
+++ b/include/gpu/GrDrawEffect.h
@@ -22,8 +22,8 @@
     GrDrawEffect(const GrEffectStage& stage, bool explicitLocalCoords)
         : fEffectStage(&stage)
         , fExplicitLocalCoords(explicitLocalCoords) {
-        GrAssert(NULL != fEffectStage);
-        GrAssert(NULL != fEffectStage->getEffect());
+        SkASSERT(NULL != fEffectStage);
+        SkASSERT(NULL != fEffectStage->getEffect());
     }
     const GrEffectRef* effect() const { return fEffectStage->getEffect(); }
 
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index 20dc5da..d8757b2 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -167,7 +167,7 @@
     /** Useful for effects that want to insert a texture matrix that is implied by the texture
         dimensions */
     static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) {
-        GrAssert(NULL != texture);
+        SkASSERT(NULL != texture);
         SkMatrix mat;
         mat.setIDiv(texture->width(), texture->height());
         return mat;
@@ -235,7 +235,7 @@
 
     /** Used by GR_CREATE_STATIC_EFFECT below */
     static GrEffectRef* CreateStaticEffectRef(void* refStorage, GrEffect* effect) {
-        GrAssert(NULL == effect->fEffectRef);
+        SkASSERT(NULL == effect->fEffectRef);
         effect->fEffectRef = SkNEW_PLACEMENT_ARGS(refStorage, GrEffectRef, (effect));
         return effect->fEffectRef;
     }
@@ -289,9 +289,9 @@
         bool result = this->onIsEqual(other);
 #if GR_DEBUG
         if (result) {
-            GrAssert(this->numTextures() == other.numTextures());
+            SkASSERT(this->numTextures() == other.numTextures());
             for (int i = 0; i < this->numTextures(); ++i) {
-                GrAssert(*fTextureAccesses[i] == *other.fTextureAccesses[i]);
+                SkASSERT(*fTextureAccesses[i] == *other.fTextureAccesses[i]);
             }
         }
 #endif
@@ -320,7 +320,7 @@
 };
 
 inline GrEffectRef::GrEffectRef(GrEffect* effect) {
-    GrAssert(NULL != effect);
+    SkASSERT(NULL != effect);
     effect->ref();
     fEffect = effect;
 }
diff --git a/include/gpu/GrEffectStage.h b/include/gpu/GrEffectStage.h
index 08fb159..561a789 100644
--- a/include/gpu/GrEffectStage.h
+++ b/include/gpu/GrEffectStage.h
@@ -48,8 +48,8 @@
     }
 
     bool operator== (const GrEffectStage& other) const {
-        GrAssert(NULL != fEffectRef.get());
-        GrAssert(NULL != other.fEffectRef.get());
+        SkASSERT(NULL != fEffectRef.get());
+        SkASSERT(NULL != other.fEffectRef.get());
 
         if (!(*this->getEffect())->isEqual(*other.getEffect())) {
             return false;
@@ -103,7 +103,7 @@
         if (fCoordChangeMatrixSet) {
             savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix;
         }
-        GrAssert(NULL == savedCoordChange->fEffectRef.get());
+        SkASSERT(NULL == savedCoordChange->fEffectRef.get());
         GR_DEBUGCODE(SkRef(fEffectRef.get());)
         GR_DEBUGCODE(savedCoordChange->fEffectRef.reset(fEffectRef.get());)
     }
@@ -116,7 +116,7 @@
         if (fCoordChangeMatrixSet) {
             fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix;
         }
-        GrAssert(savedCoordChange.fEffectRef.get() == fEffectRef);
+        SkASSERT(savedCoordChange.fEffectRef.get() == fEffectRef);
         GR_DEBUGCODE(savedCoordChange.fEffectRef.reset(NULL);)
     }
 
@@ -137,8 +137,8 @@
         }
 
         void saveFrom(const GrEffectStage& stage) {
-            GrAssert(!fInitialized);
-            GrAssert(NULL != stage.fEffectRef.get());
+            SkASSERT(!fInitialized);
+            SkASSERT(NULL != stage.fEffectRef.get());
             stage.fEffectRef->get()->incDeferredRefCounts();
             fEffect = stage.fEffectRef->get();
             fCoordChangeMatrixSet = stage.fCoordChangeMatrixSet;
@@ -151,7 +151,7 @@
         }
 
         void restoreTo(GrEffectStage* stage) const {
-            GrAssert(fInitialized);
+            SkASSERT(fInitialized);
             stage->fEffectRef.reset(GrEffect::CreateEffectRef(fEffect));
             stage->fCoordChangeMatrixSet = fCoordChangeMatrixSet;
             if (fCoordChangeMatrixSet) {
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 59343e7..25557f9 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -109,7 +109,7 @@
      * Appends an additional color effect to the color computation.
      */
     const GrEffectRef* addColorEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
-        GrAssert(NULL != effect);
+        SkASSERT(NULL != effect);
         SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, attr1));
         return effect;
     }
@@ -118,7 +118,7 @@
      * Appends an additional coverage effect to the coverage computation.
      */
     const GrEffectRef* addCoverageEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
-        GrAssert(NULL != effect);
+        SkASSERT(NULL != effect);
         SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1));
         return effect;
     }
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index eab65b5..f43aba9 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -156,7 +156,7 @@
     friend class GrTexture;
     // called by ~GrTexture to remove the non-ref'ed back ptr.
     void owningTextureDestroyed() {
-        GrAssert(NULL != fTexture);
+        SkASSERT(NULL != fTexture);
         fTexture = NULL;
     }
 
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index 72e6928..61a089e 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -69,8 +69,8 @@
     void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry; }
     GrResourceEntry* getCacheEntry() { return fCacheEntry; }
 
-    void incDeferredRefCount() const { GrAssert(fDeferredRefCount >= 0); ++fDeferredRefCount; }
-    void decDeferredRefCount() const { GrAssert(fDeferredRefCount > 0); --fDeferredRefCount; }
+    void incDeferredRefCount() const { SkASSERT(fDeferredRefCount >= 0); ++fDeferredRefCount; }
+    void decDeferredRefCount() const { SkASSERT(fDeferredRefCount > 0); --fDeferredRefCount; }
 
 protected:
     /**
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index eeb63ad..3aa498b 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -41,7 +41,7 @@
                                                          SkIntToScalar(this->height())); }
 
     GrSurfaceOrigin origin() const {
-        GrAssert(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin);
+        SkASSERT(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin);
         return fDesc.fOrigin;
     }
 
@@ -81,7 +81,7 @@
             return thisRT == other->asRenderTarget();
         } else {
             const GrTexture* thisTex = this->asTexture();
-            GrAssert(NULL != thisTex); // We must be one or the other
+            SkASSERT(NULL != thisTex); // We must be one or the other
             return thisTex == other->asTexture();
         }
     }
diff --git a/include/gpu/GrTBackendEffectFactory.h b/include/gpu/GrTBackendEffectFactory.h
index 813f54b..87ace75 100644
--- a/include/gpu/GrTBackendEffectFactory.h
+++ b/include/gpu/GrTBackendEffectFactory.h
@@ -32,19 +32,19 @@
         GLSL code generation. */
     virtual EffectKey glEffectKey(const GrDrawEffect& drawEffect,
                                   const GrGLCaps& caps) const SK_OVERRIDE {
-        GrAssert(kIllegalEffectClassID != fEffectClassID);
+        SkASSERT(kIllegalEffectClassID != fEffectClassID);
         EffectKey effectKey = GLEffect::GenKey(drawEffect, caps);
         EffectKey textureKey = GLEffect::GenTextureKey(drawEffect, caps);
         EffectKey attribKey = GLEffect::GenAttribKey(drawEffect);
 #if GR_DEBUG
         static const EffectKey kIllegalIDMask = (uint16_t) (~((1U << kEffectKeyBits) - 1));
-        GrAssert(!(kIllegalIDMask & effectKey));
+        SkASSERT(!(kIllegalIDMask & effectKey));
 
         static const EffectKey kIllegalTextureKeyMask = (uint16_t) (~((1U << kTextureKeyBits) - 1));
-        GrAssert(!(kIllegalTextureKeyMask & textureKey));
+        SkASSERT(!(kIllegalTextureKeyMask & textureKey));
 
         static const EffectKey kIllegalAttribKeyMask = (uint16_t) (~((1U << kAttribKeyBits) - 1));
-        GrAssert(!(kIllegalAttribKeyMask & textureKey));
+        SkASSERT(!(kIllegalAttribKeyMask & textureKey));
 #endif
         return fEffectClassID | (attribKey << (kEffectKeyBits+kTextureKeyBits)) |
                (textureKey << kEffectKeyBits) | effectKey;
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 1fb575c..f1c855d 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -100,11 +100,11 @@
      * only.
      */
     GrFixed normalizeFixedX(GrFixed x) const {
-        GrAssert(GrIsPow2(fDesc.fWidth));
+        SkASSERT(GrIsPow2(fDesc.fWidth));
         return x >> fShiftFixedX;
     }
     GrFixed normalizeFixedY(GrFixed y) const {
-        GrAssert(GrIsPow2(fDesc.fHeight));
+        SkASSERT(GrIsPow2(fDesc.fHeight));
         return y >> fShiftFixedY;
     }
 
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index 8100b7a..e3ab79f 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -151,7 +151,7 @@
     bool operator== (const GrTextureAccess& other) const {
 #if GR_DEBUG
         // below assumes all chars in fSwizzle are initialized even if string is < 4 chars long.
-        GrAssert(memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1) ==
+        SkASSERT(memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1) ==
                  strcmp(fSwizzle, other.fSwizzle));
 #endif
         return fParams == other.fParams &&
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 18aedc5..3a52804 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -74,7 +74,7 @@
  *  divide, rounding up
  */
 static inline int32_t GrIDivRoundUp(int x, int y) {
-    GrAssert(y > 0);
+    SkASSERT(y > 0);
     return (x + (y-1)) / y;
 }
 static inline uint32_t GrUIDivRoundUp(uint32_t x, uint32_t y) {
@@ -152,7 +152,7 @@
 }
 
 static inline int GrNextPow2(int n) {
-    GrAssert(n >= 0); // this impl only works for non-neg.
+    SkASSERT(n >= 0); // this impl only works for non-neg.
     return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
 }
 
@@ -166,7 +166,7 @@
 #if GR_DEBUG
 
 static inline int16_t GrToS16(intptr_t x) {
-    GrAssert((int16_t)x == x);
+    SkASSERT((int16_t)x == x);
     return (int16_t)x;
 }
 
@@ -256,7 +256,7 @@
  *  Return the number of bytes-per-pixel for the specified mask format.
  */
 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) {
-    GrAssert((unsigned)format <= 2);
+    SkASSERT((unsigned)format <= 2);
     // kA8   (0) -> 1
     // kA565 (1) -> 2
     // kA888 (2) -> 4
@@ -472,7 +472,7 @@
      * Initialize the cache ID to a domain and key.
      */
     GrCacheID(Domain domain, const Key& key) {
-        GrAssert(kInvalid_Domain != domain);
+        SkASSERT(kInvalid_Domain != domain);
         this->reset(domain, key);
     }
 
@@ -484,8 +484,8 @@
     /** Has this been initialized to a valid domain */
     bool isValid() const { return kInvalid_Domain != fDomain; }
 
-    const Key& getKey() const { GrAssert(this->isValid()); return fKey; }
-    Domain getDomain() const { GrAssert(this->isValid()); return fDomain; }
+    const Key& getKey() const { SkASSERT(this->isValid()); return fKey; }
+    Domain getDomain() const { SkASSERT(this->isValid()); return fDomain; }
 
     /** Creates a new unique ID domain. */
     static Domain GenerateDomain();
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 3538f38..8888066 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -33,7 +33,7 @@
  * Gets the vector size of the SLType. Returns -1 for void, matrices, and samplers.
  */
 static inline int GrSLTypeVectorCount(GrSLType type) {
-    GrAssert(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
+    SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
     static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1 };
     return kCounts[type];
 
@@ -51,7 +51,7 @@
 /** Return the type enum for a vector of floats of length n (1..4),
  e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */
 static inline GrSLType GrSLFloatVectorType(int count) {
-    GrAssert(count > 0 && count <= 4);
+    SkASSERT(count > 0 && count <= 4);
     return (GrSLType)(count);
 
     GR_STATIC_ASSERT(kFloat_GrSLType == 1);
@@ -78,7 +78,7 @@
  * Returns the vector size of the type.
  */
 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
-    GrAssert(type >= 0 && type < kGrVertexAttribTypeCount);
+    SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
     static const int kCounts[] = { 1, 2, 3, 4, 4 };
     return kCounts[type];
 
@@ -94,7 +94,7 @@
  * Returns the size of the attrib type in bytes.
  */
 static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
-    GrAssert(type >= 0 && type < kGrVertexAttribTypeCount);
+    SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
     static const size_t kSizes[] = {
         sizeof(float),          // kFloat_GrVertexAttribType
         2*sizeof(float),        // kVec2f_GrVertexAttribType
@@ -136,7 +136,7 @@
     kLastFixedFunction_GrVertexAttribBinding + 1;
 
 static inline int GrFixedFunctionVertexAttribVectorCount(GrVertexAttribBinding binding) {
-    GrAssert(binding >= 0 && binding < kGrFixedFunctionVertexAttribBindingCnt);
+    SkASSERT(binding >= 0 && binding < kGrFixedFunctionVertexAttribBindingCnt);
     static const int kVecCounts[] = { 2, 2, 4, 4 };
 
     return kVecCounts[binding];
diff --git a/include/gpu/gl/GrGLExtensions.h b/include/gpu/gl/GrGLExtensions.h
index f4e950a..ffb6733 100644
--- a/include/gpu/gl/GrGLExtensions.h
+++ b/include/gpu/gl/GrGLExtensions.h
@@ -20,7 +20,7 @@
 class GrGLExtensions {
 public:
     bool init(GrGLBinding binding, const GrGLInterface* iface) {
-        GrAssert(binding & iface->fBindingsExported);
+        SkASSERT(binding & iface->fBindingsExported);
         return this->init(binding, iface->fGetString, iface->fGetStringi, iface->fGetIntegerv);
     }
     /**
diff --git a/include/gpu/gl/SkGLContextHelper.h b/include/gpu/gl/SkGLContextHelper.h
index 386a695..97d416b 100644
--- a/include/gpu/gl/SkGLContextHelper.h
+++ b/include/gpu/gl/SkGLContextHelper.h
@@ -35,7 +35,7 @@
     virtual void makeCurrent() const = 0;
 
     bool hasExtension(const char* extensionName) const {
-        GrAssert(NULL != fGL);
+        SkASSERT(NULL != fGL);
         return fExtensions.has(extensionName);
     }