Home | History | Annotate | Download | only in dm
      1 #include "DMRecordTask.h"
      2 #include "DMSKPTask.h"
      3 #include "DMUtil.h"
      4 #include "DMWriteTask.h"
      5 
      6 namespace DM {
      7 
      8 SKPTask::SKPTask(Reporter* r, TaskRunner* tr, SkPicture* pic, SkString filename)
      9     : CpuTask(r, tr), fPicture(SkRef(pic)), fName(FileToTaskName(filename)) {}
     10 
     11 void SKPTask::draw() {
     12     SkBitmap bitmap;
     13     AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bitmap);
     14     DrawPicture(fPicture, &bitmap);
     15 
     16     this->spawnChild(SkNEW_ARGS(RecordTask,
     17                                 (*this, fPicture, bitmap, RecordTask::kNoOptimize_Mode)));
     18     this->spawnChild(SkNEW_ARGS(RecordTask,
     19                                 (*this, fPicture, bitmap, RecordTask::kOptimize_Mode)));
     20     this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
     21 }
     22 
     23 }  // namespace DM
     24