Push isEqual/onIsEqual down from GrProcessor to subclasses.

R=joshualitt@google.com

Review URL: https://codereview.chromium.org/654273002
This commit is contained in:
bsalomon 2014-10-15 08:19:04 -07:00 committed by Commit bot
parent 157f36d358
commit 0e08fc17e4
49 changed files with 129 additions and 114 deletions

View File

@ -37,6 +37,19 @@ public:
const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; }
bool isEqual(const GrGeometryProcessor& that) const {
if (&this->getFactory() != &that.getFactory()) {
return false;
}
bool result = this->onIsEqual(that);
#ifdef SK_DEBUG
if (result) {
this->assertTexturesEqual(that);
}
#endif
return result;
}
protected:
/**
* Subclasses call this from their constructor to register vertex attributes (at most
@ -49,6 +62,8 @@ protected:
}
private:
virtual bool onIsEqual(const GrGeometryProcessor&) const = 0;
SkSTArray<kMaxVertexAttribs, GrShaderVar, true> fVertexAttribs;
typedef GrProcessor INHERITED;

View File

@ -175,27 +175,6 @@ public:
*/
virtual const GrBackendProcessorFactory& getFactory() const = 0;
/** Returns true if this and other effect conservatively draw identically. It can only return
true when the two effects are of the same subclass (i.e. they return the same object from
from getFactory()).
A return value of true from isEqual() should not be used to test whether the effects would
generate the same shader code. To test for identical code generation use the effects' keys
computed by the GrBackendEffectFactory.
*/
bool isEqual(const GrProcessor& other) const {
if (&this->getFactory() != &other.getFactory()) {
return false;
}
bool result = this->onIsEqual(other);
#ifdef SK_DEBUG
if (result) {
this->assertEquality(other);
}
#endif
return result;
}
/** Human-meaningful string to identify this effect; may be embedded
in generated shader code. */
const char* name() const;
@ -246,13 +225,9 @@ protected:
*/
void setWillReadFragmentPosition() { fWillReadFragmentPosition = true; }
private:
SkDEBUGCODE(void assertEquality(const GrProcessor& other) const;)
SkDEBUGCODE(void assertTexturesEqual(const GrProcessor& other) const;)
/** 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 GrProcessor& other) const = 0;
private:
/**
* Subclass implements this to support getConstantColorComponents(...).
@ -286,6 +261,26 @@ public:
/** Will this effect read the source color value? */
bool willUseInputColor() const { return fWillUseInputColor; }
/** Returns true if this and other effect conservatively draw identically. It can only return
true when the two effects are of the same subclass (i.e. they return the same object from
from getFactory()).
A return value of true from isEqual() should not be used to test whether the effects would
generate the same shader code. To test for identical code generation use the effects' keys
computed by the GrBackendEffectFactory. */
bool isEqual(const GrFragmentProcessor& other) const {
if (&this->getFactory() != &other.getFactory()) {
return false;
}
bool result = this->onIsEqual(other);
#ifdef SK_DEBUG
if (result) {
this->assertTexturesEqual(other);
}
#endif
return result;
}
protected:
/**
* Fragment Processor subclasses call this from their constructor to register coordinate
@ -312,6 +307,11 @@ protected:
void setWillNotUseInputColor() { fWillUseInputColor = false; }
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 GrFragmentProcessor& other) const = 0;
SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
bool fWillReadDstColor;
bool fWillUseInputColor;

View File

@ -1206,7 +1206,7 @@ private:
this->setWillReadDstColor();
}
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
const XferEffect& s = other.cast<XferEffect>();
return fMode == s.fMode &&
fBackgroundAccess.getTexture() == s.fBackgroundAccess.getTexture();

View File

@ -100,7 +100,7 @@ private:
this->addTextureAccess(&fMaskTextureAccess);
}
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -221,7 +221,7 @@ const GrBackendFragmentProcessorFactory& AlphaThresholdEffect::getFactory() cons
return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance();
}
bool AlphaThresholdEffect::onIsEqual(const GrProcessor& sBase) const {
bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>();
return (this->texture(0) == s.texture(0) &&
this->fInnerThreshold == s.fInnerThreshold &&

View File

@ -296,7 +296,7 @@ public:
bool enforcePMColor() const { return fEnforcePMColor; }
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -330,7 +330,7 @@ GrArithmeticEffect::GrArithmeticEffect(float k1, float k2, float k3, float k4,
GrArithmeticEffect::~GrArithmeticEffect() {
}
bool GrArithmeticEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrArithmeticEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrArithmeticEffect& s = sBase.cast<GrArithmeticEffect>();
return fK1 == s.fK1 &&
fK2 == s.fK2 &&

View File

@ -590,7 +590,7 @@ public:
private:
GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blur_profile);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -760,7 +760,7 @@ const GrBackendFragmentProcessorFactory& GrRectBlurEffect::getFactory() const {
return GrTBackendFragmentProcessorFactory<GrRectBlurEffect>::getInstance();
}
bool GrRectBlurEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrRectBlurEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>();
return this->getSigma() == s.getSigma() && this->getRect() == s.getRect();
}
@ -841,7 +841,7 @@ public:
private:
GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -944,7 +944,7 @@ GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur
this->setWillReadFragmentPosition();
}
bool GrRRectBlurEffect::onIsEqual(const GrProcessor& other) const {
bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const {
const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>();
return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX && fSigma == rrbe.fSigma;
}

View File

@ -232,7 +232,7 @@ public:
};
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
GrColorCubeEffect(GrTexture* colorCube);
@ -254,7 +254,7 @@ GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube)
GrColorCubeEffect::~GrColorCubeEffect() {
}
bool GrColorCubeEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrColorCubeEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrColorCubeEffect& s = sBase.cast<GrColorCubeEffect>();
return fColorCubeAccess.getTexture() == s.fColorCubeAccess.getTexture();
}

View File

@ -286,7 +286,7 @@ private:
}
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
const ModeColorFilterEffect& s = other.cast<ModeColorFilterEffect>();
return fMode == s.fMode && fColor == s.fColor;
}

View File

@ -421,7 +421,7 @@ public:
private:
ColorMatrixEffect(const SkColorMatrix& matrix) : fMatrix(matrix) {}
virtual bool onIsEqual(const GrProcessor& s) const {
virtual bool onIsEqual(const GrFragmentProcessor& s) const {
const ColorMatrixEffect& cme = s.cast<ColorMatrixEffect>();
return cme.fMatrix == fMatrix;
}

View File

@ -352,7 +352,7 @@ public:
static const char* Name() { return "DisplacementMap"; }
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -479,7 +479,7 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
GrDisplacementMapEffect::~GrDisplacementMapEffect() {
}
bool GrDisplacementMapEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrDisplacementMapEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>();
return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture() &&
fColorAccess.getTexture() == s.fColorAccess.getTexture() &&

View File

@ -351,7 +351,7 @@ public:
const SkMatrix& filterMatrix() const { return fFilterMatrix; }
protected:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
// lighting shaders are complicated. We just throw up our hands.
@ -387,7 +387,7 @@ public:
SkScalar kd() const { return fKD; }
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
GrDiffuseLightingEffect(GrTexture* texture,
const SkLight* light,
@ -424,7 +424,7 @@ public:
SkScalar shininess() const { return fShininess; }
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
GrSpecularLightingEffect(GrTexture* texture,
const SkLight* light,
@ -1302,7 +1302,7 @@ GrLightingEffect::~GrLightingEffect() {
fLight->unref();
}
bool GrLightingEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrLightingEffect& s = sBase.cast<GrLightingEffect>();
return this->texture(0) == s.texture(0) &&
fLight->isEqual(*s.fLight) &&
@ -1323,7 +1323,7 @@ const GrBackendFragmentProcessorFactory& GrDiffuseLightingEffect::getFactory() c
return GrTBackendFragmentProcessorFactory<GrDiffuseLightingEffect>::getInstance();
}
bool GrDiffuseLightingEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrDiffuseLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrDiffuseLightingEffect& s = sBase.cast<GrDiffuseLightingEffect>();
return INHERITED::onIsEqual(sBase) &&
this->kd() == s.kd();
@ -1529,7 +1529,7 @@ const GrBackendFragmentProcessorFactory& GrSpecularLightingEffect::getFactory()
return GrTBackendFragmentProcessorFactory<GrSpecularLightingEffect>::getInstance();
}
bool GrSpecularLightingEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrSpecularLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrSpecularLightingEffect& s = sBase.cast<GrSpecularLightingEffect>();
return INHERITED::onIsEqual(sBase) &&
this->ks() == s.ks() &&

View File

@ -109,7 +109,7 @@ public:
};
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE {
return true;
}

View File

@ -72,7 +72,7 @@ private:
, fXInvInset(xInvInset)
, fYInvInset(yInvInset) {}
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -216,7 +216,7 @@ const GrBackendFragmentProcessorFactory& GrMagnifierEffect::getFactory() const {
return GrTBackendFragmentProcessorFactory<GrMagnifierEffect>::getInstance();
}
bool GrMagnifierEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrMagnifierEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrMagnifierEffect& s = sBase.cast<GrMagnifierEffect>();
return (this->texture(0) == s.texture(0) &&
this->fXOffset == s.fXOffset &&

View File

@ -315,7 +315,7 @@ protected:
MorphologyType fType;
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -448,7 +448,7 @@ const GrBackendFragmentProcessorFactory& GrMorphologyEffect::getFactory() const
return GrTBackendFragmentProcessorFactory<GrMorphologyEffect>::getInstance();
}
bool GrMorphologyEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>();
return (this->texture(0) == s.texture(0) &&
this->radius() == s.radius() &&

View File

@ -573,7 +573,7 @@ public:
typedef GrGLPerlinNoise GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const GrPerlinNoiseEffect& s = sBase.cast<GrPerlinNoiseEffect>();
return fType == s.fType &&
fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency &&

View File

@ -297,7 +297,7 @@ public:
typedef GLColorTableEffect GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -397,7 +397,7 @@ const GrBackendFragmentProcessorFactory& ColorTableEffect::getFactory() const {
return GrTBackendFragmentProcessorFactory<ColorTableEffect>::getInstance();
}
bool ColorTableEffect::onIsEqual(const GrProcessor& sBase) const {
bool ColorTableEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
return this->texture(0) == sBase.texture(0);
}

View File

@ -1180,7 +1180,7 @@ GrGradientEffect::~GrGradientEffect() {
}
}
bool GrGradientEffect::onIsEqual(const GrProcessor& processor) const {
bool GrGradientEffect::onIsEqual(const GrFragmentProcessor& processor) const {
const GrGradientEffect& s = processor.cast<GrGradientEffect>();
if (this->fColorType == s.getColorType()){

View File

@ -372,7 +372,7 @@ protected:
SkScalar** stops,
SkShader::TileMode* tm);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -80,7 +80,7 @@ public:
typedef GLEdge2PtConicalEffect GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const Edge2PtConicalEffect& s = sBase.cast<Edge2PtConicalEffect>();
return (INHERITED::onIsEqual(sBase) &&
this->fCenterX1 == s.fCenterX1 &&
@ -394,7 +394,7 @@ public:
typedef GLFocalOutside2PtConicalEffect GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const FocalOutside2PtConicalEffect& s = sBase.cast<FocalOutside2PtConicalEffect>();
return (INHERITED::onIsEqual(sBase) &&
this->fFocalX == s.fFocalX &&
@ -605,7 +605,7 @@ public:
typedef GLFocalInside2PtConicalEffect GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const FocalInside2PtConicalEffect& s = sBase.cast<FocalInside2PtConicalEffect>();
return (INHERITED::onIsEqual(sBase) &&
this->fFocalX == s.fFocalX);
@ -847,7 +847,7 @@ public:
typedef GLCircleInside2PtConicalEffect GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const CircleInside2PtConicalEffect& s = sBase.cast<CircleInside2PtConicalEffect>();
return (INHERITED::onIsEqual(sBase) &&
this->fInfo.fCenterEnd == s.fInfo.fCenterEnd &&
@ -1066,7 +1066,7 @@ public:
typedef GLCircleOutside2PtConicalEffect GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const CircleOutside2PtConicalEffect& s = sBase.cast<CircleOutside2PtConicalEffect>();
return (INHERITED::onIsEqual(sBase) &&
this->fInfo.fCenterEnd == s.fInfo.fCenterEnd &&

View File

@ -473,7 +473,7 @@ public:
typedef GrGLRadial2Gradient GLProcessor;
private:
virtual bool onIsEqual(const GrProcessor& sBase) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
const GrRadial2Gradient& s = sBase.cast<GrRadial2Gradient>();
return (INHERITED::onIsEqual(sBase) &&
this->fCenterX1 == s.fCenterX1 &&

View File

@ -584,7 +584,7 @@ private:
GrShaderVar::kAttribute_TypeModifier))) {
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
return true;
}

View File

@ -105,7 +105,7 @@ private:
const GrShaderVar& fInRect;
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
virtual bool onIsEqual(const GrGeometryProcessor&) const SK_OVERRIDE { return true; }
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
inout->mulByUnknownAlpha();
@ -249,7 +249,7 @@ private:
this->setWillReadFragmentPosition();
}
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
virtual bool onIsEqual(const GrGeometryProcessor&) const SK_OVERRIDE { return true; }
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
inout->mulByUnknownAlpha();

View File

@ -140,7 +140,7 @@ private:
fStroke = stroke;
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>();
return cee.fStroke == fStroke;
}
@ -280,7 +280,7 @@ private:
fStroke = stroke;
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>();
return eee.fStroke == fStroke;
}
@ -448,7 +448,7 @@ private:
fMode = mode;
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>();
return eee.fMode == fMode;
}

View File

@ -117,7 +117,7 @@ void GrProcessor::operator delete(void* target) {
}
#ifdef SK_DEBUG
void GrProcessor::assertEquality(const GrProcessor& other) const {
void GrProcessor::assertTexturesEqual(const GrProcessor& other) const {
SkASSERT(this->numTextures() == other.numTextures());
for (int i = 0; i < this->numTextures(); ++i) {
SkASSERT(this->textureAccess(i) == other.textureAccess(i));

View File

@ -141,7 +141,7 @@ GrConicEffect::GrConicEffect(GrPrimitiveEdgeType edgeType)
GrShaderVar::kAttribute_TypeModifier))) {
}
bool GrConicEffect::onIsEqual(const GrProcessor& other) const {
bool GrConicEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrConicEffect& ce = other.cast<GrConicEffect>();
return (ce.fEdgeType == fEdgeType);
}
@ -279,7 +279,7 @@ GrQuadEffect::GrQuadEffect(GrPrimitiveEdgeType edgeType)
GrShaderVar::kAttribute_TypeModifier))) {
}
bool GrQuadEffect::onIsEqual(const GrProcessor& other) const {
bool GrQuadEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrQuadEffect& ce = other.cast<GrQuadEffect>();
return (ce.fEdgeType == fEdgeType);
}
@ -459,7 +459,7 @@ GrCubicEffect::GrCubicEffect(GrPrimitiveEdgeType edgeType)
GrShaderVar::kAttribute_TypeModifier))) {
}
bool GrCubicEffect::onIsEqual(const GrProcessor& other) const {
bool GrCubicEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrCubicEffect& ce = other.cast<GrCubicEffect>();
return (ce.fEdgeType == fEdgeType);
}

View File

@ -102,7 +102,7 @@ public:
private:
GrConicEffect(GrPrimitiveEdgeType);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
inout->mulByUnknownAlpha();
@ -174,7 +174,7 @@ public:
private:
GrQuadEffect(GrPrimitiveEdgeType);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
inout->mulByUnknownAlpha();
@ -248,7 +248,7 @@ public:
private:
GrCubicEffect(GrPrimitiveEdgeType);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
inout->mulByUnknownAlpha();

View File

@ -162,7 +162,7 @@ const GrBackendFragmentProcessorFactory& GrBicubicEffect::getFactory() const {
return GrTBackendFragmentProcessorFactory<GrBicubicEffect>::getInstance();
}
bool GrBicubicEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrBicubicEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>();
return this->textureAccess(0) == s.textureAccess(0) &&
!memcmp(fCoefficients, s.coefficients(), 16) &&

View File

@ -90,7 +90,7 @@ private:
const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
GrBicubicEffect(GrTexture*, const SkScalar coefficients[16],
const SkMatrix &matrix, const SkRect& domain);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -119,7 +119,7 @@ const GrBackendFragmentProcessorFactory& GrConfigConversionEffect::getFactory()
return GrTBackendFragmentProcessorFactory<GrConfigConversionEffect>::getInstance();
}
bool GrConfigConversionEffect::onIsEqual(const GrProcessor& s) const {
bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& s) const {
const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>();
return this->texture(0) == s.texture(0) &&
other.fSwapRedAndBlue == fSwapRedAndBlue &&

View File

@ -61,7 +61,7 @@ private:
PMConversion pmConversion,
const SkMatrix& matrix);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -38,7 +38,7 @@ private:
this->setWillReadFragmentPosition();
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
const AARectEffect& aare = other.cast<AARectEffect>();
return fRect == aare.fRect;
}
@ -348,7 +348,7 @@ GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, cons
this->setWillReadFragmentPosition();
}
bool GrConvexPolyEffect::onIsEqual(const GrProcessor& other) const {
bool GrConvexPolyEffect::onIsEqual(const GrFragmentProcessor& other) const {
const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>();
// ignore the fact that 0 == -0 and just use memcmp.
return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount &&

View File

@ -75,7 +75,7 @@ public:
private:
GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[]);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -200,7 +200,7 @@ const GrBackendFragmentProcessorFactory& GrConvolutionEffect::getFactory() const
return GrTBackendFragmentProcessorFactory<GrConvolutionEffect>::getInstance();
}
bool GrConvolutionEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrConvolutionEffect& s = sBase.cast<GrConvolutionEffect>();
return (this->texture(0) == s.texture(0) &&
this->radius() == s.radius() &&

View File

@ -95,7 +95,7 @@ private:
bool useBounds,
float bounds[2]);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const {
// If the texture was opaque we could know that the output color if we knew the sum of the

View File

@ -67,7 +67,7 @@ GrCustomCoordsTextureEffect::GrCustomCoordsTextureEffect(GrTexture* texture,
this->addTextureAccess(&fTextureAccess);
}
bool GrCustomCoordsTextureEffect::onIsEqual(const GrProcessor& other) const {
bool GrCustomCoordsTextureEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrCustomCoordsTextureEffect& cte = other.cast<GrCustomCoordsTextureEffect>();
return fTextureAccess == cte.fTextureAccess;
}

View File

@ -37,7 +37,7 @@ public:
private:
GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -461,7 +461,7 @@ public:
private:
DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScalar radius);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -605,7 +605,7 @@ DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const Das
fCenterX = SkScalarHalf(offLen);
}
bool DashingCircleEffect::onIsEqual(const GrProcessor& other) const {
bool DashingCircleEffect::onIsEqual(const GrGeometryProcessor& other) const {
const DashingCircleEffect& dce = other.cast<DashingCircleEffect>();
return (fEdgeType == dce.fEdgeType &&
fIntervalLength == dce.fIntervalLength &&
@ -673,7 +673,7 @@ public:
private:
DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -829,7 +829,7 @@ DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInf
fRect.set(halfOffLen, -halfStroke, halfOffLen + onLen, halfStroke);
}
bool DashingLineEffect::onIsEqual(const GrProcessor& other) const {
bool DashingLineEffect::onIsEqual(const GrGeometryProcessor& other) const {
const DashingLineEffect& de = other.cast<DashingLineEffect>();
return (fEdgeType == de.fEdgeType &&
fRect == de.fRect &&

View File

@ -196,7 +196,7 @@ GrDistanceFieldTextureEffect::GrDistanceFieldTextureEffect(GrTexture* texture,
#endif
}
bool GrDistanceFieldTextureEffect::onIsEqual(const GrProcessor& other) const {
bool GrDistanceFieldTextureEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureEffect>();
return fTextureAccess == cte.fTextureAccess &&
#ifdef SK_GAMMA_APPLY_TO_A8
@ -379,7 +379,7 @@ GrDistanceFieldNoGammaTextureEffect::GrDistanceFieldNoGammaTextureEffect(GrTextu
this->addTextureAccess(&fTextureAccess);
}
bool GrDistanceFieldNoGammaTextureEffect::onIsEqual(const GrProcessor& other) const {
bool GrDistanceFieldNoGammaTextureEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrDistanceFieldNoGammaTextureEffect& cte =
other.cast<GrDistanceFieldNoGammaTextureEffect>();
return fTextureAccess == cte.fTextureAccess && fFlags == cte.fFlags;
@ -628,7 +628,7 @@ GrDistanceFieldLCDTextureEffect::GrDistanceFieldLCDTextureEffect(
this->addTextureAccess(&fGammaTextureAccess);
}
bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrProcessor& other) const {
bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrGeometryProcessor& other) const {
const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTextureEffect>();
return (fTextureAccess == cte.fTextureAccess &&
fGammaTextureAccess == cte.fGammaTextureAccess &&

View File

@ -76,7 +76,7 @@ private:
#endif
uint32_t flags);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -122,7 +122,7 @@ private:
GrDistanceFieldNoGammaTextureEffect(GrTexture* texture, const GrTextureParams& params,
uint32_t flags);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -168,7 +168,7 @@ private:
SkColor textColor,
uint32_t flags);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -40,7 +40,7 @@ private:
}
// All dither effects are equal
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { return true; }
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -176,7 +176,7 @@ const GrBackendFragmentProcessorFactory& GrMatrixConvolutionEffect::getFactory()
return GrTBackendFragmentProcessorFactory<GrMatrixConvolutionEffect>::getInstance();
}
bool GrMatrixConvolutionEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrMatrixConvolutionEffect& s = sBase.cast<GrMatrixConvolutionEffect>();
return this->texture(0) == s.texture(0) &&
fKernelSize == s.kernelSize() &&

View File

@ -77,7 +77,7 @@ private:
GrTextureDomain::Mode tileMode,
bool convolveAlpha);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE {
// TODO: Try to do better?

View File

@ -37,7 +37,7 @@ public:
private:
CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -71,7 +71,7 @@ CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkSca
this->setWillReadFragmentPosition();
}
bool CircleEffect::onIsEqual(const GrProcessor& other) const {
bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const {
const CircleEffect& ce = other.cast<CircleEffect>();
return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.fRadius;
}
@ -209,7 +209,7 @@ public:
private:
EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkScalar ry);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -245,7 +245,7 @@ EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkS
this->setWillReadFragmentPosition();
}
bool EllipseEffect::onIsEqual(const GrProcessor& other) const {
bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const {
const EllipseEffect& ee = other.cast<EllipseEffect>();
return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fRadii;
}

View File

@ -64,7 +64,7 @@ public:
private:
CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const SkRRect&);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -102,7 +102,7 @@ CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t
this->setWillReadFragmentPosition();
}
bool CircularRRectEffect::onIsEqual(const GrProcessor& other) const {
bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const {
const CircularRRectEffect& crre = other.cast<CircularRRectEffect>();
// The corner flags are derived from fRRect, so no need to check them.
return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect;
@ -404,7 +404,7 @@ public:
private:
EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&);
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;
@ -438,7 +438,7 @@ EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const
this->setWillReadFragmentPosition();
}
bool EllipticalRRectEffect::onIsEqual(const GrProcessor& other) const {
bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const {
const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>();
return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect;
}

View File

@ -68,7 +68,7 @@ private:
: GrSingleTextureEffect(texture, matrix, params, coordSet) {
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
const GrSimpleTextureEffect& ste = other.cast<GrSimpleTextureEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(ste);
}

View File

@ -263,7 +263,7 @@ const GrBackendFragmentProcessorFactory& GrTextureDomainEffect::getFactory() con
return GrTBackendFragmentProcessorFactory<GrTextureDomainEffect>::getInstance();
}
bool GrTextureDomainEffect::onIsEqual(const GrProcessor& sBase) const {
bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(s) &&
this->fTextureDomain == s.fTextureDomain;

View File

@ -173,7 +173,7 @@ private:
GrTextureParams::FilterMode,
GrCoordSet);
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE;

View File

@ -102,7 +102,7 @@ private:
this->setWillNotUseInputColor();
}
virtual bool onIsEqual(const GrProcessor& sBase) const {
virtual bool onIsEqual(const GrFragmentProcessor& sBase) const {
const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>();
return fYAccess.getTexture() == s.fYAccess.getTexture() &&
fUAccess.getTexture() == s.fUAccess.getTexture() &&

View File

@ -48,7 +48,7 @@ public:
private:
BigKeyProcessor() { }
virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { return true; }
virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { }
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;