static sk_sp<GrFragmentProcessor> MulOutputByInputAlpha(sk_sp<GrFragmentProcessor>);
/**
- * Similar to the above but it modulates the output r,g,b of the child processor by the input
- * rgb and then multiplies all the components by the input alpha. This effectively modulates
- * the child processor's premul color by a unpremul'ed input and produces a premul output
+ * This assumes that the input color to the returned processor will be unpremul and that the
+ * passed processor (which becomes the returned processor's child) produces a premul output.
+ * The result of the returned processor is a premul of its input color modulated by the child
+ * processor's premul output.
*/
- static sk_sp<GrFragmentProcessor> MulOutputByInputUnpremulColor(sk_sp<GrFragmentProcessor>);
+ static sk_sp<GrFragmentProcessor> MakeInputPremulAndMulByOutput(sk_sp<GrFragmentProcessor>);
/**
* Returns a parent fragment processor that adopts the passed fragment processor as a child.
return GrFragmentProcessor::RunInSeries(fpPipeline, 2);
}
-sk_sp<GrFragmentProcessor> GrFragmentProcessor::MulOutputByInputUnpremulColor(
- sk_sp<GrFragmentProcessor> fp) {
+sk_sp<GrFragmentProcessor> GrFragmentProcessor::MakeInputPremulAndMulByOutput(
+ sk_sp<GrFragmentProcessor> fp) {
class PremulFragmentProcessor : public GrFragmentProcessor {
public:
std::move(colorSpaceXform),
SkMatrix::I()));
if (GrPixelConfigIsAlphaOnly(texture->config())) {
- fp = GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(fp));
+ fp = GrFragmentProcessor::MakeInputPremulAndMulByOutput(std::move(fp));
} else {
fp = GrFragmentProcessor::MulOutputByInputAlpha(std::move(fp));
}
sk_sp<GrFragmentProcessor> fpSeries[] = { std::move(shaderFP), std::move(fp) };
shaderFP = GrFragmentProcessor::RunInSeries(fpSeries, 2);
} else {
- shaderFP = GrFragmentProcessor::MulOutputByInputUnpremulColor(fp);
+ shaderFP = GrFragmentProcessor::MakeInputPremulAndMulByOutput(fp);
}
} else {
shaderFP = GrFragmentProcessor::MulOutputByInputAlpha(fp);