"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>
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 187a2a5..eaab71f 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -417,8 +417,13 @@
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 @@
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 @@
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()