"support" 3D masks like Ganesh does

Ignore the mul and add planes and just use the A8 mask.
It's better than not drawing anything at all.

Change-Id: Ic20cec975c2db5c7aeb46ab7b430e8442dc8d8e9
Reviewed-on: https://skia-review.googlesource.com/71440
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-11-14 13:41:30 -05:00 committed by Skia Commit-Bot
parent cb9fc4160e
commit e822803242

View File

@ -417,8 +417,13 @@ void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip)
return INHERITED::blitMask(mask, clip);
}
// We'll use the first (A8) plane of any mask and ignore the other two, just like Ganesh.
SkMask::Format effectiveMaskFormat = mask.fFormat == SkMask::k3D_Format ? SkMask::kA8_Format
: mask.fFormat;
// Lazily build whichever pipeline we need, specialized for each mask format.
if (mask.fFormat == SkMask::kA8_Format && !fBlitMaskA8) {
if (effectiveMaskFormat == SkMask::kA8_Format && !fBlitMaskA8) {
SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (SkBlendMode_ShouldPreScaleCoverage(fBlend, /*rgb_coverage=*/false)) {
@ -433,7 +438,7 @@ void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip)
this->append_store(&p);
fBlitMaskA8 = p.compile();
}
if (mask.fFormat == SkMask::kLCD16_Format && !fBlitMaskLCD16) {
if (effectiveMaskFormat == SkMask::kLCD16_Format && !fBlitMaskLCD16) {
SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (SkBlendMode_ShouldPreScaleCoverage(fBlend, /*rgb_coverage=*/true)) {
@ -452,7 +457,7 @@ void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip)
std::function<void(size_t,size_t,size_t,size_t)>* blitter = nullptr;
// Update fMaskPtr to point "into" this current mask, but lined up with fDstPtr at (0,0).
switch (mask.fFormat) {
switch (effectiveMaskFormat) {
case SkMask::kA8_Format:
fMaskPtr.stride = mask.fRowBytes;
fMaskPtr.pixels = (uint8_t*)mask.fImage - mask.fBounds.left()