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

Unified Diff: src/effects/SkTableColorFilter.cpp

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkTableColorFilter.cpp
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 3e4877e89b9461017362269e284969234f6526c4..9d97411042f78eb8aa094eeb7f806f85c028b441 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -420,46 +420,46 @@ void GLColorTableEffect::emitCode(EmitArgs& args) {
"yoffsets", &yoffsets);
static const float kColorScaleFactor = 255.0f / 256.0f;
static const float kColorOffsetFactor = 1.0f / 512.0f;
- GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
if (nullptr == args.fInputColor) {
// the input color is solid white (all ones).
static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
- fsBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n",
- kMaxValue, kMaxValue, kMaxValue, kMaxValue);
+ fragBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n",
+ kMaxValue, kMaxValue, kMaxValue, kMaxValue);
} else {
- fsBuilder->codeAppendf("\t\tfloat nonZeroAlpha = max(%s.a, .0001);\n", args.fInputColor);
- fsBuilder->codeAppendf("\t\tvec4 coord = vec4(%s.rgb / nonZeroAlpha, nonZeroAlpha);\n",
- args.fInputColor);
- fsBuilder->codeAppendf("\t\tcoord = coord * %f + vec4(%f, %f, %f, %f);\n",
- kColorScaleFactor,
- kColorOffsetFactor, kColorOffsetFactor,
- kColorOffsetFactor, kColorOffsetFactor);
+ fragBuilder->codeAppendf("\t\tfloat nonZeroAlpha = max(%s.a, .0001);\n", args.fInputColor);
+ fragBuilder->codeAppendf("\t\tvec4 coord = vec4(%s.rgb / nonZeroAlpha, nonZeroAlpha);\n",
+ args.fInputColor);
+ fragBuilder->codeAppendf("\t\tcoord = coord * %f + vec4(%f, %f, %f, %f);\n",
+ kColorScaleFactor,
+ kColorOffsetFactor, kColorOffsetFactor,
+ kColorOffsetFactor, kColorOffsetFactor);
}
SkString coord;
- fsBuilder->codeAppendf("\t\t%s.a = ", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s.a = ", args.fOutputColor);
coord.printf("vec2(coord.a, %s.a)", yoffsets);
- fsBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
- fsBuilder->codeAppend(";\n");
+ fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
+ fragBuilder->codeAppend(";\n");
- fsBuilder->codeAppendf("\t\t%s.r = ", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s.r = ", args.fOutputColor);
coord.printf("vec2(coord.r, %s.r)", yoffsets);
- fsBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
- fsBuilder->codeAppend(";\n");
+ fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
+ fragBuilder->codeAppend(";\n");
- fsBuilder->codeAppendf("\t\t%s.g = ", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s.g = ", args.fOutputColor);
coord.printf("vec2(coord.g, %s.g)", yoffsets);
- fsBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
- fsBuilder->codeAppend(";\n");
+ fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
+ fragBuilder->codeAppend(";\n");
- fsBuilder->codeAppendf("\t\t%s.b = ", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s.b = ", args.fOutputColor);
coord.printf("vec2(coord.b, %s.b)", yoffsets);
- fsBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
- fsBuilder->codeAppend(";\n");
+ fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
+ fragBuilder->codeAppend(";\n");
- fsBuilder->codeAppendf("\t\t%s.rgb *= %s.a;\n", args.fOutputColor, args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s.rgb *= %s.a;\n", args.fOutputColor, args.fOutputColor);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698