| 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     enum Mode { |  | 
|  19         kParseName_Mode,  // Parse the parent's name into directories by undersc
    ores. |  | 
|  20         kVerbatim_Mode,   // Don't parse the name at all. |  | 
|  21     }; |  | 
|  22     WriteTask(const Task& parent,    // WriteTask must be a child Task.  Pass it
    s parent here. |  18     WriteTask(const Task& parent,    // WriteTask must be a child Task.  Pass it
    s parent here. | 
|  23               SkBitmap bitmap,       // Bitmap to write. |  19               SkBitmap bitmap);      // Bitmap to write. | 
|  24               Mode = kParseName_Mode); |  | 
|  25  |  20  | 
|  26     virtual void draw() SK_OVERRIDE; |  21     virtual void draw() SK_OVERRIDE; | 
|  27     virtual bool shouldSkip() const SK_OVERRIDE; |  22     virtual bool shouldSkip() const SK_OVERRIDE; | 
|  28     virtual SkString name() const SK_OVERRIDE; |  23     virtual SkString name() const SK_OVERRIDE; | 
|  29  |  24  | 
|  30     // Reads image files WriteTask wrote under root and compares them with bitma
    p. |  25     // Reads image files WriteTask wrote under root and compares them with bitma
    p. | 
|  31     class Expectations : public DM::Expectations { |  26     class Expectations : public DM::Expectations { | 
|  32     public: |  27     public: | 
|  33         explicit Expectations(const char* root) : fRoot(root) {} |  28         explicit Expectations(const char* root) : fRoot(root) {} | 
|  34  |  29  | 
|  35         bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE; |  30         bool check(const Task& task, SkBitmap bitmap) const SK_OVERRIDE; | 
|  36     private: |  31     private: | 
|  37         const char* fRoot; |  32         const char* fRoot; | 
|  38     }; |  33     }; | 
|  39  |  34  | 
|  40 private: |  35 private: | 
|  41     SkTArray<SkString> fSuffixes; |  36     SkTArray<SkString> fSuffixes; | 
|  42     SkString fGmName; |  37     SkString fGmName; | 
|  43     const SkBitmap fBitmap; |  38     const SkBitmap fBitmap; | 
|  44  |  39  | 
|  45     void makeDirOrFail(SkString dir); |  40     void makeDirOrFail(SkString dir); | 
|  46 }; |  41 }; | 
|  47  |  42  | 
|  48 }  // namespace DM |  43 }  // namespace DM | 
|  49  |  44  | 
|  50 #endif  // DMWriteTask_DEFINED |  45 #endif  // DMWriteTask_DEFINED | 
| OLD | NEW |