diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-22 20:35:13 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-01-22 20:35:13 +0000 |
commit | 8a252f79629b189a03de22cd8ff0312c5bccedd1 (patch) | |
tree | 8c2aa239766105fe6b5079c349b6a302c922c983 | |
parent | 1e3052354ac155e3d9418cf7e8c8e009df524e01 (diff) |
Switch GrEffect::onIsEqual signature back to GrEffect from GrEffectRef.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/7188046
git-svn-id: http://skia.googlecode.com/svn/trunk@7326 2bbb7eff-a529-9590-31e7-b0007b416f81
21 files changed, 38 insertions, 39 deletions
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h index 0e6aab027e..4d9202fe3e 100644 --- a/include/gpu/GrEffect.h +++ b/include/gpu/GrEffect.h @@ -123,7 +123,7 @@ public: if (&this->getFactory() != &other->getFactory()) { return false; } - bool result = this->onIsEqual(other); + bool result = this->onIsEqual(*other.get()); #if GR_DEBUG if (result) { GrAssert(this->numTextures() == other->numTextures()); @@ -209,9 +209,8 @@ protected: /** Helper for getting the GrEffect out of a GrEffectRef and down-casting to a GrEffect subclass */ template <typename T> - static const T& CastEffect(const GrEffectRef& effectRef) { - GrAssert(NULL != effectRef.get()); - return *static_cast<const T*>(effectRef.get()); + static const T& CastEffect(const GrEffect& effectRef) { + return *static_cast<const T*>(&effectRef); } private: @@ -219,7 +218,7 @@ private: /** Subclass implements this to support isEqual(). It will only be called if it is known that the two effects are of the same subclass (i.e. they return the same object from getFactory()).*/ - virtual bool onIsEqual(const GrEffectRef& other) const = 0; + virtual bool onIsEqual(const GrEffect& other) const = 0; void EffectRefDestroyed() { fEffectRef = NULL; } diff --git a/src/effects/SkBicubicImageFilter.cpp b/src/effects/SkBicubicImageFilter.cpp index 36a4e47454..10eed5bbeb 100644 --- a/src/effects/SkBicubicImageFilter.cpp +++ b/src/effects/SkBicubicImageFilter.cpp @@ -170,7 +170,7 @@ public: private: GrBicubicEffect(GrTexture*, const SkScalar coefficients[16]); - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; float fCoefficients[16]; GR_DECLARE_EFFECT_TEST; @@ -305,7 +305,7 @@ const GrBackendEffectFactory& GrBicubicEffect::getFactory() const { return GrTBackendEffectFactory<GrBicubicEffect>::getInstance(); } -bool GrBicubicEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrBicubicEffect::onIsEqual(const GrEffect& sBase) const { const GrBicubicEffect& s = CastEffect<GrBicubicEffect>(sBase); return this->texture(0) == s.texture(0) && !memcmp(fCoefficients, s.coefficients(), 16); diff --git a/src/effects/SkBlendImageFilter.cpp b/src/effects/SkBlendImageFilter.cpp index 840912c0ee..bf1dbe4f48 100644 --- a/src/effects/SkBlendImageFilter.cpp +++ b/src/effects/SkBlendImageFilter.cpp @@ -161,7 +161,7 @@ public: void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; private: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GrBlendEffect(SkBlendImageFilter::Mode mode, GrTexture* foreground, GrTexture* background); GrTextureAccess fForegroundAccess; @@ -246,7 +246,7 @@ GrBlendEffect::GrBlendEffect(SkBlendImageFilter::Mode mode, GrBlendEffect::~GrBlendEffect() { } -bool GrBlendEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrBlendEffect::onIsEqual(const GrEffect& sBase) const { const GrBlendEffect& s = CastEffect<GrBlendEffect>(sBase); return fForegroundAccess.getTexture() == s.fForegroundAccess.getTexture() && fBackgroundAccess.getTexture() == s.fBackgroundAccess.getTexture() && diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index dfd9566b28..15824642eb 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -450,7 +450,7 @@ public: private: ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) {} - virtual bool onIsEqual(const GrEffectRef& s) const { + virtual bool onIsEqual(const GrEffect& s) const { const ColorMatrixEffect& cme = CastEffect<ColorMatrixEffect>(s); return cme.fMatrix == fMatrix; } diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 895dd9827d..527cc9ef13 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -258,7 +258,7 @@ public: void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; private: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, @@ -361,7 +361,7 @@ GrDisplacementMapEffect::GrDisplacementMapEffect( GrDisplacementMapEffect::~GrDisplacementMapEffect() { } -bool GrDisplacementMapEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrDisplacementMapEffect::onIsEqual(const GrEffect& sBase) const { const GrDisplacementMapEffect& s = CastEffect<GrDisplacementMapEffect>(sBase); return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture() && fColorAccess.getTexture() == s.fColorAccess.getTexture() && diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 81a686a8ff..dd892f91d9 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -317,7 +317,7 @@ public: } protected: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; private: typedef GrSingleTextureEffect INHERITED; @@ -346,7 +346,7 @@ public: SkScalar kd() const { return fKD; } private: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GrDiffuseLightingEffect(GrTexture* texture, const SkLight* light, @@ -381,7 +381,7 @@ public: SkScalar shininess() const { return fShininess; } private: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GrSpecularLightingEffect(GrTexture* texture, const SkLight* light, @@ -1054,7 +1054,7 @@ GrLightingEffect::~GrLightingEffect() { fLight->unref(); } -bool GrLightingEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrLightingEffect::onIsEqual(const GrEffect& sBase) const { const GrLightingEffect& s = CastEffect<GrLightingEffect>(sBase); return this->texture(0) == s.texture(0) && fLight->isEqual(*s.fLight) && @@ -1071,7 +1071,7 @@ const GrBackendEffectFactory& GrDiffuseLightingEffect::getFactory() const { return GrTBackendEffectFactory<GrDiffuseLightingEffect>::getInstance(); } -bool GrDiffuseLightingEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrDiffuseLightingEffect::onIsEqual(const GrEffect& sBase) const { const GrDiffuseLightingEffect& s = CastEffect<GrDiffuseLightingEffect>(sBase); return INHERITED::onIsEqual(sBase) && this->kd() == s.kd(); @@ -1281,7 +1281,7 @@ const GrBackendEffectFactory& GrSpecularLightingEffect::getFactory() const { return GrTBackendEffectFactory<GrSpecularLightingEffect>::getInstance(); } -bool GrSpecularLightingEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrSpecularLightingEffect::onIsEqual(const GrEffect& sBase) const { const GrSpecularLightingEffect& s = CastEffect<GrSpecularLightingEffect>(sBase); return INHERITED::onIsEqual(sBase) && this->ks() == s.ks() && diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index f5d9030d58..e0ab4d0d4d 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -75,7 +75,7 @@ private: , fXInset(xInset) , fYInset(yInset) {} - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GR_DECLARE_EFFECT_TEST; @@ -229,7 +229,7 @@ const GrBackendEffectFactory& GrMagnifierEffect::getFactory() const { return GrTBackendEffectFactory<GrMagnifierEffect>::getInstance(); } -bool GrMagnifierEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrMagnifierEffect::onIsEqual(const GrEffect& sBase) const { const GrMagnifierEffect& s = CastEffect<GrMagnifierEffect>(sBase); return (this->texture(0) == s.texture(0) && this->fXOffset == s.fXOffset && diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 9efb0a3e66..0c2a24e04d 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -298,7 +298,7 @@ private: TileMode tileMode, bool convolveAlpha); - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; SkISize fKernelSize; float *fKernel; @@ -517,7 +517,7 @@ const GrBackendEffectFactory& GrMatrixConvolutionEffect::getFactory() const { return GrTBackendEffectFactory<GrMatrixConvolutionEffect>::getInstance(); } -bool GrMatrixConvolutionEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrMatrixConvolutionEffect::onIsEqual(const GrEffect& sBase) const { const GrMatrixConvolutionEffect& s = CastEffect<GrMatrixConvolutionEffect>(sBase); return this->texture(0) == s.texture(0) && fKernelSize == s.kernelSize() && diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 746f966103..10878d779b 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -264,7 +264,7 @@ protected: MorphologyType fType; private: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); @@ -400,7 +400,7 @@ const GrBackendEffectFactory& GrMorphologyEffect::getFactory() const { return GrTBackendEffectFactory<GrMorphologyEffect>::getInstance(); } -bool GrMorphologyEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrMorphologyEffect::onIsEqual(const GrEffect& sBase) const { const GrMorphologyEffect& s = CastEffect<GrMorphologyEffect>(sBase); return (this->texture(0) == s.texture(0) && this->radius() == s.radius() && diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index dcdb39f5eb..b703f99cca 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -241,7 +241,7 @@ public: typedef GLColorTableEffect GLEffect; private: - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; explicit ColorTableEffect(GrTexture* texture, unsigned flags); @@ -343,8 +343,8 @@ const GrBackendEffectFactory& ColorTableEffect::getFactory() const { return GrTBackendEffectFactory<ColorTableEffect>::getInstance(); } -bool ColorTableEffect::onIsEqual(const GrEffectRef& sBase) const { - return this->texture(0) == sBase->texture(0); +bool ColorTableEffect::onIsEqual(const GrEffect& sBase) const { + return this->texture(0) == sBase.texture(0); } void ColorTableEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 1880425c21..cdbfd7c150 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -829,7 +829,7 @@ GrGradientEffect::~GrGradientEffect() { } } -bool GrGradientEffect::onIsEqual(const GrEffectRef& effect) const { +bool GrGradientEffect::onIsEqual(const GrEffect& effect) const { const GrGradientEffect& s = CastEffect<GrGradientEffect>(effect); return fTextureAccess.getTexture() == s.fTextureAccess.getTexture() && fTextureAccess.getParams().getTileModeX() == diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index a34e4ab9bb..954acb2e45 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -255,7 +255,7 @@ protected: SkScalar** stops, SkShader::TileMode* tm); - virtual bool onIsEqual(const GrEffectRef& effect) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect& effect) const SK_OVERRIDE; private: diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index bef29c0437..e23953005b 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -393,7 +393,7 @@ public: typedef GrGLConical2Gradient GLEffect; private: - virtual bool onIsEqual(const GrEffectRef& sBase) const SK_OVERRIDE { + virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { const GrConical2Gradient& s = CastEffect<GrConical2Gradient>(sBase); return (INHERITED::onIsEqual(sBase) && this->fCenterX1 == s.fCenterX1 && diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp index b1c13037fb..4eaf487230 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -451,7 +451,7 @@ public: typedef GrGLRadial2Gradient GLEffect; private: - virtual bool onIsEqual(const GrEffectRef& sBase) const SK_OVERRIDE { + virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { const GrRadial2Gradient& s = CastEffect<GrRadial2Gradient>(sBase); return (INHERITED::onIsEqual(sBase) && this->fCenterX1 == s.fCenterX1 && diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 2271b105b5..4c4d0792c0 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -115,9 +115,9 @@ const GrBackendEffectFactory& GrConfigConversionEffect::getFactory() const { return GrTBackendEffectFactory<GrConfigConversionEffect>::getInstance(); } -bool GrConfigConversionEffect::onIsEqual(const GrEffectRef& s) const { +bool GrConfigConversionEffect::onIsEqual(const GrEffect& s) const { const GrConfigConversionEffect& other = CastEffect<GrConfigConversionEffect>(s); - return this->texture(0) == s->texture(0) && + return this->texture(0) == s.texture(0) && other.fSwapRedAndBlue == fSwapRedAndBlue && other.fPMConversion == fPMConversion; } diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index 08e5f71001..3845d32bbd 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -66,7 +66,7 @@ private: PMConversion pmConversion, const SkMatrix& matrix); - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; bool fSwapRedAndBlue; PMConversion fPMConversion; diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index ffa5427155..896885794d 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -166,7 +166,7 @@ const GrBackendEffectFactory& GrConvolutionEffect::getFactory() const { return GrTBackendEffectFactory<GrConvolutionEffect>::getInstance(); } -bool GrConvolutionEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const { const GrConvolutionEffect& s = CastEffect<GrConvolutionEffect>(sBase); return (this->texture(0) == s.texture(0) && this->radius() == s.radius() && diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h index 7345ae4fee..072404856e 100644 --- a/src/gpu/effects/GrConvolutionEffect.h +++ b/src/gpu/effects/GrConvolutionEffect.h @@ -82,7 +82,7 @@ private: int halfWidth, float gaussianSigma); - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GR_DECLARE_EFFECT_TEST; diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index b7466b4ffb..ffc05e5b52 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -54,7 +54,7 @@ private: GrSimpleTextureEffect(GrTexture* texture, const SkMatrix& matrix, const GrTextureParams& params) : GrSingleTextureEffect(texture, matrix, params) {} - virtual bool onIsEqual(const GrEffectRef& other) const SK_OVERRIDE { + virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { const GrSimpleTextureEffect& ste = CastEffect<GrSimpleTextureEffect>(other); return this->hasSameTextureParamsAndMatrix(ste); } diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index 58c8b80762..bfd62c2528 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -169,7 +169,7 @@ const GrBackendEffectFactory& GrTextureDomainEffect::getFactory() const { return GrTBackendEffectFactory<GrTextureDomainEffect>::getInstance(); } -bool GrTextureDomainEffect::onIsEqual(const GrEffectRef& sBase) const { +bool GrTextureDomainEffect::onIsEqual(const GrEffect& sBase) const { const GrTextureDomainEffect& s = CastEffect<GrTextureDomainEffect>(sBase); return this->hasSameTextureParamsAndMatrix(s) && this->fTextureDomain == s.fTextureDomain; } diff --git a/src/gpu/effects/GrTextureDomainEffect.h b/src/gpu/effects/GrTextureDomainEffect.h index 81b3da4f4b..b7f665cba3 100644 --- a/src/gpu/effects/GrTextureDomainEffect.h +++ b/src/gpu/effects/GrTextureDomainEffect.h @@ -77,7 +77,7 @@ private: WrapMode, bool bilerp); - virtual bool onIsEqual(const GrEffectRef&) const SK_OVERRIDE; + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; GR_DECLARE_EFFECT_TEST; |