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

Unified Diff: src/gpu/effects/GrXfermodeFragmentProcessor.cpp

Issue 1338403003: Revert of Test that GrFragmentProcessors work without input colors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrXfermodeFragmentProcessor.cpp
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index c039db343315b6610ee1d4a62048becd2ffa2ba3..3cb56d07f7ea2ce74d3a5d08f0118781293a3958 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -78,12 +78,12 @@
// possibility of an arbitrarily large tree of procs.
SkAutoTUnref<const GrFragmentProcessor> fpA;
do {
- fpA.reset(GrProcessorTestFactory<GrFragmentProcessor>::Create(d));
+ fpA.reset(GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(d));
SkASSERT(fpA);
} while (fpA->numChildProcessors() != 0);
SkAutoTUnref<const GrFragmentProcessor> fpB;
do {
- fpB.reset(GrProcessorTestFactory<GrFragmentProcessor>::Create(d));
+ fpB.reset(GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(d));
SkASSERT(fpB);
} while (fpB->numChildProcessors() != 0);
@@ -112,26 +112,20 @@
// This is because we don't want the paint's alpha to affect either child proc's output
// before the blend; we want to apply the paint's alpha AFTER the blend. This mirrors the
// software implementation of SkComposeShader.
- const char* opaqueInput = nullptr;
- const char* inputAlpha = nullptr;
- if (args.fInputColor) {
- inputAlpha = "inputAlpha";
- opaqueInput = "opaqueInput";
- fsBuilder->codeAppendf("float inputAlpha = %s.a;", args.fInputColor);
- fsBuilder->codeAppendf("vec4 opaqueInput = vec4(%s.rgb / inputAlpha, 1);",
- args.fInputColor);
- }
+ SkString inputAlpha("inputAlpha");
+ fsBuilder->codeAppendf("float %s = %s.a;", inputAlpha.c_str(), args.fInputColor);
+ fsBuilder->codeAppendf("%s /= %s.a;", args.fInputColor, args.fInputColor);
// declare outputColor and emit the code for each of the two children
SkString outputColorSrc(args.fOutputColor);
outputColorSrc.append("_src");
fsBuilder->codeAppendf("vec4 %s;\n", outputColorSrc.c_str());
- this->emitChild(0, opaqueInput, outputColorSrc.c_str(), args);
+ this->emitChild(0, args.fInputColor, outputColorSrc.c_str(), args);
SkString outputColorDst(args.fOutputColor);
outputColorDst.append("_dst");
fsBuilder->codeAppendf("vec4 %s;\n", outputColorDst.c_str());
- this->emitChild(1, opaqueInput, outputColorDst.c_str(), args);
+ this->emitChild(1, args.fInputColor, outputColorDst.c_str(), args);
// emit blend code
SkXfermode::Mode mode = cs.getMode();
@@ -142,10 +136,9 @@
fsBuilder->codeAppend("}");
// re-multiply the output color by the input color's alpha
- if (inputAlpha) {
- fsBuilder->codeAppendf("%s *= %s;", args.fOutputColor, inputAlpha);
- }
+ fsBuilder->codeAppendf("%s *= %s;", args.fOutputColor, inputAlpha.c_str());
}
+
const GrFragmentProcessor* GrXfermodeFragmentProcessor::CreateFromTwoProcessors(
const GrFragmentProcessor* src, const GrFragmentProcessor* dst, SkXfermode::Mode mode) {
« no previous file with comments | « src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698