2014-06-03 20:57:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DMPDFRasterizeTask_DEFINED
|
|
|
|
#define DMPDFRasterizeTask_DEFINED
|
|
|
|
|
|
|
|
#include "DMTask.h"
|
|
|
|
#include "SkBitmap.h"
|
|
|
|
#include "SkData.h"
|
|
|
|
#include "SkStream.h"
|
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkTemplates.h"
|
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
|
|
|
typedef bool (*RasterizePdfProc)(SkStream* pdf, SkBitmap* output);
|
|
|
|
|
|
|
|
class PDFRasterizeTask : public CpuTask {
|
|
|
|
public:
|
2014-08-26 17:38:07 +00:00
|
|
|
// takes ownership of SkStreamAsset.
|
2014-06-03 20:57:14 +00:00
|
|
|
PDFRasterizeTask(const Task& parent,
|
2014-08-26 17:38:07 +00:00
|
|
|
SkStreamAsset* pdf,
|
2014-06-03 20:57:14 +00:00
|
|
|
RasterizePdfProc);
|
|
|
|
|
|
|
|
virtual void draw() SK_OVERRIDE;
|
|
|
|
virtual bool shouldSkip() const SK_OVERRIDE { return NULL == fRasterize; }
|
|
|
|
virtual SkString name() const SK_OVERRIDE { return fName; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
const SkString fName;
|
2014-08-26 17:38:07 +00:00
|
|
|
SkAutoTDelete<SkStreamAsset> fPdf;
|
2014-06-03 20:57:14 +00:00
|
|
|
RasterizePdfProc fRasterize;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMPDFRasterizeTask_DEFINED
|