blob: 72c023282a5d3486b33ea45b1f41a98da4cbc910 [file] [log] [blame]
mtklein30bf3e22014-06-03 13:57:14 -07001#ifndef DMPDFTask_DEFINED
2#define DMPDFTask_DEFINED
3
mtkleine4d3e602014-06-06 09:28:43 -07004#include "DMPDFRasterizeTask.h"
mtklein30bf3e22014-06-03 13:57:14 -07005#include "DMTask.h"
6#include "SkBitmap.h"
mtkleine4d3e602014-06-06 09:28:43 -07007#include "SkPicture.h"
mtklein30bf3e22014-06-03 13:57:14 -07008#include "SkString.h"
9#include "SkTemplates.h"
10#include "gm.h"
11
12namespace DM {
13
mtkleine4d3e602014-06-06 09:28:43 -070014// This task renders a GM or SKP using Skia's PDF backend.
mtklein30bf3e22014-06-03 13:57:14 -070015// If rasterizePdfProc is non-NULL, it will spawn a PDFRasterizeTask.
16class PDFTask : public CpuTask {
17public:
mtkleine4d3e602014-06-06 09:28:43 -070018 PDFTask(const char*,
mtklein30bf3e22014-06-03 13:57:14 -070019 Reporter*,
20 TaskRunner*,
mtklein30bf3e22014-06-03 13:57:14 -070021 skiagm::GMRegistry::Factory,
22 RasterizePdfProc);
23
mtkleine4d3e602014-06-06 09:28:43 -070024 PDFTask(Reporter*,
25 TaskRunner*,
mtkleind3e474e2014-06-27 12:34:44 -070026 const SkPicture*,
mtkleine4d3e602014-06-06 09:28:43 -070027 SkString name,
28 RasterizePdfProc);
29
mtklein30bf3e22014-06-03 13:57:14 -070030 virtual void draw() SK_OVERRIDE;
31
32 virtual bool shouldSkip() const SK_OVERRIDE;
33
34 virtual SkString name() const SK_OVERRIDE { return fName; }
35
36private:
mtkleine4d3e602014-06-06 09:28:43 -070037 // One of these two will be set.
mtklein30bf3e22014-06-03 13:57:14 -070038 SkAutoTDelete<skiagm::GM> fGM;
mtkleind3e474e2014-06-27 12:34:44 -070039 SkAutoTUnref<const SkPicture> fPicture;
mtkleine4d3e602014-06-06 09:28:43 -070040
mtklein30bf3e22014-06-03 13:57:14 -070041 const SkString fName;
mtklein30bf3e22014-06-03 13:57:14 -070042 RasterizePdfProc fRasterize;
43};
44
45} // namespace DM
46
47#endif // DMPDFTask_DEFINED