1 #ifndef DMWriteTask_DEFINED
2 #define DMWriteTask_DEFINED
12 // Writes a bitmap to a file.
16 class WriteTask : public CpuTask {
19 WriteTask(const Task& parent, // WriteTask must be a child task.
20 const char* sourceType, // E.g. "GM", "SKP". For humans.
21 SkBitmap bitmap); // Bitmap to encode to PNG and write to disk.
23 // Takes ownership of SkStreamAsset
24 WriteTask(const Task& parent, // WriteTask must be a child task.
25 const char* sourceType, // E.g. "GM", "SKP". For humans.
26 SkStreamAsset* data, // Pre-encoded data to write to disk.
27 const char* ext); // File extension.
29 virtual void draw() SK_OVERRIDE;
30 virtual bool shouldSkip() const SK_OVERRIDE;
31 virtual SkString name() const SK_OVERRIDE;
33 static void DumpJson();
36 SkTArray<SkString> fSuffixes;
37 const SkString fBaseName;
38 const SkString fSourceType;
39 const SkBitmap fBitmap;
40 SkAutoTDelete<SkStreamAsset> fData;
41 const char* fExtension;
43 void makeDirOrFail(SkString dir);
48 #endif // DMWriteTask_DEFINED