diff options
author | 2013-01-11 13:54:30 +0000 | |
---|---|---|
committer | 2013-01-11 13:54:30 +0000 | |
commit | 50db75c871b203081a32190ab173f13c785a147f (patch) | |
tree | 0be6d6097142a65706e784d11a0824cf98286445 /src/effects | |
parent | 55e4a2005eae1e4f677ec145c577c615a63cf05d (diff) |
Make GrEffect::textureAccess non-virtual. Require subclasses to append their GrTAs.
Review URL: https://codereview.appspot.com/7062063
git-svn-id: http://skia.googlecode.com/svn/trunk@7129 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlendImageFilter.cpp | 12 | ||||
-rw-r--r-- | src/effects/SkColorMatrixFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkTableColorFilter.cpp | 11 | ||||
-rw-r--r-- | src/effects/gradients/SkGradientShader.cpp | 9 | ||||
-rw-r--r-- | src/effects/gradients/SkGradientShaderPriv.h | 2 |
5 files changed, 8 insertions, 28 deletions
diff --git a/src/effects/SkBlendImageFilter.cpp b/src/effects/SkBlendImageFilter.cpp index 4e5e018d0f..6dd5eab4c5 100644 --- a/src/effects/SkBlendImageFilter.cpp +++ b/src/effects/SkBlendImageFilter.cpp @@ -153,8 +153,6 @@ public: typedef GrGLBlendEffect GLEffect; static const char* Name() { return "Blend"; } - virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE; - private: GrTextureAccess fForegroundAccess; GrTextureAccess fBackgroundAccess; @@ -228,10 +226,11 @@ GrTexture* SkBlendImageFilter::filterImageGPU(Proxy* proxy, GrTexture* src, cons GrBlendEffect::GrBlendEffect(SkBlendImageFilter::Mode mode, GrTexture* foreground, GrTexture* background) - : INHERITED(2) - , fForegroundAccess(foreground) + : fForegroundAccess(foreground) , fBackgroundAccess(background) , fMode(mode) { + this->addTextureAccess(&fForegroundAccess); + this->addTextureAccess(&fBackgroundAccess); } GrBlendEffect::~GrBlendEffect() { @@ -246,11 +245,6 @@ const GrBackendEffectFactory& GrBlendEffect::getFactory() const { return GrTBackendEffectFactory<GrBlendEffect>::getInstance(); } -const GrTextureAccess& GrBlendEffect::textureAccess(int index) const { - SkASSERT(index >= 0 && index < 2); - return (0 == index) ? fForegroundAccess : fBackgroundAccess; -} - /////////////////////////////////////////////////////////////////////////////// GrGLBlendEffect::GrGLBlendEffect(const GrBackendEffectFactory& factory, const GrEffect& effect) diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index e460325de4..ed34f64ea3 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -327,7 +327,7 @@ class ColorMatrixEffect : public GrEffect { public: static const char* Name() { return "Color Matrix"; } - ColorMatrixEffect(const SkColorMatrix& matrix) : GrEffect(0), fMatrix(matrix) {} + ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) {} virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { return GrTBackendEffectFactory<ColorMatrixEffect>::getInstance(); diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index ff30636ec7..eb59425aa7 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -233,8 +233,6 @@ public: virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; virtual bool isEqual(const GrEffect&) const SK_OVERRIDE; - virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE; - typedef GLColorTableEffect GLEffect; private: @@ -324,8 +322,8 @@ GrGLEffect::EffectKey GLColorTableEffect::GenKey(const GrEffectStage&, const GrG /////////////////////////////////////////////////////////////////////////////// ColorTableEffect::ColorTableEffect(GrTexture* texture) - : INHERITED(1) - , fTextureAccess(texture, "a") { + : fTextureAccess(texture, "a") { + this->addTextureAccess(&fTextureAccess); } ColorTableEffect::~ColorTableEffect() { @@ -339,11 +337,6 @@ bool ColorTableEffect::isEqual(const GrEffect& sBase) const { return INHERITED::isEqual(sBase); } -const GrTextureAccess& ColorTableEffect::textureAccess(int index) const { - GrAssert(0 == index); - return fTextureAccess; -} - /////////////////////////////////////////////////////////////////////////////// GR_DEFINE_EFFECT_TEST(ColorTableEffect); diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 5b2a60e944..8521bdbf61 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -742,8 +742,7 @@ void GrGLGradientEffect::emitColorLookup(GrGLShaderBuilder* builder, GrGradientEffect::GrGradientEffect(GrContext* ctx, const SkGradientShaderBase& shader, const SkMatrix& matrix, - SkShader::TileMode tileMode) - : INHERITED(1) { + SkShader::TileMode tileMode) { // TODO: check for simple cases where we don't need a texture: //GradientInfo info; //shader.asAGradient(&info); @@ -783,6 +782,7 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx, // the cache, but it'll still be ref'd until it's no longer being used. GrUnlockCachedBitmapTexture(texture); } + this->addTextureAccess(&fTextureAccess); } GrGradientEffect::~GrGradientEffect() { @@ -791,11 +791,6 @@ GrGradientEffect::~GrGradientEffect() { } } -const GrTextureAccess& GrGradientEffect::textureAccess(int index) const { - GrAssert(0 == index); - return fTextureAccess; -} - int GrGradientEffect::RandomGradientParams(SkRandom* random, SkColor colors[], SkScalar** stops, diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 1662188d05..552013efa5 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -233,8 +233,6 @@ public: virtual ~GrGradientEffect(); - virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE; - bool useAtlas() const { return SkToBool(-1 != fRow); } SkScalar getYCoord() const { return fYCoord; }; const SkMatrix& getMatrix() const { return fMatrix;} |