Home | History | Annotate | Download | only in dm
      1 /*
      2  * Copyright 2014 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef DMPDFRasterizeTask_DEFINED
      9 #define DMPDFRasterizeTask_DEFINED
     10 
     11 #include "DMTask.h"
     12 #include "SkBitmap.h"
     13 #include "SkData.h"
     14 #include "SkStream.h"
     15 #include "SkString.h"
     16 #include "SkTemplates.h"
     17 
     18 namespace DM {
     19 
     20 typedef bool (*RasterizePdfProc)(SkStream* pdf, SkBitmap* output);
     21 
     22 class PDFRasterizeTask : public CpuTask {
     23 public:
     24     PDFRasterizeTask(const Task& parent,
     25                      SkData* pdf,
     26                      RasterizePdfProc);
     27 
     28     virtual void draw() SK_OVERRIDE;
     29     virtual bool shouldSkip() const SK_OVERRIDE { return NULL == fRasterize; }
     30     virtual SkString name()   const SK_OVERRIDE { return fName; }
     31 
     32 private:
     33     const SkString fName;
     34     SkAutoTUnref<SkData> fPdf;
     35     RasterizePdfProc fRasterize;
     36 };
     37 
     38 }  // namespace DM
     39 
     40 #endif  // DMPDFRasterizeTask_DEFINED
     41