DMReplayTask.h revision c1362424b864ee3ae7aa44971985e5481057363a
1d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#ifndef DMReplayTask_DEFINED
2d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#define DMReplayTask_DEFINED
3d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
4d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#include "DMTask.h"
5d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#include "SkBitmap.h"
6d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#include "SkString.h"
7d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#include "SkTemplates.h"
8d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#include "gm.h"
9d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
1066bb3d1f5e451f8501f5c28d1dc28fcef6e908e1commit-bot@chromium.org// Records a GM through an SkPicture, draws it, and compares against the reference bitmap.
11d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
12d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.comnamespace DM {
13d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
14d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.comclass ReplayTask : public Task {
15d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
16d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.compublic:
17c1362424b864ee3ae7aa44971985e5481057363acommit-bot@chromium.org    ReplayTask(const Task& parent,  // ReplayTask must be a child task.  Pass its parent here.
18c1362424b864ee3ae7aa44971985e5481057363acommit-bot@chromium.org               skiagm::GM*,         // GM to run through a pipe.  Takes ownership.
19c1362424b864ee3ae7aa44971985e5481057363acommit-bot@chromium.org               SkBitmap reference,  // Bitmap to compare pipe results to.
20c1362424b864ee3ae7aa44971985e5481057363acommit-bot@chromium.org               bool useRTree);      // Record with an RTree?
21d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
22d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com    virtual void draw() SK_OVERRIDE;
23d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com    virtual bool usesGpu() const SK_OVERRIDE { return false; }
24d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com    virtual bool shouldSkip() const SK_OVERRIDE;
25d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com    virtual SkString name() const SK_OVERRIDE { return fName; }
26d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
27d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.comprivate:
28d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com    const SkString fName;
29d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com    SkAutoTDelete<skiagm::GM> fGM;
3066bb3d1f5e451f8501f5c28d1dc28fcef6e908e1commit-bot@chromium.org    const SkBitmap fReference;
31c1362424b864ee3ae7aa44971985e5481057363acommit-bot@chromium.org    const bool fUseRTree;
32d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com};
33d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
34d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com}  // namespace DM
35d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com
36d36522d12d3e71958e50683a7eef43dc2a47d96dmtklein@google.com#endif  // DMReplayTask_DEFINED
37