Index: dm/DMReplayTask.cpp |
diff --git a/dm/DMReplayTask.cpp b/dm/DMReplayTask.cpp |
index 86838795d26d0929c4d092c4e6ca00070bf77fce..7fd58cef6a4cf777ab789366aa80bb005e86f090 100644 |
--- a/dm/DMReplayTask.cpp |
+++ b/dm/DMReplayTask.cpp |
@@ -8,6 +8,10 @@ |
DEFINE_bool(replay, true, "If true, run picture replay tests."); |
DEFINE_bool(rtree, true, "If true, run picture replay tests with an rtree."); |
+DEFINE_bool(skr, true, "If true, run picture replay tests with SkRecord backend."); |
+ |
+static const char* kSuffixes[] = { "replay", "rtree", "skr" }; |
+static const bool* kEnabled[] = { &FLAGS_replay, &FLAGS_rtree, &FLAGS_skr }; |
namespace DM { |
@@ -16,22 +20,23 @@ ReplayTask::ReplayTask(const Task& parent, |
SkBitmap reference, |
Mode mode) |
: CpuTask(parent) |
- , fUseRTree(mode == kRTree_Mode) |
- , fName(UnderJoin(parent.name().c_str(), fUseRTree ? "rtree" : "replay")) |
+ , fMode(mode) |
+ , fName(UnderJoin(parent.name().c_str(), kSuffixes[mode])) |
, fGM(gm) |
, fReference(reference) |
{} |
void ReplayTask::draw() { |
SkAutoTDelete<SkBBHFactory> factory; |
- if (fUseRTree) { |
+ if (kRTree_Mode == fMode) { |
factory.reset(SkNEW(SkRTreeFactory)); |
} |
- SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), 0, factory.get())); |
+ SkAutoTUnref<SkPicture> recorded( |
+ RecordPicture(fGM.get(), factory.get(), kSkRecord_Mode == fMode)); |
SkBitmap bitmap; |
AllocatePixels(fReference, &bitmap); |
- DrawPicture(recorded, &bitmap); |
+ DrawPicture(*recorded, &bitmap); |
if (!BitmapsEqual(bitmap, fReference)) { |
this->fail(); |
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); |
@@ -42,14 +47,7 @@ bool ReplayTask::shouldSkip() const { |
if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { |
return true; |
} |
- |
- if (FLAGS_rtree && fUseRTree) { |
- return false; |
- } |
- if (FLAGS_replay && !fUseRTree) { |
- return false; |
- } |
- return true; |
+ return !*kEnabled[fMode]; |
} |
} // namespace DM |