diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h index 0d41a267de..2ed187d19e 100644 --- a/include/gpu/GrFragmentProcessor.h +++ b/include/gpu/GrFragmentProcessor.h @@ -35,11 +35,12 @@ public: static sk_sp MulOutputByInputAlpha(sk_sp); /** - * 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 MulOutputByInputUnpremulColor(sk_sp); + static sk_sp MakeInputPremulAndMulByOutput(sk_sp); /** * Returns a parent fragment processor that adopts the passed fragment processor as a child. diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp index f294ac646d..92d74eb592 100644 --- a/src/gpu/GrFragmentProcessor.cpp +++ b/src/gpu/GrFragmentProcessor.cpp @@ -153,8 +153,8 @@ sk_sp GrFragmentProcessor::PremulInput(sk_sp GrFragmentProcessor::MulOutputByInputUnpremulColor( - sk_sp fp) { +sk_sp GrFragmentProcessor::MakeInputPremulAndMulByOutput( + sk_sp fp) { class PremulFragmentProcessor : public GrFragmentProcessor { public: diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index c5ade9e7b1..f4ee5445d5 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1192,7 +1192,7 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw, 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)); } diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index f7949e2120..aef3c0d1be 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -646,7 +646,7 @@ bool SkPaintToGrPaintWithTexture(GrContext* context, sk_sp 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);