Index: src/effects/gradients/SkTwoPointRadialGradient.cpp |
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp |
index a3f82ec0389f74eb97b9217840f83b668ff775d8..e8ec73625b76c7bc2be585c7b740047650b16f34 100644 |
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp |
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp |
@@ -548,8 +548,11 @@ void GrGLRadial2Gradient::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, "Radial2BCoeff", &fVSVaryingName, &fFSVaryingName); |
+ GrGLShaderBuilder::VertexBuilder* vertexBuilder = |
+ (kVec2f_GrSLType == coordsVaryingType) ? builder->getVertexBuilder() : NULL; |
+ if (NULL != vertexBuilder) { |
+ vertexBuilder->addVarying(kFloat_GrSLType, "Radial2BCoeff", |
+ &fVSVaryingName, &fFSVaryingName); |
} |
// VS |
@@ -561,11 +564,11 @@ void GrGLRadial2Gradient::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]) |
- builder->vsCodeAppendf("\t%s = 2.0 *(%s * %s.x - %s);\n", |
- fVSVaryingName, p2.c_str(), |
- vsCoordsVarying.c_str(), p3.c_str()); |
+ vertexBuilder->vsCodeAppendf("\t%s = 2.0 *(%s * %s.x - %s);\n", |
+ fVSVaryingName, p2.c_str(), |
+ vsCoordsVarying.c_str(), p3.c_str()); |
} |
} |
@@ -591,7 +594,7 @@ void GrGLRadial2Gradient::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"; |