Index: src/gpu/effects/GrMatrixConvolutionEffect.cpp |
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp |
index c188baf89ec499c307c3626a373e0b8365283d08..7cbf8dc9d39d93ac58af7e278933bbbe7416d362 100644 |
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp |
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp |
@@ -64,41 +64,40 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) { |
int kWidth = fKernelSize.width(); |
int kHeight = fKernelSize.height(); |
- GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); |
- SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0); |
- fsBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);"); |
- fsBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset, |
- imgInc); |
- fsBuilder->codeAppend("vec4 c;"); |
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
+ SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); |
+ fragBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);"); |
+ fragBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset, imgInc); |
+ fragBuilder->codeAppend("vec4 c;"); |
for (int y = 0; y < kHeight; y++) { |
for (int x = 0; x < kWidth; x++) { |
- GrGLSLShaderBuilder::ShaderBlock block(fsBuilder); |
- fsBuilder->codeAppendf("float k = %s[%d * %d + %d];", kernel, y, kWidth, x); |
+ GrGLSLShaderBuilder::ShaderBlock block(fragBuilder); |
+ fragBuilder->codeAppendf("float k = %s[%d * %d + %d];", kernel, y, kWidth, x); |
SkString coord; |
coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc); |
- fDomain.sampleTexture(fsBuilder, domain, "c", coord, args.fSamplers[0]); |
+ fDomain.sampleTexture(fragBuilder, domain, "c", coord, args.fSamplers[0]); |
if (!fConvolveAlpha) { |
- fsBuilder->codeAppend("c.rgb /= c.a;"); |
- fsBuilder->codeAppend("c.rgb = clamp(c.rgb, 0.0, 1.0);"); |
+ fragBuilder->codeAppend("c.rgb /= c.a;"); |
+ fragBuilder->codeAppend("c.rgb = clamp(c.rgb, 0.0, 1.0);"); |
} |
- fsBuilder->codeAppend("sum += c * k;"); |
+ fragBuilder->codeAppend("sum += c * k;"); |
} |
} |
if (fConvolveAlpha) { |
- fsBuilder->codeAppendf("%s = sum * %s + %s;", args.fOutputColor, gain, bias); |
- fsBuilder->codeAppendf("%s.rgb = clamp(%s.rgb, 0.0, %s.a);", |
- args.fOutputColor, args.fOutputColor, args.fOutputColor); |
+ fragBuilder->codeAppendf("%s = sum * %s + %s;", args.fOutputColor, gain, bias); |
+ fragBuilder->codeAppendf("%s.rgb = clamp(%s.rgb, 0.0, %s.a);", |
+ args.fOutputColor, args.fOutputColor, args.fOutputColor); |
} else { |
- fDomain.sampleTexture(fsBuilder, domain, "c", coords2D, args.fSamplers[0]); |
- fsBuilder->codeAppendf("%s.a = c.a;", args.fOutputColor); |
- fsBuilder->codeAppendf("%s.rgb = sum.rgb * %s + %s;", args.fOutputColor, gain, bias); |
- fsBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColor, args.fOutputColor); |
+ fDomain.sampleTexture(fragBuilder, domain, "c", coords2D, args.fSamplers[0]); |
+ fragBuilder->codeAppendf("%s.a = c.a;", args.fOutputColor); |
+ fragBuilder->codeAppendf("%s.rgb = sum.rgb * %s + %s;", args.fOutputColor, gain, bias); |
+ fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColor, args.fOutputColor); |
} |
SkString modulate; |
GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); |
- fsBuilder->codeAppend(modulate.c_str()); |
+ fragBuilder->codeAppend(modulate.c_str()); |
} |
void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor, |