Make enabling static rect VB configurable by user config file.
git-svn-id: http://skia.googlecode.com/svn/trunk@753 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrConfig.h b/gpu/include/GrConfig.h
index b599a53..4c5ddd6 100644
--- a/gpu/include/GrConfig.h
+++ b/gpu/include/GrConfig.h
@@ -305,6 +305,10 @@
#define GR_GL_LOG_CALLS 0
#endif
+#if !defined(GR_STATIC_RECT_VB)
+ #define GR_STATIC_RECT_VB 0
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// tail section:
//
diff --git a/gpu/include/GrUserConfig.h b/gpu/include/GrUserConfig.h
index 2d46b9f..3484760 100644
--- a/gpu/include/GrUserConfig.h
+++ b/gpu/include/GrUserConfig.h
@@ -51,6 +51,14 @@
*/
//#define GR_GL_LOG_CALLS 1
+/*
+ * When drawing rects this causes Ganesh to use a vertex buffer containing
+ * a unit square that is positioned by a matrix. Enable on systems where
+ * emitting per-rect-draw verts is more expensive than constant/matrix
+ * updates. Defaults to 0.
+ */
+//#define GR_STATIC_RECT_VB 1
+
///////////////////////////////////////////////////////////////////////////////
/*
* temporary flags (may go away soon)
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index f966c2c..3446e23 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -24,7 +24,6 @@
#include "GrIndexBuffer.h"
#define DEFER_TEXT_RENDERING 1
-#define USE_STATIC_RECT_VB 0
static const size_t MAX_TEXTURE_CACHE_COUNT = 128;
static const size_t MAX_TEXTURE_CACHE_BYTES = 8 * 1024 * 1024;
@@ -381,7 +380,7 @@
fGpu->drawNonIndexed(primType, 0, vertCount);
} else {
- #if USE_STATIC_RECT_VB
+ #if GR_STATIC_RECT_VB
fGpu->setVertexSourceToBuffer(fGpu->unitSquareVertexBuffer(), layout);
GrDrawTarget::AutoViewMatrixRestore avmr(fGpu);
GrMatrix m;
@@ -428,7 +427,7 @@
this->prepareToDraw(paint);
-#if USE_STATIC_RECT_VB
+#if GR_STATIC_RECT_VB
GrVertexLayout layout = GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(0);
GrDrawTarget::AutoViewMatrixRestore avmr(fGpu);