2013-10-16 13:02:15 +00:00
|
|
|
#ifndef DMReplayTask_DEFINED
|
|
|
|
#define DMReplayTask_DEFINED
|
|
|
|
|
|
|
|
#include "DMTask.h"
|
|
|
|
#include "SkBitmap.h"
|
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkTemplates.h"
|
|
|
|
#include "gm.h"
|
|
|
|
|
2013-10-16 19:13:38 +00:00
|
|
|
// Records a GM through an SkPicture, draws it, and compares against the reference bitmap.
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
class ReplayTask : public CpuTask {
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
public:
|
2014-05-14 17:55:32 +00:00
|
|
|
enum Mode {
|
|
|
|
kNormal_Mode,
|
|
|
|
kRTree_Mode,
|
|
|
|
};
|
2013-10-30 20:45:28 +00:00
|
|
|
ReplayTask(const Task& parent, // ReplayTask must be a child task. Pass its parent here.
|
2013-12-02 13:50:38 +00:00
|
|
|
skiagm::GM*, // GM to run through a picture. Takes ownership.
|
|
|
|
SkBitmap reference, // Bitmap to compare picture replay results to.
|
2014-05-14 17:55:32 +00:00
|
|
|
Mode);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
virtual void draw() SK_OVERRIDE;
|
|
|
|
virtual bool shouldSkip() const SK_OVERRIDE;
|
|
|
|
virtual SkString name() const SK_OVERRIDE { return fName; }
|
|
|
|
|
|
|
|
private:
|
2014-05-14 17:55:32 +00:00
|
|
|
const bool fUseRTree;
|
2013-10-16 13:02:15 +00:00
|
|
|
const SkString fName;
|
|
|
|
SkAutoTDelete<skiagm::GM> fGM;
|
2013-10-16 19:13:38 +00:00
|
|
|
const SkBitmap fReference;
|
2013-10-16 13:02:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMReplayTask_DEFINED
|