2014-06-03 20:57:14 +00:00
|
|
|
#ifndef DMPDFTask_DEFINED
|
|
|
|
#define DMPDFTask_DEFINED
|
|
|
|
|
|
|
|
#include "DMExpectations.h"
|
2014-06-06 16:28:43 +00:00
|
|
|
#include "DMPDFRasterizeTask.h"
|
2014-06-03 20:57:14 +00:00
|
|
|
#include "DMTask.h"
|
|
|
|
#include "SkBitmap.h"
|
2014-06-06 16:28:43 +00:00
|
|
|
#include "SkPicture.h"
|
2014-06-03 20:57:14 +00:00
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkTemplates.h"
|
|
|
|
#include "gm.h"
|
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
2014-06-06 16:28:43 +00:00
|
|
|
// This task renders a GM or SKP using Skia's PDF backend.
|
2014-06-03 20:57:14 +00:00
|
|
|
// If rasterizePdfProc is non-NULL, it will spawn a PDFRasterizeTask.
|
|
|
|
class PDFTask : public CpuTask {
|
|
|
|
public:
|
2014-06-06 16:28:43 +00:00
|
|
|
PDFTask(const char*,
|
2014-06-03 20:57:14 +00:00
|
|
|
Reporter*,
|
|
|
|
TaskRunner*,
|
|
|
|
skiagm::GMRegistry::Factory,
|
|
|
|
RasterizePdfProc);
|
|
|
|
|
2014-06-06 16:28:43 +00:00
|
|
|
PDFTask(Reporter*,
|
|
|
|
TaskRunner*,
|
2014-06-27 19:34:44 +00:00
|
|
|
const SkPicture*,
|
2014-06-06 16:28:43 +00:00
|
|
|
SkString name,
|
|
|
|
RasterizePdfProc);
|
|
|
|
|
2014-06-03 20:57:14 +00:00
|
|
|
virtual void draw() SK_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool shouldSkip() const SK_OVERRIDE;
|
|
|
|
|
|
|
|
virtual SkString name() const SK_OVERRIDE { return fName; }
|
|
|
|
|
|
|
|
private:
|
2014-06-06 16:28:43 +00:00
|
|
|
// One of these two will be set.
|
2014-06-03 20:57:14 +00:00
|
|
|
SkAutoTDelete<skiagm::GM> fGM;
|
2014-06-27 19:34:44 +00:00
|
|
|
SkAutoTUnref<const SkPicture> fPicture;
|
2014-06-06 16:28:43 +00:00
|
|
|
|
2014-06-03 20:57:14 +00:00
|
|
|
const SkString fName;
|
|
|
|
RasterizePdfProc fRasterize;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMPDFTask_DEFINED
|