Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Unified Diff: dm/DMSrcSink.cpp

Issue 963953002: XPS, DM: add SkDocument::CreateXPS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix iOS compile Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMSrcSink.h ('k') | gyp/dm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index e67d4355e4ca4caf4f7605422b2bd73f8b91a3ac..cec782e392f780d7da6603dfc901f36b0ceeca85 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -194,12 +194,9 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-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();
@@ -231,6 +228,27 @@ Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
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() {}
« no previous file with comments | « dm/DMSrcSink.h ('k') | gyp/dm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698