Clean up GrColorSpaceXformEffect to allow a null child FP.
Previously, GrColorSpaceXformEffect had separate Make methods; one took
a child FP, the other did not, and they had slightly different color-
transform inputs (the destination alpha type was assumed to be premul
when a child FP was provided). A null FP was considered invalid.
This has been updated to work more like other FPs. An childFP must
always be supplied, and nullptr is interpreted as "use the sk_InColor".
The destination alpha type is now always supplied. Existing call sites
were fixed up as needed.
Previously, the child-FP path would actually render the product of the
child FP and the sk_InColor. This extra multiplication step no longer
occurs; the sk_InColor is simply ignored when a child FP is used. In
practice, this did not affect any existing GM tests.
Change-Id: Id53449234948255cbdaab9b88b1c94201eeb0a0d
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299576
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index 6ff41e3..ebd12c4 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -104,8 +104,9 @@
GrBicubicEffect::Direction::kXY);
}
if (fImage->fFromColorSpace) {
- fp = GrColorSpaceXformEffect::Make(std::move(fp), fImage->fFromColorSpace.get(),
- fImage->alphaType(), fImage->colorSpace());
+ fp = GrColorSpaceXformEffect::Make(std::move(fp),
+ fImage->fFromColorSpace.get(), fImage->alphaType(),
+ fImage->colorSpace(), kPremul_SkAlphaType);
}
return fp;
}