OLD | NEW |
1 #include "DMPipeTask.h" | 1 #include "DMPipeTask.h" |
2 #include "DMUtil.h" | 2 #include "DMUtil.h" |
3 #include "DMWriteTask.h" | 3 #include "DMWriteTask.h" |
4 | 4 |
5 #include "SamplePipeControllers.h" | 5 #include "SamplePipeControllers.h" |
6 #include "SkCommandLineFlags.h" | 6 #include "SkCommandLineFlags.h" |
7 #include "SkGPipe.h" | 7 #include "SkGPipe.h" |
8 | 8 |
9 DEFINE_bool(pipe, true, "If true, check several pipe variants against the refere
nce bitmap."); | 9 DEFINE_bool(pipe, true, "If true, check several pipe variants against the refere
nce bitmap."); |
10 | 10 |
11 namespace DM { | 11 namespace DM { |
12 | 12 |
13 static uint32_t get_flags(bool crossProcess, bool sharedAddressSpace) { | 13 static uint32_t get_flags(PipeTask::Mode mode) { |
14 SkASSERT(!(!crossProcess && sharedAddressSpace)); | |
15 uint32_t flags = 0; | 14 uint32_t flags = 0; |
16 if (crossProcess) { | 15 if (mode != PipeTask::kInProcess_Mode) { |
17 flags |= SkGPipeWriter::kCrossProcess_Flag; | 16 flags |= SkGPipeWriter::kCrossProcess_Flag; |
18 if (sharedAddressSpace) { | 17 } |
19 flags |= SkGPipeWriter::kSharedAddressSpace_Flag; | 18 if (mode == PipeTask::kSharedAddress_Mode) { |
20 } | 19 flags |= SkGPipeWriter::kSharedAddressSpace_Flag; |
21 } | 20 } |
22 return flags; | 21 return flags; |
23 } | 22 } |
24 | 23 |
25 static const char* get_name(const uint32_t flags) { | 24 static const char* get_name(const uint32_t flags) { |
26 if (flags & SkGPipeWriter::kCrossProcess_Flag && | 25 if (flags & SkGPipeWriter::kCrossProcess_Flag && |
27 flags & SkGPipeWriter::kSharedAddressSpace_Flag) { | 26 flags & SkGPipeWriter::kSharedAddressSpace_Flag) { |
28 return "cross_process_shared_address_space_pipe"; | 27 return "shared_address_space_pipe"; |
29 } else if (flags & SkGPipeWriter::kCrossProcess_Flag) { | 28 } else if (flags & SkGPipeWriter::kCrossProcess_Flag) { |
30 return "cross_process_pipe"; | 29 return "cross_process_pipe"; |
31 } else { | 30 } else { |
32 return "pipe"; | 31 return "pipe"; |
33 } | 32 } |
34 } | 33 } |
35 | 34 |
36 PipeTask::PipeTask(const Task& parent, | 35 PipeTask::PipeTask(const Task& parent, |
37 skiagm::GM* gm, | 36 skiagm::GM* gm, |
38 SkBitmap reference, | 37 SkBitmap reference, |
39 bool crossProcess, | 38 Mode mode) |
40 bool sharedAddressSpace) | |
41 : CpuTask(parent) | 39 : CpuTask(parent) |
42 , fFlags(get_flags(crossProcess, sharedAddressSpace)) | 40 , fFlags(get_flags(mode)) |
43 , fName(UnderJoin(parent.name().c_str(), get_name(fFlags))) | 41 , fName(UnderJoin(parent.name().c_str(), get_name(fFlags))) |
44 , fGM(gm) | 42 , fGM(gm) |
45 , fReference(reference) | 43 , fReference(reference) |
46 {} | 44 {} |
47 | 45 |
48 void PipeTask::draw() { | 46 void PipeTask::draw() { |
49 SkBitmap bitmap; | 47 SkBitmap bitmap; |
50 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); | 48 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); |
51 | 49 |
52 SkCanvas canvas(bitmap); | 50 SkCanvas canvas(bitmap); |
(...skipping 22 matching lines...) Expand all Loading... |
75 return true; | 73 return true; |
76 } | 74 } |
77 if (fFlags == SkGPipeWriter::kCrossProcess_Flag && | 75 if (fFlags == SkGPipeWriter::kCrossProcess_Flag && |
78 fGM->getFlags() & skiagm::GM::kSkipPipeCrossProcess_Flag) { | 76 fGM->getFlags() & skiagm::GM::kSkipPipeCrossProcess_Flag) { |
79 return true; | 77 return true; |
80 } | 78 } |
81 return false; | 79 return false; |
82 } | 80 } |
83 | 81 |
84 } // namespace DM | 82 } // namespace DM |
OLD | NEW |