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

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: rebase Created 5 years, 3 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 095dca2332cc364c4e85bb50eca700ecd7945dc6..50fc6aaa392a0e1fb268fb0843ee10658261af35 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;", inputAlpha.c_str(), args.fInputColor);
fsBuilder->codeAppendf("%s /= %s.a;", 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");
+ 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("{");
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("}");
// 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