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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1475793002: Fix merge crop rect computation. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comments; this-> Created 5 years, 1 month 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/SkMergeImageFilter.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 012b1a98624ff146c0ff1000d2c0f87e8816d1d8..39d0dc25d0144faafb1f096d4707c26f7db3a395 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -642,6 +642,29 @@ DEF_TEST(ImageFilterComposedBlurFastBounds, reporter) {
REPORTER_ASSERT(reporter, boundsDst == expectedBounds);
}
+DEF_TEST(ImageFilterMergeResultSize, reporter) {
+ SkBitmap greenBM;
+ greenBM.allocN32Pixels(20, 20);
+ greenBM.eraseColor(SK_ColorGREEN);
+ SkAutoTUnref<SkImage> greenImage(SkImage::NewFromBitmap(greenBM));
+ SkAutoTUnref<SkImageFilter> source(SkImageSource::Create(greenImage.get()));
+ SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(source.get(), source.get()));
+
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(1, 1);
+ bitmap.eraseColor(0);
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
+ const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
+ SkAutoTUnref<SkBaseDevice> device(SkBitmapDevice::Create(info, props));
+ SkImageFilter::DeviceProxy proxy(device);
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr,
+ SkImageFilter::kApprox_SizeConstraint);
+ SkBitmap result;
+ SkIPoint offset;
+ REPORTER_ASSERT(reporter, merge->filterImage(&proxy, bitmap, ctx, &result, &offset));
+ REPORTER_ASSERT(reporter, result.width() == 20 && result.height() == 20);
+}
+
static void draw_blurred_rect(SkCanvas* canvas) {
SkAutoTUnref<SkImageFilter> filter(SkBlurImageFilter::Create(SkIntToScalar(8), 0));
SkPaint filterPaint;
« no previous file with comments | « src/effects/SkMergeImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698