aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/matrixconvolution.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-09-25 14:32:42 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-09-25 14:32:42 +0000
commit8640d5024d57da5508bdf7585849e3b1f1cb365b (patch)
tree7fbf975b21bfd199135354d0a34b561e7150f029 /gm/matrixconvolution.cpp
parent63e0ffde9faf7e5e233128f4bc5459eee23a2a17 (diff)
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
Diffstat (limited to 'gm/matrixconvolution.cpp')
-rw-r--r--gm/matrixconvolution.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp
index 6c69fac485..0a0afa492d 100644
--- a/gm/matrixconvolution.cpp
+++ b/gm/matrixconvolution.cpp
@@ -36,10 +36,10 @@ protected:
}
virtual SkISize onISize() {
- return make_isize(300, 300);
+ return make_isize(400, 300);
}
- void draw(SkCanvas* canvas, int x, int y, const SkIPoint& target, SkMatrixConvolutionImageFilter::TileMode tileMode) {
+ void draw(SkCanvas* canvas, int x, int y, const SkIPoint& target, SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha) {
SkScalar kernel[9] = {
SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
@@ -48,7 +48,7 @@ protected:
SkISize kernelSize = SkISize::Make(3, 3);
SkScalar gain = SkFloatToScalar(0.3f), bias = SkIntToScalar(100);
SkPaint paint;
- SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias, target, tileMode)));
+ SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias, target, tileMode, convolveAlpha)));
paint.setImageFilter(filter);
canvas->drawSprite(fBitmap, x, y, &paint);
}
@@ -62,10 +62,12 @@ protected:
SkIPoint target = SkIPoint::Make(1, 1);
for (target.fY = 0; target.fY < 3; ++target.fY) {
int y = target.fY * 100 + 10;
- draw(canvas, 10, y, target, SkMatrixConvolutionImageFilter::kClamp_TileMode);
- draw(canvas, 110, y, target, SkMatrixConvolutionImageFilter::kClampToBlack_TileMode);
- draw(canvas, 210, y, target, SkMatrixConvolutionImageFilter::kRepeat_TileMode);
+ draw(canvas, 10, y, target, SkMatrixConvolutionImageFilter::kClamp_TileMode, true);
+ draw(canvas, 110, y, target, SkMatrixConvolutionImageFilter::kClampToBlack_TileMode, true);
+ draw(canvas, 210, y, target, SkMatrixConvolutionImageFilter::kRepeat_TileMode, true);
}
+ target.fY = 1;
+ draw(canvas, 310, 10, target, SkMatrixConvolutionImageFilter::kClamp_TileMode, false);
}
private: