mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 1 | #ifndef DMPDFTask_DEFINED |
| 2 | #define DMPDFTask_DEFINED |
| 3 | |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 4 | #include "DMPDFRasterizeTask.h" |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 5 | #include "DMTask.h" |
| 6 | #include "SkBitmap.h" |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 7 | #include "SkPicture.h" |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 8 | #include "SkString.h" |
| 9 | #include "SkTemplates.h" |
| 10 | #include "gm.h" |
| 11 | |
| 12 | namespace DM { |
| 13 | |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 14 | // This task renders a GM or SKP using Skia's PDF backend. |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 15 | // If rasterizePdfProc is non-NULL, it will spawn a PDFRasterizeTask. |
| 16 | class PDFTask : public CpuTask { |
| 17 | public: |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 18 | PDFTask(const char*, |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 19 | Reporter*, |
| 20 | TaskRunner*, |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 21 | skiagm::GMRegistry::Factory, |
| 22 | RasterizePdfProc); |
| 23 | |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 24 | PDFTask(Reporter*, |
| 25 | TaskRunner*, |
mtklein | d3e474e | 2014-06-27 12:34:44 -0700 | [diff] [blame] | 26 | const SkPicture*, |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 27 | SkString name, |
| 28 | RasterizePdfProc); |
| 29 | |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 30 | virtual void draw() SK_OVERRIDE; |
| 31 | |
| 32 | virtual bool shouldSkip() const SK_OVERRIDE; |
| 33 | |
| 34 | virtual SkString name() const SK_OVERRIDE { return fName; } |
| 35 | |
| 36 | private: |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 37 | // One of these two will be set. |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 38 | SkAutoTDelete<skiagm::GM> fGM; |
mtklein | d3e474e | 2014-06-27 12:34:44 -0700 | [diff] [blame] | 39 | SkAutoTUnref<const SkPicture> fPicture; |
mtklein | e4d3e60 | 2014-06-06 09:28:43 -0700 | [diff] [blame] | 40 | |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 41 | const SkString fName; |
mtklein | 30bf3e2 | 2014-06-03 13:57:14 -0700 | [diff] [blame] | 42 | RasterizePdfProc fRasterize; |
| 43 | }; |
| 44 | |
| 45 | } // namespace DM |
| 46 | |
| 47 | #endif // DMPDFTask_DEFINED |