Update SkSRGBGammaColorFilter to accept an input fragment processor.

Change-Id: Ib9a61ffba5495c67652662a0d15fafc8f1f6ff1f
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299577
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2020-06-29 12:48:29 -04:00 committed by Skia Commit-Bot
parent 3e62762229
commit ad43fd834f

View File

@ -249,21 +249,25 @@ public:
}()) {}
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
const GrColorInfo&) const override {
bool colorFilterAcceptsInputFP() const override { return true; }
GrFPResult asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
GrRecordingContext* context,
const GrColorInfo& dstColorInfo) const override {
// wish our caller would let us know if our input was opaque...
SkAlphaType at = kPremul_SkAlphaType;
constexpr SkAlphaType alphaType = kPremul_SkAlphaType;
switch (fDir) {
case Direction::kLinearToSRGB:
return GrColorSpaceXformEffect::Make(/*childFP=*/nullptr,
sk_srgb_linear_singleton(), at,
sk_srgb_singleton(), at);
return GrFPSuccess(GrColorSpaceXformEffect::Make(
std::move(inputFP),
sk_srgb_linear_singleton(), alphaType,
sk_srgb_singleton(), alphaType));
case Direction::kSRGBToLinear:
return GrColorSpaceXformEffect::Make(/*childFP=*/nullptr,
sk_srgb_singleton(), at,
sk_srgb_linear_singleton(), at);
return GrFPSuccess(GrColorSpaceXformEffect::Make(
std::move(inputFP),
sk_srgb_singleton(), alphaType,
sk_srgb_linear_singleton(), alphaType));
}
return nullptr;
SkUNREACHABLE;
}
#endif