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

Unified Diff: Source/platform/DragImageTest.cpp

Issue 886323005: Pass InterpolationQuality into DragImage to respect image-rendering:pixelated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Sync and rebase Created 5 years, 10 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 | « Source/platform/DragImage.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/DragImageTest.cpp
diff --git a/Source/platform/DragImageTest.cpp b/Source/platform/DragImageTest.cpp
index 825134f1b6d2b981bcb84a509430b2717345ea03..dae6fa0d1a351cd22c1aa36a49e1a803728912a9 100644
--- a/Source/platform/DragImageTest.cpp
+++ b/Source/platform/DragImageTest.cpp
@@ -211,4 +211,39 @@ TEST(DragImageTest, InvalidRotatedBitmapImage)
}
}
+TEST(DragImageTest, InterpolationNone)
+{
+ SkBitmap expectedBitmap;
+ expectedBitmap.allocN32Pixels(4, 4);
+ {
+ SkAutoLockPixels lock(expectedBitmap);
+ expectedBitmap.eraseArea(SkIRect::MakeXYWH(0, 0, 2, 2), 0xFFFFFFFF);
+ expectedBitmap.eraseArea(SkIRect::MakeXYWH(0, 2, 2, 2), 0xFF000000);
+ expectedBitmap.eraseArea(SkIRect::MakeXYWH(2, 0, 2, 2), 0xFF000000);
+ expectedBitmap.eraseArea(SkIRect::MakeXYWH(2, 2, 2, 2), 0xFFFFFFFF);
+ }
+
+ RefPtr<TestImage> testImage(TestImage::create(IntSize(2, 2)));
+ const SkBitmap& testBitmap = testImage->nativeImageForCurrentFrame()->bitmap();
+ {
+ SkAutoLockPixels lock(testBitmap);
+ testBitmap.eraseArea(SkIRect::MakeXYWH(0, 0, 1, 1), 0xFFFFFFFF);
+ testBitmap.eraseArea(SkIRect::MakeXYWH(0, 1, 1, 1), 0xFF000000);
+ testBitmap.eraseArea(SkIRect::MakeXYWH(1, 0, 1, 1), 0xFF000000);
+ testBitmap.eraseArea(SkIRect::MakeXYWH(1, 1, 1, 1), 0xFFFFFFFF);
+ }
+
+ OwnPtr<DragImage> dragImage = DragImage::create(testImage.get(), DoNotRespectImageOrientation, 1, InterpolationNone);
+ ASSERT_TRUE(dragImage);
+ dragImage->scale(2, 2);
+ const SkBitmap& dragBitmap = dragImage->bitmap();
+ {
+ SkAutoLockPixels lock1(dragBitmap);
+ SkAutoLockPixels lock2(expectedBitmap);
+ for (int x = 0; x < dragBitmap.width(); ++x)
+ for (int y = 0; y < dragBitmap.height(); ++y)
+ EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y));
+ }
+}
+
} // anonymous namespace
« no previous file with comments | « Source/platform/DragImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698