Fix default value of doSerialize parameter (oops!).
Change suffixes on auxiliary output directories to match names of flags
(-replay and -serialize).
Add to output messages an indication of whether this error occurred during
-replay or -serialize (no indication == standard rendering).
git-svn-id: http://skia.googlecode.com/svn/trunk@1185 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 2f6c3fd..8cea67f 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -120,7 +120,8 @@
}
static bool compare(const SkBitmap& target, const SkBitmap& base,
- const SkString& name, SkBitmap* diff) {
+ const SkString& name, const char* modeDescriptor,
+ SkBitmap* diff) {
SkBitmap copy;
const SkBitmap* bm = ⌖
if (target.config() != SkBitmap::kARGB_8888_Config) {
@@ -133,8 +134,9 @@
const int w = bm->width();
const int h = bm->height();
if (w != base.width() || h != base.height()) {
- SkDebugf("---- dimensions mismatch for %s base [%d %d] current [%d %d]\n",
- name.c_str(), base.width(), base.height(), w, h);
+ SkDebugf("---- %s dimensions mismatch for %s base [%d %d] current [%d %d]\n",
+ modeDescriptor, name.c_str(),
+ base.width(), base.height(), w, h);
return false;
}
@@ -146,8 +148,8 @@
SkPMColor c0 = *base.getAddr32(x, y);
SkPMColor c1 = *bm->getAddr32(x, y);
if (c0 != c1) {
- SkDebugf("----- pixel mismatch for %s at [%d %d] base 0x%08X current 0x%08X\n",
- name.c_str(), x, y, c0, c1);
+ SkDebugf("----- %s pixel mismatch for %s at [%d %d] base 0x%08X current 0x%08X\n",
+ modeDescriptor, name.c_str(), x, y, c0, c1);
if (diff) {
diff->setConfig(SkBitmap::kARGB_8888_Config, w, h);
@@ -268,7 +270,8 @@
static void compare_to_reference_image(const char readPath [],
const SkString& name,
SkBitmap &bitmap,
- const char diffPath []) {
+ const char diffPath [],
+ const char modeDescriptor []) {
SkString path = make_filename(readPath, "", name, "png");
SkBitmap orig;
bool success = SkImageDecoder::DecodeFile(path.c_str(), &orig,
@@ -276,7 +279,8 @@
SkImageDecoder::kDecodePixels_Mode, NULL);
if (success) {
SkBitmap diffBitmap;
- success = compare(bitmap, orig, name, diffPath ? &diffBitmap : NULL);
+ success = compare(bitmap, orig, name, modeDescriptor,
+ diffPath ? &diffBitmap : NULL);
if (!success && diffPath) {
SkString diffName = make_filename(diffPath, "", name, ".diff.png");
fprintf(stderr, "Writing %s\n", diffName.c_str());
@@ -304,7 +308,7 @@
// TODO: Figure out a way to compare PDFs.
} else if (readPath && gRec.fBackend != kPDF_Backend) {
compare_to_reference_image(readPath, name, bitmap,
- diffPath);
+ diffPath, writePathSuffix);
}
}
@@ -378,7 +382,7 @@
SkBitmap bitmap;
generate_image_from_picture(gm, gRec, pict, &bitmap);
handle_test_results(gm, gRec, writePath, readPath, diffPath,
- "-pict", bitmap, NULL);
+ "-replay", bitmap, NULL);
}
}
@@ -396,7 +400,7 @@
SkBitmap bitmap;
generate_image_from_picture(gm, gRec, repict, &bitmap);
handle_test_results(gm, gRec, writePath, readPath, diffPath,
- "-replay", bitmap, NULL);
+ "-serialize", bitmap, NULL);
}
}
@@ -431,7 +435,7 @@
const char* diffPath = NULL; // if non-null, where we write our diffs (from compare)
bool doReplay = false;
- bool doSerialize = true;
+ bool doSerialize = false;
const char* const commandName = argv[0];
char* const* stop = argv + argc;
for (++argv; argv < stop; ++argv) {