DM: PDFSink sets rasterizer keyword
Review URL: https://codereview.chromium.org/1376573002
diff --git a/dm/DM.cpp b/dm/DM.cpp
index f70c81a..11581fd 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -589,7 +589,8 @@
if (FLAGS_cpu) {
SINK("565", RasterSink, kRGB_565_SkColorType);
SINK("8888", RasterSink, kN32_SkColorType);
- SINK("pdf", PDFSink);
+ SINK("pdf", PDFSink, "Pdfium");
+ SINK("pdf_poppler", PDFSink, "Poppler");
SINK("skp", SKPSink);
SINK("svg", SVGSink);
SINK("null", NullSink);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 25b5f7b..96a0ab1 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -924,7 +924,7 @@
return "";
}
-PDFSink::PDFSink() {}
+PDFSink::PDFSink(const char* rasterizer) : fRasterizer(rasterizer) {}
Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(dst));
@@ -936,6 +936,9 @@
info.emplace_back(SkString("Subject"),
SkString("rendering correctness test"));
info.emplace_back(SkString("Creator"), SkString("Skia/DM"));
+
+ info.emplace_back(SkString("Keywords"),
+ SkStringPrintf("Rasterizer:%s;", fRasterizer));
doc->setMetadata(info, nullptr, nullptr);
return draw_skdocument(src, doc.get(), dst);
}
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index 9e0ef49..d881137 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -213,12 +213,14 @@
class PDFSink : public Sink {
public:
- PDFSink();
+ PDFSink(const char* rasterizer);
Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
int enclave() const override { return kAnyThread_Enclave; }
const char* fileExtension() const override { return "pdf"; }
SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; }
+private:
+ const char* fRasterizer;
};
class XPSSink : public Sink {