From: Brian Salomon Date: Tue, 21 Feb 2017 19:19:07 +0000 (-0500) Subject: Fix ComposeOneFragmentProcessor coverage as alpha optimization. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~55^2~181 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e026511f4c4b90bfe842f89966d088b663fc8c13;p=platform%2Fupstream%2FlibSkiaSharp.git Fix ComposeOneFragmentProcessor coverage as alpha optimization. It should only be advertised if the child also advertises it. Change-Id: I698213c9562d710dff45f0622d50eacc41e29af5 Reviewed-on: https://skia-review.googlesource.com/8811 Reviewed-by: Greg Daniel Commit-Queue: Brian Salomon --- diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp index 8488fec..eb6f04b 100644 --- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp +++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp @@ -285,15 +285,21 @@ private: break; // Produces opaque if both src and dst are opaque. These also will modulate the child's - // output by either the input color or alpha. + // output by either the input color or alpha. However, if the child is not compatible + // with the coverage as alpha then it may produce a color that is not valid premul. case SkBlendMode::kSrcIn: case SkBlendMode::kDstIn: case SkBlendMode::kModulate: - if (fp->preservesOpaqueInput()) { - flags = kPreservesOpaqueInput_OptimizationFlag | - kCompatibleWithCoverageAsAlpha_OptimizationFlag; + if (fp->compatibleWithCoverageAsAlpha()) { + if (fp->preservesOpaqueInput()) { + flags = kPreservesOpaqueInput_OptimizationFlag | + kCompatibleWithCoverageAsAlpha_OptimizationFlag; + } else { + flags = kCompatibleWithCoverageAsAlpha_OptimizationFlag; + } } else { - flags = kCompatibleWithCoverageAsAlpha_OptimizationFlag; + flags = fp->preservesOpaqueInput() ? kPreservesOpaqueInput_OptimizationFlag + : kNone_OptimizationFlags; } break;