Make numTextures() be non-virtual on GrCustomStage.
R=tomhudson@google.com,robertphillips@google.com,senorblanco@chromium.org
Review URL: https://codereview.appspot.com/6586081
git-svn-id: http://skia.googlecode.com/svn/trunk@5805 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrCustomStage.cpp b/src/gpu/GrCustomStage.cpp
index b9ad4ea..0000278 100644
--- a/src/gpu/GrCustomStage.cpp
+++ b/src/gpu/GrCustomStage.cpp
@@ -38,8 +38,8 @@
int32_t GrProgramStageFactory::fCurrStageClassID =
GrProgramStageFactory::kIllegalStageClassID;
-GrCustomStage::GrCustomStage() {
-
+GrCustomStage::GrCustomStage(int numTextures)
+ : fNumTextures(numTextures) {
}
GrCustomStage::~GrCustomStage() {
@@ -62,10 +62,6 @@
return true;
}
-int GrCustomStage::numTextures() const {
- return 0;
-}
-
const GrTextureAccess& GrCustomStage::textureAccess(int index) const {
GrCrash("We shouldn't be calling this function on the base class.");
static GrTextureAccess kDummy;
diff --git a/src/gpu/effects/GrColorTableEffect.cpp b/src/gpu/effects/GrColorTableEffect.cpp
index 0edc00d..165cd60 100644
--- a/src/gpu/effects/GrColorTableEffect.cpp
+++ b/src/gpu/effects/GrColorTableEffect.cpp
@@ -91,7 +91,8 @@
///////////////////////////////////////////////////////////////////////////////
GrColorTableEffect::GrColorTableEffect(GrTexture* texture)
- : fTextureAccess(texture, "a") {
+ : INHERITED(1)
+ , fTextureAccess(texture, "a") {
}
GrColorTableEffect::~GrColorTableEffect() {
diff --git a/src/gpu/effects/GrColorTableEffect.h b/src/gpu/effects/GrColorTableEffect.h
index fe762fd..c064600 100644
--- a/src/gpu/effects/GrColorTableEffect.h
+++ b/src/gpu/effects/GrColorTableEffect.h
@@ -21,14 +21,13 @@
class GrColorTableEffect : public GrCustomStage {
public:
- GrColorTableEffect(GrTexture* texture);
+ explicit GrColorTableEffect(GrTexture* texture);
virtual ~GrColorTableEffect();
static const char* Name() { return "ColorTable"; }
virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;
- virtual int numTextures() const SK_OVERRIDE { return 1; }
virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE;
typedef GrGLColorTableEffect GLProgramStage;
diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
index e96eb47..f6f7b8c 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -38,24 +38,23 @@
///////////////////////////////////////////////////////////////////////////////
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture)
- : fTextureAccess(texture) {
+ : INHERITED(1)
+ , fTextureAccess(texture) {
}
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, bool bilerp)
- : fTextureAccess(texture, bilerp) {
+ : INHERITED(1)
+ , fTextureAccess(texture, bilerp) {
}
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, const GrTextureParams& params)
- : fTextureAccess(texture, params) {
+ : INHERITED(1)
+ , fTextureAccess(texture, params) {
}
GrSingleTextureEffect::~GrSingleTextureEffect() {
}
-int GrSingleTextureEffect::numTextures() const {
- return 1;
-}
-
const GrTextureAccess& GrSingleTextureEffect::textureAccess(int index) const {
GrAssert(0 == index);
return fTextureAccess;
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index 4d0a40f..ad47eb7 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -28,7 +28,6 @@
virtual ~GrSingleTextureEffect();
- virtual int numTextures() const SK_OVERRIDE;
virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE;
static const char* Name() { return "Single Texture"; }