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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1376573002: DM: PDFSink sets rasterizer keyword (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « dm/DMSrcSink.h ('k') | tools/dm_flags.json » ('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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | tools/dm_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698