Split GrConstColorProcessor into three separate .fp effects.
ConstColorProcessor contained three separate InputModes with their own
unique behaviors, but every (non-test) call site simply hardcoded one of
the InputModes.
This change also allows the actual const-color processor to remove the
inputFP entirely; it is never sampled.
The GM slide has been split into three separate slides as well.
Change-Id: I2b77f4eab4d655f06e3704fb6fde8d4f8c70a075
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301987
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index e7e181f..8df9db0 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -45,6 +45,7 @@
#include "src/gpu/effects/generated/GrClampFragmentProcessor.h"
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
#include "src/gpu/effects/generated/GrDitherEffect.h"
+#include "src/gpu/effects/generated/GrModulateRGBAEffect.h"
#include "src/image/SkImage_Base.h"
#include "src/shaders/SkShaderBase.h"
@@ -262,9 +263,8 @@
if (1.0f != paintAlpha) {
// No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
// color channels. It's value should be treated as the same in ANY color space.
- paintFP = GrConstColorProcessor::Make(
- std::move(paintFP), { paintAlpha, paintAlpha, paintAlpha, paintAlpha },
- GrConstColorProcessor::InputMode::kModulateRGBA);
+ paintFP = GrModulateRGBAEffect::Make(
+ std::move(paintFP), {paintAlpha, paintAlpha, paintAlpha, paintAlpha});
}
} else {
// The shader's FP sees the paint *unpremul* color
@@ -276,8 +276,7 @@
// There is a blend between the primitive color and the paint color. The blend considers
// the opaque paint color. The paint's alpha is applied to the post-blended color.
SkPMColor4f opaqueColor = origColor.makeOpaque().premul();
- paintFP = GrConstColorProcessor::Make(/*inputFP=*/nullptr, opaqueColor,
- GrConstColorProcessor::InputMode::kIgnore);
+ paintFP = GrConstColorProcessor::Make(opaqueColor);
paintFP = GrXfermodeFragmentProcessor::Make(std::move(paintFP), /*dst=*/nullptr,
*primColorMode);
grPaint->setColor4f(opaqueColor);
@@ -287,9 +286,8 @@
if (1.0f != paintAlpha) {
// No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
// color channels. It's value should be treated as the same in ANY color space.
- paintFP = GrConstColorProcessor::Make(
- std::move(paintFP), { paintAlpha, paintAlpha, paintAlpha, paintAlpha },
- GrConstColorProcessor::InputMode::kModulateRGBA);
+ paintFP = GrModulateRGBAEffect::Make(
+ std::move(paintFP), {paintAlpha, paintAlpha, paintAlpha, paintAlpha});
}
} else {
// No shader, no primitive color.