blob: 760138f7c98a96d4b52ac5d5a424fcd6cdbfe3fc [file] [log] [blame]
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +00001#include "DMRecordTask.h"
2#include "DMSKPTask.h"
3#include "DMUtil.h"
4#include "DMWriteTask.h"
5
6namespace DM {
7
commit-bot@chromium.orgd6dcacd2014-05-14 20:26:00 +00008SKPTask::SKPTask(Reporter* r, TaskRunner* tr, SkPicture* pic, SkString filename)
mtkleine4d3e602014-06-06 09:28:43 -07009 : CpuTask(r, tr), fPicture(SkRef(pic)), fName(FileToTaskName(filename)) {}
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000010
11void SKPTask::draw() {
12 SkBitmap bitmap;
commit-bot@chromium.org26642072014-05-15 17:33:31 +000013 AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bitmap);
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000014 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)));
commit-bot@chromium.orgd6dcacd2014-05-14 20:26:00 +000020 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000021}
22
23} // namespace DM