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
This commit is contained in:
parent
1e3052354a
commit
8a252f7962
@ -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; }
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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() &&
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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() &&
|
||||
|
@ -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() &&
|
||||
|
@ -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 &&
|
||||
|
@ -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() &&
|
||||
|
@ -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() &&
|
||||
|
@ -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 {
|
||||
|
@ -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() ==
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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() &&
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user