experimental/xps_to_png: pass in DPI as program argument

NOTRY=true
Change-Id: Ieb4f43c69a4f185d8e7877c9c736bd6a7d7b1eac
Reviewed-on: https://skia-review.googlesource.com/4761
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/experimental/xps_to_png/xps_to_png.cs b/experimental/xps_to_png/xps_to_png.cs
index 34b9132..738e0fc 100644
--- a/experimental/xps_to_png/xps_to_png.cs
+++ b/experimental/xps_to_png/xps_to_png.cs
@@ -79,14 +79,27 @@
     }
     // For each command line argument, convert xps to sequence of pngs.
     static void Main(string[] args) {
-        const double dpi = 72.0;
+        double dpi = 72.0;
         if (args.Length == 0) {
-            System.Console.WriteLine("usage:\n\txps_to_png [XPS_FILES]\n\n");
+            System.Console.WriteLine("usage:\n\txps_to_png [-dDPI] [XPS_FILES]\n\n");
             System.Environment.Exit(1);
         }
+        System.Collections.Generic.List<string> xpsFiles =
+                new System.Collections.Generic.List<string>();
         foreach (string arg in args) {
+            string flag = "-d";
+            if (arg.StartsWith(flag)) {
+                dpi = System.Convert.ToDouble(arg.Remove(0, flag.Length));
+            } else if (System.IO.File.Exists(arg)) {
+                xpsFiles.Add(arg);
+            } else {
+                System.Console.WriteLine("file missing: '" + arg + "'\n\n");
+                System.Environment.Exit(1);
+            }
+        }
+        foreach (string file in xpsFiles) {
             System.Threading.Thread t = new System.Threading.Thread(
-                    () => try_convert(dpi, arg, arg));
+                    () => try_convert(dpi, file, file));
             t.SetApartmentState(System.Threading.ApartmentState.STA);
             t.Start();
         }