Add --csv parameter to skpdiff to dump all scores in a csv file. We can run it with all skps, and have scores available to look at worst offenders progarmatically.

R=djsollen@google.com, zachr@google.com

Review URL: https://codereview.chromium.org/19826002

git-svn-id: http://skia.googlecode.com/svn/trunk@10234 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/skpdiff/main.cpp b/experimental/skpdiff/main.cpp
index d258c14..7ed0e4d 100644
--- a/experimental/skpdiff/main.cpp
+++ b/experimental/skpdiff/main.cpp
@@ -32,6 +32,7 @@
 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline> <test>");
 DEFINE_string2(output, o, "skpdiff_output.json", "Writes the output of these diffs to output: <output>");
 DEFINE_bool(jsonp, true, "Output JSON with padding");
+DEFINE_string(csv, "", "Writes the output of these diffs to a csv file");
 
 #if SK_SUPPORT_OPENCL
 /// A callback for any OpenCL errors
@@ -169,6 +170,13 @@
         }
     }
 
+    if (!FLAGS_csv.isEmpty()) {
+        if (1 != FLAGS_csv.count()) {
+            SkDebugf("csv flag expects one argument: <csv file>\n");
+            return 1;
+        }
+    }
+
     SkDiffContext ctx;
     ctx.setDiffers(chosenDiffers);
 
@@ -188,5 +196,10 @@
         ctx.outputRecords(outputStream, FLAGS_jsonp);
     }
 
+    if (!FLAGS_csv.isEmpty()) {
+        SkFILEWStream outputStream(FLAGS_csv[0]);
+        ctx.outputCsv(outputStream);
+    }
+
     return 0;
 }