| Index: tools/skdiff_main.cpp
|
| diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
|
| index 9d0bcf55e9d92c64fee2628993b50671dae9fdab..ba3221678e51c8e6f2ea9e593c6271a3cea42804 100644
|
| --- a/tools/skdiff_main.cpp
|
| +++ b/tools/skdiff_main.cpp
|
| @@ -311,6 +311,20 @@ static void get_bounds(DiffRecord& drp) {
|
| get_bounds(drp.fComparison, "comparison");
|
| }
|
|
|
| +#ifdef SK_OS_WIN
|
| +#define ANSI_COLOR_RED ""
|
| +#define ANSI_COLOR_GREEN ""
|
| +#define ANSI_COLOR_YELLOW ""
|
| +#define ANSI_COLOR_RESET ""
|
| +#else
|
| +#define ANSI_COLOR_RED "\x1b[31m"
|
| +#define ANSI_COLOR_GREEN "\x1b[32m"
|
| +#define ANSI_COLOR_YELLOW "\x1b[33m"
|
| +#define ANSI_COLOR_RESET "\x1b[0m"
|
| +#endif
|
| +
|
| +#define VERBOSE_STATUS(status,color,filename) if (verbose) printf( "[ " color " %10s " ANSI_COLOR_RESET " ] %s\n", status, filename->c_str())
|
| +
|
| /// Creates difference images, returns the number that have a 0 metric.
|
| /// If outputDir.isEmpty(), don't write out diff files.
|
| static void create_diff_images (DiffMetricProc dmp,
|
| @@ -323,6 +337,7 @@ static void create_diff_images (DiffMetricProc dmp,
|
| const StringArray& nomatchSubstrings,
|
| bool recurseIntoSubdirs,
|
| bool getBounds,
|
| + bool verbose,
|
| DiffSummary* summary) {
|
| SkASSERT(!baseDir.isEmpty());
|
| SkASSERT(!comparisonDir.isEmpty());
|
| @@ -370,6 +385,8 @@ static void create_diff_images (DiffMetricProc dmp,
|
| drp->fComparison.fFullPath = comparisonPath;
|
| drp->fComparison.fStatus = DiffResource::kDoesNotExist_Status;
|
|
|
| + VERBOSE_STATUS("MISSING", ANSI_COLOR_YELLOW, baseFiles[i]);
|
| +
|
| ++i;
|
| } else if (v > 0) {
|
| // in comparisonDir, but not in baseDir
|
| @@ -386,6 +403,8 @@ static void create_diff_images (DiffMetricProc dmp,
|
| drp->fComparison.fFullPath = comparisonPath;
|
| drp->fComparison.fStatus = DiffResource::kExists_Status;
|
|
|
| + VERBOSE_STATUS("MISSING", ANSI_COLOR_YELLOW, comparisonFiles[j]);
|
| +
|
| ++j;
|
| } else {
|
| // Found the same filename in both baseDir and comparisonDir.
|
| @@ -413,20 +432,23 @@ static void create_diff_images (DiffMetricProc dmp,
|
| if (NULL == baseFileBits || NULL == comparisonFileBits) {
|
| if (NULL == baseFileBits) {
|
| drp->fBase.fStatus = DiffResource::kCouldNotRead_Status;
|
| + VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, baseFiles[i]);
|
| }
|
| if (NULL == comparisonFileBits) {
|
| drp->fComparison.fStatus = DiffResource::kCouldNotRead_Status;
|
| + VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, comparisonFiles[j]);
|
| }
|
| drp->fResult = DiffRecord::kCouldNotCompare_Result;
|
|
|
| } else if (are_buffers_equal(baseFileBits, comparisonFileBits)) {
|
| drp->fResult = DiffRecord::kEqualBits_Result;
|
| -
|
| + VERBOSE_STATUS("MATCH", ANSI_COLOR_GREEN, baseFiles[i]);
|
| } else {
|
| AutoReleasePixels arp(drp);
|
| get_bitmap(baseFileBits, drp->fBase, SkImageDecoder::kDecodePixels_Mode);
|
| get_bitmap(comparisonFileBits, drp->fComparison,
|
| SkImageDecoder::kDecodePixels_Mode);
|
| + VERBOSE_STATUS("DIFFERENT", ANSI_COLOR_RED, baseFiles[i]);
|
| if (DiffResource::kDecoded_Status == drp->fBase.fStatus &&
|
| DiffResource::kDecoded_Status == drp->fComparison.fStatus) {
|
| create_and_write_diff_image(drp, dmp, colorThreshold,
|
| @@ -558,6 +580,7 @@ int tool_main(int argc, char** argv) {
|
| bool listFilenames = false;
|
| bool printDirNames = true;
|
| bool recurseIntoSubdirs = true;
|
| + bool verbose = false;
|
|
|
| RecordArray differences;
|
| DiffSummary summary;
|
| @@ -625,6 +648,10 @@ int tool_main(int argc, char** argv) {
|
| listFilenames = true;
|
| continue;
|
| }
|
| + if (!strcmp(argv[i], "--verbose")) {
|
| + verbose = true;
|
| + continue;
|
| + }
|
| if (!strcmp(argv[i], "--match")) {
|
| matchSubstrings.push(new SkString(argv[++i]));
|
| continue;
|
| @@ -728,7 +755,7 @@ int tool_main(int argc, char** argv) {
|
| create_diff_images(diffProc, colorThreshold, &differences,
|
| baseDir, comparisonDir, outputDir,
|
| matchSubstrings, nomatchSubstrings, recurseIntoSubdirs, generateDiffs,
|
| - &summary);
|
| + verbose, &summary);
|
| summary.print(listFilenames, failOnResultType, failOnStatusType);
|
|
|
| if (differences.count()) {
|
|
|