OLD | NEW |
1 #ifndef DMWriteTask_DEFINED | 1 #ifndef DMWriteTask_DEFINED |
2 #define DMWriteTask_DEFINED | 2 #define DMWriteTask_DEFINED |
3 | 3 |
4 #include "DMExpectations.h" | 4 #include "DMExpectations.h" |
5 #include "DMTask.h" | 5 #include "DMTask.h" |
6 #include "SkBitmap.h" | 6 #include "SkBitmap.h" |
7 #include "SkString.h" | 7 #include "SkString.h" |
8 #include "SkTArray.h" | 8 #include "SkTArray.h" |
9 | 9 |
10 | 10 |
11 // Writes a bitmap to a file. | 11 // Writes a bitmap to a file. |
12 | 12 |
13 namespace DM { | 13 namespace DM { |
14 | 14 |
15 class WriteTask : public CpuTask { | 15 class WriteTask : public CpuTask { |
16 | 16 |
17 public: | 17 public: |
18 WriteTask(const Task& parent, // WriteTask must be a child Task. Pass its
parent here. | 18 WriteTask(const Task& parent, // WriteTask must be a child Task. Pass it
s parent here. |
19 SkBitmap bitmap); // Bitmap to write. | 19 SkBitmap bitmap, // Bitmap to write. |
| 20 bool verbatim=false); // If set, don't parse the parent's name, j
ust use it verbatim. |
20 | 21 |
21 virtual void draw() SK_OVERRIDE; | 22 virtual void draw() SK_OVERRIDE; |
22 virtual bool shouldSkip() const SK_OVERRIDE; | 23 virtual bool shouldSkip() const SK_OVERRIDE; |
23 virtual SkString name() const SK_OVERRIDE; | 24 virtual SkString name() const SK_OVERRIDE; |
24 | 25 |
25 // Reads image files WriteTask wrote under root and compares them with bitma
p. | 26 // Reads image files WriteTask wrote under root and compares them with bitma
p. |
26 class Expectations : public DM::Expectations { | 27 class Expectations : public DM::Expectations { |
27 public: | 28 public: |
28 explicit Expectations(const char* root) : fRoot(root) {} | 29 explicit Expectations(const char* root) : fRoot(root) {} |
29 | 30 |
30 bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE; | 31 bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE; |
31 private: | 32 private: |
32 const char* fRoot; | 33 const char* fRoot; |
33 }; | 34 }; |
34 | 35 |
35 private: | 36 private: |
36 SkTArray<SkString> fSuffixes; | 37 SkTArray<SkString> fSuffixes; |
37 SkString fGmName; | 38 SkString fGmName; |
38 const SkBitmap fBitmap; | 39 const SkBitmap fBitmap; |
39 | 40 |
40 void makeDirOrFail(SkString dir); | 41 void makeDirOrFail(SkString dir); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace DM | 44 } // namespace DM |
44 | 45 |
45 #endif // DMWriteTask_DEFINED | 46 #endif // DMWriteTask_DEFINED |
OLD | NEW |