From 275df2e8730676c1e0ccc715a98868c6421bc5f4 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 25 Apr 2018 15:27:40 -0400 Subject: Just pass color glyph masks to filters. Allow the filters to try to apply themselves to the color mask. Most mask filters will just return false, but allow them the opprotunity. This removes the behavior of trying to create a mask from the color mask. This updates the blur mask filter to handle kARGB32_Format directly by using just the alpha (which mirrors current behavior). Change-Id: I15eb736060ecf9b24aca874758c167b74d9ebc22 Reviewed-on: https://skia-review.googlesource.com/124185 Reviewed-by: Herb Derby Commit-Queue: Ben Wagner --- src/effects/SkEmbossMaskFilter.cpp | 4 ++++ src/effects/SkShaderMaskFilter.cpp | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/effects') diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp index e991d94985..4a4c8d0e34 100644 --- a/src/effects/SkEmbossMaskFilter.cpp +++ b/src/effects/SkEmbossMaskFilter.cpp @@ -72,6 +72,10 @@ SkMask::Format SkEmbossMaskFilter::getFormat() const { bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src, const SkMatrix& matrix, SkIPoint* margin) const { + if (src.fFormat != SkMask::kA8_Format) { + return false; + } + SkScalar sigma = matrix.mapRadius(fBlurSigma); if (!SkBlurMask::BoxBlur(dst, src, sigma, kInner_SkBlurStyle)) { diff --git a/src/effects/SkShaderMaskFilter.cpp b/src/effects/SkShaderMaskFilter.cpp index 83159941a1..cfa15c5bad 100644 --- a/src/effects/SkShaderMaskFilter.cpp +++ b/src/effects/SkShaderMaskFilter.cpp @@ -70,7 +70,9 @@ static void rect_memcpy(void* dst, size_t dstRB, const void* src, size_t srcRB, bool SkShaderMF::filterMask(SkMask* dst, const SkMask& src, const SkMatrix& ctm, SkIPoint* margin) const { - SkASSERT(src.fFormat == SkMask::kA8_Format); + if (src.fFormat != SkMask::kA8_Format) { + return false; + } if (margin) { margin->set(0, 0); -- cgit v1.2.3