Index: src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
index a3ba479cb77e874c3ed2f522862df8fca59e1e69..4c474b28dc3631bffba0b0282ca6674ce4d6a750 100644 |
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp |
@@ -81,7 +81,7 @@ public: |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const Edge2PtConicalEffect& s = CastEffect<Edge2PtConicalEffect>(sBase); |
+ const Edge2PtConicalEffect& s = sBase.cast<Edge2PtConicalEffect>(); |
return (INHERITED::onIsEqual(sBase) && |
this->fCenterX1 == s.fCenterX1 && |
this->fRadius0 == s.fRadius0 && |
@@ -134,19 +134,19 @@ private: |
class GLEdge2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLEdge2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
+ GLEdge2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
virtual ~GLEdge2PtConicalEffect() { } |
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 void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fParamUni; |
@@ -210,7 +210,7 @@ GrEffect* Edge2PtConicalEffect::TestCreate(SkRandom* random, |
} |
GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrDrawEffect& drawEffect) |
+ const GrEffect& effect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
@@ -218,7 +218,7 @@ GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendEffectFactory& fac |
, fCachedDiffRadius(-SK_ScalarMax) {} |
void GLEdge2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrDrawEffect&, |
+ const GrEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -246,7 +246,8 @@ void GLEdge2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
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 { |
@@ -275,9 +276,9 @@ void GLEdge2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
} |
void GLEdge2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrDrawEffect& drawEffect) { |
- INHERITED::setData(pdman, drawEffect); |
- const Edge2PtConicalEffect& data = drawEffect.castEffect<Edge2PtConicalEffect>(); |
+ const GrEffect& effect) { |
+ INHERITED::setData(pdman, effect); |
+ const Edge2PtConicalEffect& data = effect.cast<Edge2PtConicalEffect>(); |
SkScalar radius0 = data.radius(); |
SkScalar diffRadius = data.diffRadius(); |
@@ -296,9 +297,9 @@ void GLEdge2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
} |
} |
-void GLEdge2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
+void GLEdge2PtConicalEffect::GenKey(const GrEffect& effect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(drawEffect)); |
+ b->add32(GenBaseGradientKey(effect)); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -388,7 +389,7 @@ public: |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const FocalOutside2PtConicalEffect& s = CastEffect<FocalOutside2PtConicalEffect>(sBase); |
+ const FocalOutside2PtConicalEffect& s = sBase.cast<FocalOutside2PtConicalEffect>(); |
return (INHERITED::onIsEqual(sBase) && |
this->fFocalX == s.fFocalX && |
this->fIsFlipped == s.fIsFlipped); |
@@ -411,19 +412,19 @@ private: |
class GLFocalOutside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLFocalOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
+ GLFocalOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
virtual ~GLFocalOutside2PtConicalEffect() { } |
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 void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fParamUni; |
@@ -485,17 +486,17 @@ GrEffect* FocalOutside2PtConicalEffect::TestCreate(SkRandom* random, |
} |
GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrDrawEffect& drawEffect) |
+ const GrEffect& effect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
, fCachedFocal(SK_ScalarMax) { |
- const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutside2PtConicalEffect>(); |
+ const FocalOutside2PtConicalEffect& data = effect.cast<FocalOutside2PtConicalEffect>(); |
fIsFlipped = data.isFlipped(); |
} |
void GLFocalOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrDrawEffect&, |
+ const GrEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -544,9 +545,9 @@ void GLFocalOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
} |
void GLFocalOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrDrawEffect& drawEffect) { |
- INHERITED::setData(pdman, drawEffect); |
- const FocalOutside2PtConicalEffect& data = drawEffect.castEffect<FocalOutside2PtConicalEffect>(); |
+ const GrEffect& effect) { |
+ INHERITED::setData(pdman, effect); |
+ const FocalOutside2PtConicalEffect& data = effect.cast<FocalOutside2PtConicalEffect>(); |
SkASSERT(data.isFlipped() == fIsFlipped); |
SkScalar focal = data.focal(); |
@@ -563,11 +564,11 @@ void GLFocalOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman |
} |
} |
-void GLFocalOutside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
+void GLFocalOutside2PtConicalEffect::GenKey(const GrEffect& effect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
uint32_t* key = b->add32n(2); |
- key[0] = GenBaseGradientKey(drawEffect); |
- key[1] = drawEffect.castEffect<FocalOutside2PtConicalEffect>().isFlipped(); |
+ key[0] = GenBaseGradientKey(effect); |
+ key[1] = effect.cast<FocalOutside2PtConicalEffect>().isFlipped(); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -596,7 +597,7 @@ public: |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const FocalInside2PtConicalEffect& s = CastEffect<FocalInside2PtConicalEffect>(sBase); |
+ const FocalInside2PtConicalEffect& s = sBase.cast<FocalInside2PtConicalEffect>(); |
return (INHERITED::onIsEqual(sBase) && |
this->fFocalX == s.fFocalX); |
} |
@@ -617,19 +618,19 @@ private: |
class GLFocalInside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLFocalInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
+ GLFocalInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
virtual ~GLFocalInside2PtConicalEffect() {} |
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 void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fFocalUni; |
@@ -691,14 +692,14 @@ GrEffect* FocalInside2PtConicalEffect::TestCreate(SkRandom* random, |
} |
GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrDrawEffect& drawEffect) |
+ const GrEffect& effect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
, fCachedFocal(SK_ScalarMax) {} |
void GLFocalInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrDrawEffect&, |
+ const GrEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -727,9 +728,9 @@ void GLFocalInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
} |
void GLFocalInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrDrawEffect& drawEffect) { |
- INHERITED::setData(pdman, drawEffect); |
- const FocalInside2PtConicalEffect& data = drawEffect.castEffect<FocalInside2PtConicalEffect>(); |
+ const GrEffect& effect) { |
+ INHERITED::setData(pdman, effect); |
+ const FocalInside2PtConicalEffect& data = effect.cast<FocalInside2PtConicalEffect>(); |
SkScalar focal = data.focal(); |
if (fCachedFocal != focal) { |
@@ -738,9 +739,9 @@ void GLFocalInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
} |
} |
-void GLFocalInside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
+void GLFocalInside2PtConicalEffect::GenKey(const GrEffect& effect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(drawEffect)); |
+ b->add32(GenBaseGradientKey(effect)); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -835,7 +836,7 @@ public: |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const CircleInside2PtConicalEffect& s = CastEffect<CircleInside2PtConicalEffect>(sBase); |
+ const CircleInside2PtConicalEffect& s = sBase.cast<CircleInside2PtConicalEffect>(); |
return (INHERITED::onIsEqual(sBase) && |
this->fInfo.fCenterEnd == s.fInfo.fCenterEnd && |
this->fInfo.fA == s.fInfo.fA && |
@@ -859,19 +860,19 @@ private: |
class GLCircleInside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLCircleInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
+ GLCircleInside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
virtual ~GLCircleInside2PtConicalEffect() {} |
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 void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fCenterUni; |
@@ -937,7 +938,7 @@ GrEffect* CircleInside2PtConicalEffect::TestCreate(SkRandom* random, |
} |
GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrDrawEffect& drawEffect) |
+ const GrEffect& effect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
@@ -948,7 +949,7 @@ GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendEf |
, fCachedC(SK_ScalarMax) {} |
void GLCircleInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrDrawEffect&, |
+ const GrEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -982,7 +983,8 @@ void GLCircleInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
// 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()); |
@@ -990,9 +992,9 @@ void GLCircleInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
} |
void GLCircleInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrDrawEffect& drawEffect) { |
- INHERITED::setData(pdman, drawEffect); |
- const CircleInside2PtConicalEffect& data = drawEffect.castEffect<CircleInside2PtConicalEffect>(); |
+ const GrEffect& effect) { |
+ INHERITED::setData(pdman, effect); |
+ const CircleInside2PtConicalEffect& data = effect.cast<CircleInside2PtConicalEffect>(); |
SkScalar centerX = data.centerX(); |
SkScalar centerY = data.centerY(); |
SkScalar A = data.A(); |
@@ -1013,9 +1015,9 @@ void GLCircleInside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman |
} |
} |
-void GLCircleInside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
+void GLCircleInside2PtConicalEffect::GenKey(const GrEffect& effect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
- b->add32(GenBaseGradientKey(drawEffect)); |
+ b->add32(GenBaseGradientKey(effect)); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -1050,7 +1052,7 @@ public: |
private: |
virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE { |
- const CircleOutside2PtConicalEffect& s = CastEffect<CircleOutside2PtConicalEffect>(sBase); |
+ const CircleOutside2PtConicalEffect& s = sBase.cast<CircleOutside2PtConicalEffect>(); |
return (INHERITED::onIsEqual(sBase) && |
this->fInfo.fCenterEnd == s.fInfo.fCenterEnd && |
this->fInfo.fA == s.fInfo.fA && |
@@ -1067,7 +1069,8 @@ private: |
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; |
} |
@@ -1086,19 +1089,19 @@ private: |
class GLCircleOutside2PtConicalEffect : public GrGLGradientEffect { |
public: |
- GLCircleOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&); |
+ GLCircleOutside2PtConicalEffect(const GrBackendEffectFactory& factory, const GrEffect&); |
virtual ~GLCircleOutside2PtConicalEffect() {} |
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 void GenKey(const GrDrawEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
protected: |
UniformHandle fCenterUni; |
@@ -1168,7 +1171,7 @@ GrEffect* CircleOutside2PtConicalEffect::TestCreate(SkRandom* random, |
} |
GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackendEffectFactory& factory, |
- const GrDrawEffect& drawEffect) |
+ const GrEffect& effect) |
: INHERITED(factory) |
, fVSVaryingName(NULL) |
, fFSVaryingName(NULL) |
@@ -1178,12 +1181,12 @@ GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackend |
, fCachedB(SK_ScalarMax) |
, fCachedC(SK_ScalarMax) |
, fCachedTLimit(SK_ScalarMax) { |
- const CircleOutside2PtConicalEffect& data = drawEffect.castEffect<CircleOutside2PtConicalEffect>(); |
+ const CircleOutside2PtConicalEffect& data = effect.cast<CircleOutside2PtConicalEffect>(); |
fIsFlipped = data.isFlipped(); |
} |
void GLCircleOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrDrawEffect&, |
+ const GrEffect&, |
const GrEffectKey& key, |
const char* outputColor, |
const char* inputColor, |
@@ -1222,8 +1225,10 @@ void GLCircleOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
// 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 |
@@ -1240,9 +1245,9 @@ void GLCircleOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder, |
} |
void GLCircleOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdman, |
- const GrDrawEffect& drawEffect) { |
- INHERITED::setData(pdman, drawEffect); |
- const CircleOutside2PtConicalEffect& data = drawEffect.castEffect<CircleOutside2PtConicalEffect>(); |
+ const GrEffect& effect) { |
+ INHERITED::setData(pdman, effect); |
+ const CircleOutside2PtConicalEffect& data = effect.cast<CircleOutside2PtConicalEffect>(); |
SkASSERT(data.isFlipped() == fIsFlipped); |
SkScalar centerX = data.centerX(); |
SkScalar centerY = data.centerY(); |
@@ -1267,11 +1272,11 @@ void GLCircleOutside2PtConicalEffect::setData(const GrGLProgramDataManager& pdma |
} |
} |
-void GLCircleOutside2PtConicalEffect::GenKey(const GrDrawEffect& drawEffect, |
+void GLCircleOutside2PtConicalEffect::GenKey(const GrEffect& effect, |
const GrGLCaps&, GrEffectKeyBuilder* b) { |
uint32_t* key = b->add32n(2); |
- key[0] = GenBaseGradientKey(drawEffect); |
- key[1] = drawEffect.castEffect<CircleOutside2PtConicalEffect>().isFlipped(); |
+ key[0] = GenBaseGradientKey(effect); |
+ key[1] = effect.cast<CircleOutside2PtConicalEffect>().isFlipped(); |
} |
////////////////////////////////////////////////////////////////////////////// |