blob: de28172000d6eba391554e3ad0ac57543583be79 [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.org90b5a2a2014-05-14 17:55:32 +000017 enum Mode {
18 kNormal_Mode,
19 kRTree_Mode,
20 };
commit-bot@chromium.orgc1362422013-10-30 20:45:28 +000021 ReplayTask(const Task& parent, // ReplayTask must be a child task. Pass its parent here.
rmistry@google.comd6bab022013-12-02 13:50:38 +000022 skiagm::GM*, // GM to run through a picture. Takes ownership.
23 SkBitmap reference, // Bitmap to compare picture replay results to.
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000024 Mode);
mtklein@google.comd36522d2013-10-16 13:02:15 +000025
26 virtual void draw() SK_OVERRIDE;
mtklein@google.comd36522d2013-10-16 13:02:15 +000027 virtual bool shouldSkip() const SK_OVERRIDE;
28 virtual SkString name() const SK_OVERRIDE { return fName; }
29
30private:
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000031 const bool fUseRTree;
mtklein@google.comd36522d2013-10-16 13:02:15 +000032 const SkString fName;
33 SkAutoTDelete<skiagm::GM> fGM;
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +000034 const SkBitmap fReference;
mtklein@google.comd36522d2013-10-16 13:02:15 +000035};
36
37} // namespace DM
38
39#endif // DMReplayTask_DEFINED