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

Unified Diff: dm/DMSrcSink.cpp

Issue 1916093002: SkDocument/PDF: new API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-26 (Tuesday) 15:55:33 EDT Created 4 years, 8 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/common_variables.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 18ac6b420a70a0661af55c7a2a3fb15255072ea1..e8018297b7da6732330265fd91fbd78c21ee46db 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1115,16 +1115,15 @@ static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
}
Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
+ SkDocument::PDFMetadata metadata;
+ metadata.fTitle = src.name();
+ metadata.fSubject = "rendering correctness test";
+ metadata.fCreator = "Skia/DM";
+ sk_sp<SkDocument> doc = SkDocument::MakePDF(dst, SK_ScalarDefaultRasterDPI,
+ metadata, nullptr, fPDFA);
if (!doc) {
- return "SkDocument::CreatePDF() returned nullptr";
- }
- SkTArray<SkDocument::Attribute> info;
- info.emplace_back(SkString("Title"), src.name());
- info.emplace_back(SkString("Subject"),
- SkString("rendering correctness test"));
- info.emplace_back(SkString("Creator"), SkString("Skia/DM"));
- doc->setMetadata(&info[0], info.count(), nullptr, nullptr);
+ return "SkDocument::MakePDF() returned nullptr";
+ }
return draw_skdocument(src, doc.get(), dst);
}
@@ -1133,9 +1132,9 @@ Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
XPSSink::XPSSink() {}
Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
- SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst));
+ sk_sp<SkDocument> doc(SkDocument::MakeXPS(dst));
if (!doc) {
- return "SkDocument::CreateXPS() returned nullptr";
+ return "SkDocument::MakeXPS() returned nullptr";
}
return draw_skdocument(src, doc.get(), dst);
}
« no previous file with comments | « dm/DMSrcSink.h ('k') | gyp/common_variables.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698