| OLD | NEW |
| 1 #ifndef DMWriteTask_DEFINED | 1 #ifndef DMWriteTask_DEFINED |
| 2 #define DMWriteTask_DEFINED | 2 #define DMWriteTask_DEFINED |
| 3 | 3 |
| 4 #include "DMTask.h" | 4 #include "DMTask.h" |
| 5 #include "SkBitmap.h" | 5 #include "SkBitmap.h" |
| 6 #include "SkJSONCPP.h" | 6 #include "SkJSONCPP.h" |
| 7 #include "SkStream.h" | 7 #include "SkStream.h" |
| 8 #include "SkString.h" | 8 #include "SkString.h" |
| 9 #include "SkTArray.h" | 9 #include "SkTArray.h" |
| 10 | 10 |
| 11 | 11 |
| 12 // Writes a bitmap to a file. | 12 // Writes a bitmap to a file. |
| 13 | 13 |
| 14 namespace DM { | 14 namespace DM { |
| 15 | 15 |
| 16 class WriteTask : public CpuTask { | 16 class WriteTask : public CpuTask { |
| 17 | 17 |
| 18 public: | 18 public: |
| 19 WriteTask(const Task& parent, // WriteTask must be a child task. | 19 WriteTask(const Task& parent, // WriteTask must be a child task. |
| 20 SkBitmap bitmap); // Bitmap to encode to PNG and write to disk. | 20 const char* sourceType, // E.g. "GM", "SKP". For humans. |
| 21 SkBitmap bitmap); // Bitmap to encode to PNG and write to d
isk. |
| 21 | 22 |
| 22 // Takes ownership of SkStreamAsset | 23 // Takes ownership of SkStreamAsset |
| 23 WriteTask(const Task& parent, // WriteTask must be a child task. | 24 WriteTask(const Task& parent, // WriteTask must be a child task. |
| 24 SkStreamAsset* data, // Pre-encoded data to write to disk. | 25 const char* sourceType, // E.g. "GM", "SKP". For humans. |
| 25 const char* ext); // File extension. | 26 SkStreamAsset* data, // Pre-encoded data to write to disk. |
| 27 const char* ext); // File extension. |
| 26 | 28 |
| 27 virtual void draw() SK_OVERRIDE; | 29 virtual void draw() SK_OVERRIDE; |
| 28 virtual bool shouldSkip() const SK_OVERRIDE; | 30 virtual bool shouldSkip() const SK_OVERRIDE; |
| 29 virtual SkString name() const SK_OVERRIDE; | 31 virtual SkString name() const SK_OVERRIDE; |
| 30 | 32 |
| 31 static void DumpJson(); | 33 static void DumpJson(); |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 SkTArray<SkString> fSuffixes; | 36 SkTArray<SkString> fSuffixes; |
| 35 const SkString fFullName; | |
| 36 const SkString fBaseName; | 37 const SkString fBaseName; |
| 38 const SkString fSourceType; |
| 37 const SkBitmap fBitmap; | 39 const SkBitmap fBitmap; |
| 38 SkAutoTDelete<SkStreamAsset> fData; | 40 SkAutoTDelete<SkStreamAsset> fData; |
| 39 const char* fExtension; | 41 const char* fExtension; |
| 40 | 42 |
| 41 void makeDirOrFail(SkString dir); | 43 void makeDirOrFail(SkString dir); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace DM | 46 } // namespace DM |
| 45 | 47 |
| 46 #endif // DMWriteTask_DEFINED | 48 #endif // DMWriteTask_DEFINED |
| OLD | NEW |