| Index: gm/gmmain.cpp | 
| =================================================================== | 
| --- gm/gmmain.cpp (revision 7412) | 
| +++ gm/gmmain.cpp (working copy) | 
| @@ -195,6 +195,36 @@ | 
| | SkGPipeWriter::kSharedAddressSpace_Flag } | 
| }; | 
| +static int brute_force_bitmap_compare(const SkBitmap& a, const SkBitmap& b) { | 
| + SkAutoLockPixels alp0(a); | 
| + SkAutoLockPixels alp1(b); | 
| + | 
| + if (a.width() != b.width() || a.height() != b.height()) { | 
| + return -1; | 
|    epoger 2013/01/30 16:46:50 This is OK, but it would be better to report ERROR     | 
| + } | 
| + if (a.config() != SkBitmap::kARGB_8888_Config || | 
| + b.config() != SkBitmap::kARGB_8888_Config) { | 
| + return -2; | 
|    epoger 2013/01/30 16:46:50 Do we not care at all about non-8888 images?     | 
| + } | 
| + | 
| + int err = 0; | 
| + for (int y = 0; y < a.height(); ++y) { | 
| + const SkPMColor* pa = a.getAddr32(0, y); | 
| + const SkPMColor* pb = b.getAddr32(0, y); | 
| + for (int x = 0; x < a.width(); ++x) { | 
| + SkPMColor ca = *pa++; | 
| + SkPMColor cb = *pb++; | 
| + if (ca == cb) { | 
| + continue; | 
| + } | 
| + err = SkMax32(err, SkAbs32((int)SkGetPackedR32(ca) - (int)SkGetPackedR32(cb))); | 
|    bsalomon 2013/01/28 20:14:43 We've had images differ only in alpha in the past.     epoger 2013/01/30 16:46:50 Right. See http://code.google.com/p/skia/source/d     | 
| + err = SkMax32(err, SkAbs32((int)SkGetPackedG32(ca) - (int)SkGetPackedG32(cb))); | 
| + err = SkMax32(err, SkAbs32((int)SkGetPackedB32(ca) - (int)SkGetPackedB32(cb))); | 
| + } | 
| + } | 
| + return err; | 
| +} | 
| + | 
| class GMMain { | 
| public: | 
| GMMain() { | 
| @@ -676,7 +706,18 @@ | 
| * force_all_opaque(). | 
| * See comments above get_checksum() for more detail. | 
| */ | 
| - Expectations expectations = expectationsSource->get(name.c_str()); | 
| + SkBitmap expectedBitmap; | 
| + Expectations expectations = expectationsSource->get(name.c_str(), | 
| + &expectedBitmap); | 
| + | 
| + int maxErr = 0; | 
| + if (!expectedBitmap.isNull()) { | 
| + maxErr = brute_force_bitmap_compare(actualBitmap, expectedBitmap); | 
| + } | 
| + if (maxErr) { | 
| + SkDebugf("--- bitmap compare failed with max component difference %d\n", maxErr); | 
| + } | 
| + | 
| retval |= compare_to_expectations(expectations, actualBitmap, | 
| name, "", true); | 
| } else { |