Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: src/effects/SkMorphologyImageFilter.cpp

Issue 1834953002: Update Morphology image filter to store its type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add virtual op() method Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkMorphologyImageFilter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMorphologyImageFilter.cpp
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 8c952e87a25808b963128d40350681516f4355f5..5c36480bc8dead57fdf31e3da471267d86a83779 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);
-}
« no previous file with comments | « include/effects/SkMorphologyImageFilter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698