Revert "don't compose with (forced) opaque colors"

This reverts commit 81995592d8a941fcf79ba5cee71a37510fa8d6e5.

Reason for revert: Various bots reporting "Processor ComposeTwo claimed output for const input doesn't match actual output"

Original change's description:
> don't compose with (forced) opaque colors
> 
> Bug: skia:
> Change-Id: Ic5ea706430b4698e7e937a0cc424ec29b0d8da10
> Reviewed-on: https://skia-review.googlesource.com/22029
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=bsalomon@google.com,brianosman@google.com,reed@google.com

Change-Id: Idf0e0db6e2d81dd00fa39c4ea0b3bcd92af8cae0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/22067
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index ad04271..94491c9 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -146,12 +146,14 @@
     }
 
     GrColor4f constantOutputForConstantInput(GrColor4f input) const override {
+        float alpha = input.fRGBA[3];
+        input = input.opaque();
         GrColor4f srcColor = ConstantOutputForConstantInput(this->childProcessor(0), input);
         GrColor4f dstColor = ConstantOutputForConstantInput(this->childProcessor(1), input);
         SkPM4f src = GrColor4fToSkPM4f(srcColor);
         SkPM4f dst = GrColor4fToSkPM4f(dstColor);
         SkPM4f res = SkBlendMode_Apply(fMode, src, dst);
-        return SkPM4fToGrColor4f(res);
+        return SkPM4fToGrColor4f(res).mulByScalar(alpha);
     }
 
     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@@ -203,12 +205,18 @@
     GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
     const ComposeTwoFragmentProcessor& cs = args.fFp.cast<ComposeTwoFragmentProcessor>();
 
+    const char* inputColor = nullptr;
+    if (args.fInputColor) {
+        inputColor = "inputColor";
+        fragBuilder->codeAppendf("vec4 inputColor = vec4(%s.rgb, 1.0);", args.fInputColor);
+    }
+
     // declare outputColor and emit the code for each of the two children
     SkString srcColor("xfer_src");
-    this->emitChild(0, args.fInputColor, &srcColor, args);
+    this->emitChild(0, inputColor, &srcColor, args);
 
     SkString dstColor("xfer_dst");
-    this->emitChild(1, args.fInputColor, &dstColor, args);
+    this->emitChild(1, inputColor, &dstColor, args);
 
     // emit blend code
     SkBlendMode mode = cs.getMode();
@@ -218,6 +226,11 @@
                             dstColor.c_str(),
                             args.fOutputColor,
                             mode);
+
+    // re-multiply the output color by the input color's alpha
+    if (args.fInputColor) {
+        fragBuilder->codeAppendf("%s *= %s.a;", args.fOutputColor, args.fInputColor);
+    }
 }
 
 sk_sp<GrFragmentProcessor> GrXfermodeFragmentProcessor::MakeFromTwoProcessors(