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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1877343002: Switch SkMatrixConvolutionImageFilter over to new onFilterImage interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix return value Created 4 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 a6ff0875b70fefeacb2d90e4c99b02073b61d868..114c342ada91b09e94ec0ef754e59cd77a9c2ed1 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -1093,6 +1093,51 @@ DEF_TEST(ImageFilterMatrixConvolutionBorder, reporter) {
canvas.restore();
}
+static void test_big_kernel(SkImageFilter::Proxy* proxy,
+ skiatest::Reporter* reporter,
+ GrContext* context) {
+ // Check that a kernel that is too big for the GPU still works
+ SkScalar identityKernel[49] = {
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0
+ };
+ SkISize kernelSize = SkISize::Make(7, 7);
+ SkScalar gain = SK_Scalar1, bias = 0;
+ SkIPoint kernelOffset = SkIPoint::Make(0, 0);
+
+ sk_sp<SkImageFilter> filter(SkMatrixConvolutionImageFilter::Make(
+ kernelSize, identityKernel, gain, bias, kernelOffset,
+ SkMatrixConvolutionImageFilter::kClamp_TileMode,
+ true, nullptr));
+
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+ SkASSERT(srcImg);
+
+ SkIPoint offset;
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr);
+ sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
+ REPORTER_ASSERT(reporter, resultImg);
+ REPORTER_ASSERT(reporter, SkToBool(context) == resultImg->isTextureBacked());
+ REPORTER_ASSERT(reporter, resultImg->width() == 100 && resultImg->height() == 100);
+ REPORTER_ASSERT(reporter, offset.fX == 0 && offset.fY == 0);
+}
+
+DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
+ run_raster_test(reporter, 100, test_big_kernel);
+}
+
+#if SK_SUPPORT_GPU
+DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
+ reporter, ctxInfo) {
+ run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_big_kernel);
+}
+#endif
+
DEF_TEST(ImageFilterCropRect, reporter) {
run_raster_test(reporter, 100, test_crop_rects);
}
« 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