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

Unified Diff: src/effects/SkMorphologyImageFilter.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/SkMagnifierImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMorphologyImageFilter.cpp
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 251938e500c31feb6dd4df9ee71e7c88c87f8de9..fbc071fe5887b7f8464df407895ce560ef9c4bc7 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -297,16 +297,16 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) {
"Range");
const char* range = args.fBuilder->getUniformCStr(fRangeUni);
- GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
- SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
+ SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
const char* func;
switch (fType) {
case GrMorphologyEffect::kErode_MorphologyType:
- fsBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s = vec4(1, 1, 1, 1);\n", args.fOutputColor);
func = "min";
break;
case GrMorphologyEffect::kDilate_MorphologyType:
- fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutputColor);
func = "max";
break;
default:
@@ -329,30 +329,30 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) {
}
// vec2 coord = coord2D;
- fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
+ fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
// coord.x -= radius * pixelSize;
- fsBuilder->codeAppendf("\t\tcoord.%s -= %d.0 * %s; \n", dir, fRadius, pixelSizeInc);
+ fragBuilder->codeAppendf("\t\tcoord.%s -= %d.0 * %s; \n", dir, fRadius, pixelSizeInc);
if (fUseRange) {
// highBound = min(highBound, coord.x + (width-1) * pixelSize);
- fsBuilder->codeAppendf("\t\tfloat highBound = min(%s.y, coord.%s + %f * %s);",
- range, dir, float(width() - 1), pixelSizeInc);
+ fragBuilder->codeAppendf("\t\tfloat highBound = min(%s.y, coord.%s + %f * %s);",
+ range, dir, float(width() - 1), pixelSizeInc);
// coord.x = max(lowBound, coord.x);
- fsBuilder->codeAppendf("\t\tcoord.%s = max(%s.x, coord.%s);", dir, range, dir);
+ fragBuilder->codeAppendf("\t\tcoord.%s = max(%s.x, coord.%s);", dir, range, dir);
}
- fsBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", width());
- fsBuilder->codeAppendf("\t\t\t%s = %s(%s, ", args.fOutputColor, func, args.fOutputColor);
- fsBuilder->appendTextureLookup(args.fSamplers[0], "coord");
- fsBuilder->codeAppend(");\n");
+ fragBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", width());
+ fragBuilder->codeAppendf("\t\t\t%s = %s(%s, ", args.fOutputColor, func, args.fOutputColor);
+ fragBuilder->appendTextureLookup(args.fSamplers[0], "coord");
+ fragBuilder->codeAppend(");\n");
// coord.x += pixelSize;
- fsBuilder->codeAppendf("\t\t\tcoord.%s += %s;\n", dir, pixelSizeInc);
+ fragBuilder->codeAppendf("\t\t\tcoord.%s += %s;\n", dir, pixelSizeInc);
if (fUseRange) {
// coord.x = min(highBound, coord.x);
- fsBuilder->codeAppendf("\t\t\tcoord.%s = min(highBound, coord.%s);", dir, dir);
+ fragBuilder->codeAppendf("\t\t\tcoord.%s = min(highBound, coord.%s);", dir, dir);
}
- fsBuilder->codeAppend("\t\t}\n");
+ fragBuilder->codeAppend("\t\t}\n");
SkString modulate;
GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor);
- fsBuilder->codeAppend(modulate.c_str());
+ fragBuilder->codeAppend(modulate.c_str());
}
void GrGLMorphologyEffect::GenKey(const GrProcessor& proc,
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698