diff options
Diffstat (limited to 'src/gpu/GrAARectRenderer.cpp')
-rw-r--r-- | src/gpu/GrAARectRenderer.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp index 320b3d7cb0..b2052a8d28 100644 --- a/src/gpu/GrAARectRenderer.cpp +++ b/src/gpu/GrAARectRenderer.cpp @@ -8,6 +8,7 @@ #include "GrAARectRenderer.h" #include "GrGpu.h" #include "gl/GrGLEffect.h" +#include "gl/GrGLVertexEffect.h" #include "GrTBackendEffectFactory.h" #include "SkColorPriv.h" #include "effects/GrVertexEffect.h" @@ -39,29 +40,26 @@ public: return GrTBackendEffectFactory<GrAlignedRectEffect>::getInstance(); } - class GLEffect : public GrGLEffect { + class GLEffect : public GrGLVertexEffect { public: GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) : INHERITED (factory) {} - virtual void emitCode(GrGLShaderBuilder* builder, + virtual void emitCode(GrGLFullShaderBuilder* builder, const GrDrawEffect& drawEffect, EffectKey key, const char* outputColor, const char* inputColor, const TransformedCoordsArray&, const TextureSamplerArray& samplers) SK_OVERRIDE { - GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertexBuilder(); - SkASSERT(NULL != vertexBuilder); - // setup the varying for the Axis aligned rect effect // xy -> interpolated offset // zw -> w/2+0.5, h/2+0.5 const char *vsRectName, *fsRectName; - vertexBuilder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsRectName); + builder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsRectName); const SkString* attr0Name = - vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); - vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsRectName, attr0Name->c_str()); + builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); + builder->vsCodeAppendf("\t%s = %s;\n", vsRectName, attr0Name->c_str()); // TODO: compute all these offsets, spans, and scales in the VS builder->fsCodeAppendf("\tfloat insetW = min(1.0, %s.z) - 0.5;\n", fsRectName); @@ -98,7 +96,7 @@ public: virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&) SK_OVERRIDE {} private: - typedef GrGLEffect INHERITED; + typedef GrGLVertexEffect INHERITED; }; @@ -160,37 +158,34 @@ public: return GrTBackendEffectFactory<GrRectEffect>::getInstance(); } - class GLEffect : public GrGLEffect { + class GLEffect : public GrGLVertexEffect { public: GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) : INHERITED (factory) {} - virtual void emitCode(GrGLShaderBuilder* builder, + virtual void emitCode(GrGLFullShaderBuilder* builder, const GrDrawEffect& drawEffect, EffectKey key, const char* outputColor, const char* inputColor, const TransformedCoordsArray&, const TextureSamplerArray& samplers) SK_OVERRIDE { - GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertexBuilder(); - SkASSERT(NULL != vertexBuilder); - // setup the varying for the center point and the unit vector // that points down the height of the rect const char *vsRectEdgeName, *fsRectEdgeName; - vertexBuilder->addVarying(kVec4f_GrSLType, "RectEdge", - &vsRectEdgeName, &fsRectEdgeName); + builder->addVarying(kVec4f_GrSLType, "RectEdge", + &vsRectEdgeName, &fsRectEdgeName); const SkString* attr0Name = - vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); - vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsRectEdgeName, attr0Name->c_str()); + builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); + builder->vsCodeAppendf("\t%s = %s;\n", vsRectEdgeName, attr0Name->c_str()); // setup the varying for width/2+.5 and height/2+.5 const char *vsWidthHeightName, *fsWidthHeightName; - vertexBuilder->addVarying(kVec2f_GrSLType, "WidthHeight", - &vsWidthHeightName, &fsWidthHeightName); + builder->addVarying(kVec2f_GrSLType, "WidthHeight", + &vsWidthHeightName, &fsWidthHeightName); const SkString* attr1Name = - vertexBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[1]); - vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsWidthHeightName, attr1Name->c_str()); + builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[1]); + builder->vsCodeAppendf("\t%s = %s;\n", vsWidthHeightName, attr1Name->c_str()); // TODO: compute all these offsets, spans, and scales in the VS builder->fsCodeAppendf("\tfloat insetW = min(1.0, %s.x) - 0.5;\n", fsWidthHeightName); @@ -234,7 +229,7 @@ public: virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&) SK_OVERRIDE {} private: - typedef GrGLEffect INHERITED; + typedef GrGLVertexEffect INHERITED; }; |