OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |