SkShaders::Blend/GPU: treat null inputs as input color

Matches CPU behavior.

Bug: skia:10019
Change-Id: I514bb996fdce8de2af5df008e185c48617a20a37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276008
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Florin Malita 2020-03-09 14:56:00 -04:00 committed by Skia Commit-Bot
parent a67d1aebf2
commit 0c465e3f35
2 changed files with 6 additions and 8 deletions

View File

@ -103,14 +103,9 @@ void RenderNode::RenderContext::modulatePaint(const SkMatrix& ctm, SkPaint* pain
// Only apply the shader mask for regular paints. Isolation layers require
// special handling on restore.
if (!is_layer_paint && fMaskShader) {
// TODO: GPU doesn't seem to grok null-input = input-color?
auto paint_shader = paint->refShader();
if (!paint_shader) {
paint_shader = SkShaders::Color(paint->getColor());
}
paint->setShader(SkShaders::Blend(SkBlendMode::kSrcIn,
LocalShader(fMaskShader, fMaskCTM, ctm),
std::move(paint_shader)));
paint->refShader()));
}
}

View File

@ -224,8 +224,11 @@ std::unique_ptr<GrFragmentProcessor> SkShader_Blend::asFragmentProcessor(
const GrFPArgs::WithPreLocalMatrix args(orig_args, this->getLocalMatrix());
auto fpA = as_fp(args, fDst.get());
auto fpB = as_fp(args, fSrc.get());
if (!fpA || !fpB) {
return nullptr;
if (!fpA) {
return GrXfermodeFragmentProcessor::MakeFromSrcProcessor(std::move(fpB), fMode);
}
if (!fpB) {
return GrXfermodeFragmentProcessor::MakeFromDstProcessor(std::move(fpA), fMode);
}
return GrXfermodeFragmentProcessor::MakeFromTwoProcessors(std::move(fpB),
std::move(fpA), fMode);