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); |