| OLD | NEW |
| 1 #include "DMSKPTask.h" | 1 #include "DMSKPTask.h" |
| 2 #include "DMExpectationsTask.h" |
| 2 #include "DMUtil.h" | 3 #include "DMUtil.h" |
| 3 #include "DMWriteTask.h" | 4 #include "DMWriteTask.h" |
| 4 | 5 |
| 5 #include "SkCommandLineFlags.h" | 6 #include "SkCommandLineFlags.h" |
| 6 #include "SkPictureRecorder.h" | 7 #include "SkPictureRecorder.h" |
| 7 | 8 |
| 8 DEFINE_int32(skpMaxWidth, 1000, "Max SKPTask viewport width."); | 9 DEFINE_int32(skpMaxWidth, 1000, "Max SKPTask viewport width."); |
| 9 DEFINE_int32(skpMaxHeight, 1000, "Max SKPTask viewport height."); | 10 DEFINE_int32(skpMaxHeight, 1000, "Max SKPTask viewport height."); |
| 10 | 11 |
| 11 namespace DM { | 12 namespace DM { |
| 12 | 13 |
| 13 SKPTask::SKPTask(Reporter* r, TaskRunner* tr, const SkPicture* pic, SkString fil
ename) | 14 SKPTask::SKPTask(Reporter* r, |
| 14 : CpuTask(r, tr), fPicture(SkRef(pic)), fName(FileToTaskName(filename)) {} | 15 TaskRunner* tr, |
| 16 const Expectations& expectations, |
| 17 const SkPicture* pic, |
| 18 SkString filename) |
| 19 : CpuTask(r, tr) |
| 20 , fPicture(SkRef(pic)) |
| 21 , fExpectations(expectations) |
| 22 , fName(FileToTaskName(filename)) {} |
| 15 | 23 |
| 16 void SKPTask::draw() { | 24 void SKPTask::draw() { |
| 17 const int width = SkTMin(SkScalarCeilToInt(fPicture->cullRect().width()),
FLAGS_skpMaxWidth), | 25 const int width = SkTMin(SkScalarCeilToInt(fPicture->cullRect().width()),
FLAGS_skpMaxWidth), |
| 18 height = SkTMin(SkScalarCeilToInt(fPicture->cullRect().height()),
FLAGS_skpMaxHeight); | 26 height = SkTMin(SkScalarCeilToInt(fPicture->cullRect().height()),
FLAGS_skpMaxHeight); |
| 19 SkBitmap bitmap; | 27 SkBitmap bitmap; |
| 20 AllocatePixels(kN32_SkColorType, width, height, &bitmap); | 28 AllocatePixels(kN32_SkColorType, width, height, &bitmap); |
| 21 DrawPicture(*fPicture, &bitmap); | 29 DrawPicture(*fPicture, &bitmap); |
| 22 | 30 |
| 23 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); | 31 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); |
| 32 this->spawnChild(SkNEW_ARGS(ExpectationsTask, (*this, fExpectations, bitmap)
)); |
| 24 } | 33 } |
| 25 | 34 |
| 26 } // namespace DM | 35 } // namespace DM |
| OLD | NEW |