Index: src/effects/gradients/SkTwoPointConicalGradient.cpp |
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp |
index 6315565149e016730cf7389759a34e01cfd70b6f..0a5e29b856a3e6c9355cf127c27297fc89e08317 100644 |
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp |
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp |
@@ -347,6 +347,7 @@ public: |
EffectKey, |
const char* outputColor, |
const char* inputColor, |
+ const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE; |
@@ -488,12 +489,8 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
EffectKey key, |
const char* outputColor, |
const char* inputColor, |
+ const TransformedCoordsArray& coords, |
const TextureSamplerArray& samplers) { |
- SkString fsCoords; |
- SkString vsCoordsVarying; |
- GrSLType coordsVaryingType; |
- this->setupMatrix(builder, key, &fsCoords, &vsCoordsVarying, &coordsVaryingType); |
- |
this->emitUniforms(builder, key); |
// 2 copies of uniform array, 1 for each of vertex & fragment shader, |
// to work around Xoom bug. Doesn't seem to cause performance decrease |
@@ -506,7 +503,7 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
// For radial gradients without perspective we can pass the linear |
// part of the quadratic as a varying. |
GrGLShaderBuilder::VertexBuilder* vertexBuilder = |
- (kVec2f_GrSLType == coordsVaryingType) ? builder->getVertexBuilder() : NULL; |
+ (kVec2f_GrSLType == coords[0].type()) ? builder->getVertexBuilder() : NULL; |
if (NULL != vertexBuilder) { |
vertexBuilder->addVarying(kFloat_GrSLType, "Conical2BCoeff", |
&fVSVaryingName, &fFSVaryingName); |
@@ -527,13 +524,13 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
// r2Var = -2 * (r2Parm[2] * varCoord.x - r2Param[3] * r2Param[5]) |
vertexBuilder->vsCodeAppendf("\t%s = -2.0 * (%s * %s.x + %s * %s);\n", |
fVSVaryingName, p2.c_str(), |
- vsCoordsVarying.c_str(), p3.c_str(), p5.c_str()); |
+ coords[0].getVSName().c_str(), p3.c_str(), p5.c_str()); |
} |
} |
// FS |
{ |
- |
+ SkString coords2D = builder->ensureFSCoords2D(coords, 0); |
SkString cName("c"); |
SkString ac4Name("ac4"); |
SkString dName("d"); |
@@ -563,7 +560,7 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
} else { |
bVar = "b"; |
builder->fsCodeAppendf("\tfloat %s = -2.0 * (%s * %s.x + %s * %s);\n", |
- bVar.c_str(), p2.c_str(), fsCoords.c_str(), |
+ bVar.c_str(), p2.c_str(), coords2D.c_str(), |
p3.c_str(), p5.c_str()); |
} |
@@ -573,7 +570,7 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
// c = (x^2)+(y^2) - params[4] |
builder->fsCodeAppendf("\tfloat %s = dot(%s, %s) - %s;\n", cName.c_str(), |
- fsCoords.c_str(), fsCoords.c_str(), |
+ coords2D.c_str(), coords2D.c_str(), |
p4.c_str()); |
// Non-degenerate case (quadratic) |