diff options
author | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-02 14:50:13 +0000 |
---|---|---|
committer | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-02 14:50:13 +0000 |
commit | 5d0c62f0f654127b7d66358405d824266868bd1d (patch) | |
tree | 50d26572a137e75de406dd631e11da79cc880a92 /gm | |
parent | 4866cc0afb7571309d9fdecb221d919f663054c0 (diff) |
add -wp option to write serialized pictures to the specified directory
git-svn-id: http://skia.googlecode.com/svn/trunk@4131 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/gmmain.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 66cbc0c067..61a085938d 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -615,6 +615,23 @@ static ErrorBitfield test_picture_serialization(GM* gm, } } +static void write_picture_serialization(GM* gm, const ConfigData& rec, + const char writePicturePath[]) { + // only do this once, so we pick raster + if (kRaster_Backend == rec.fBackend && + SkBitmap::kARGB_8888_Config == rec.fConfig) { + + SkAutoTUnref<SkPicture> pict(generate_new_picture(gm)); + + const char* pictureSuffix = "skp"; + SkString path = make_filename(writePicturePath, "", + SkString(gm->shortName()), pictureSuffix); + + SkFILEWStream stream(path.c_str()); + pict->serialize(&stream); + } +} + static void usage(const char * argv0) { SkDebugf( "%s [-w writePath] [-r readPath] [-d diffPath] [-i resourcePath]\n" @@ -729,6 +746,7 @@ int main(int argc, char * const argv[]) { setSystemPreferences(); const char* writePath = NULL; // if non-null, where we write the originals + const char* writePicturePath = NULL; // if non-null, where we write serialized pictures const char* readPath = NULL; // if non-null, were we read from to compare const char* diffPath = NULL; // if non-null, where we write our diffs (from compare) const char* resourcePath = NULL;// if non-null, where we read from for image resources @@ -752,6 +770,11 @@ int main(int argc, char * const argv[]) { if (argv < stop && **argv) { writePath = *argv; } + } else if (strcmp(*argv, "-wp") == 0) { + argv++; + if (argv < stop && **argv) { + writePicturePath = *argv; + } } else if (strcmp(*argv, "-r") == 0) { argv++; if (argv < stop && **argv) { @@ -809,7 +832,9 @@ int main(int argc, char * const argv[]) { if (writePath) { fprintf(stderr, "writing to %s\n", writePath); } - + if (writePicturePath) { + fprintf(stderr, "writing pictures to %s\n", writePicturePath); + } if (resourcePath) { fprintf(stderr, "reading resources from %s\n", resourcePath); } @@ -912,6 +937,10 @@ int main(int argc, char * const argv[]) { forwardRenderedBitmap, readPath, diffPath); } + + if (!(gmFlags & GM::kSkipPicture_Flag) && writePicturePath) { + write_picture_serialization(gm, gRec[i], writePicturePath); + } // Update overall results. // We only tabulate the particular error types that we currently |