Chromium Code Reviews| Index: gm/gmmain.cpp |
| =================================================================== |
| --- gm/gmmain.cpp (revision 9460) |
| +++ gm/gmmain.cpp (working copy) |
| @@ -225,6 +225,16 @@ |
| return SkOSPath::SkPathJoin(path, filename.c_str()); |
| } |
| + /** |
| + * Assemble filename suitable for writing out an SkBitmap. |
| + */ |
| + SkString make_bitmap_filename(const char *path, |
|
epoger
2013/06/18 05:45:36
Patchset 2 adds the make_bitmap_filename() wrapper
|
| + const char *shortName, |
| + const char *configName, |
| + const char *renderModeDescriptor) { |
| + return make_filename(path, shortName, configName, renderModeDescriptor, kPNG_FileExtension); |
| + } |
| + |
| /* since PNG insists on unpremultiplying our alpha, we take no |
| precision chances and force all pixels to be 100% opaque, |
| otherwise on compare we may not get a perfect match. |
| @@ -253,6 +263,8 @@ |
| } |
| } |
| + // EPOGER: make sure to create any directories needed along the path |
| + // EPOGER: make sure this works even if the destination file already exists -- just overwrite it |
| static bool write_bitmap(const SkString& path, const SkBitmap& bitmap) { |
| // TODO(epoger): Now that we have removed force_all_opaque() |
| // from this method, we should be able to get rid of the |
| @@ -642,8 +654,7 @@ |
| gRec.fBackend == kGPU_Backend || |
| (gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) { |
| - path = make_filename(writePath, shortName, gRec.fName, renderModeDescriptor, |
| - kPNG_FileExtension); |
| + path = make_bitmap_filename(writePath, shortName, gRec.fName, renderModeDescriptor); |
| success = write_bitmap(path, bitmap); |
| } |
| if (kPDF_Backend == gRec.fBackend) { |
| @@ -780,9 +791,8 @@ |
| // Write out the "actuals" for any mismatches, if we have |
| // been directed to do so. |
| if (fMismatchPath) { |
| - SkString path = |
| - make_filename(fMismatchPath, shortName, configName, renderModeDescriptor, |
| - kPNG_FileExtension); |
| + SkString path = make_bitmap_filename(fMismatchPath, shortName, configName, |
| + renderModeDescriptor); |
| write_bitmap(path, actualBitmap); |
| } |
| @@ -1303,9 +1313,11 @@ |
| DEFINE_bool(tileGrid, true, "Exercise the tile grid variant of SkPicture."); |
| DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale " |
| "factors to be used for tileGrid playback testing. Default value: 1.0"); |
| -DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file."); |
| DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more info about " |
| "each test)."); |
| +DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-" |
| + "based filenames, as rebaseline.py will use when downloading them from Google Storage"); |
| +DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file."); |
| DEFINE_string2(writePath, w, "", "Write rendered images into this directory."); |
| DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory."); |
| DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, " |