blob: ae0dcce4e01a739d8ff729aa63d48bbf939fd81e [file] [log] [blame]
mtklein30bf3e22014-06-03 13:57:14 -07001#ifndef DMPDFTask_DEFINED
2#define DMPDFTask_DEFINED
3
mtklein30bf3e22014-06-03 13:57:14 -07004#include "DMExpectations.h"
mtkleine4d3e602014-06-06 09:28:43 -07005#include "DMPDFRasterizeTask.h"
mtklein30bf3e22014-06-03 13:57:14 -07006#include "DMTask.h"
7#include "SkBitmap.h"
mtkleine4d3e602014-06-06 09:28:43 -07008#include "SkPicture.h"
mtklein30bf3e22014-06-03 13:57:14 -07009#include "SkString.h"
10#include "SkTemplates.h"
11#include "gm.h"
12
13namespace DM {
14
mtkleine4d3e602014-06-06 09:28:43 -070015// This task renders a GM or SKP using Skia's PDF backend.
mtklein30bf3e22014-06-03 13:57:14 -070016// If rasterizePdfProc is non-NULL, it will spawn a PDFRasterizeTask.
17class PDFTask : public CpuTask {
18public:
mtkleine4d3e602014-06-06 09:28:43 -070019 PDFTask(const char*,
mtklein30bf3e22014-06-03 13:57:14 -070020 Reporter*,
21 TaskRunner*,
mtklein30bf3e22014-06-03 13:57:14 -070022 skiagm::GMRegistry::Factory,
23 RasterizePdfProc);
24
mtkleine4d3e602014-06-06 09:28:43 -070025 PDFTask(Reporter*,
26 TaskRunner*,
mtkleind3e474e2014-06-27 12:34:44 -070027 const SkPicture*,
mtkleine4d3e602014-06-06 09:28:43 -070028 SkString name,
29 RasterizePdfProc);
30
mtklein30bf3e22014-06-03 13:57:14 -070031 virtual void draw() SK_OVERRIDE;
32
33 virtual bool shouldSkip() const SK_OVERRIDE;
34
35 virtual SkString name() const SK_OVERRIDE { return fName; }
36
37private:
mtkleine4d3e602014-06-06 09:28:43 -070038 // One of these two will be set.
mtklein30bf3e22014-06-03 13:57:14 -070039 SkAutoTDelete<skiagm::GM> fGM;
mtkleind3e474e2014-06-27 12:34:44 -070040 SkAutoTUnref<const SkPicture> fPicture;
mtkleine4d3e602014-06-06 09:28:43 -070041
mtklein30bf3e22014-06-03 13:57:14 -070042 const SkString fName;
mtklein30bf3e22014-06-03 13:57:14 -070043 RasterizePdfProc fRasterize;
44};
45
46} // namespace DM
47
48#endif // DMPDFTask_DEFINED