blob: d06ebeb5f759d22752b41c20d8e20bc4d3566a99 [file] [log] [blame]
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +00001#ifndef DMSerializeTask_DEFINED
2#define DMSerializeTask_DEFINED
3
4#include "DMTask.h"
5#include "SkBitmap.h"
6#include "SkString.h"
7#include "SkTemplates.h"
8#include "gm.h"
9
10// Record a picture, serialize it, deserialize it, then draw it and compare to reference bitmap.
11
12namespace DM {
13
commit-bot@chromium.orgef57b7e2014-02-28 20:31:31 +000014class SerializeTask : public CpuTask {
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000015
16public:
mtklein73734562014-06-24 12:28:34 -070017 enum Mode {
18 kNormal_Mode,
19 kSkRecord_Mode,
20 };
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000021 SerializeTask(const Task& parent,
22 skiagm::GM*,
mtklein73734562014-06-24 12:28:34 -070023 SkBitmap reference,
24 Mode mode);
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000025
26 virtual void draw() SK_OVERRIDE;
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000027 virtual bool shouldSkip() const SK_OVERRIDE;
28 virtual SkString name() const SK_OVERRIDE { return fName; }
29
30private:
mtklein73734562014-06-24 12:28:34 -070031 const Mode fMode;
commit-bot@chromium.org192cbf62013-10-21 18:40:25 +000032 const SkString fName;
33 SkAutoTDelete<skiagm::GM> fGM;
34 const SkBitmap fReference;
35};
36
37} // namespace DM
38
39#endif // DMSerializeTask_DEFINED