Home | History | Annotate | Download | only in dm
      1 #ifndef DMReplayTask_DEFINED
      2 #define DMReplayTask_DEFINED
      3 
      4 #include "DMTask.h"
      5 #include "SkBitmap.h"
      6 #include "SkString.h"
      7 #include "SkTemplates.h"
      8 #include "gm.h"
      9 
     10 // Records a GM through an SkPicture, draws it, and compares against the reference bitmap.
     11 
     12 namespace DM {
     13 
     14 class ReplayTask : public CpuTask {
     15 
     16 public:
     17     enum Mode {
     18         kNormal_Mode,
     19         kRTree_Mode,
     20     };
     21     ReplayTask(const Task& parent,  // ReplayTask must be a child task.  Pass its parent here.
     22                skiagm::GM*,         // GM to run through a picture.  Takes ownership.
     23                SkBitmap reference,  // Bitmap to compare picture replay results to.
     24                Mode);
     25 
     26     virtual void draw() SK_OVERRIDE;
     27     virtual bool shouldSkip() const SK_OVERRIDE;
     28     virtual SkString name() const SK_OVERRIDE { return fName; }
     29 
     30 private:
     31     const bool fUseRTree;
     32     const SkString fName;
     33     SkAutoTDelete<skiagm::GM> fGM;
     34     const SkBitmap fReference;
     35 };
     36 
     37 }  // namespace DM
     38 
     39 #endif  // DMReplayTask_DEFINED
     40