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