Replace uses of GR_DEBUG by SK_DEBUG.
BUG=None
R=bsalomon@google.com, robertphillips@google.com
Author: tfarina@chromium.org
Review URL: https://chromiumcodereview.appspot.com/23137022
git-svn-id: http://skia.googlecode.com/svn/trunk@10978 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index d47ccb3..ad8c1d2 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -85,26 +85,14 @@
#endif
#endif
-// we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1
-//
-#ifndef GR_DEBUG
- #ifdef GR_RELEASE
- #define GR_DEBUG !GR_RELEASE
- #else
- #ifdef NDEBUG
- #define GR_DEBUG 0
- #else
- #define GR_DEBUG 1
- #endif
+#if !defined(SK_DEBUG) && !GR_RELEASE
+ #ifdef NDEBUG
+ #define GR_RELEASE 1
#endif
#endif
-#ifndef GR_RELEASE
- #define GR_RELEASE !GR_DEBUG
-#endif
-
-#if GR_DEBUG == GR_RELEASE
- #error "GR_DEBUG and GR_RELEASE must not be the same"
+#if defined(SK_DEBUG) && GR_RELEASE
+ #error "cannot define both SK_DEBUG and GR_RELEASE"
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -142,8 +130,8 @@
* A alternate user config file can be specified by defining
* GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h
*
- * e.g. it can specify GR_DEBUG/GR_RELEASE as it please, change the BUILD
- * target, or supply its own defines for anything else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
+ * e.g. it can change the BUILD target or supply its own defines for anything
+ * else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
*/
#if !defined(GR_USER_CONFIG_FILE)
#include "GrUserConfig.h"
@@ -212,7 +200,7 @@
* GR_DEBUGBREAK is an unconditional break in debug builds.
*/
#if !defined(GR_DEBUGBREAK)
- #if GR_DEBUG
+ #ifdef SK_DEBUG
#define GR_DEBUGBREAK GR_ALWAYSBREAK
#else
#define GR_DEBUGBREAK
@@ -236,7 +224,7 @@
* GR_DEBUGASSERT is an assertion in debug builds only.
*/
#if !defined(GR_DEBUGASSERT)
- #if GR_DEBUG
+ #ifdef SK_DEBUG
#define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND)
#else
#define GR_DEBUGASSERT(COND)
@@ -261,7 +249,7 @@
* GR_DEBUGCODE compiles the code X in debug builds only
*/
#if !defined(GR_DEBUGCODE)
- #if GR_DEBUG
+ #ifdef SK_DEBUG
#define GR_DEBUGCODE(X) X
#else
#define GR_DEBUGCODE(X)
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index d8757b2..942e580 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -287,7 +287,7 @@
return false;
}
bool result = this->onIsEqual(other);
-#if GR_DEBUG
+#ifdef SK_DEBUG
if (result) {
SkASSERT(this->numTextures() == other.numTextures());
for (int i = 0; i < this->numTextures(); ++i) {
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index 61a089e..c52fa04 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -92,7 +92,7 @@
bool isWrapped() const { return kWrapped_Flag & fFlags; }
private:
-#if GR_DEBUG
+#ifdef SK_DEBUG
friend class GrGpu; // for assert in GrGpu to access getGpu
#endif
diff --git a/include/gpu/GrTBackendEffectFactory.h b/include/gpu/GrTBackendEffectFactory.h
index 87ace75..1a01e1c 100644
--- a/include/gpu/GrTBackendEffectFactory.h
+++ b/include/gpu/GrTBackendEffectFactory.h
@@ -36,7 +36,7 @@
EffectKey effectKey = GLEffect::GenKey(drawEffect, caps);
EffectKey textureKey = GLEffect::GenTextureKey(drawEffect, caps);
EffectKey attribKey = GLEffect::GenAttribKey(drawEffect);
-#if GR_DEBUG
+#ifdef SK_DEBUG
static const EffectKey kIllegalIDMask = (uint16_t) (~((1U << kEffectKeyBits) - 1));
SkASSERT(!(kIllegalIDMask & effectKey));
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index f1c855d..4fe1894 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -120,7 +120,7 @@
*/
virtual void invalidateCachedState() = 0;
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const {
this->INHERITED::validate();
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index e3ab79f..0f44807 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -149,7 +149,7 @@
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode);
bool operator== (const GrTextureAccess& other) const {
-#if GR_DEBUG
+#ifdef SK_DEBUG
// below assumes all chars in fSwizzle are initialized even if string is < 4 chars long.
SkASSERT(memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1) ==
strcmp(fSwizzle, other.fSwizzle));
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 3a52804..497f938 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -163,7 +163,7 @@
*/
typedef int32_t GrFixed;
-#if GR_DEBUG
+#ifdef SK_DEBUG
static inline int16_t GrToS16(intptr_t x) {
SkASSERT((int16_t)x == x);
diff --git a/include/gpu/GrUserConfig.h b/include/gpu/GrUserConfig.h
index a10d339..6bae564 100644
--- a/include/gpu/GrUserConfig.h
+++ b/include/gpu/GrUserConfig.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 Google Inc.
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef GrUserConfig_DEFINED
#define GrUserConfig_DEFINED
@@ -14,13 +12,6 @@
#error "default user config pulled in but GR_USER_CONFIG_FILE is defined."
#endif
-#if 0
- #undef GR_RELEASE
- #undef GR_DEBUG
- #define GR_RELEASE 0
- #define GR_DEBUG 1
-#endif
-
/**
* This gives a threshold in bytes of when to lock a GrGeometryBuffer vs using
* updateData. (Note the depending on the underlying 3D API the update functions
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index 1f72fbc..15e54a3 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -25,8 +25,8 @@
#include "SkRegion.h"
#include "SkClipStack.h"
-#if (GR_DEBUG && defined(SK_RELEASE)) || (GR_RELEASE && defined(SK_DEBUG))
-// #error "inconsistent GR_DEBUG and SK_DEBUG"
+#if (GR_RELEASE && defined(SK_DEBUG))
+// #error "inconsistent GR_RELEASE and SK_DEBUG"
#endif
////////////////////////////////////////////////////////////////////////////////
diff --git a/include/gpu/gl/GrGLConfig.h b/include/gpu/gl/GrGLConfig.h
index 81cba1b..1f7c9e2 100644
--- a/include/gpu/gl/GrGLConfig.h
+++ b/include/gpu/gl/GrGLConfig.h
@@ -39,7 +39,7 @@
* GR_GL_LOG_CALLS is 1. Defaults to 0.
*
* GR_GL_CHECK_ERROR: if enabled Gr can do a glGetError() after every GL call.
- * Defaults to 1 if GR_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1
+ * Defaults to 1 if SK_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1
* this can be toggled in a debugger using the gCheckErrorGL global. The initial
* value of gCheckErrorGL is controlled by by GR_GL_CHECK_ERROR_START.
*
@@ -107,7 +107,11 @@
*/
#if !defined(GR_GL_LOG_CALLS)
- #define GR_GL_LOG_CALLS GR_DEBUG
+ #ifdef SK_DEBUG
+ #define GR_GL_LOG_CALLS 1
+ #else
+ #define GR_GL_LOG_CALLS 0
+ #endif
#endif
#if !defined(GR_GL_LOG_CALLS_START)
@@ -115,7 +119,11 @@
#endif
#if !defined(GR_GL_CHECK_ERROR)
- #define GR_GL_CHECK_ERROR GR_DEBUG
+ #ifdef SK_DEBUG
+ #define GR_GL_CHECK_ERROR 1
+ #else
+ #define GR_GL_CHECK_ERROR 0
+ #endif
#endif
#if !defined(GR_GL_CHECK_ERROR_START)