Home | History | Annotate | Download | only in dm
      1 #ifndef DMRecordTask_DEFINED
      2 #define DMRecordTask_DEFINED
      3 
      4 #include "DMTask.h"
      5 #include "SkBitmap.h"
      6 #include "SkPicture.h"
      7 #include "SkString.h"
      8 #include "SkTemplates.h"
      9 #include "gm.h"
     10 
     11 // Records a GM or SKP through an SkRecord, draws it, and compares against the reference bitmap.
     12 
     13 namespace DM {
     14 
     15 class RecordTask : public CpuTask {
     16 
     17 public:
     18     enum Mode {
     19         kNoOptimize_Mode,
     20         kOptimize_Mode,
     21     };
     22     RecordTask(const Task& parent, skiagm::GM*, SkBitmap reference, Mode);
     23     RecordTask(const Task& parent, SkPicture*,  SkBitmap reference, Mode);
     24 
     25     virtual void draw() SK_OVERRIDE;
     26     virtual bool shouldSkip() const SK_OVERRIDE;
     27     virtual SkString name() const SK_OVERRIDE { return fName; }
     28 
     29 private:
     30     bool fOptimize;
     31     const SkString fName;
     32     SkAutoTUnref<SkPicture> fPicture;
     33     SkAutoTDelete<skiagm::GM> fGM;
     34     const SkBitmap fReference;
     35 };
     36 
     37 }  // namespace DM
     38 
     39 #endif  // DMRecordTask_DEFINED
     40