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

Unified Diff: src/core/SkComposeShader.cpp

Issue 1321253003: emitChild() takes an outputColor instead of generating one (Closed) Base URL: https://skia.googlesource.com/skia@cs3_composeshader2
Patch Set: Created 5 years, 4 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 | « no previous file | src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkComposeShader.cpp
diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp
index b45a81e2a1438bd8f51f515810bd740593a70cb5..530e651e6f660e5eff2f4a828796f5da5a8f020d 100644
--- a/src/core/SkComposeShader.cpp
+++ b/src/core/SkComposeShader.cpp
@@ -283,18 +283,23 @@ void GrGLComposeEffect::emitCode(EmitArgs& args) {
fsBuilder->codeAppendf("float %s = %s.a;\n", inputAlpha.c_str(), args.fInputColor);
fsBuilder->codeAppendf("%s /= %s.a;\n", args.fInputColor, args.fInputColor);
- // emit the code of the two child shaders
- SkString mangledOutputColorA;
- this->emitChild(0, args.fInputColor, &mangledOutputColorA, args);
- SkString mangledOutputColorB;
- this->emitChild(1, args.fInputColor, &mangledOutputColorB, args);
+ // declare outputColor and emit the code for each of the two children
+ SkString outputColorA(args.fOutputColor);
+ outputColorA.append("_dst");
bsalomon 2015/08/31 20:41:38 Your code should already be enclosed in braces so
wangyix 2015/08/31 22:01:22 Done.
+ fsBuilder->codeAppendf("vec4 %s;\n", outputColorA.c_str());
+ this->emitChild(0, args.fInputColor, outputColorA.c_str(), args);
+
+ SkString outputColorB(args.fOutputColor);
+ outputColorB.append("_src");
+ fsBuilder->codeAppendf("vec4 %s;\n", outputColorB.c_str());
+ this->emitChild(1, args.fInputColor, outputColorB.c_str(), args);
// emit blend code
SkXfermode::Mode mode = cs.getMode();
fsBuilder->codeAppend("{\n");
fsBuilder->codeAppendf("// Compose Xfer Mode: %s\n", SkXfermode::ModeName(mode));
- GrGLBlend::AppendPorterDuffBlend(fsBuilder, mangledOutputColorB.c_str(),
- mangledOutputColorA.c_str(), args.fOutputColor, mode);
+ GrGLBlend::AppendPorterDuffBlend(fsBuilder, outputColorB.c_str(), outputColorA.c_str(),
+ args.fOutputColor, mode);
fsBuilder->codeAppend("}\n");
// re-multiply the output color by the input color's alpha
« no previous file with comments | « no previous file | src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698