| OLD | NEW |
| 1 #include "DMRecordTask.h" | 1 #include "DMRecordTask.h" |
| 2 #include "DMSKPTask.h" | 2 #include "DMSKPTask.h" |
| 3 #include "DMUtil.h" | 3 #include "DMUtil.h" |
| 4 #include "DMWriteTask.h" | 4 #include "DMWriteTask.h" |
| 5 | 5 |
| 6 namespace DM { | 6 namespace DM { |
| 7 | 7 |
| 8 SKPTask::SKPTask(Reporter* r, TaskRunner* tr, SkPicture* pic, SkString name) | 8 // foo_bar.skp -> foo-bar_skp |
| 9 : CpuTask(r, tr), fPicture(SkRef(pic)), fName(name) {} | 9 static SkString filename_to_task_name(SkString filename) { |
| 10 for (size_t i = 0; i < filename.size(); i++) { |
| 11 if ('_' == filename[i]) { filename[i] = '-'; } |
| 12 if ('.' == filename[i]) { filename[i] = '_'; } |
| 13 } |
| 14 return filename; |
| 15 } |
| 16 |
| 17 SKPTask::SKPTask(Reporter* r, TaskRunner* tr, SkPicture* pic, SkString filename) |
| 18 : CpuTask(r, tr), fPicture(SkRef(pic)), fName(filename_to_task_name(filename
)) {} |
| 10 | 19 |
| 11 void SKPTask::draw() { | 20 void SKPTask::draw() { |
| 12 SkBitmap bitmap; | 21 SkBitmap bitmap; |
| 13 SetupBitmap(kN32_SkColorType, *fPicture, &bitmap); | 22 SetupBitmap(kN32_SkColorType, *fPicture, &bitmap); |
| 14 DrawPicture(fPicture, &bitmap); | 23 DrawPicture(fPicture, &bitmap); |
| 15 | 24 |
| 16 this->spawnChild(SkNEW_ARGS(RecordTask, | 25 this->spawnChild(SkNEW_ARGS(RecordTask, |
| 17 (*this, fPicture, bitmap, RecordTask::kNoOptimiz
e_Mode))); | 26 (*this, fPicture, bitmap, RecordTask::kNoOptimiz
e_Mode))); |
| 18 this->spawnChild(SkNEW_ARGS(RecordTask, | 27 this->spawnChild(SkNEW_ARGS(RecordTask, |
| 19 (*this, fPicture, bitmap, RecordTask::kOptimize_
Mode))); | 28 (*this, fPicture, bitmap, RecordTask::kOptimize_
Mode))); |
| 20 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap, WriteTask::kVerbatim_
Mode))); | 29 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); |
| 21 } | 30 } |
| 22 | 31 |
| 23 } // namespace DM | 32 } // namespace DM |
| OLD | NEW |