From ad43fd834f3adaf903ee0c1b6f3edbe48b0cf93f Mon Sep 17 00:00:00 2001 From: John Stiles Date: Mon, 29 Jun 2020 12:48:29 -0400 Subject: [PATCH] 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 Reviewed-by: Michael Ludwig Auto-Submit: John Stiles --- src/core/SkColorFilter.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp index 31f58ba0e0..5e08491c40 100644 --- a/src/core/SkColorFilter.cpp +++ b/src/core/SkColorFilter.cpp @@ -249,21 +249,25 @@ public: }()) {} #if SK_SUPPORT_GPU - std::unique_ptr asFragmentProcessor(GrRecordingContext*, - const GrColorInfo&) const override { + bool colorFilterAcceptsInputFP() const override { return true; } + GrFPResult asFragmentProcessor(std::unique_ptr 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