From 95a7b76a44edd2f25423a4d395df553b80fe06d7 Mon Sep 17 00:00:00 2001 From: Bryce Thomas Date: Fri, 2 Mar 2018 13:54:21 -0800 Subject: dm: support printing specific page of mskp to SVG Currently with dm, it's possible to convert an .mskp to a multi-page PDF as follows: out/Release/dm --src mskp --mskps /tmp/filename.mskp -w /tmp \ --config pdf --verbose The SVG equivalent partially works, although only outputs the first page: out/Release/dm --src mskp --mskps /tmp/filename.mskp -w /tmp \ --config svg --verbose This CL adds support for passing extended options to SVG. Specifically, the 'page' option , which now determines which page of the source mskp gets converted to the SVG output. The new syntax is as follows: out/Release/dm --src mskp --mskps /tmp/filename.mskp -w /tmp \ --config svg[page=2] --verbose The `[key=value]` syntax is the same extended options syntax currently used by dm with --config gpu, e.g. `gpu[api=gl,color=8888]`. BUG=skia:7601 Change-Id: I3523d79b1cdbbba9e80fd46501331877091bdead Reviewed-on: https://skia-review.googlesource.com/105404 Commit-Queue: Mike Klein Reviewed-by: Mike Klein Reviewed-by: Mike Klein --- dm/DMSrcSink.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'dm/DMSrcSink.h') diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index 6cc5df690f..227ef5341a 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -458,11 +458,14 @@ public: class SVGSink : public Sink { public: - SVGSink(); + SVGSink(int pageIndex = 0); Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; const char* fileExtension() const override { return "svg"; } SinkFlags flags() const override { return SinkFlags{ SinkFlags::kVector, SinkFlags::kDirect }; } + +private: + int fPageIndex; }; -- cgit v1.2.3