[4fGradient] Veto blitters for non-opaque paints

The current blitters don't support SrcOver, so we must ensure the colors
are opaque.  Checking shader.colorsAreOpaque() is not enough as it
doesn't reflect the paint alpha.

Instead we should check for context flags & kOpaqueAlpha_Flag, which is
only set when both the color stops AND the paint are opaque.

R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1870773002

Review URL: https://codereview.chromium.org/1870773002
This commit is contained in:
fmalita 2016-04-07 13:16:13 -07:00 committed by Commit bot
parent 78daeff1f9
commit eadf3cf899

View File

@ -419,9 +419,8 @@ bool SkLinearGradient::LinearGradient4fContext::onChooseBlitProcs(const SkImageI
return false;
}
const SkGradientShaderBase& shader = static_cast<const SkGradientShaderBase&>(fShader);
if (mode != SkXfermode::kSrc_Mode &&
!(mode == SkXfermode::kSrcOver_Mode && shader.colorsAreOpaque())) {
!(mode == SkXfermode::kSrcOver_Mode && (fFlags & kOpaqueAlpha_Flag))) {
return false;
}