XPS, DM: add SkDocument::CreateXPS

-   SkDocument::CreateXPS() function added, returns NULL on non-Windows OS.

-   DM: (Windows only) an XPSSink is added, fails on non-Windows OS

-   DM: Common code for PDFSink::draw and XPSSink::draw are factored into
    draw_skdocument static function.

-   SkDocument_XPS (Windows only) implementation of SkDocument via
    SkXPSDevice.

-   SkDocument_XPS_None (non-Windows) returns NULL for
    SkDocument::CreateXPS().

-   gyp/xps.gyp refactored.

-   SkXPSDevice::drawTextOnPath removed (see http://crrev.com/925343003 )

-   SkXPSDevice::drawPath supports conics via SkAutoConicToQuads.

Review URL: https://codereview.chromium.org/963953002
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 67f8ac6..2060ce2 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -223,12 +223,9 @@
 
 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
-PDFSink::PDFSink() {}
-
-Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
-    // Print the given DM:Src to a PDF, breaking on 8.5x11 pages.
-    SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
-
+static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
+    // Print the given DM:Src to a document, breaking on 8.5x11 pages.
+    SkASSERT(doc);
     int width  = src.size().width(),
         height = src.size().height();
 
@@ -260,6 +257,27 @@
     return "";
 }
 
+PDFSink::PDFSink() {}
+
+Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
+    SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
+    if (!doc) {
+        return "SkDocument::CreatePDF() returned NULL";
+    }
+    return draw_skdocument(src, doc.get(), dst);
+}
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+XPSSink::XPSSink() {}
+
+Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
+    SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst));
+    if (!doc) {
+        return "SkDocument::CreateXPS() returned NULL";
+    }
+    return draw_skdocument(src, doc.get(), dst);
+}
 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
 SKPSink::SKPSink() {}