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