diff options
-rw-r--r-- | tools/skdiff_main.cpp | 15 | ||||
-rwxr-xr-x | tools/tests/run.sh | 1 | ||||
-rw-r--r-- | tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png | bin | 2461 -> 0 bytes | |||
-rw-r--r-- | tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png | bin | 2461 -> 0 bytes | |||
-rw-r--r-- | tools/tests/skdiff/output-expected/different-sizes-diff.png | bin | 6531 -> 0 bytes | |||
-rw-r--r-- | tools/tests/skdiff/output-expected/different-sizes-white.png | bin | 2461 -> 0 bytes | |||
-rw-r--r-- | tools/tests/skdiff/output-expected/identical-bits-diff.png | bin | 2461 -> 0 bytes | |||
-rw-r--r-- | tools/tests/skdiff/output-expected/identical-bits-white.png | bin | 2461 -> 0 bytes |
8 files changed, 11 insertions, 5 deletions
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp index f038b2c183..e7d30d256d 100644 --- a/tools/skdiff_main.cpp +++ b/tools/skdiff_main.cpp @@ -401,6 +401,8 @@ static inline bool colors_match_thresholded(SkPMColor c0, SkPMColor c1, } // based on gm +// Postcondition: when we exit this method, dr->fResult should have some value +// other than kUnknown. static void compute_diff(DiffRecord* dr, DiffMetricProc diffFunction, const int colorThreshold) { @@ -531,9 +533,12 @@ static void create_and_write_diff_image(DiffRecord* drp, drp->fDifferenceBitmap->allocPixels(); drp->fWhiteBitmap->setConfig(SkBitmap::kARGB_8888_Config, w, h); drp->fWhiteBitmap->allocPixels(); + + SkASSERT(kUnknown == drp->fResult); compute_diff(drp, dmp, colorThreshold); + SkASSERT(kUnknown != drp->fResult); - if (!outputDir.isEmpty()) { + if ((kDifferentPixels == drp->fResult) && !outputDir.isEmpty()) { SkString differencePath (outputDir); differencePath.append(filename_to_diff_filename(filename)); write_bitmap(differencePath, drp->fDifferenceBitmap); @@ -541,7 +546,7 @@ static void create_and_write_diff_image(DiffRecord* drp, whitePath.append(filename_to_white_filename(filename)); write_bitmap(whitePath, drp->fWhiteBitmap); } - + release_bitmaps(drp); } @@ -612,7 +617,7 @@ static void create_diff_images (DiffMetricProc dmp, qsort(comparisonFiles.begin(), comparisonFiles.count(), sizeof(SkString*), SkCastForQSort(compare_file_name_metrics)); } - + int i = 0; int j = 0; @@ -1138,7 +1143,7 @@ int main (int argc, char ** argv) { return 0; } } - + if (numUnflaggedArguments == 2) { outputDir = comparisonDir; } else if (numUnflaggedArguments != 3) { @@ -1198,7 +1203,7 @@ int main (int argc, char ** argv) { qsort(differences.begin(), differences.count(), sizeof(DiffRecord*), sortProc); } - + if (generateDiffs) { print_diff_page(summary.fNumMatches, colorThreshold, differences, baseDir, comparisonDir, outputDir); diff --git a/tools/tests/run.sh b/tools/tests/run.sh index d88740f399..6c2f549702 100755 --- a/tools/tests/run.sh +++ b/tools/tests/run.sh @@ -19,6 +19,7 @@ function compare_directories { # SKDIFF_TESTDIR=tools/tests/skdiff SKDIFF_OUTPUT_DIR=$SKDIFF_TESTDIR/output-actual +rm -rf $SKDIFF_OUTPUT_DIR mkdir -p $SKDIFF_OUTPUT_DIR $SKDIFF_BINARY $SKDIFF_TESTDIR/baseDir $SKDIFF_TESTDIR/comparisonDir \ $SKDIFF_OUTPUT_DIR &>$SKDIFF_OUTPUT_DIR/stdout diff --git a/tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png b/tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png Binary files differdeleted file mode 100644 index 170092865a..0000000000 --- a/tools/tests/skdiff/output-expected/different-bits-identical-pixels-diff.png +++ /dev/null diff --git a/tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png b/tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png Binary files differdeleted file mode 100644 index 170092865a..0000000000 --- a/tools/tests/skdiff/output-expected/different-bits-identical-pixels-white.png +++ /dev/null diff --git a/tools/tests/skdiff/output-expected/different-sizes-diff.png b/tools/tests/skdiff/output-expected/different-sizes-diff.png Binary files differdeleted file mode 100644 index ecba8036f9..0000000000 --- a/tools/tests/skdiff/output-expected/different-sizes-diff.png +++ /dev/null diff --git a/tools/tests/skdiff/output-expected/different-sizes-white.png b/tools/tests/skdiff/output-expected/different-sizes-white.png Binary files differdeleted file mode 100644 index 170092865a..0000000000 --- a/tools/tests/skdiff/output-expected/different-sizes-white.png +++ /dev/null diff --git a/tools/tests/skdiff/output-expected/identical-bits-diff.png b/tools/tests/skdiff/output-expected/identical-bits-diff.png Binary files differdeleted file mode 100644 index 170092865a..0000000000 --- a/tools/tests/skdiff/output-expected/identical-bits-diff.png +++ /dev/null diff --git a/tools/tests/skdiff/output-expected/identical-bits-white.png b/tools/tests/skdiff/output-expected/identical-bits-white.png Binary files differdeleted file mode 100644 index 170092865a..0000000000 --- a/tools/tests/skdiff/output-expected/identical-bits-white.png +++ /dev/null |