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

Unified Diff: tests/BitmapTest.cpp

Issue 1510253002: SkBitmap::getColor repsects swizzle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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/SkBitmap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapTest.cpp
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index 4d68e73dbe4dae7981f9ed52e1f1d96d2c6e7a1e..2bd8490b770ae481370aa36328c5c3d1d6cbad0d 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -122,3 +122,26 @@ DEF_TEST(Bitmap, reporter) {
test_bigalloc(reporter);
test_peekpixels(reporter);
}
+
+/**
+ * This test checks that getColor works for both swizzles.
+ */
+DEF_TEST(Bitmap_getColor_Swizzle, r) {
+ SkBitmap source;
+ source.allocN32Pixels(1,1);
+ source.eraseColor(SK_ColorRED);
+ SkColorType colorTypes[] = {
+ kRGBA_8888_SkColorType,
+ kBGRA_8888_SkColorType,
+ };
+ for (SkColorType ct : colorTypes) {
+ SkBitmap copy;
+ if (!source.copyTo(&copy, ct)) {
+ ERRORF(r, "SkBitmap::copy failed %d", (int)ct);
+ continue;
+ }
+ SkAutoLockPixels autoLockPixels1(copy);
+ SkAutoLockPixels autoLockPixels2(source);
+ REPORTER_ASSERT(r, source.getColor(0, 0) == copy.getColor(0, 0));
+ }
+}
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698