Index: src/effects/gradients/SkTwoPointConicalGradient.cpp |
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp |
index 5e0c4b892b472f67e81b3685a2d0099bb531ffe5..cf9cb98a276f66e52925518a53069f548208f993 100644 |
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp |
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp |
@@ -506,9 +506,11 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
// For radial gradients without perspective we can pass the linear |
// part of the quadratic as a varying. |
- if (kVec2f_GrSLType == coordsVaryingType) { |
- builder->addVarying(kFloat_GrSLType, "Conical2BCoeff", |
- &fVSVaryingName, &fFSVaryingName); |
+ GrGLShaderBuilder::VertexBuilder* vertexBuilder = |
+ (kVec2f_GrSLType == coordsVaryingType) ? builder->getVertexBuilder() : NULL; |
+ if (NULL != vertexBuilder) { |
+ vertexBuilder->addVarying(kFloat_GrSLType, "Conical2BCoeff", |
+ &fVSVaryingName, &fFSVaryingName); |
} |
// VS |
@@ -522,11 +524,11 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
// For radial gradients without perspective we can pass the linear |
// part of the quadratic as a varying. |
- if (kVec2f_GrSLType == coordsVaryingType) { |
+ if (NULL != vertexBuilder) { |
// r2Var = -2 * (r2Parm[2] * varCoord.x - r2Param[3] * r2Param[5]) |
- builder->vsCodeAppendf("\t%s = -2.0 * (%s * %s.x + %s * %s);\n", |
- fVSVaryingName, p2.c_str(), |
- vsCoordsVarying.c_str(), p3.c_str(), p5.c_str()); |
+ 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()); |
} |
} |
@@ -557,7 +559,7 @@ void GrGLConical2Gradient::emitCode(GrGLShaderBuilder* builder, |
// If we we're able to interpolate the linear component, |
// bVar is the varying; otherwise compute it |
SkString bVar; |
- if (kVec2f_GrSLType == coordsVaryingType) { |
+ if (NULL != vertexBuilder) { |
bVar = fFSVaryingName; |
} else { |
bVar = "b"; |