Index: src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
index 4c474b28dc3631bffba0b0282ca6674ce4d6a750..a3ba479cb77e874c3ed2f522862df8fca59e1e69 100644 |
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
@@ -81,7 +81,7 @@ |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const Edge2PtConicalEffect& s = sBase.cast<Edge2PtConicalEffect>(); |
+ const Edge2PtConicalEffect& s = CastEffect<Edge2PtConicalEffect>(sBase); |
return (INHERITED::onIsEqual(sBase) && |
this->fCenterX1 == s.fCenterX1 && |
this->fRadius0 == s.fRadius0 && |
@@ -134,19 +134,19 @@ |
class GLEdge2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLEdge2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
+ GLEdge2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
virtual ~GLEdge2PtConicalEffect() { } |
virtual void emitCode(GrGLProgramBuilder*, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey&, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE; |
- |
- static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE; |
+ |
+ static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fParamUni; |
@@ -210,7 +210,7 @@ |
} |
GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrEffect& effect) |
+ const GrDrawEffect& drawEffect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
@@ -218,7 +218,7 @@ |
, fCachedDiffRadius(-SK_ScalarMax) {} |
void GLEdge2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -246,8 +246,7 @@ |
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
if (kVec3f_GrSLType == coords[0].type()) { |
fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x / %s.z);\n", |
- coords[0].c_str(), coords[0].c_str(), coords[1].c_str(), |
- coords[1].c_str()); |
+ coords[0].c_str(), coords[0].c_str(), coords[1].c_str(), coords[1].c_str()); |
coords2D = "interpolants.xy"; |
bVar = "interpolants.z"; |
} else { |
@@ -276,9 +275,9 @@ |
} |
void GLEdge2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrEffect& effect) { |
- INHERITED::setData(pdman, effect); |
- const Edge2PtConicalEffect& data = effect.cast<Edge2PtConicalEffect>(); |
+ const GrDrawEffect& drawEffect) { |
+ INHERITED::setData(pdman, drawEffect); |
+ const Edge2PtConicalEffect& data = drawEffect.castEffect<Edge2PtConicalEffect>(); |
SkScalar radius0 = data.radius(); |
SkScalar diffRadius = data.diffRadius(); |
@@ -297,9 +296,9 @@ |
} |
} |
-void GLEdge2PtConicalEffect::GenKey(const GrEffect& effect, |
+void GLEdge2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(effect)); |
+ b->add32(GenBaseGradientKey(drawEffect)); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -389,7 +388,7 @@ |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const FocalOutside2PtConicalEffect& s = sBase.cast<FocalOutside2PtConicalEffect>(); |
+ const FocalOutside2PtConicalEffect& s = CastEffect<FocalOutside2PtConicalEffect>(sBase); |
return (INHERITED::onIsEqual(sBase) && |
this->fFocalX == s.fFocalX && |
this->fIsFlipped == s.fIsFlipped); |
@@ -412,19 +411,19 @@ |
class GLFocalOutside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLFocalOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
+ GLFocalOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
virtual ~GLFocalOutside2PtConicalEffect() { } |
virtual void emitCode(GrGLProgramBuilder*, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey&, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE; |
- |
- static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE; |
+ |
+ static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fParamUni; |
@@ -486,17 +485,17 @@ |
} |
GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrEffect& effect) |
+ const GrDrawEffect& drawEffect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
, fCachedFocal(SK_ScalarMax) { |
- const FocalOutside2PtConicalEffect& data = effect.cast<FocalOutside2PtConicalEffect>(); |
+ const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutside2PtConicalEffect>(); |
fIsFlipped = data.isFlipped(); |
} |
void GLFocalOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -545,9 +544,9 @@ |
} |
void GLFocalOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrEffect& effect) { |
- INHERITED::setData(pdman, effect); |
- const FocalOutside2PtConicalEffect& data = effect.cast<FocalOutside2PtConicalEffect>(); |
+ const GrDrawEffect& drawEffect) { |
+ INHERITED::setData(pdman, drawEffect); |
+ const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutside2PtConicalEffect>(); |
SkASSERT(data.isFlipped() == fIsFlipped); |
SkScalar focal = data.focal(); |
@@ -564,11 +563,11 @@ |
} |
} |
-void GLFocalOutside2PtConicalEffect::GenKey(const GrEffect& effect, |
+void GLFocalOutside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
uint32_t* key = b->add32n(2); |
- key[0] = GenBaseGradientKey(effect); |
- key[1] = effect.cast<FocalOutside2PtConicalEffect>().isFlipped(); |
+ key[0] = GenBaseGradientKey(drawEffect); |
+ key[1] = drawEffect.castEffect<FocalOutside2PtConicalEffect>().isFlipped(); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -597,7 +596,7 @@ |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const FocalInside2PtConicalEffect& s = sBase.cast<FocalInside2PtConicalEffect>(); |
+ const FocalInside2PtConicalEffect& s = CastEffect<FocalInside2PtConicalEffect>(sBase); |
return (INHERITED::onIsEqual(sBase) && |
this->fFocalX == s.fFocalX); |
} |
@@ -618,19 +617,19 @@ |
class GLFocalInside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLFocalInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
+ GLFocalInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
virtual ~GLFocalInside2PtConicalEffect() {} |
virtual void emitCode(GrGLProgramBuilder*, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey&, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE; |
- |
- static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE; |
+ |
+ static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fFocalUni; |
@@ -692,14 +691,14 @@ |
} |
GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrEffect& effect) |
+ const GrDrawEffect& drawEffect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
, fCachedFocal(SK_ScalarMax) {} |
void GLFocalInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -728,9 +727,9 @@ |
} |
void GLFocalInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrEffect& effect) { |
- INHERITED::setData(pdman, effect); |
- const FocalInside2PtConicalEffect& data = effect.cast<FocalInside2PtConicalEffect>(); |
+ const GrDrawEffect& drawEffect) { |
+ INHERITED::setData(pdman, drawEffect); |
+ const FocalInside2PtConicalEffect& data = drawEffect.castEffect<FocalInside2PtConicalEffect>(); |
SkScalar focal = data.focal(); |
if (fCachedFocal != focal) { |
@@ -739,9 +738,9 @@ |
} |
} |
-void GLFocalInside2PtConicalEffect::GenKey(const GrEffect& effect, |
+void GLFocalInside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(effect)); |
+ b->add32(GenBaseGradientKey(drawEffect)); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -836,7 +835,7 @@ |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const CircleInside2PtConicalEffect& s = sBase.cast<CircleInside2PtConicalEffect>(); |
+ const CircleInside2PtConicalEffect& s = CastEffect<CircleInside2PtConicalEffect>(sBase); |
return (INHERITED::onIsEqual(sBase) && |
this->fInfo.fCenterEnd == s.fInfo.fCenterEnd && |
this->fInfo.fA == s.fInfo.fA && |
@@ -860,19 +859,19 @@ |
class GLCircleInside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLCircleInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
+ GLCircleInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
virtual ~GLCircleInside2PtConicalEffect() {} |
virtual void emitCode(GrGLProgramBuilder*, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey&, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE; |
- |
- static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE; |
+ |
+ static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fCenterUni; |
@@ -938,7 +937,7 @@ |
} |
GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrEffect& effect) |
+ const GrDrawEffect& drawEffect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
@@ -949,7 +948,7 @@ |
, fCachedC(SK_ScalarMax) {} |
void GLCircleInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -983,8 +982,7 @@ |
// d = dot(e, p) + B |
// t = d +/- sqrt(d^2 - A * dot(p, p) + C) |
fsBuilder->codeAppendf("\tfloat pDotp = dot(%s, %s);\n", coords2D, coords2D); |
- fsBuilder->codeAppendf("\tfloat d = dot(%s, %s) + %s.y;\n", coords2D, center.c_str(), |
- params.c_str()); |
+ fsBuilder->codeAppendf("\tfloat d = dot(%s, %s) + %s.y;\n", coords2D, center.c_str(), params.c_str()); |
fsBuilder->codeAppendf("\tfloat %s = d + sqrt(d * d - %s.x * pDotp + %s.z);\n", |
tName.c_str(), params.c_str(), params.c_str()); |
@@ -992,9 +990,9 @@ |
} |
void GLCircleInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrEffect& effect) { |
- INHERITED::setData(pdman, effect); |
- const CircleInside2PtConicalEffect& data = effect.cast<CircleInside2PtConicalEffect>(); |
+ const GrDrawEffect& drawEffect) { |
+ INHERITED::setData(pdman, drawEffect); |
+ const CircleInside2PtConicalEffect& data = drawEffect.castEffect<CircleInside2PtConicalEffect>(); |
SkScalar centerX = data.centerX(); |
SkScalar centerY = data.centerY(); |
SkScalar A = data.A(); |
@@ -1015,9 +1013,9 @@ |
} |
} |
-void GLCircleInside2PtConicalEffect::GenKey(const GrEffect& effect, |
+void GLCircleInside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(effect)); |
+ b->add32(GenBaseGradientKey(drawEffect)); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -1052,7 +1050,7 @@ |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const CircleOutside2PtConicalEffect& s = sBase.cast<CircleOutside2PtConicalEffect>(); |
+ const CircleOutside2PtConicalEffect& s = CastEffect<CircleOutside2PtConicalEffect>(sBase); |
return (INHERITED::onIsEqual(sBase) && |
this->fInfo.fCenterEnd == s.fInfo.fCenterEnd && |
this->fInfo.fA == s.fInfo.fA && |
@@ -1069,8 +1067,7 @@ |
const CircleConicalInfo& info) |
: INHERITED(ctx, shader, matrix, tm), fInfo(info) { |
if (shader.getStartRadius() != shader.getEndRadius()) { |
- fTLimit = SkScalarDiv(shader.getStartRadius(), |
- (shader.getStartRadius() - shader.getEndRadius())); |
+ fTLimit = SkScalarDiv(shader.getStartRadius(), (shader.getStartRadius() - shader.getEndRadius())); |
} else { |
fTLimit = SK_ScalarMin; |
} |
@@ -1089,19 +1086,19 @@ |
class GLCircleOutside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLCircleOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
+ GLCircleOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
virtual ~GLCircleOutside2PtConicalEffect() {} |
virtual void emitCode(GrGLProgramBuilder*, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey&, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE; |
- |
- static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE; |
+ |
+ static void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fCenterUni; |
@@ -1171,7 +1168,7 @@ |
} |
GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrEffect& effect) |
+ const GrDrawEffect& drawEffect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
@@ -1181,12 +1178,12 @@ |
, fCachedB(SK_ScalarMax) |
, fCachedC(SK_ScalarMax) |
, fCachedTLimit(SK_ScalarMax) { |
- const CircleOutside2PtConicalEffect& data = effect.cast<CircleOutside2PtConicalEffect>(); |
+ const CircleOutside2PtConicalEffect& data = drawEffect.castEffect<CircleOutside2PtConicalEffect>(); |
fIsFlipped = data.isFlipped(); |
} |
void GLCircleOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrEffect&, |
+ const GrDrawEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -1225,10 +1222,8 @@ |
// t = d +/- sqrt(d^2 - A * dot(p, p) + C) |
fsBuilder->codeAppendf("\tfloat pDotp = dot(%s, %s);\n", coords2D, coords2D); |
- fsBuilder->codeAppendf("\tfloat d = dot(%s, %s) + %s.y;\n", coords2D, center.c_str(), |
- params.c_str()); |
- fsBuilder->codeAppendf("\tfloat deter = d * d - %s.x * pDotp + %s.z;\n", params.c_str(), |
- params.c_str()); |
+ fsBuilder->codeAppendf("\tfloat d = dot(%s, %s) + %s.y;\n", coords2D, center.c_str(), params.c_str()); |
+ fsBuilder->codeAppendf("\tfloat deter = d * d - %s.x * pDotp + %s.z;\n", params.c_str(), params.c_str()); |
// Must check to see if we flipped the circle order (to make sure start radius < end radius) |
// If so we must also flip sign on sqrt |
@@ -1245,9 +1240,9 @@ |
} |
void GLCircleOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrEffect& effect) { |
- INHERITED::setData(pdman, effect); |
- const CircleOutside2PtConicalEffect& data = effect.cast<CircleOutside2PtConicalEffect>(); |
+ const GrDrawEffect& drawEffect) { |
+ INHERITED::setData(pdman, drawEffect); |
+ const CircleOutside2PtConicalEffect& data = drawEffect.castEffect<CircleOutside2PtConicalEffect>(); |
SkASSERT(data.isFlipped() == fIsFlipped); |
SkScalar centerX = data.centerX(); |
SkScalar centerY = data.centerY(); |
@@ -1272,11 +1267,11 @@ |
} |
} |
-void GLCircleOutside2PtConicalEffect::GenKey(const GrEffect& effect, |
+void GLCircleOutside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
uint32_t* key = b->add32n(2); |
- key[0] = GenBaseGradientKey(effect); |
- key[1] = effect.cast<CircleOutside2PtConicalEffect>().isFlipped(); |
+ key[0] = GenBaseGradientKey(drawEffect); |
+ key[1] = drawEffect.castEffect<CircleOutside2PtConicalEffect>().isFlipped(); |
} |
////////////////////////////////////////////////////////////////////////////// |