aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-03-30 08:09:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-30 08:09:57 -0700
commit40d8d62854b725b30876a01f5038c51033758f08 (patch)
tree3ebda5b8137f8abac5a33c415eb7452b9fb9e1cf /src
parent15bc5603e44fdcac7418f08842974a80f935a577 (diff)
Update Morphology image filter to store its type
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 8c952e87a2..5c36480bc8 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -515,10 +515,9 @@ static sk_sp<SkSpecialImage> apply_morphology(SkSpecialImage* input,
}
#endif
-sk_sp<SkSpecialImage> SkMorphologyImageFilter::filterImageGeneric(bool dilate,
- SkSpecialImage* source,
- const Context& ctx,
- SkIPoint* offset) const {
+sk_sp<SkSpecialImage> SkMorphologyImageFilter::onFilterImage(SkSpecialImage* source,
+ const Context& ctx,
+ SkIPoint* offset) const {
SkIPoint inputOffset = SkIPoint::Make(0, 0);
sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset));
if (!input) {
@@ -552,8 +551,8 @@ sk_sp<SkSpecialImage> SkMorphologyImageFilter::filterImageGeneric(bool dilate,
#if SK_SUPPORT_GPU
if (input->peekTexture() && input->peekTexture()->getContext()) {
- auto type = dilate ? GrMorphologyEffect::kDilate_MorphologyType
- : GrMorphologyEffect::kErode_MorphologyType;
+ auto type = (kDilate_Op == this->op()) ? GrMorphologyEffect::kDilate_MorphologyType
+ : GrMorphologyEffect::kErode_MorphologyType;
sk_sp<SkSpecialImage> result(apply_morphology(input.get(), srcBounds, type,
SkISize::Make(width, height)));
if (result) {
@@ -586,7 +585,7 @@ sk_sp<SkSpecialImage> SkMorphologyImageFilter::filterImageGeneric(bool dilate,
SkMorphologyImageFilter::Proc procX, procY;
- if (dilate) {
+ if (kDilate_Op == this->op()) {
procX = SkOpts::dilate_x;
procY = SkOpts::dilate_y;
} else {
@@ -622,13 +621,3 @@ sk_sp<SkSpecialImage> SkMorphologyImageFilter::filterImageGeneric(bool dilate,
SkIRect::MakeWH(bounds.width(), bounds.height()),
dst);
}
-
-sk_sp<SkSpecialImage> SkDilateImageFilter::onFilterImage(SkSpecialImage* source, const Context& ctx,
- SkIPoint* offset) const {
- return this->filterImageGeneric(true, source, ctx, offset);
-}
-
-sk_sp<SkSpecialImage> SkErodeImageFilter::onFilterImage(SkSpecialImage* source, const Context& ctx,
- SkIPoint* offset) const {
- return this->filterImageGeneric(false, source, ctx, offset);
-}