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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1232873002: Fix for partially-specified crop rects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix 100-cols Created 5 years, 5 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/core/SkImageFilter.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 480a75fe1d3573d5fbcedb003a019a427170b882..dc3533259390457157ff4199ce64a055c02d784e 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -1139,6 +1139,27 @@ DEF_TEST(ComposedImageFilterOffset, reporter) {
REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0);
}
+DEF_TEST(PartialCropRect, reporter) {
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(100, 100);
+ bitmap.eraseARGB(0, 0, 0, 0);
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
+ SkBitmapDevice device(bitmap, props);
+ SkImageFilter::Proxy proxy(&device);
+
+ SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
+ SkImageFilter::CropRect::kHasRight_CropEdge | SkImageFilter::CropRect::kHasBottom_CropEdge);
+ SkAutoTUnref<SkImageFilter> filter(make_grayscale(NULL, &cropRect));
+ SkBitmap result;
+ SkIPoint offset;
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL);
+ REPORTER_ASSERT(reporter, filter->filterImage(&proxy, bitmap, ctx, &result, &offset));
+ REPORTER_ASSERT(reporter, offset.fX == 0);
+ REPORTER_ASSERT(reporter, offset.fY == 0);
+ REPORTER_ASSERT(reporter, result.width() == 20);
+ REPORTER_ASSERT(reporter, result.height() == 30);
+}
+
#if SK_SUPPORT_GPU
DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) {
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698