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