Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Unified Diff: src/effects/gradients/SkTwoPointConicalGradient.cpp

Issue 23754003: Isolate VertexBuilder from GrGLShaderBuilder (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/effects/gradients/SkTwoPointRadialGradient.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « no previous file | src/effects/gradients/SkTwoPointRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698