Remove easily-removable uses of setTexture(), instead creating a GrSingleTextureEffect -
where feasible, through convenience function on GrDrawState.
http://codereview.appspot.com/6425055/
git-svn-id: http://skia.googlecode.com/svn/trunk@4694 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index df70bb2..471ae1c 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -16,6 +16,7 @@
#include "GrStencil.h"
#include "GrTexture.h"
#include "GrRenderTarget.h"
+#include "effects/GrSingleTextureEffect.h"
#include "SkXfermode.h"
@@ -187,6 +188,8 @@
*
* @param texture The texture to set. Can be NULL though there is no
* advantage to settings a NULL texture if doing non-textured drawing
+ *
+ * @deprecated
*/
void setTexture(int stage, GrTexture* texture) {
GrAssert((unsigned)stage < kNumStages);
@@ -195,6 +198,17 @@
}
/**
+ * Creates a GrSingleTextureEffect.
+ *
+ * Replacement for setTexture.
+ */
+ void createTextureEffect(int stage, GrTexture* texture) {
+ GrAssert(!this->getSampler(stage).getCustomStage());
+ this->sampler(stage)->setCustomStage(
+ SkNEW_ARGS(GrSingleTextureEffect, (texture)))->unref();
+ }
+
+ /**
* Retrieves the currently set texture.
*
* @return The currently set texture. The return value will be NULL if no