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