diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-20 17:47:16 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-20 17:47:16 +0000 |
commit | 67e7cde5c5e59a8f1de7ee28276b8193ecb2bc7f (patch) | |
tree | fbb2c63213570deb6062b3eb8e9ba1a13c0431d4 /src/gpu/effects/GrCircleEdgeEffect.cpp | |
parent | 113994051b41366a7b25851d05cd56e89866a33b (diff) |
revert 8265-8264 (broke build)
git-svn-id: http://skia.googlecode.com/svn/trunk@8268 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrCircleEdgeEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrCircleEdgeEffect.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gpu/effects/GrCircleEdgeEffect.cpp b/src/gpu/effects/GrCircleEdgeEffect.cpp index 4ecdedbcde..ba7350226b 100644 --- a/src/gpu/effects/GrCircleEdgeEffect.cpp +++ b/src/gpu/effects/GrCircleEdgeEffect.cpp @@ -17,27 +17,29 @@ class GrGLCircleEdgeEffect : public GrGLEffect { public: - GrGLCircleEdgeEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) + GrGLCircleEdgeEffect(const GrBackendEffectFactory& factory, const GrEffectRef&) : INHERITED (factory) {} virtual void emitCode(GrGLShaderBuilder* builder, - const GrDrawEffect& drawEffect, + const GrEffectStage& stage, EffectKey key, + const char* vertexCoords, const char* outputColor, const char* inputColor, const TextureSamplerArray& samplers) SK_OVERRIDE { - const GrCircleEdgeEffect& circleEffect = drawEffect.castEffect<GrCircleEdgeEffect>(); + const GrCircleEdgeEffect& effect = GetEffectFromStage<GrCircleEdgeEffect>(stage); + const char *vsName, *fsName; builder->addVarying(kVec4f_GrSLType, "CircleEdge", &vsName, &fsName); const SkString* attrName = - builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); + builder->getEffectAttributeName(stage.getVertexAttribIndices()[0]); builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str()); builder->fsCodeAppendf("\tfloat d = distance(%s.xy, %s.xy);\n", builder->fragmentPosition(), fsName); builder->fsCodeAppendf("\tfloat edgeAlpha = clamp(%s.z - d, 0.0, 1.0);\n", fsName); - if (circleEffect.isStroked()) { + if (effect.isStroked()) { builder->fsCodeAppendf("\tfloat innerAlpha = clamp(d - %s.w, 0.0, 1.0);\n", fsName); builder->fsCodeAppend("\tedgeAlpha *= innerAlpha;\n"); } @@ -46,13 +48,13 @@ public: builder->fsCodeAppendf("\t%s = %s;\n", outputColor, modulate.c_str()); } - static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&) { - const GrCircleEdgeEffect& circleEffect = drawEffect.castEffect<GrCircleEdgeEffect>(); + static inline EffectKey GenKey(const GrEffectStage& stage, const GrGLCaps&) { + const GrCircleEdgeEffect& effect = GetEffectFromStage<GrCircleEdgeEffect>(stage); - return circleEffect.isStroked() ? 0x1 : 0x0; + return effect.isStroked() ? 0x1 : 0x0; } - virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE { + virtual void setData(const GrGLUniformManager& uman, const GrEffectStage& stage) SK_OVERRIDE { } private: |