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

Unified Diff: dm/DM.cpp

Issue 1226933005: DM: swizzle BGRA to RGBA before calculating pixel MD5. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 565 note 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 6b3464157b797a53187314c99b2e7ecfdfafd82b..5cabae6926533c21e90f83b2402725517978c34a 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -515,7 +515,17 @@ struct Task {
hash.writeStream(data, data->getLength());
data->rewind();
} else {
- hash.write(bitmap.getPixels(), bitmap.getSize());
+ // If we're BGRA (Linux, Windows), swizzle over to RGBA (Mac, Android).
+ // This helps eliminate multiple 0-pixel-diff hashes on gold.skia.org.
+ // (Android's general slow speed breaks the tie arbitrarily in RGBA's favor.)
+ // We might consider promoting 565 to RGBA too.
+ if (bitmap.colorType() == kBGRA_8888_SkColorType) {
+ SkBitmap swizzle;
+ SkAssertResult(bitmap.copyTo(&swizzle, kRGBA_8888_SkColorType));
+ hash.write(swizzle.getPixels(), swizzle.getSize());
+ } else {
+ hash.write(bitmap.getPixels(), bitmap.getSize());
+ }
}
SkMD5::Digest digest;
hash.finish(digest);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698