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/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
new file mode 100644
index 0000000..a373ebe
--- /dev/null
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "effects/GrSingleTextureEffect.h"
+#include "GrTexture.h"
+
+GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture)
+ : fTexture (texture) {
+ SkSafeRef(fTexture);
+}
+
+GrSingleTextureEffect::~GrSingleTextureEffect() {
+ SkSafeUnref(fTexture);
+}
+
+unsigned int GrSingleTextureEffect::numTextures() const {
+ return 1;
+}
+
+GrTexture* GrSingleTextureEffect::texture(unsigned int index) const {
+ GrAssert(0 == index);
+ return fTexture;
+}
+
+