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

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: style change Created 5 years, 2 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') | no next file with comments »
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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 return ""; 923 return "";
924 } 924 }
925 925
926 PDFSink::PDFSink() {} 926 PDFSink::PDFSink() {}
927 927
928 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { 928 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
929 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst)); 929 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
930 if (!doc) { 930 if (!doc) {
931 return "SkDocument::CreatePDF() returned nullptr"; 931 return "SkDocument::CreatePDF() returned nullptr";
932 } 932 }
933 SkTArray<SkDocument::Attribute> info;
934 info.emplace_back(SkString("Title"), src.name());
935 info.emplace_back(SkString("Subject"),
936 SkString("rendering correctness test"));
937 info.emplace_back(SkString("Creator"), SkString("Skia/DM"));
938 doc->setMetadata(info, nullptr, nullptr);
933 return draw_skdocument(src, doc.get(), dst); 939 return draw_skdocument(src, doc.get(), dst);
934 } 940 }
935 941
936 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 942 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
937 943
938 XPSSink::XPSSink() {} 944 XPSSink::XPSSink() {}
939 945
940 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { 946 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
941 SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst)); 947 SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst));
942 if (!doc) { 948 if (!doc) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 skr.visit<void>(i, drawsAsSingletonPictures); 1269 skr.visit<void>(i, drawsAsSingletonPictures);
1264 } 1270 }
1265 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1271 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1266 1272
1267 canvas->drawPicture(macroPic); 1273 canvas->drawPicture(macroPic);
1268 return ""; 1274 return "";
1269 }); 1275 });
1270 } 1276 }
1271 1277
1272 } // namespace DM 1278 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | include/core/SkDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698