Introduces new SingleTextureEffect base class for GrCustomStage objects.
This class tracks the texture that the object uses. A future commit will get rid of the
GrTexture pointer currenty stored in the GrDrawState, allowing us to have CustomStages
*without* textures.

Requires gyp change on next roll.

http://codereview.appspot.com/6306097/



git-svn-id: http://skia.googlecode.com/svn/trunk@4576 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 7ebe9d7..edabb9c 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2140,6 +2140,21 @@
     GrGLTexture* nextTexture = 
         static_cast<GrGLTexture*>(drawState->getTexture(stage));
 
+    // HACK - if we're using a new SingleTextureEffect, override
+    // the old texture pointer
+    const GrSamplerState& sampler = drawState->getSampler(stage);
+    GrCustomStage* customStage = sampler.getCustomStage();
+    if (customStage && customStage->numTextures()) {
+        nextTexture = 
+            static_cast<GrGLTexture*>(customStage->texture(0));
+    }
+
+    flushBoundTextureAndParams(stage, nextTexture);
+}
+
+void GrGpuGL::flushBoundTextureAndParams(int stage, GrGLTexture* nextTexture) {
+    GrDrawState* drawState = this->drawState();
+
     // true for now, but maybe not with GrEffect.
     GrAssert(NULL != nextTexture);
     // if we created a rt/tex and rendered to it without using a