removing GrDrawEffect
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/8ddbe8b9366c8c59c4fb55f01f253de8a0b37d6e
R=bsalomon@google.com
Author: joshualitt@chromium.org
Review URL: https://codereview.chromium.org/571163002
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index c6da45e..a479310 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -530,11 +530,11 @@
class GLEffect : public GrGLGeometryProcessor {
public:
- GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GLEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -569,14 +569,14 @@
fsBuilder->codeAppendf("\t%s = %s;\n", outputColor,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
- const GrShaderVar& inQuadEdge = drawEffect.castEffect<QuadEdgeEffect>().inQuadEdge();
+ const GrShaderVar& inQuadEdge = effect.cast<QuadEdgeEffect>().inQuadEdge();
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
vsBuilder->codeAppendf("\t%s = %s;\n", vsName, inQuadEdge.c_str());
}
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
private:
typedef GrGLGeometryProcessor INHERITED;
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 954a6f2..a083622 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -43,11 +43,11 @@
class GLEffect : public GrGLGeometryProcessor {
public:
- GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GLEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -59,7 +59,7 @@
const char *vsRectName, *fsRectName;
builder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsRectName);
- const GrShaderVar& inRect = drawEffect.castEffect<GrAlignedRectEffect>().inRect();
+ const GrShaderVar& inRect = effect.cast<GrAlignedRectEffect>().inRect();
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
vsBuilder->codeAppendf("\t%s = %s;\n", vsRectName, inRect.c_str());
@@ -92,9 +92,9 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("coverage")).c_str());
}
- static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
+ static void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
- virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager& pdman, const GrEffect&) SK_OVERRIDE {}
private:
typedef GrGLGeometryProcessor INHERITED;
@@ -169,11 +169,11 @@
class GLEffect : public GrGLGeometryProcessor {
public:
- GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GLEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -185,7 +185,7 @@
builder->addVarying(kVec4f_GrSLType, "RectEdge",
&vsRectEdgeName, &fsRectEdgeName);
- const GrRectEffect& rectEffect = drawEffect.castEffect<GrRectEffect>();
+ const GrRectEffect& rectEffect = effect.cast<GrRectEffect>();
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
vsBuilder->codeAppendf("%s = %s;", vsRectEdgeName, rectEffect.inRectEdge().c_str());
@@ -233,9 +233,9 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("coverage")).c_str());
}
- static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
+ static void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
- virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager& pdman, const GrEffect&) SK_OVERRIDE {}
private:
typedef GrGLGeometryProcessor INHERITED;
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 46ba72d..7743494 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -94,17 +94,17 @@
class GLEffect : public GrGLGeometryProcessor {
public:
- GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GLEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
- const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleEdgeEffect>();
+ const CircleEdgeEffect& circleEffect = effect.cast<CircleEdgeEffect>();
const char *vsName, *fsName;
builder->addVarying(kVec4f_GrSLType, "CircleEdge", &vsName, &fsName);
@@ -123,13 +123,13 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
- static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleEdgeEffect>();
+ const CircleEdgeEffect& circleEffect = effect.cast<CircleEdgeEffect>();
b->add32(circleEffect.isStroked());
}
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
private:
typedef GrGLGeometryProcessor INHERITED;
@@ -146,7 +146,7 @@
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
- const CircleEdgeEffect& cee = CastEffect<CircleEdgeEffect>(other);
+ const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>();
return cee.fStroke == fStroke;
}
@@ -212,17 +212,17 @@
class GLEffect : public GrGLGeometryProcessor {
public:
- GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GLEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
- const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<EllipseEdgeEffect>();
+ const EllipseEdgeEffect& ellipseEffect = effect.cast<EllipseEdgeEffect>();
const char *vsOffsetName, *fsOffsetName;
const char *vsRadiiName, *fsRadiiName;
@@ -260,13 +260,13 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
- static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<EllipseEdgeEffect>();
+ const EllipseEdgeEffect& ellipseEffect = effect.cast<EllipseEdgeEffect>();
b->add32(ellipseEffect.isStroked());
}
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {
}
private:
@@ -287,7 +287,7 @@
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
- const EllipseEdgeEffect& eee = CastEffect<EllipseEdgeEffect>(other);
+ const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>();
return eee.fStroke == fStroke;
}
@@ -361,17 +361,17 @@
class GLEffect : public GrGLGeometryProcessor {
public:
- GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GLEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
- const DIEllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<DIEllipseEdgeEffect>();
+ const DIEllipseEdgeEffect& ellipseEffect = effect.cast<DIEllipseEdgeEffect>();
const char *vsOffsetName0, *fsOffsetName0;
builder->addVarying(kVec2f_GrSLType, "EllipseOffsets0",
@@ -427,15 +427,14 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
- static void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const DIEllipseEdgeEffect& ellipseEffect =
- drawEffect.castEffect<DIEllipseEdgeEffect>();
+ const DIEllipseEdgeEffect& ellipseEffect = effect.cast<DIEllipseEdgeEffect>();
b->add32(ellipseEffect.getMode());
}
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {
}
private:
@@ -456,7 +455,7 @@
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
- const DIEllipseEdgeEffect& eee = CastEffect<DIEllipseEdgeEffect>(other);
+ const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>();
return eee.fMode == fMode;
}
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 8c85809..1b4191c 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -15,19 +15,19 @@
class GrGLConicEffect : public GrGLGeometryProcessor {
public:
- GrGLConicEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GrGLConicEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
private:
GrEffectEdgeType fEdgeType;
@@ -36,14 +36,14 @@
};
GrGLConicEffect::GrGLConicEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
- const GrConicEffect& ce = drawEffect.castEffect<GrConicEffect>();
+ const GrConicEffect& ce = effect.cast<GrConicEffect>();
fEdgeType = ce.getEdgeType();
}
void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -54,7 +54,7 @@
builder->addVarying(kVec4f_GrSLType, "ConicCoeffs",
&vsName, &fsName);
- const GrShaderVar& inConicCoeffs = drawEffect.castEffect<GrConicEffect>().inConicCoeffs();
+ const GrShaderVar& inConicCoeffs = effect.cast<GrConicEffect>().inConicCoeffs();
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
vsBuilder->codeAppendf("%s = %s;", vsName, inConicCoeffs.c_str());
@@ -119,9 +119,9 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
-void GrGLConicEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GrGLConicEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrConicEffect& ce = drawEffect.castEffect<GrConicEffect>();
+ const GrConicEffect& ce = effect.cast<GrConicEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
b->add32(key);
}
@@ -142,7 +142,7 @@
}
bool GrConicEffect::onIsEqual(const GrEffect& other) const {
- const GrConicEffect& ce = CastEffect<GrConicEffect>(other);
+ const GrConicEffect& ce = other.cast<GrConicEffect>();
return (ce.fEdgeType == fEdgeType);
}
@@ -169,19 +169,19 @@
class GrGLQuadEffect : public GrGLGeometryProcessor {
public:
- GrGLQuadEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GrGLQuadEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
private:
GrEffectEdgeType fEdgeType;
@@ -190,14 +190,14 @@
};
GrGLQuadEffect::GrGLQuadEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
- const GrQuadEffect& ce = drawEffect.castEffect<GrQuadEffect>();
+ const GrQuadEffect& ce = effect.cast<GrQuadEffect>();
fEdgeType = ce.getEdgeType();
}
void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -207,7 +207,7 @@
builder->addVarying(kVec4f_GrSLType, "HairQuadEdge", &vsName, &fsName);
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
- const GrShaderVar& inHairQuadEdge = drawEffect.castEffect<GrQuadEffect>().inHairQuadEdge();
+ const GrShaderVar& inHairQuadEdge = effect.cast<GrQuadEffect>().inHairQuadEdge();
vsBuilder->codeAppendf("%s = %s;", vsName, inHairQuadEdge.c_str());
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
@@ -257,9 +257,9 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
-void GrGLQuadEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GrGLQuadEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrQuadEffect& ce = drawEffect.castEffect<GrQuadEffect>();
+ const GrQuadEffect& ce = effect.cast<GrQuadEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
b->add32(key);
}
@@ -280,7 +280,7 @@
}
bool GrQuadEffect::onIsEqual(const GrEffect& other) const {
- const GrQuadEffect& ce = CastEffect<GrQuadEffect>(other);
+ const GrQuadEffect& ce = other.cast<GrQuadEffect>();
return (ce.fEdgeType == fEdgeType);
}
@@ -307,19 +307,19 @@
class GrGLCubicEffect : public GrGLGeometryProcessor {
public:
- GrGLCubicEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GrGLCubicEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
private:
GrEffectEdgeType fEdgeType;
@@ -328,14 +328,14 @@
};
GrGLCubicEffect::GrGLCubicEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
- const GrCubicEffect& ce = drawEffect.castEffect<GrCubicEffect>();
+ const GrCubicEffect& ce = effect.cast<GrCubicEffect>();
fEdgeType = ce.getEdgeType();
}
void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -347,7 +347,7 @@
&vsName, &fsName, GrGLShaderVar::kHigh_Precision);
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
- const GrShaderVar& inCubicCoeffs = drawEffect.castEffect<GrCubicEffect>().inCubicCoeffs();
+ const GrShaderVar& inCubicCoeffs = effect.cast<GrCubicEffect>().inCubicCoeffs();
vsBuilder->codeAppendf("%s = %s;", vsName, inCubicCoeffs.c_str());
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
@@ -437,9 +437,9 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1(edgeAlpha.c_str())).c_str());
}
-void GrGLCubicEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GrGLCubicEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrCubicEffect& ce = drawEffect.castEffect<GrCubicEffect>();
+ const GrCubicEffect& ce = effect.cast<GrCubicEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
b->add32(key);
}
@@ -460,7 +460,7 @@
}
bool GrCubicEffect::onIsEqual(const GrEffect& other) const {
- const GrCubicEffect& ce = CastEffect<GrCubicEffect>(other);
+ const GrCubicEffect& ce = other.cast<GrCubicEffect>();
return (ce.fEdgeType == fEdgeType);
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 27d482a..e08a602 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -22,21 +22,21 @@
class GrGLBicubicEffect : public GrGLEffect {
public:
GrGLBicubicEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect&);
+ const GrEffect&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrDrawEffect&,
+ const GrEffect&,
const GrEffectKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrTextureDomain& domain = drawEffect.castEffect<GrBicubicEffect>().domain();
+ const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain();
b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
}
@@ -50,18 +50,18 @@
typedef GrGLEffect INHERITED;
};
-GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED(factory) {
}
void GrGLBicubicEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
- const GrTextureDomain& domain = drawEffect.castEffect<GrBicubicEffect>().domain();
+ const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain();
fCoefficientsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kMat44f_GrSLType, "Coefficients");
@@ -116,15 +116,15 @@
}
void GrGLBicubicEffect::setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) {
- const GrBicubicEffect& effect = drawEffect.castEffect<GrBicubicEffect>();
+ const GrEffect& effect) {
+ const GrBicubicEffect& bicubicEffect = effect.cast<GrBicubicEffect>();
const GrTexture& texture = *effect.texture(0);
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture.width();
imageIncrement[1] = 1.0f / texture.height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
- pdman.setMatrix4f(fCoefficientsUni, effect.coefficients());
- fDomain.setData(pdman, effect.domain(), texture.origin());
+ pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients());
+ fDomain.setData(pdman, bicubicEffect.domain(), texture.origin());
}
static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float dst[16],
@@ -163,7 +163,7 @@
}
bool GrBicubicEffect::onIsEqual(const GrEffect& sBase) const {
- const GrBicubicEffect& s = CastEffect<GrBicubicEffect>(sBase);
+ const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>();
return this->textureAccess(0) == s.textureAccess(0) &&
!memcmp(fCoefficients, s.coefficients(), 16) &&
fDomain == s.fDomain;
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index 27b111e..2c1a299 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -10,7 +10,6 @@
#include "GrSingleTextureEffect.h"
#include "GrTextureDomain.h"
-#include "GrDrawEffect.h"
#include "gl/GrGLEffect.h"
#include "GrTBackendEffectFactory.h"
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 84e60cd..e00ad53 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -16,15 +16,15 @@
class GrGLConfigConversionEffect : public GrGLEffect {
public:
GrGLConfigConversionEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
- const GrConfigConversionEffect& effect = drawEffect.castEffect<GrConfigConversionEffect>();
- fSwapRedAndBlue = effect.swapsRedAndBlue();
- fPMConversion = effect.pmConversion();
+ const GrConfigConversionEffect& configConversionEffect = effect.cast<GrConfigConversionEffect>();
+ fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue();
+ fPMConversion = configConversionEffect.pmConversion();
}
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect&,
+ const GrEffect&,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -84,9 +84,9 @@
fsBuilder->codeAppend(modulate.c_str());
}
- static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrConfigConversionEffect& conv = drawEffect.castEffect<GrConfigConversionEffect>();
+ const GrConfigConversionEffect& conv = effect.cast<GrConfigConversionEffect>();
uint32_t key = (conv.swapsRedAndBlue() ? 0 : 1) | (conv.pmConversion() << 1);
b->add32(key);
}
@@ -119,7 +119,7 @@
}
bool GrConfigConversionEffect::onIsEqual(const GrEffect& s) const {
- const GrConfigConversionEffect& other = CastEffect<GrConfigConversionEffect>(s);
+ const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>();
return this->texture(0) == s.texture(0) &&
other.fSwapRedAndBlue == fSwapRedAndBlue &&
other.fPMConversion == fPMConversion;
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 71a8bef..afe3674 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -50,7 +50,7 @@
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
- const AARectEffect& aare = CastEffect<AARectEffect>(other);
+ const AARectEffect& aare = other.cast<AARectEffect>();
return fRect == aare.fRect;
}
@@ -87,19 +87,19 @@
class GLAARectEffect : public GrGLEffect {
public:
- GLAARectEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLAARectEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fRectUniform;
@@ -108,19 +108,19 @@
};
GLAARectEffect::GLAARectEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRect.fLeft = SK_ScalarNaN;
}
void GLAARectEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const AARectEffect& aare = drawEffect.castEffect<AARectEffect>();
+ const AARectEffect& aare = effect.cast<AARectEffect>();
const char *rectName;
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
// respectively.
@@ -157,8 +157,8 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLAARectEffect::setData(const GrGLProgramDataManager& pdman, const GrDrawEffect& drawEffect) {
- const AARectEffect& aare = drawEffect.castEffect<AARectEffect>();
+void GLAARectEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+ const AARectEffect& aare = effect.cast<AARectEffect>();
const SkRect& rect = aare.getRect();
if (rect != fPrevRect) {
pdman.set4f(fRectUniform, rect.fLeft + 0.5f, rect.fTop + 0.5f,
@@ -167,9 +167,9 @@
}
}
-void GLAARectEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLAARectEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const AARectEffect& aare = drawEffect.castEffect<AARectEffect>();
+ const AARectEffect& aare = effect.cast<AARectEffect>();
b->add32(aare.getEdgeType());
}
@@ -181,19 +181,19 @@
class GrGLConvexPolyEffect : public GrGLEffect {
public:
- GrGLConvexPolyEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GrGLConvexPolyEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fEdgeUniform;
@@ -202,19 +202,19 @@
};
GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevEdges[0] = SK_ScalarNaN;
}
void GrGLConvexPolyEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const GrConvexPolyEffect& cpe = drawEffect.castEffect<GrConvexPolyEffect>();
+ const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
const char *edgeArrayName;
fEdgeUniform = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
@@ -249,8 +249,8 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const GrDrawEffect& drawEffect) {
- const GrConvexPolyEffect& cpe = drawEffect.castEffect<GrConvexPolyEffect>();
+void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+ const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
size_t byteSize = 3 * cpe.getEdgeCount() * sizeof(SkScalar);
if (0 != memcmp(fPrevEdges, cpe.getEdges(), byteSize)) {
pdman.set3fv(fEdgeUniform, cpe.getEdgeCount(), cpe.getEdges());
@@ -258,9 +258,9 @@
}
}
-void GrGLConvexPolyEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GrGLConvexPolyEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrConvexPolyEffect& cpe = drawEffect.castEffect<GrConvexPolyEffect>();
+ const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
GR_STATIC_ASSERT(kGrEffectEdgeTypeCnt <= 8);
uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType();
b->add32(key);
@@ -351,7 +351,7 @@
}
bool GrConvexPolyEffect::onIsEqual(const GrEffect& other) const {
- const GrConvexPolyEffect& cpe = CastEffect<GrConvexPolyEffect>(other);
+ const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>();
// ignore the fact that 0 == -0 and just use memcmp.
return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount &&
0 == memcmp(cpe.fEdges, fEdges, 3 * fEdgeCount * sizeof(SkScalar)));
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 90a655c..b0abdcf 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -17,19 +17,19 @@
class GrGLConvolutionEffect : public GrGLEffect {
public:
- GrGLConvolutionEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GrGLConvolutionEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrDrawEffect&,
+ const GrEffect&,
const GrEffectKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLProgramDataManager& pdman, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager& pdman, const GrEffect&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
private:
int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); }
@@ -47,16 +47,16 @@
};
GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED(factory) {
- const GrConvolutionEffect& c = drawEffect.castEffect<GrConvolutionEffect>();
+ const GrConvolutionEffect& c = effect.cast<GrConvolutionEffect>();
fRadius = c.radius();
fUseBounds = c.useBounds();
fDirection = c.direction();
}
void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect&,
+ const GrEffect&,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -106,8 +106,8 @@
}
void GrGLConvolutionEffect::setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) {
- const GrConvolutionEffect& conv = drawEffect.castEffect<GrConvolutionEffect>();
+ const GrEffect& effect) {
+ const GrConvolutionEffect& conv = effect.cast<GrConvolutionEffect>();
GrTexture& texture = *conv.texture(0);
// the code we generated was for a specific kernel radius
SkASSERT(conv.radius() == fRadius);
@@ -136,9 +136,9 @@
pdman.set1fv(fKernelUni, this->width(), conv.kernel());
}
-void GrGLConvolutionEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GrGLConvolutionEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrConvolutionEffect& conv = drawEffect.castEffect<GrConvolutionEffect>();
+ const GrConvolutionEffect& conv = effect.cast<GrConvolutionEffect>();
uint32_t key = conv.radius();
key <<= 2;
if (conv.useBounds()) {
@@ -201,7 +201,7 @@
}
bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
- const GrConvolutionEffect& s = CastEffect<GrConvolutionEffect>(sBase);
+ const GrConvolutionEffect& s = sBase.cast<GrConvolutionEffect>();
return (this->texture(0) == s.texture(0) &&
this->radius() == s.radius() &&
this->direction() == s.direction() &&
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
index 206c524..9998bdd 100644
--- a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
+++ b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
@@ -16,18 +16,18 @@
class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor {
public:
- GrGLCustomCoordsTextureEffect(const GrBackendEffectFactory& factory, const GrDrawEffect& drawEffect)
+ GrGLCustomCoordsTextureEffect(const GrBackendEffectFactory& factory, const GrEffect& effect)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrCustomCoordsTextureEffect& customCoordsTextureEffect =
- drawEffect.castEffect<GrCustomCoordsTextureEffect>();
+ effect.cast<GrCustomCoordsTextureEffect>();
SkASSERT(1 == customCoordsTextureEffect.getVertexAttribs().count());
SkString fsCoordName;
@@ -50,7 +50,7 @@
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) SK_OVERRIDE {}
+ const GrEffect& effect) SK_OVERRIDE {}
private:
typedef GrGLGeometryProcessor INHERITED;
@@ -68,7 +68,7 @@
}
bool GrCustomCoordsTextureEffect::onIsEqual(const GrEffect& other) const {
- const GrCustomCoordsTextureEffect& cte = CastEffect<GrCustomCoordsTextureEffect>(other);
+ const GrCustomCoordsTextureEffect& cte = other.cast<GrCustomCoordsTextureEffect>();
return fTextureAccess == cte.fTextureAccess;
}
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 398b0dd..53aba0e 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -478,19 +478,19 @@
class GLDashingCircleEffect : public GrGLGeometryProcessor {
public:
- GLDashingCircleEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLDashingCircleEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fParamUniform;
@@ -501,7 +501,7 @@
};
GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRadius = SK_ScalarMin;
fPrevCenterX = SK_ScalarMin;
@@ -509,13 +509,13 @@
}
void GLDashingCircleEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>();
+ const DashingCircleEffect& dce = effect.cast<DashingCircleEffect>();
const char *paramName;
// The param uniforms, xyz, refer to circle radius - 0.5, cicles center x coord, and
// the total interval length of the dash.
@@ -549,8 +549,8 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrDrawEffect& drawEffect) {
- const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>();
+void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+ const DashingCircleEffect& dce = effect.cast<DashingCircleEffect>();
SkScalar radius = dce.getRadius();
SkScalar centerX = dce.getCenterX();
SkScalar intervalLength = dce.getIntervalLength();
@@ -562,9 +562,9 @@
}
}
-void GLDashingCircleEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLDashingCircleEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>();
+ const DashingCircleEffect& dce = effect.cast<DashingCircleEffect>();
b->add32(dce.getEdgeType());
}
@@ -603,7 +603,7 @@
}
bool DashingCircleEffect::onIsEqual(const GrEffect& other) const {
- const DashingCircleEffect& dce = CastEffect<DashingCircleEffect>(other);
+ const DashingCircleEffect& dce = other.cast<DashingCircleEffect>();
return (fEdgeType == dce.fEdgeType &&
fIntervalLength == dce.fIntervalLength &&
fRadius == dce.fRadius &&
@@ -688,19 +688,19 @@
class GLDashingLineEffect : public GrGLGeometryProcessor {
public:
- GLDashingLineEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLDashingLineEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fRectUniform;
@@ -711,20 +711,20 @@
};
GLDashingLineEffect::GLDashingLineEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRect.fLeft = SK_ScalarNaN;
fPrevIntervalLength = SK_ScalarMax;
}
void GLDashingLineEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>();
+ const DashingLineEffect& de = effect.cast<DashingLineEffect>();
const char *rectName;
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
// respectively.
@@ -770,8 +770,8 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, const GrDrawEffect& drawEffect) {
- const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>();
+void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+ const DashingLineEffect& de = effect.cast<DashingLineEffect>();
const SkRect& rect = de.getRect();
SkScalar intervalLength = de.getIntervalLength();
if (rect != fPrevRect || intervalLength != fPrevIntervalLength) {
@@ -783,9 +783,9 @@
}
}
-void GLDashingLineEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLDashingLineEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>();
+ const DashingLineEffect& de = effect.cast<DashingLineEffect>();
b->add32(de.getEdgeType());
}
@@ -825,7 +825,7 @@
}
bool DashingLineEffect::onIsEqual(const GrEffect& other) const {
- const DashingLineEffect& de = CastEffect<DashingLineEffect>(other);
+ const DashingLineEffect& de = other.cast<DashingLineEffect>();
return (fEdgeType == de.fEdgeType &&
fRect == de.fRect &&
fIntervalLength == de.fIntervalLength);
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
index b689c8f..28035ef 100755
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
@@ -32,7 +32,7 @@
class GrGLDistanceFieldTextureEffect : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldTextureEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory)
, fTextureSize(SkISize::Make(-1,-1))
#ifdef SK_GAMMA_APPLY_TO_A8
@@ -41,14 +41,14 @@
{}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrDistanceFieldTextureEffect& dfTexEffect =
- drawEffect.castEffect<GrDistanceFieldTextureEffect>();
+ effect.cast<GrDistanceFieldTextureEffect>();
SkASSERT(1 == dfTexEffect.getVertexAttribs().count());
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
@@ -131,10 +131,10 @@
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) SK_OVERRIDE {
+ const GrEffect& effect) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
- GrTexture* texture = drawEffect.effect()->texture(0);
+ GrTexture* texture = effect.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@@ -144,7 +144,7 @@
}
#ifdef SK_GAMMA_APPLY_TO_A8
const GrDistanceFieldTextureEffect& dfTexEffect =
- drawEffect.castEffect<GrDistanceFieldTextureEffect>();
+ effect.cast<GrDistanceFieldTextureEffect>();
float luminance = dfTexEffect.getLuminance();
if (luminance != fLuminance) {
pdman.set1f(fLuminanceUni, luminance);
@@ -153,10 +153,10 @@
#endif
}
- static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
const GrDistanceFieldTextureEffect& dfTexEffect =
- drawEffect.castEffect<GrDistanceFieldTextureEffect>();
+ effect.cast<GrDistanceFieldTextureEffect>();
b->add32(dfTexEffect.getFlags());
}
@@ -197,7 +197,7 @@
}
bool GrDistanceFieldTextureEffect::onIsEqual(const GrEffect& other) const {
- const GrDistanceFieldTextureEffect& cte = CastEffect<GrDistanceFieldTextureEffect>(other);
+ const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureEffect>();
return fTextureAccess == cte.fTextureAccess &&
#ifdef SK_GAMMA_APPLY_TO_A8
fGammaTextureAccess == cte.fGammaTextureAccess &&
@@ -264,20 +264,20 @@
class GrGLDistanceFieldLCDTextureEffect : public GrGLGeometryProcessor {
public:
GrGLDistanceFieldLCDTextureEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory)
, fTextureSize(SkISize::Make(-1,-1))
, fTextColor(GrColor_ILLEGAL) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
- drawEffect.castEffect<GrDistanceFieldLCDTextureEffect>();
+ effect.cast<GrDistanceFieldLCDTextureEffect>();
SkASSERT(1 == dfTexEffect.getVertexAttribs().count());
SkString fsCoordName;
@@ -400,13 +400,13 @@
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) SK_OVERRIDE {
+ const GrEffect& effect) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
SkASSERT(fTextColorUni.isValid());
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
- drawEffect.castEffect<GrDistanceFieldLCDTextureEffect>();
- GrTexture* texture = drawEffect.effect()->texture(0);
+ effect.cast<GrDistanceFieldLCDTextureEffect>();
+ GrTexture* texture = effect.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@@ -431,10 +431,10 @@
}
}
- static inline void GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
- drawEffect.castEffect<GrDistanceFieldLCDTextureEffect>();
+ effect.cast<GrDistanceFieldLCDTextureEffect>();
b->add32(dfTexEffect.getFlags());
}
@@ -469,8 +469,7 @@
}
bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrEffect& other) const {
- const GrDistanceFieldLCDTextureEffect& cte =
- CastEffect<GrDistanceFieldLCDTextureEffect>(other);
+ const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTextureEffect>();
return (fTextureAccess == cte.fTextureAccess &&
fGammaTextureAccess == cte.fGammaTextureAccess &&
fTextColor == cte.fTextColor &&
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 443df9e..35726fd 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -68,10 +68,10 @@
class GLDitherEffect : public GrGLEffect {
public:
- GLDitherEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLDitherEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -83,12 +83,12 @@
};
GLDitherEffect::GLDitherEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
}
void GLDitherEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index b78c637..4ba1895 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -14,18 +14,18 @@
class GrGLMatrixConvolutionEffect : public GrGLEffect {
public:
GrGLMatrixConvolutionEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& effect);
+ const GrEffect& effect);
virtual void emitCode(GrGLProgramBuilder*,
- const GrDrawEffect&,
+ const GrEffect&,
const GrEffectKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
typedef GrGLProgramDataManager::UniformHandle UniformHandle;
@@ -44,22 +44,22 @@
};
GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED(factory) {
- const GrMatrixConvolutionEffect& m = drawEffect.castEffect<GrMatrixConvolutionEffect>();
+ const GrMatrixConvolutionEffect& m = effect.cast<GrMatrixConvolutionEffect>();
fKernelSize = m.kernelSize();
fConvolveAlpha = m.convolveAlpha();
}
void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
sk_ignore_unused_variable(inputColor);
- const GrTextureDomain& domain = drawEffect.castEffect<GrMatrixConvolutionEffect>().domain();
+ const GrTextureDomain& domain = effect.cast<GrMatrixConvolutionEffect>().domain();
fBoundsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, "Bounds");
@@ -120,9 +120,9 @@
fsBuilder->codeAppend(modulate.c_str());
}
-void GrGLMatrixConvolutionEffect::GenKey(const GrDrawEffect& drawEffect,
+void GrGLMatrixConvolutionEffect::GenKey(const GrEffect& effect,
const GrGLCaps&, GrEffectKeyBuilder* b) {
- const GrMatrixConvolutionEffect& m = drawEffect.castEffect<GrMatrixConvolutionEffect>();
+ const GrMatrixConvolutionEffect& m = effect.cast<GrMatrixConvolutionEffect>();
SkASSERT(m.kernelSize().width() <= 0x7FFF && m.kernelSize().height() <= 0xFFFF);
uint32_t key = m.kernelSize().width() << 16 | m.kernelSize().height();
key |= m.convolveAlpha() ? 1 << 31 : 0;
@@ -131,8 +131,8 @@
}
void GrGLMatrixConvolutionEffect::setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) {
- const GrMatrixConvolutionEffect& conv = drawEffect.castEffect<GrMatrixConvolutionEffect>();
+ const GrEffect& effect) {
+ const GrMatrixConvolutionEffect& conv = effect.cast<GrMatrixConvolutionEffect>();
GrTexture& texture = *conv.texture(0);
// the code we generated was for a specific kernel size
SkASSERT(conv.kernelSize() == fKernelSize);
@@ -178,7 +178,7 @@
}
bool GrMatrixConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
- const GrMatrixConvolutionEffect& s = CastEffect<GrMatrixConvolutionEffect>(sBase);
+ const GrMatrixConvolutionEffect& s = sBase.cast<GrMatrixConvolutionEffect>();
return this->texture(0) == s.texture(0) &&
fKernelSize == s.kernelSize() &&
!memcmp(fKernel, s.kernel(),
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index 369b780..65f188e 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -71,7 +71,7 @@
}
bool CircleEffect::onIsEqual(const GrEffect& other) const {
- const CircleEffect& ce = CastEffect<CircleEffect>(other);
+ const CircleEffect& ce = other.cast<CircleEffect>();
return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.fRadius;
}
@@ -98,19 +98,19 @@
class GLCircleEffect : public GrGLEffect {
public:
- GLCircleEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLCircleEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fCircleUniform;
@@ -121,19 +121,19 @@
};
GLCircleEffect::GLCircleEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRadius = -1.f;
}
void GLCircleEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const CircleEffect& ce = drawEffect.castEffect<CircleEffect>();
+ const CircleEffect& ce = effect.cast<CircleEffect>();
const char *circleName;
// The circle uniform is (center.x, center.y, radius + 0.5) for regular fills and
// (... ,radius - 0.5) for inverse fills.
@@ -163,14 +163,14 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("d")).c_str());
}
-void GLCircleEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLCircleEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const CircleEffect& ce = drawEffect.castEffect<CircleEffect>();
+ const CircleEffect& ce = effect.cast<CircleEffect>();
b->add32(ce.getEdgeType());
}
-void GLCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrDrawEffect& drawEffect) {
- const CircleEffect& ce = drawEffect.castEffect<CircleEffect>();
+void GLCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+ const CircleEffect& ce = effect.cast<CircleEffect>();
if (ce.getRadius() != fPrevRadius || ce.getCenter() != fPrevCenter) {
SkScalar radius = ce.getRadius();
if (GrEffectEdgeTypeIsInverseFill(ce.getEdgeType())) {
@@ -244,7 +244,7 @@
}
bool EllipseEffect::onIsEqual(const GrEffect& other) const {
- const EllipseEffect& ee = CastEffect<EllipseEffect>(other);
+ const EllipseEffect& ee = other.cast<EllipseEffect>();
return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fRadii;
}
@@ -272,19 +272,19 @@
class GLEllipseEffect : public GrGLEffect {
public:
- GLEllipseEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLEllipseEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fEllipseUniform;
@@ -295,19 +295,19 @@
};
GLEllipseEffect::GLEllipseEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRadii.fX = -1.f;
}
void GLEllipseEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const EllipseEffect& ee = drawEffect.castEffect<EllipseEffect>();
+ const EllipseEffect& ee = effect.cast<EllipseEffect>();
const char *ellipseName;
// The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
fEllipseUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
@@ -350,14 +350,14 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLEllipseEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLEllipseEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const EllipseEffect& ee = drawEffect.castEffect<EllipseEffect>();
+ const EllipseEffect& ee = effect.cast<EllipseEffect>();
b->add32(ee.getEdgeType());
}
-void GLEllipseEffect::setData(const GrGLProgramDataManager& pdman, const GrDrawEffect& drawEffect) {
- const EllipseEffect& ee = drawEffect.castEffect<EllipseEffect>();
+void GLEllipseEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+ const EllipseEffect& ee = effect.cast<EllipseEffect>();
if (ee.getRadii() != fPrevRadii || ee.getCenter() != fPrevCenter) {
SkScalar invRXSqd = 1.f / (ee.getRadii().fX * ee.getRadii().fX);
SkScalar invRYSqd = 1.f / (ee.getRadii().fY * ee.getRadii().fY);
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 8a3fc44..1c45c37 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -102,7 +102,7 @@
}
bool CircularRRectEffect::onIsEqual(const GrEffect& other) const {
- const CircularRRectEffect& crre = CastEffect<CircularRRectEffect>(other);
+ 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;
}
@@ -132,19 +132,19 @@
class GLCircularRRectEffect : public GrGLEffect {
public:
- GLCircularRRectEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLCircularRRectEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fInnerRectUniform;
@@ -154,19 +154,19 @@
};
GLCircularRRectEffect::GLCircularRRectEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRRect.setEmpty();
}
void GLCircularRRectEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const CircularRRectEffect& crre = drawEffect.castEffect<CircularRRectEffect>();
+ const CircularRRectEffect& crre = effect.cast<CircularRRectEffect>();
const char *rectName;
const char *radiusPlusHalfName;
// The inner rect is the rrect bounds inset by the radius. Its left, top, right, and bottom
@@ -293,16 +293,16 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLCircularRRectEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLCircularRRectEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const CircularRRectEffect& crre = drawEffect.castEffect<CircularRRectEffect>();
+ const CircularRRectEffect& crre = effect.cast<CircularRRectEffect>();
GR_STATIC_ASSERT(kGrEffectEdgeTypeCnt <= 8);
b->add32((crre.getCircularCornerFlags() << 3) | crre.getEdgeType());
}
void GLCircularRRectEffect::setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) {
- const CircularRRectEffect& crre = drawEffect.castEffect<CircularRRectEffect>();
+ const GrEffect& effect) {
+ const CircularRRectEffect& crre = effect.cast<CircularRRectEffect>();
const SkRRect& rrect = crre.getRRect();
if (rrect != fPrevRRect) {
SkRect rect = rrect.getBounds();
@@ -436,7 +436,7 @@
}
bool EllipticalRRectEffect::onIsEqual(const GrEffect& other) const {
- const EllipticalRRectEffect& erre = CastEffect<EllipticalRRectEffect>(other);
+ const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>();
return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect;
}
@@ -486,19 +486,19 @@
class GLEllipticalRRectEffect : public GrGLEffect {
public:
- GLEllipticalRRectEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GLEllipticalRRectEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fInnerRectUniform;
@@ -508,19 +508,19 @@
};
GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect& drawEffect)
+ const GrEffect& effect)
: INHERITED (factory) {
fPrevRRect.setEmpty();
}
void GLEllipticalRRectEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const EllipticalRRectEffect& erre = drawEffect.castEffect<EllipticalRRectEffect>();
+ const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
const char *rectName;
// The inner rect is the rrect bounds inset by the x/y radii
fInnerRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
@@ -590,16 +590,16 @@
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLEllipticalRRectEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GLEllipticalRRectEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const EllipticalRRectEffect& erre = drawEffect.castEffect<EllipticalRRectEffect>();
+ const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
GR_STATIC_ASSERT(kLast_GrEffectEdgeType < (1 << 3));
b->add32(erre.getRRect().getType() | erre.getEdgeType() << 3);
}
void GLEllipticalRRectEffect::setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) {
- const EllipticalRRectEffect& erre = drawEffect.castEffect<EllipticalRRectEffect>();
+ const GrEffect& effect) {
+ const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
const SkRRect& rrect = erre.getRRect();
if (rrect != fPrevRRect) {
SkRect rect = rrect.getBounds();
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index fe55ce9..7871920 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -15,12 +15,12 @@
class GrGLSimpleTextureEffect : public GrGLEffect {
public:
- GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
+ GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrEffect&)
: INHERITED (factory) {
}
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index 49e3d7a..e81dd86 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -71,7 +71,7 @@
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
- const GrSimpleTextureEffect& ste = CastEffect<GrSimpleTextureEffect>(other);
+ const GrSimpleTextureEffect& ste = other.cast<GrSimpleTextureEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(ste);
}
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 40006a3..664c65c 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -167,19 +167,19 @@
class GrGLTextureDomainEffect : public GrGLEffect {
public:
- GrGLTextureDomainEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
+ GrGLTextureDomainEffect(const GrBackendEffectFactory&, const GrEffect&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrDrawEffect&,
+ const GrEffect&,
const GrEffectKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
private:
GrTextureDomain::GLDomain fGLDomain;
@@ -187,19 +187,19 @@
};
GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect&)
+ const GrEffect&)
: INHERITED(factory) {
}
void GrGLTextureDomainEffect::emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
- const GrTextureDomainEffect& effect = drawEffect.castEffect<GrTextureDomainEffect>();
- const GrTextureDomain& domain = effect.textureDomain();
+ const GrTextureDomainEffect& textureDomainEffect = effect.cast<GrTextureDomainEffect>();
+ const GrTextureDomain& domain = textureDomainEffect.textureDomain();
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
@@ -207,15 +207,15 @@
}
void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) {
- const GrTextureDomainEffect& effect = drawEffect.castEffect<GrTextureDomainEffect>();
- const GrTextureDomain& domain = effect.textureDomain();
+ const GrEffect& effect) {
+ const GrTextureDomainEffect& textureDomainEffect = effect.cast<GrTextureDomainEffect>();
+ const GrTextureDomain& domain = textureDomainEffect.textureDomain();
fGLDomain.setData(pdman, domain, effect.texture(0)->origin());
}
-void GrGLTextureDomainEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+void GrGLTextureDomainEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrEffectKeyBuilder* b) {
- const GrTextureDomain& domain = drawEffect.castEffect<GrTextureDomainEffect>().textureDomain();
+ const GrTextureDomain& domain = effect.cast<GrTextureDomainEffect>().textureDomain();
b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
}
@@ -264,7 +264,7 @@
}
bool GrTextureDomainEffect::onIsEqual(const GrEffect& sBase) const {
- const GrTextureDomainEffect& s = CastEffect<GrTextureDomainEffect>(sBase);
+ const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(s) &&
this->fTextureDomain == s.fTextureDomain;
}
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 4ffc345..cba8140 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -45,15 +45,15 @@
static const GrGLfloat kRec601ConversionMatrix[16];
// this class always generates the same code.
- static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
+ static void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
GLEffect(const GrBackendEffectFactory& factory,
- const GrDrawEffect&)
+ const GrEffect&)
: INHERITED(factory) {
}
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect&,
const GrEffectKey&,
const char* outputColor,
const char* inputColor,
@@ -75,8 +75,8 @@
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect) SK_OVERRIDE {
- const YUVtoRGBEffect& yuvEffect = drawEffect.castEffect<YUVtoRGBEffect>();
+ const GrEffect& effect) SK_OVERRIDE {
+ const YUVtoRGBEffect& yuvEffect = effect.cast<YUVtoRGBEffect>();
switch (yuvEffect.getColorSpace()) {
case kJPEG_SkYUVColorSpace:
pdman.setMatrix4f(fMatrixUni, kJPEGConversionMatrix);
@@ -110,7 +110,7 @@
}
virtual bool onIsEqual(const GrEffect& sBase) const {
- const YUVtoRGBEffect& s = CastEffect<YUVtoRGBEffect>(sBase);
+ const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>();
return fYAccess.getTexture() == s.fYAccess.getTexture() &&
fUAccess.getTexture() == s.fUAccess.getTexture() &&
fVAccess.getTexture() == s.fVAccess.getTexture() &&
diff --git a/src/gpu/gl/GrGLEffect.h b/src/gpu/gl/GrGLEffect.h
index e7d847d..24c20c6 100644
--- a/src/gpu/gl/GrGLEffect.h
+++ b/src/gpu/gl/GrGLEffect.h
@@ -20,19 +20,16 @@
include/gpu/GrEffect.h. Objects of type GrGLEffect are responsible for emitting the
GLSL code that implements a GrEffect and for uploading uniforms at draw time. If they don't
always emit the same GLSL code, they must have a function:
- static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*)
+ static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*)
that is used to implement a program cache. When two GrEffects produce the same key this means
that their GrGLEffects would emit the same GLSL code.
The GrGLEffect subclass must also have a constructor of the form:
- EffectSubclass::EffectSubclass(const GrBackendEffectFactory&, const GrDrawEffect&)
- The effect held by the GrDrawEffect is guaranteed to be of the type that generated the
- GrGLEffect subclass instance.
+ EffectSubclass::EffectSubclass(const GrBackendEffectFactory&, const GrEffect&)
These objects are created by the factory object returned by the GrEffect::getFactory().
*/
-class GrDrawEffect;
class GrGLTexture;
class GrGLGeometryProcessor;
@@ -55,7 +52,7 @@
stages.
@param builder Interface used to emit code in the shaders.
- @param drawEffect A wrapper on the effect that generated this program stage.
+ @param effect The effect that generated this program stage.
@param key The key that was computed by GenKey() from the generating GrEffect.
@param outputColor A predefined vec4 in the FS in which the stage should place its output
color (or coverage).
@@ -69,7 +66,7 @@
reads in the generated code.
*/
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -78,16 +75,16 @@
/** A GrGLEffect instance can be reused with any GrEffect that produces the same stage
key; this function reads data from a GrEffect and uploads any uniform variables required
- by the shaders created in emitCode(). The GrEffect installed in the GrDrawEffect is
+ by the shaders created in emitCode(). The GrEffect is
guaranteed to be of the same type that created this GrGLEffect and to have an identical
effect key as the one that created this GrGLEffect. Effects that use local coords have
to consider whether the GrEffectStage's coord change matrix should be used. When explicit
local coordinates are used it can be ignored. */
- virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) {}
+ virtual void setData(const GrGLProgramDataManager&, const GrEffect&) {}
const char* name() const { return fFactory.name(); }
- static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
+ static void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
/** Used by the system when generating shader code, to see if this effect can be downcasted to
the internal GrGLGeometryProcessor type */
diff --git a/src/gpu/gl/GrGLGeometryProcessor.h b/src/gpu/gl/GrGLGeometryProcessor.h
index 4b9bd44..d057154 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.h
+++ b/src/gpu/gl/GrGLGeometryProcessor.h
@@ -25,7 +25,7 @@
* This allows the effect subclass to emit vertex code.
*/
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
@@ -35,7 +35,7 @@
* Provide a default override for base class's emitCode() function.
*/
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffect& effect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 916c31c..1ad05eb 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -10,7 +10,6 @@
#include "GrAllocator.h"
#include "GrEffect.h"
#include "GrCoordTransform.h"
-#include "GrDrawEffect.h"
#include "GrGLEffect.h"
#include "GrGpuGL.h"
#include "GrGLPathRendering.h"
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index d7ba287..4056c77 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -8,7 +8,6 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrGLProgramDesc.h"
#include "GrBackendEffectFactory.h"
-#include "GrDrawEffect.h"
#include "GrEffect.h"
#include "GrGpuGL.h"
@@ -23,24 +22,27 @@
bool* setTrueIfReadsPos,
bool* setTrueIfRequiresVertexShader) {
const GrBackendEffectFactory& factory = stage.getEffect()->getFactory();
- GrDrawEffect drawEffect(stage, useExplicitLocalCoords);
- if (stage.getEffect()->willReadDstColor()) {
+ const GrEffect& effect = *stage.getEffect();
+ if (effect.willReadDstColor()) {
*setTrueIfReadsDst = true;
}
- if (stage.getEffect()->willReadFragmentPosition()) {
+ if (effect.willReadFragmentPosition()) {
*setTrueIfReadsPos = true;
}
- if (stage.getEffect()->requiresVertexShader()) {
+ if (effect.requiresVertexShader()) {
*setTrueIfRequiresVertexShader = true;
}
- factory.getGLEffectKey(drawEffect, caps, b);
+ factory.getGLEffectKey(effect, caps, b);
size_t size = b->size();
if (size > SK_MaxU16) {
*effectKeySize = 0; // suppresses a warning.
return false;
}
*effectKeySize = SkToU16(size);
- if (!GrGLProgramEffects::GenEffectMetaKey(drawEffect, caps, b)) {
+ if (!GrGLProgramEffects::GenEffectMetaKey(stage,
+ useExplicitLocalCoords,
+ caps,
+ b)) {
return false;
}
return true;
diff --git a/src/gpu/gl/GrGLProgramEffects.cpp b/src/gpu/gl/GrGLProgramEffects.cpp
index 369ec10..d69cbbb 100644
--- a/src/gpu/gl/GrGLProgramEffects.cpp
+++ b/src/gpu/gl/GrGLProgramEffects.cpp
@@ -7,7 +7,6 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrGLProgramEffects.h"
-#include "GrDrawEffect.h"
#include "gl/GrGLEffect.h"
#include "gl/GrGLPathRendering.h"
#include "gl/builders/GrGLProgramBuilder.h"
@@ -89,15 +88,17 @@
/**
* Retrieves the final matrix that a transform needs to apply to its source coords.
*/
-SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx) {
- const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform(transformIdx);
+SkMatrix get_transform_matrix(const GrEffectStage& effectStage,
+ bool useExplicitLocalCoords,
+ int transformIdx) {
+ const GrCoordTransform& coordTransform = effectStage.getEffect()->coordTransform(transformIdx);
SkMatrix combined;
if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
// If we have explicit local coords then we shouldn't need a coord change.
- SkASSERT(!drawEffect.programHasExplicitLocalCoords() ||
- drawEffect.getCoordChangeMatrix().isIdentity());
- combined.setConcat(coordTransform.getMatrix(), drawEffect.getCoordChangeMatrix());
+ const SkMatrix& ccm =
+ useExplicitLocalCoords ? SkMatrix::I() : effectStage.getCoordChangeMatrix();
+ combined.setConcat(coordTransform.getMatrix(), ccm);
} else {
combined = coordTransform.getMatrix();
}
@@ -113,18 +114,19 @@
}
return combined;
}
-
}
////////////////////////////////////////////////////////////////////////////////
-bool GrGLProgramEffects::GenEffectMetaKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps,
+bool GrGLProgramEffects::GenEffectMetaKey(const GrEffectStage& effectStage,
+ bool useExplicitLocalCoords,
+ const GrGLCaps& caps,
GrEffectKeyBuilder* b) {
- uint32_t textureKey = GrGLProgramEffects::GenTextureKey(drawEffect, caps);
- uint32_t transformKey = GrGLProgramEffects::GenTransformKey(drawEffect);
- uint32_t attribKey = GrGLProgramEffects::GenAttribKey(drawEffect.castEffect<GrEffect>());
- uint32_t classID = drawEffect.effect()->getFactory().effectClassID();
+ uint32_t textureKey = GrGLProgramEffects::GenTextureKey(effectStage.getEffect(), caps);
+ uint32_t transformKey = GrGLProgramEffects::GenTransformKey(effectStage,useExplicitLocalCoords);
+ uint32_t attribKey = GrGLProgramEffects::GenAttribKey(effectStage.getEffect());
+ uint32_t classID = effectStage.getEffect()->getFactory().effectClassID();
// Currently we allow 16 bits for each of the above portions of the meta-key. Fail if they
// don't fit.
@@ -139,10 +141,10 @@
return true;
}
-uint32_t GrGLProgramEffects::GenAttribKey(const GrEffect& effect) {
+uint32_t GrGLProgramEffects::GenAttribKey(const GrEffect* effect) {
uint32_t key = 0;
- const GrEffect::VertexAttribArray& vars = effect.getVertexAttribs();
+ const GrEffect::VertexAttribArray& vars = effect->getVertexAttribs();
int numAttributes = vars.count();
SkASSERT(numAttributes <= 2);
for (int a = 0; a < numAttributes; ++a) {
@@ -152,24 +154,22 @@
return key;
}
-uint32_t GrGLProgramEffects::GenTransformKey(const GrDrawEffect& drawEffect) {
+uint32_t GrGLProgramEffects::GenTransformKey(const GrEffectStage& effectStage,
+ bool useExplicitLocalCoords) {
uint32_t totalKey = 0;
- int numTransforms = drawEffect.effect()->numTransforms();
+ int numTransforms = effectStage.getEffect()->numTransforms();
for (int t = 0; t < numTransforms; ++t) {
uint32_t key = 0;
- const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform(t);
+ const GrCoordTransform& coordTransform = effectStage.getEffect()->coordTransform(t);
SkMatrix::TypeMask type0 = coordTransform.getMatrix().getType();
- SkMatrix::TypeMask type1;
- if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
- type1 = drawEffect.getCoordChangeMatrix().getType();
- } else {
- if (drawEffect.programHasExplicitLocalCoords()) {
- // We only make the key indicate that device coords are referenced when the local coords
- // are not actually determined by positions. Otherwise the local coords var and position
- // var are identical.
- key |= kPositionCoords_Flag;
- }
- type1 = SkMatrix::kIdentity_Mask;
+ SkMatrix::TypeMask type1 = SkMatrix::kIdentity_Mask;
+ if (kLocal_GrCoordSet == coordTransform.sourceCoords() && !useExplicitLocalCoords) {
+ type1 = effectStage.getCoordChangeMatrix().getType();
+ } else if (kPosition_GrCoordSet == coordTransform.sourceCoords() && useExplicitLocalCoords) {
+ // We only make the key indicate that device coords are referenced when the local coords
+ // are not actually determined by positions. Otherwise the local coords var and position
+ // var are identical.
+ key |= kPositionCoords_Flag;
}
int combinedTypes = type0 | type1;
@@ -186,11 +186,11 @@
return totalKey;
}
-uint32_t GrGLProgramEffects::GenTextureKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps) {
+uint32_t GrGLProgramEffects::GenTextureKey(const GrEffect* effect, const GrGLCaps& caps) {
uint32_t key = 0;
- int numTextures = drawEffect.effect()->numTextures();
+ int numTextures = effect->numTextures();
for (int t = 0; t < numTextures; ++t) {
- const GrTextureAccess& access = drawEffect.effect()->textureAccess(t);
+ const GrTextureAccess& access = effect->textureAccess(t);
uint32_t configComponentMask = GrPixelConfigComponentMask(access.getTexture()->config());
if (swizzle_requires_alpha_remapping(caps, configComponentMask, access.swizzleMask())) {
key |= 1 << t;
@@ -207,10 +207,10 @@
}
void GrGLProgramEffects::emitSamplers(GrGLProgramBuilder* builder,
- const GrEffect* effect,
+ const GrEffect& effect,
TextureSamplerArray* outSamplers) {
SkTArray<Sampler, true>& samplers = fSamplers.push_back();
- int numTextures = effect->numTextures();
+ int numTextures = effect.numTextures();
samplers.push_back_n(numTextures);
SkString name;
for (int t = 0; t < numTextures; ++t) {
@@ -219,7 +219,7 @@
kSampler2D_GrSLType,
name.c_str());
SkNEW_APPEND_TO_TARRAY(outSamplers, TextureSampler,
- (samplers[t].fUniform, effect->textureAccess(t)));
+ (samplers[t].fUniform, effect.textureAccess(t)));
}
}
@@ -237,13 +237,13 @@
}
}
-void GrGLProgramEffects::bindTextures(GrGpuGL* gpu, const GrEffect* effect, int effectIdx) {
+void GrGLProgramEffects::bindTextures(GrGpuGL* gpu, const GrEffect& effect, int effectIdx) {
const SkTArray<Sampler, true>& samplers = fSamplers[effectIdx];
int numSamplers = samplers.count();
- SkASSERT(numSamplers == effect->numTextures());
+ SkASSERT(numSamplers == effect.numTextures());
for (int s = 0; s < numSamplers; ++s) {
SkASSERT(samplers[s].fTextureUnit >= 0);
- const GrTextureAccess& textureAccess = effect->textureAccess(s);
+ const GrTextureAccess& textureAccess = effect.textureAccess(s);
gpu->bindTexture(samplers[s].fTextureUnit,
textureAccess.getParams(),
static_cast<GrGLTexture*>(textureAccess.getTexture()));
@@ -258,18 +258,17 @@
const char* outColor,
const char* inColor,
int stageIndex) {
- GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords);
- const GrEffect* effect = stage.getEffect();
- SkSTArray<2, TransformedCoords> coords(effect->numTransforms());
- SkSTArray<4, TextureSampler> samplers(effect->numTextures());
+ const GrEffect& effect = *stage.getEffect();
+ SkSTArray<2, TransformedCoords> coords(effect.numTransforms());
+ SkSTArray<4, TextureSampler> samplers(effect.numTextures());
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
vsBuilder->emitAttributes(stage);
- this->emitTransforms(builder, drawEffect, &coords);
+ this->emitTransforms(builder, stage, &coords);
this->emitSamplers(builder, effect, &samplers);
- GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect);
+ GrGLEffect* glEffect = effect.getFactory().createGLInstance(effect);
fGLEffects.push_back(glEffect);
// Enclose custom code in a block to avoid namespace conflicts
@@ -280,9 +279,9 @@
if (glEffect->isVertexEffect()) {
GrGLGeometryProcessor* vertexEffect = static_cast<GrGLGeometryProcessor*>(glEffect);
- vertexEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samplers);
+ vertexEffect->emitCode(builder, effect, key, outColor, inColor, coords, samplers);
} else {
- glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samplers);
+ glEffect->emitCode(builder, effect, key, outColor, inColor, coords, samplers);
}
vsBuilder->codeAppend("\t}\n");
@@ -290,11 +289,11 @@
}
void GrGLVertexProgramEffects::emitTransforms(GrGLFullProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffectStage& effectStage,
TransformedCoordsArray* outCoords) {
SkTArray<Transform, true>& transforms = fTransforms.push_back();
- uint32_t totalKey = GenTransformKey(drawEffect);
- int numTransforms = drawEffect.effect()->numTransforms();
+ uint32_t totalKey = GenTransformKey(effectStage, fHasExplicitLocalCoords);
+ int numTransforms = effectStage.getEffect()->numTransforms();
transforms.push_back_n(numTransforms);
SkTArray<PathTransform, true>* pathTransforms = NULL;
@@ -375,15 +374,16 @@
SkASSERT(numEffects == fTransforms.count());
SkASSERT(numEffects == fSamplers.count());
for (int e = 0; e < numEffects; ++e) {
- GrDrawEffect drawEffect(*effectStages[e], fHasExplicitLocalCoords);
- fGLEffects[e]->setData(programDataManager, drawEffect);
+ const GrEffectStage& effectStage = *effectStages[e];
+ const GrEffect& effect = *effectStage.getEffect();
+ fGLEffects[e]->setData(programDataManager, effect);
if (GrGpu::IsPathRenderingDrawType(drawType)) {
- this->setPathTransformData(gpu, programDataManager, drawEffect, e);
+ this->setPathTransformData(gpu, programDataManager, effectStage, e);
} else {
- this->setTransformData(gpu, programDataManager, drawEffect, e);
+ this->setTransformData(gpu, programDataManager, effectStage, e);
}
- this->bindTextures(gpu, drawEffect.effect(), e);
+ this->bindTextures(gpu, effect, e);
}
}
@@ -394,27 +394,27 @@
SkASSERT(1 == fTransforms.count());
SkASSERT(1 == fSamplers.count());
SkASSERT(1 == fGLEffects.count());
- GrDrawEffect drawEffect(*effectStage, fHasExplicitLocalCoords);
- fGLEffects[0]->setData(programDataManager, drawEffect);
+ const GrEffect& effect = *effectStage->getEffect();
+ fGLEffects[0]->setData(programDataManager, effect);
if (GrGpu::IsPathRenderingDrawType(drawType)) {
- this->setPathTransformData(gpu, programDataManager, drawEffect, 0);
+ this->setPathTransformData(gpu, programDataManager, *effectStage, 0);
} else {
- this->setTransformData(gpu, programDataManager, drawEffect, 0);
+ this->setTransformData(gpu, programDataManager, *effectStage, 0);
}
- this->bindTextures(gpu, drawEffect.effect(), 0);
+ this->bindTextures(gpu, effect, 0);
}
void GrGLVertexProgramEffects::setTransformData(GrGpuGL* gpu,
const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect,
+ const GrEffectStage& effectStage,
int effectIdx) {
SkTArray<Transform, true>& transforms = fTransforms[effectIdx];
int numTransforms = transforms.count();
- SkASSERT(numTransforms == drawEffect.effect()->numTransforms());
+ SkASSERT(numTransforms == effectStage.getEffect()->numTransforms());
for (int t = 0; t < numTransforms; ++t) {
SkASSERT(transforms[t].fHandle.isValid());
- const SkMatrix& matrix = get_transform_matrix(drawEffect, t);
+ const SkMatrix& matrix = get_transform_matrix(effectStage, fHasExplicitLocalCoords, t);
if (!transforms[t].fCurrentValue.cheapEqualTo(matrix)) {
pdman.setSkMatrix(transforms[t].fHandle, matrix);
transforms[t].fCurrentValue = matrix;
@@ -424,14 +424,14 @@
void GrGLVertexProgramEffects::setPathTransformData(GrGpuGL* gpu,
const GrGLProgramDataManager& pdman,
- const GrDrawEffect& drawEffect,
+ const GrEffectStage& effectStage,
int effectIdx) {
SkTArray<PathTransform, true>& transforms = fPathTransforms[effectIdx];
int numTransforms = transforms.count();
- SkASSERT(numTransforms == drawEffect.effect()->numTransforms());
+ SkASSERT(numTransforms == effectStage.getEffect()->numTransforms());
for (int t = 0; t < numTransforms; ++t) {
SkASSERT(transforms[t].fHandle.isValid());
- const SkMatrix& transform = get_transform_matrix(drawEffect, t);
+ const SkMatrix& transform = get_transform_matrix(effectStage, fHasExplicitLocalCoords, t);
if (transforms[t].fCurrentValue.cheapEqualTo(transform)) {
continue;
}
@@ -473,16 +473,15 @@
const char* outColor,
const char* inColor,
int stageIndex) {
- GrDrawEffect drawEffect(stage, false);
- const GrEffect* effect = stage.getEffect();
- SkSTArray<2, TransformedCoords> coords(effect->numTransforms());
- SkSTArray<4, TextureSampler> samplers(effect->numTextures());
+ const GrEffect& effect = *stage.getEffect();
+ SkSTArray<2, TransformedCoords> coords(effect.numTransforms());
+ SkSTArray<4, TextureSampler> samplers(effect.numTextures());
- SkASSERT(0 == effect->getVertexAttribs().count());
- this->setupPathTexGen(builder, drawEffect, &coords);
+ SkASSERT(0 == effect.getVertexAttribs().count());
+ this->setupPathTexGen(builder, stage, &coords);
this->emitSamplers(builder, effect, &samplers);
- GrGLEffect* glEffect = effect->getFactory().createGLInstance(drawEffect);
+ GrGLEffect* glEffect = effect.getFactory().createGLInstance(effect);
fGLEffects.push_back(glEffect);
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
@@ -492,16 +491,16 @@
fsBuilder->codeAppend(openBrace.c_str());
SkASSERT(!glEffect->isVertexEffect());
- glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samplers);
+ glEffect->emitCode(builder, effect, key, outColor, inColor, coords, samplers);
fsBuilder->codeAppend("\t}\n");
}
void GrGLPathTexGenProgramEffects::setupPathTexGen(GrGLFragmentOnlyProgramBuilder* builder,
- const GrDrawEffect& drawEffect,
+ const GrEffectStage& effectStage,
TransformedCoordsArray* outCoords) {
- int numTransforms = drawEffect.effect()->numTransforms();
- uint32_t totalKey = GenTransformKey(drawEffect);
+ int numTransforms = effectStage.getEffect()->numTransforms();
+ uint32_t totalKey = GenTransformKey(effectStage, false);
int texCoordIndex = builder->addTexCoordSets(numTransforms);
SkNEW_APPEND_TO_TARRAY(&fTransforms, Transforms, (totalKey, texCoordIndex));
SkString name;
@@ -522,23 +521,24 @@
SkASSERT(numEffects == fTransforms.count());
SkASSERT(numEffects == fSamplers.count());
for (int e = 0; e < numEffects; ++e) {
- GrDrawEffect drawEffect(*effectStages[e], false);
- fGLEffects[e]->setData(pdman, drawEffect);
- this->setPathTexGenState(gpu, drawEffect, e);
- this->bindTextures(gpu, drawEffect.effect(), e);
+ const GrEffectStage& effectStage = *effectStages[e];
+ const GrEffect& effect = *effectStage.getEffect();
+ fGLEffects[e]->setData(pdman, effect);
+ this->setPathTexGenState(gpu, effectStage, e);
+ this->bindTextures(gpu, effect, e);
}
}
void GrGLPathTexGenProgramEffects::setPathTexGenState(GrGpuGL* gpu,
- const GrDrawEffect& drawEffect,
+ const GrEffectStage& effectStage,
int effectIdx) {
uint32_t totalKey = fTransforms[effectIdx].fTransformKey;
int texCoordIndex = fTransforms[effectIdx].fTexCoordIndex;
- int numTransforms = drawEffect.effect()->numTransforms();
+ int numTransforms = effectStage.getEffect()->numTransforms();
for (int t = 0; t < numTransforms; ++t) {
switch (get_matrix_type(totalKey, t)) {
case kNoPersp_MatrixType: {
- const SkMatrix& transform = get_transform_matrix(drawEffect, t);
+ const SkMatrix& transform = get_transform_matrix(effectStage, false, t);
gpu->glPathRendering()->enablePathTexGen(
texCoordIndex++,
GrGLPathRendering::kST_PathTexGenComponents,
@@ -546,7 +546,7 @@
break;
}
case kGeneral_MatrixType: {
- const SkMatrix& transform = get_transform_matrix(drawEffect, t);
+ const SkMatrix& transform = get_transform_matrix(effectStage, false, t);
gpu->glPathRendering()->enablePathTexGen(
texCoordIndex++,
GrGLPathRendering::kSTR_PathTexGenComponents,
diff --git a/src/gpu/gl/GrGLProgramEffects.h b/src/gpu/gl/GrGLProgramEffects.h
index 79afa0a..dd3feab 100644
--- a/src/gpu/gl/GrGLProgramEffects.h
+++ b/src/gpu/gl/GrGLProgramEffects.h
@@ -39,7 +39,10 @@
* which must be different for every GrEffect subclass. It can fail if an effect uses too many
* textures, attributes, etc for the space allotted in the meta-key.
*/
- static bool GenEffectMetaKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static bool GenEffectMetaKey(const GrEffectStage&,
+ bool,
+ const GrGLCaps&,
+ GrEffectKeyBuilder*);
virtual ~GrGLProgramEffects();
@@ -114,9 +117,9 @@
/**
* Helpers for GenEffectMetaKey.
*/
- static uint32_t GenAttribKey(const GrEffect&);
- static uint32_t GenTransformKey(const GrDrawEffect&);
- static uint32_t GenTextureKey(const GrDrawEffect&, const GrGLCaps&);
+ static uint32_t GenAttribKey(const GrEffect*);
+ static uint32_t GenTransformKey(const GrEffectStage&, bool useExplicitLocalCoords);
+ static uint32_t GenTextureKey(const GrEffect*, const GrGLCaps&);
GrGLProgramEffects(int reserveCount)
: fGLEffects(reserveCount)
@@ -128,12 +131,12 @@
* appends the necessary data to the TextureSamplerArray* object so effects can add texture
* lookups to their code. This method is only meant to be called during the construction phase.
*/
- void emitSamplers(GrGLProgramBuilder*, const GrEffect*, TextureSamplerArray*);
+ void emitSamplers(GrGLProgramBuilder*, const GrEffect&, TextureSamplerArray*);
/**
* Helper for setData(). Binds all the textures for an effect.
*/
- void bindTextures(GrGpuGL*, const GrEffect*, int effectIdx);
+ void bindTextures(GrGpuGL*, const GrEffect&, int effectIdx);
struct Sampler {
SkDEBUGCODE(Sampler() : fTextureUnit(-1) {})
@@ -212,14 +215,15 @@
* TransformedCoordsArray* object, which is in turn passed to the effect's emitCode() function.
*/
void emitTransforms(GrGLFullProgramBuilder*,
- const GrDrawEffect&,
+ const GrEffectStage&,
TransformedCoordsArray*);
/**
* Helper for setData(). Sets all the transform matrices for an effect.
*/
- void setTransformData(GrGpuGL* gpu, const GrGLProgramDataManager&, const GrDrawEffect&, int effectIdx);
- void setPathTransformData(GrGpuGL* gpu, const GrGLProgramDataManager&, const GrDrawEffect&,
+ void setTransformData(GrGpuGL* gpu, const GrGLProgramDataManager&, const GrEffectStage&,
+ int effectIdx);
+ void setPathTransformData(GrGpuGL* gpu, const GrGLProgramDataManager&, const GrEffectStage&,
int effectIdx);
struct Transform {
@@ -307,13 +311,13 @@
* effect's emitCode() function.
*/
void setupPathTexGen(GrGLFragmentOnlyProgramBuilder*,
- const GrDrawEffect&,
+ const GrEffectStage&,
TransformedCoordsArray*);
/**
* Helper for setData(). Sets the PathTexGen state for each transform in an effect.
*/
- void setPathTexGenState(GrGpuGL*, const GrDrawEffect&, int effectIdx);
+ void setPathTexGenState(GrGpuGL*, const GrEffectStage&, int effectIdx);
struct Transforms {
Transforms(uint32_t transformKey, int texCoordIndex)
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 3844a30..279f3a2 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -9,7 +9,6 @@
#include "gl/GrGLSLPrettyPrint.h"
#include "gl/GrGLUniformHandle.h"
#include "GrCoordTransform.h"
-#include "GrDrawEffect.h"
#include "../GrGpuGL.h"
#include "GrGLFragmentShaderBuilder.h"
#include "GrGLProgramBuilder.h"