aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-04-25 15:27:40 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-27 21:56:38 +0000
commit275df2e8730676c1e0ccc715a98868c6421bc5f4 (patch)
tree0aef3dbc8f2c117d879a5da20a27141f151f578e /src/effects
parent34a388edbd277cf23d55627695b4bb6c46230d22 (diff)
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 <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkEmbossMaskFilter.cpp4
-rw-r--r--src/effects/SkShaderMaskFilter.cpp4
2 files changed, 7 insertions, 1 deletions
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);