This patch adds support for optional processing of the alpha channel in
the matrix convolution filter. Test cases are added to the GM and the
bench.
NOTE: This will require rebaselining the matrixconvolution GM, so it will
likely turn the bots red until that is done.
https://codereview.appspot.com/6547049/
git-svn-id: http://skia.googlecode.com/svn/trunk@5661 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/effects/SkMatrixConvolutionImageFilter.h b/include/effects/SkMatrixConvolutionImageFilter.h
index 035b863..a938fd0 100644
--- a/include/effects/SkMatrixConvolutionImageFilter.h
+++ b/include/effects/SkMatrixConvolutionImageFilter.h
@@ -42,11 +42,14 @@
target of {1, 1}).
@param tileMode How accesses outside the image are treated. (@see
TileMode).
+ @param convolveAlpha If true, all channels are convolved. If false,
+ only the RGB channels are convolved, and
+ alpha is copied from the source image.
@param input The input image filter. If NULL, the src bitmap
passed to filterImage() is used instead.
*/
- SkMatrixConvolutionImageFilter(const SkISize& kernelSize, const SkScalar* kernel, SkScalar gain, SkScalar bias, const SkIPoint& target, TileMode tileMode, SkImageFilter* input = NULL);
+ SkMatrixConvolutionImageFilter(const SkISize& kernelSize, const SkScalar* kernel, SkScalar gain, SkScalar bias, const SkIPoint& target, TileMode tileMode, bool convolveAlpha, SkImageFilter* input = NULL);
virtual ~SkMatrixConvolutionImageFilter();
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
@@ -65,8 +68,11 @@
SkScalar fBias;
SkIPoint fTarget;
TileMode fTileMode;
+ bool fConvolveAlpha;
typedef SkSingleInputImageFilter INHERITED;
+ template <class PixelFetcher, bool convolveAlpha>
+ void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);
template <class PixelFetcher>
void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);
void filterInteriorPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect);