diff options
author | Mike Klein <mtklein@chromium.org> | 2017-11-14 13:41:30 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-14 19:01:34 +0000 |
commit | e822803242e3132db6a66ad058ced1b8842649b5 (patch) | |
tree | 93bccf7ffbfe3d98a949a735e8d2047c01fa0f6c | |
parent | cb9fc4160ea95453cb37134d4477c63d512458cc (diff) |
"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>
-rw-r--r-- | src/core/SkRasterPipelineBlitter.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index 187a2a58ea..eaab71fac5 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -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() |