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

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

Issue 25048002: Express (GLSL expression, possibly known value) pairs as a class (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing review comments Created 7 years, 2 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 | « src/effects/SkLumaXfermode.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index dff2d8cd4338ab421514d6e960584bd4a0a42838..9360ba920e9626a69be5c65f7c8f66e355097e18 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -950,11 +950,8 @@ void GrGLGradientEffect::emitColor(GrGLShaderBuilder* builder,
builder->fsCodeAppend("\tcolorTemp.rgb *= colorTemp.a;\n");
}
- SkString output;
- builder->fsCodeAppendf("\t%s = ", outputColor);
- GrGLSLModulatef<4>(&output, inputColor, "colorTemp");
- builder->fsCodeAppend(output.c_str());
- builder->fsCodeAppend(";\n");
+ builder->fsCodeAppendf("\t%s = %s;\n", outputColor,
+ (GrGLSLExpr<4>(inputColor) * GrGLSLExpr<4>("colorTemp")).c_str());
} else if (GrGradientEffect::kThree_ColorType == ColorTypeFromKey(key)){
builder->fsCodeAppendf("\tfloat oneMinus2t = 1.0 - (2.0 * (%s));\n",
gradientTValue);
@@ -977,11 +974,8 @@ void GrGLGradientEffect::emitColor(GrGLShaderBuilder* builder,
builder->fsCodeAppend("\tcolorTemp.rgb *= colorTemp.a;\n");
}
- SkString output;
- builder->fsCodeAppendf("\t%s = ", outputColor);
- GrGLSLModulatef<4>(&output, inputColor, "colorTemp");
- builder->fsCodeAppend(output.c_str());
- builder->fsCodeAppend(";\n");
+ builder->fsCodeAppendf("\t%s = %s;\n", outputColor,
+ (GrGLSLExpr<4>(inputColor) * GrGLSLExpr<4>("colorTemp")).c_str());
} else {
builder->fsCodeAppendf("\tvec2 coord = vec2(%s, %s);\n",
gradientTValue,
« no previous file with comments | « src/effects/SkLumaXfermode.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698