From 45420a945cfce1b83da954ab5fcb63516f646c0f Mon Sep 17 00:00:00 2001 From: halcanary Date: Thu, 2 Jun 2016 12:41:14 -0700 Subject: SkMultiPictureDocument & SkMultiPictureDocumentReader also, a new DM::Src. motivation: To be used to test the printing pipeline in Chromium. BUG=skia:5370 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2023593002 Review-Url: https://codereview.chromium.org/2023593002 --- dm/DMSrcSink.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'dm/DMSrcSink.h') diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index 42f0e6da36..395f59e1a9 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -15,6 +15,7 @@ #include "SkBitmapRegionDecoder.h" #include "SkCanvas.h" #include "SkData.h" +#include "SkMultiPictureDocumentReader.h" #include "SkPicture.h" #include "gm.h" @@ -66,6 +67,11 @@ struct Src { virtual void modifyGrContextOptions(GrContextOptions* options) const {} virtual bool veto(SinkFlags) const { return false; } + virtual int pageCount() const { return 1; } + virtual Error SK_WARN_UNUSED_RESULT draw(int, SkCanvas* canvas) const { + return this->draw(canvas); + } + virtual SkISize size(int) const { return this->size(); } // Force Tasks using this Src to run on the main thread? virtual bool serial() const { return false; } }; @@ -243,6 +249,24 @@ private: /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +class MSKPSrc : public Src { +public: + explicit MSKPSrc(Path path); + + int pageCount() const override; + Error draw(SkCanvas* c) const override; + Error draw(int, SkCanvas*) const override; + SkISize size() const override; + SkISize size(int) const override; + Name name() const override; + +private: + Path fPath; + SkMultiPictureDocumentReader fReader; +}; + +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + class NullSink : public Sink { public: NullSink() {} -- cgit v1.2.3