| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 } | 917 } |
| 918 doc->endPage(); | 918 doc->endPage(); |
| 919 } | 919 } |
| 920 if (!doc->close()) { | 920 if (!doc->close()) { |
| 921 return "SkDocument::close() returned false"; | 921 return "SkDocument::close() returned false"; |
| 922 } | 922 } |
| 923 dst->flush(); | 923 dst->flush(); |
| 924 return ""; | 924 return ""; |
| 925 } | 925 } |
| 926 | 926 |
| 927 PDFSink::PDFSink() {} | 927 PDFSink::PDFSink(const char* rasterizer) : fRasterizer(rasterizer) {} |
| 928 | 928 |
| 929 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ | 929 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ |
| 930 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst)); | 930 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst)); |
| 931 if (!doc) { | 931 if (!doc) { |
| 932 return "SkDocument::CreatePDF() returned nullptr"; | 932 return "SkDocument::CreatePDF() returned nullptr"; |
| 933 } | 933 } |
| 934 SkTArray<SkDocument::Attribute> info; | 934 SkTArray<SkDocument::Attribute> info; |
| 935 info.emplace_back(SkString("Title"), src.name()); | 935 info.emplace_back(SkString("Title"), src.name()); |
| 936 info.emplace_back(SkString("Subject"), | 936 info.emplace_back(SkString("Subject"), |
| 937 SkString("rendering correctness test")); | 937 SkString("rendering correctness test")); |
| 938 info.emplace_back(SkString("Creator"), SkString("Skia/DM")); | 938 info.emplace_back(SkString("Creator"), SkString("Skia/DM")); |
| 939 |
| 940 info.emplace_back(SkString("Keywords"), |
| 941 SkStringPrintf("Rasterizer:%s;", fRasterizer)); |
| 939 doc->setMetadata(info, nullptr, nullptr); | 942 doc->setMetadata(info, nullptr, nullptr); |
| 940 return draw_skdocument(src, doc.get(), dst); | 943 return draw_skdocument(src, doc.get(), dst); |
| 941 } | 944 } |
| 942 | 945 |
| 943 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 946 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 944 | 947 |
| 945 XPSSink::XPSSink() {} | 948 XPSSink::XPSSink() {} |
| 946 | 949 |
| 947 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ | 950 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ |
| 948 SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst)); | 951 SkAutoTUnref<SkDocument> doc(SkDocument::CreateXPS(dst)); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 skr.visit<void>(i, drawsAsSingletonPictures); | 1271 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1269 } | 1272 } |
| 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1273 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1271 | 1274 |
| 1272 canvas->drawPicture(macroPic); | 1275 canvas->drawPicture(macroPic); |
| 1273 return ""; | 1276 return ""; |
| 1274 }); | 1277 }); |
| 1275 } | 1278 } |
| 1276 | 1279 |
| 1277 } // namespace DM | 1280 } // namespace DM |
| OLD | NEW |