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

Unified Diff: tests/ImageFilterTest.cpp

Issue 209353014: Fix for crash on large image blur sigma values. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Tweak Created 6 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 | « src/effects/SkGpuBlurUtils.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 97d3d0fbfb353210d2a1d7663e06759a589174ae..993a1e2f2bfde470323d6681d2ce0fd2c20ab751 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -295,6 +295,29 @@ DEF_TEST(ImageFilterMatrixTest, reporter) {
canvas.drawPicture(picture);
}
+void test_huge_blur(SkBaseDevice* device, skiatest::Reporter* reporter) {
+ SkCanvas canvas(device);
+
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(100, 100);
+ bitmap.eraseARGB(0, 0, 0, 0);
+
+ // Check that a blur with an insane radius does not crash or assert.
+ SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(SkIntToScalar(1<<30), SkIntToScalar(1<<30)));
+
+ SkPaint paint;
+ paint.setImageFilter(blur);
+ canvas.drawSprite(bitmap, 0, 0, &paint);
+}
+
+DEF_TEST(HugeBlurImageFilter, reporter) {
+ SkBitmap temp;
+ temp.allocN32Pixels(100, 100);
+ SkBitmapDevice device(temp);
+ test_huge_blur(&device, reporter);
+}
+
+
#if SK_SUPPORT_GPU
DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) {
GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
@@ -303,4 +326,12 @@ DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) {
0));
test_crop_rects(device, reporter);
}
+
+DEF_GPUTEST(HugeBlurImageFilterGPU, reporter, factory) {
+ GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
+ SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
+ SkImageInfo::MakeN32Premul(100, 100),
+ 0));
+ test_huge_blur(device, reporter);
+}
#endif
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698