blob: 78bef0dfd8aae9399d1694e0066e24472188b088 [file] [log] [blame]
mtklein@google.comd36522d2013-10-16 13:02:15 +00001#ifndef DMReplayTask_DEFINED
2#define DMReplayTask_DEFINED
3
mtklein@google.comd36522d2013-10-16 13:02:15 +00004#include "DMTask.h"
mtklein@google.comd36522d2013-10-16 13:02:15 +00005#include "SkBitmap.h"
6#include "SkString.h"
7#include "SkTemplates.h"
8#include "gm.h"
mtklein@google.comd36522d2013-10-16 13:02:15 +00009
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +000010// Records a GM through an SkPicture, draws it, and compares against the reference bitmap.
mtklein@google.comd36522d2013-10-16 13:02:15 +000011
12namespace DM {
13
commit-bot@chromium.orgef57b7e2014-02-28 20:31:31 +000014class ReplayTask : public CpuTask {
mtklein@google.comd36522d2013-10-16 13:02:15 +000015
16public:
commit-bot@chromium.orgc1362422013-10-30 20:45:28 +000017 ReplayTask(const Task& parent, // ReplayTask must be a child task. Pass its parent here.
rmistry@google.comd6bab022013-12-02 13:50:38 +000018 skiagm::GM*, // GM to run through a picture. Takes ownership.
19 SkBitmap reference, // Bitmap to compare picture replay results to.
commit-bot@chromium.orgc1362422013-10-30 20:45:28 +000020 bool useRTree); // Record with an RTree?
mtklein@google.comd36522d2013-10-16 13:02:15 +000021
22 virtual void draw() SK_OVERRIDE;
mtklein@google.comd36522d2013-10-16 13:02:15 +000023 virtual bool shouldSkip() const SK_OVERRIDE;
24 virtual SkString name() const SK_OVERRIDE { return fName; }
25
26private:
27 const SkString fName;
28 SkAutoTDelete<skiagm::GM> fGM;
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +000029 const SkBitmap fReference;
commit-bot@chromium.orgc1362422013-10-30 20:45:28 +000030 const bool fUseRTree;
mtklein@google.comd36522d2013-10-16 13:02:15 +000031};
32
33} // namespace DM
34
35#endif // DMReplayTask_DEFINED