blob: f2ed89d147225e342fed029bc2cdc1efba85eda0 [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,
mtklein73734562014-06-24 12:28:34 -070020 kSkRecord_Mode,
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000021 };
commit-bot@chromium.orgc1362422013-10-30 20:45:28 +000022 ReplayTask(const Task& parent, // ReplayTask must be a child task. Pass its parent here.
rmistry@google.comd6bab022013-12-02 13:50:38 +000023 skiagm::GM*, // GM to run through a picture. Takes ownership.
24 SkBitmap reference, // Bitmap to compare picture replay results to.
commit-bot@chromium.org90b5a2a2014-05-14 17:55:32 +000025 Mode);
mtklein@google.comd36522d2013-10-16 13:02:15 +000026
27 virtual void draw() SK_OVERRIDE;
mtklein@google.comd36522d2013-10-16 13:02:15 +000028 virtual bool shouldSkip() const SK_OVERRIDE;
29 virtual SkString name() const SK_OVERRIDE { return fName; }
30
31private:
mtklein73734562014-06-24 12:28:34 -070032 const Mode fMode;
mtklein@google.comd36522d2013-10-16 13:02:15 +000033 const SkString fName;
34 SkAutoTDelete<skiagm::GM> fGM;
commit-bot@chromium.org66bb3d12013-10-16 19:13:38 +000035 const SkBitmap fReference;
mtklein@google.comd36522d2013-10-16 13:02:15 +000036};
37
38} // namespace DM
39
40#endif // DMReplayTask_DEFINED