1#ifndef DMPDFTask_DEFINED
2#define DMPDFTask_DEFINED
3
4#include "DMPDFRasterizeTask.h"
5#include "DMTask.h"
6#include "SkBitmap.h"
7#include "SkPicture.h"
8#include "SkString.h"
9#include "SkTemplates.h"
10#include "gm.h"
11
12namespace DM {
13
14// This task renders a GM or SKP using Skia's PDF backend.
15// If rasterizePdfProc is non-NULL, it will spawn a PDFRasterizeTask.
16class PDFTask : public CpuTask {
17public:
18    PDFTask(const char*,
19            Reporter*,
20            TaskRunner*,
21            skiagm::GMRegistry::Factory,
22            RasterizePdfProc);
23
24    PDFTask(Reporter*,
25            TaskRunner*,
26            const SkPicture*,
27            SkString name,
28            RasterizePdfProc);
29
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
36private:
37    // One of these two will be set.
38    SkAutoTDelete<skiagm::GM> fGM;
39    SkAutoTUnref<const SkPicture> fPicture;
40
41    const SkString fName;
42    RasterizePdfProc fRasterize;
43};
44
45}  // namespace DM
46
47#endif  // DMPDFTask_DEFINED
48