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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1359943003: SkPDF: add basic metadata support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused parameter Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | include/core/SkDocument.h » ('j') | include/core/SkDocument.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SamplePipeControllers.h" 9 #include "SamplePipeControllers.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 return ""; 922 return "";
923 } 923 }
924 924
925 PDFSink::PDFSink() {} 925 PDFSink::PDFSink() {}
926 926
927 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { 927 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
928 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst)); 928 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
929 if (!doc) { 929 if (!doc) {
930 return "SkDocument::CreatePDF() returned nullptr"; 930 return "SkDocument::CreatePDF() returned nullptr";
931 } 931 }
932 SkTArray<SkDocument::Attribute> info;
933 info.emplace_back(SkString("Title"), src.name());
934 info.emplace_back(SkString("Subject"),
935 SkString("rendering correctness test"));
936 info.emplace_back(SkString("Creator"), SkString("Skia/DM"));
937 doc->setMetadata(info, nullptr, nullptr);
932 return draw_skdocument(src, doc.get(), dst); 938 return draw_skdocument(src, doc.get(), dst);
933 } 939 }
934 940
935 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 941 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
936 942
937 XPSSink::XPSSink() {} 943 XPSSink::XPSSink() {}
938 944
939 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { 945 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
940 SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst)); 946 SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst));
941 if (!doc) { 947 if (!doc) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 skr.visit<void>(i, drawsAsSingletonPictures); 1268 skr.visit<void>(i, drawsAsSingletonPictures);
1263 } 1269 }
1264 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1265 1271
1266 canvas->drawPicture(macroPic); 1272 canvas->drawPicture(macroPic);
1267 return ""; 1273 return "";
1268 }); 1274 });
1269 } 1275 }
1270 1276
1271 } // namespace DM 1277 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | include/core/SkDocument.h » ('j') | include/core/SkDocument.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698