aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects
diff options
context:
space:
mode:
authorGravatar wutao <wutao@google.com>2017-06-30 10:44:45 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-30 18:11:16 +0000
commit039a7c70cea29aa40c4fb880b0d6bb523d449568 (patch)
treeb62a5274d4b1cbcaac89ad5fb8bf86118c7caa87 /include/effects
parent981deec8b2928f07e3899849bed31bfbb8c19b9b (diff)
Added new edge handling mode (clamp and repeat) to Gaussian blur filter.
Gaussian blur filter will interpolate value by using out of bounds coords, which is 0. This makes it appears darker near the bounds in the blurred images. There are two issues: 1) when downsampling and upsampling, we should use GrTextureDomainEffect kClamp_Mode to clamp the texture coords to the bounds; 2) during Gaussian blur, we need to clamp to texture bounds. BUG=622128 TEST=cc_unittests, GM image test & manual. Some test results can be found at: https://bugs.chromium.org/p/chromium/issues/detail?id=622128#c49 Change-Id: I9283da1d91efb0da94a991f2d372e9f62c288bdc Reviewed-on: https://skia-review.googlesource.com/20465 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include/effects')
-rw-r--r--include/effects/SkBlurImageFilter.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/effects/SkBlurImageFilter.h b/include/effects/SkBlurImageFilter.h
index 0cb864c145..bae835ccf5 100644
--- a/include/effects/SkBlurImageFilter.h
+++ b/include/effects/SkBlurImageFilter.h
@@ -12,9 +12,20 @@
class SK_API SkBlurImageFilter {
public:
+ /*! \enum TileMode */
+ enum TileMode {
+ kIgnore_TileMode = 0, /*!< Ignore the image's edge pixels. */
+ kClamp_TileMode, /*!< Clamp to the image's edge pixels. */
+ /*!< This re-weights the filter so samples outside have no effect */
+ kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */
+ kClampToBlack_TileMode, /*!< Fill with transparent black. */
+ kMax_TileMode = kClampToBlack_TileMode
+ };
+
static sk_sp<SkImageFilter> Make(SkScalar sigmaX, SkScalar sigmaY,
sk_sp<SkImageFilter> input,
- const SkImageFilter::CropRect* cropRect = nullptr);
+ const SkImageFilter::CropRect* cropRect = nullptr,
+ TileMode tileMode = TileMode::kClampToBlack_TileMode);
};
#endif