OLD | NEW |
1 #include "DMCpuGMTask.h" | 1 #include "DMCpuGMTask.h" |
2 #include "DMExpectationsTask.h" | |
3 #include "DMPipeTask.h" | 2 #include "DMPipeTask.h" |
4 #include "DMQuiltTask.h" | 3 #include "DMQuiltTask.h" |
5 #include "DMSerializeTask.h" | 4 #include "DMSerializeTask.h" |
6 #include "DMUtil.h" | 5 #include "DMUtil.h" |
7 #include "DMWriteTask.h" | 6 #include "DMWriteTask.h" |
8 | 7 |
9 namespace DM { | 8 namespace DM { |
10 | 9 |
11 CpuGMTask::CpuGMTask(const char* config, | 10 CpuGMTask::CpuGMTask(const char* config, |
12 Reporter* reporter, | 11 Reporter* reporter, |
13 TaskRunner* taskRunner, | 12 TaskRunner* taskRunner, |
14 skiagm::GMRegistry::Factory gmFactory, | 13 skiagm::GMRegistry::Factory gmFactory, |
15 const Expectations& expectations, | |
16 SkColorType colorType) | 14 SkColorType colorType) |
17 : CpuTask(reporter, taskRunner) | 15 : CpuTask(reporter, taskRunner) |
18 , fGMFactory(gmFactory) | 16 , fGMFactory(gmFactory) |
19 , fGM(fGMFactory(NULL)) | 17 , fGM(fGMFactory(NULL)) |
20 , fName(UnderJoin(fGM->getName(), config)) | 18 , fName(UnderJoin(fGM->getName(), config)) |
21 , fExpectations(expectations) | |
22 , fColorType(colorType) | 19 , fColorType(colorType) |
23 {} | 20 {} |
24 | 21 |
25 void CpuGMTask::draw() { | 22 void CpuGMTask::draw() { |
26 SkBitmap bm; | 23 SkBitmap bm; |
27 AllocatePixels(fColorType, fGM->getISize().width(), fGM->getISize().height()
, &bm); | 24 AllocatePixels(fColorType, fGM->getISize().width(), fGM->getISize().height()
, &bm); |
28 | 25 |
29 SkCanvas canvas(bm); | 26 SkCanvas canvas(bm); |
30 canvas.concat(fGM->getInitialTransform()); | 27 canvas.concat(fGM->getInitialTransform()); |
31 fGM->draw(&canvas); | 28 fGM->draw(&canvas); |
32 canvas.flush(); | 29 canvas.flush(); |
33 | 30 |
34 #define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __V
A_ARGS__))) | 31 #define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __V
A_ARGS__))) |
35 SPAWN(ExpectationsTask, fExpectations, bm); | |
36 | |
37 SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kInProcess_Mode); | 32 SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kInProcess_Mode); |
38 SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kCrossProcess_Mode); | 33 SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kCrossProcess_Mode); |
39 SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kSharedAddress_Mode); | 34 SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kSharedAddress_Mode); |
40 | 35 |
41 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kNone_BBH, QuiltTask::
kDefault_Backend); | 36 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kNone_BBH, QuiltTask::
kDefault_Backend); |
42 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kRTree_BBH, QuiltTask::
kDefault_Backend); | 37 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kRTree_BBH, QuiltTask::
kDefault_Backend); |
43 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kTileGrid_BBH, QuiltTask::
kDefault_Backend); | 38 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kTileGrid_BBH, QuiltTask::
kDefault_Backend); |
44 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kNone_BBH, QuiltTask::
kSkRecord_Backend); | 39 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kNone_BBH, QuiltTask::
kSkRecord_Backend); |
45 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kRTree_BBH, QuiltTask::
kSkRecord_Backend); | 40 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kRTree_BBH, QuiltTask::
kSkRecord_Backend); |
46 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kTileGrid_BBH, QuiltTask::
kSkRecord_Backend); | 41 SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kTileGrid_BBH, QuiltTask::
kSkRecord_Backend); |
47 | 42 |
48 SPAWN(SerializeTask, fGMFactory(NULL), bm, SerializeTask::kNormal_Mode); | 43 SPAWN(SerializeTask, fGMFactory(NULL), bm, SerializeTask::kNormal_Mode); |
49 SPAWN(SerializeTask, fGMFactory(NULL), bm, SerializeTask::kSkRecord_Mode); | 44 SPAWN(SerializeTask, fGMFactory(NULL), bm, SerializeTask::kSkRecord_Mode); |
50 | 45 |
51 SPAWN(WriteTask, bm); | 46 SPAWN(WriteTask, bm); |
52 #undef SPAWN | 47 #undef SPAWN |
53 } | 48 } |
54 | 49 |
55 bool CpuGMTask::shouldSkip() const { | 50 bool CpuGMTask::shouldSkip() const { |
56 if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSk
ip565_Flag)) { | 51 if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSk
ip565_Flag)) { |
57 return true; | 52 return true; |
58 } | 53 } |
59 if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) { | 54 if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) { |
60 return true; | 55 return true; |
61 } | 56 } |
62 return false; | 57 return false; |
63 } | 58 } |
64 | 59 |
65 } // namespace DM | 60 } // namespace DM |
OLD | NEW |