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
This commit is contained in:
parent
4866cc0afb
commit
5d0c62f0f6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user