diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index ce787c6ab8..4a4665d481 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1454,7 +1454,7 @@ void GrGLLightingEffect::emitCode(GrGLProgramBuilder* builder, fLight->emitLightColor(builder, "surfaceToLight"); fsBuilder->codeAppend(");\n"); SkString modulate; - GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); + GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); fsBuilder->codeAppend(modulate.c_str()); } diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index d6a8e783b9..54ca97e38d 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -168,7 +168,7 @@ void GrGLMagnifierEffect::emitCode(GrGLProgramBuilder* builder, fsBuilder->codeAppendf("\t\t%s = output_color;", outputColor); SkString modulate; - GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); + GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); fsBuilder->codeAppend(modulate.c_str()); } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 4c7f62482c..71a70d6459 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -399,7 +399,7 @@ void GrGLMorphologyEffect::emitCode(GrGLProgramBuilder* builder, fsBuilder->codeAppendf("\t\t\tcoord += %s;\n", imgInc); fsBuilder->codeAppend("\t\t}\n"); SkString modulate; - GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); + GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); fsBuilder->codeAppend(modulate.c_str()); } diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index f60be2a970..83c4a10a3a 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -81,7 +81,7 @@ public: fsBuilder->codeAppendf("%s = %s;", outputColor, tmpVar.c_str()); } SkString modulate; - GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); + GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); fsBuilder->codeAppend(modulate.c_str()); } diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index a836d43f2b..36a1bfe6a1 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -101,7 +101,7 @@ void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder, } SkString modulate; - GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); + GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); fsBuilder->codeAppend(modulate.c_str()); } diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index c0080c61dc..500a07e3bf 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -116,7 +116,7 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder, } SkString modulate; - GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); + GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); fsBuilder->codeAppend(modulate.c_str()); } diff --git a/src/gpu/gl/GrGLSL.cpp b/src/gpu/gl/GrGLSL.cpp index 6c8f88360c..866a0d13d3 100644 --- a/src/gpu/gl/GrGLSL.cpp +++ b/src/gpu/gl/GrGLSL.cpp @@ -69,30 +69,14 @@ const char* GrGetGLSLVersionDecl(const GrGLContextInfo& info) { } } -namespace { - void append_tabs(SkString* outAppend, int tabCnt) { - static const char kTabs[] = "\t\t\t\t\t\t\t\t"; - while (tabCnt) { - int cnt = SkTMin((int)SK_ARRAY_COUNT(kTabs), tabCnt); - outAppend->append(kTabs, cnt); - tabCnt -= cnt; - } - } -} - -void GrGLSLMulVarBy4f(SkString* outAppend, - unsigned tabCnt, - const char* vec4VarName, - const GrGLSLExpr4& mulFactor) { +void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor) { if (mulFactor.isOnes()) { *outAppend = SkString(); } - append_tabs(outAppend, tabCnt); - if (mulFactor.isZeros()) { - outAppend->appendf("%s = vec4(0);\n", vec4VarName); + outAppend->appendf("%s = vec4(0);", vec4VarName); } else { - outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor.c_str()); + outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str()); } } diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h index ff39c2b680..3cbce9c546 100644 --- a/src/gpu/gl/GrGLSL.h +++ b/src/gpu/gl/GrGLSL.h @@ -310,10 +310,9 @@ private: /** * Does an inplace mul, *=, of vec4VarName by mulFactor. - * A semicolon and newline are added after the assignment. + * A semicolon is added after the assignment. */ -void GrGLSLMulVarBy4f(SkString* outAppend, unsigned tabCnt, - const char* vec4VarName, const GrGLSLExpr4& mulFactor); +void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor); #include "GrGLSL_impl.h"