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

Unified Diff: tests/ImageFilterTest.cpp

Issue 265693005: Add a fix for a spurious assert in SkMatrixConvolutionImageFilter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index dac948ef40d3daeb2ca8d756427bd3d490f4b65d..e3d7efc28e6a38251fed690d88ae2c625e1fed12 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -372,6 +372,32 @@ DEF_TEST(ImageFilterDrawTiled, reporter) {
}
}
+DEF_TEST(ImageFilterMatrixConvolution, reporter) {
+ // Check that a 1x3 filter does not cause a spurious assert.
+ SkScalar kernel[3] = {
+ SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
+ };
+ SkISize kernelSize = SkISize::Make(1, 3);
+ SkScalar gain = SK_Scalar1, bias = 0;
+ SkIPoint kernelOffset = SkIPoint::Make(0, 0);
+
+ SkAutoTUnref<SkImageFilter> filter(
+ SkMatrixConvolutionImageFilter::Create(
+ kernelSize, kernel, gain, bias, kernelOffset,
+ SkMatrixConvolutionImageFilter::kRepeat_TileMode, false));
+
+ SkBitmap result;
+ int width = 16, height = 16;
+ result.allocN32Pixels(width, height);
+ SkCanvas canvas(result);
+ canvas.clear(0);
+
+ SkPaint paint;
+ paint.setImageFilter(filter);
+ SkRect rect = SkRect::MakeWH(width, height);
+ canvas.drawRect(rect, paint);
+}
+
DEF_TEST(ImageFilterCropRect, reporter) {
SkBitmap temp;
temp.allocN32Pixels(100, 100);
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698