Index: dm/DMSerializeTask.cpp |
diff --git a/dm/DMSerializeTask.cpp b/dm/DMSerializeTask.cpp |
index 62c45b3f048924c06fd2439b1b7fe5ea8446385c..86fbff33db43aa6d11fdd9c7a2b07cdcd1d860d4 100644 |
--- a/dm/DMSerializeTask.cpp |
+++ b/dm/DMSerializeTask.cpp |
@@ -7,20 +7,27 @@ |
#include "SkPixelRef.h" |
DEFINE_bool(serialize, true, "If true, run picture serialization tests."); |
+DECLARE_bool(skr); // in DMReplayTask.cpp |
+ |
+static const char* kSuffixes[] = { "serialize", "serialize_skr" }; |
+static const bool* kEnabled[] = { &FLAGS_serialize, &FLAGS_skr }; |
namespace DM { |
SerializeTask::SerializeTask(const Task& parent, |
skiagm::GM* gm, |
- SkBitmap reference) |
+ SkBitmap reference, |
+ SerializeTask::Mode mode) |
: CpuTask(parent) |
- , fName(UnderJoin(parent.name().c_str(), "serialize")) |
+ , fMode(mode) |
+ , fName(UnderJoin(parent.name().c_str(), kSuffixes[mode])) |
, fGM(gm) |
, fReference(reference) |
{} |
void SerializeTask::draw() { |
- SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get())); |
+ SkAutoTUnref<SkPicture> recorded( |
+ RecordPicture(fGM.get(), NULL/*no BBH*/, kSkRecord_Mode == fMode)); |
SkDynamicMemoryWStream wStream; |
recorded->serialize(&wStream, NULL); |
@@ -29,7 +36,7 @@ void SerializeTask::draw() { |
SkBitmap bitmap; |
AllocatePixels(fReference, &bitmap); |
- DrawPicture(reconstructed, &bitmap); |
+ DrawPicture(*reconstructed, &bitmap); |
if (!BitmapsEqual(bitmap, fReference)) { |
this->fail(); |
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); |
@@ -37,7 +44,10 @@ void SerializeTask::draw() { |
} |
bool SerializeTask::shouldSkip() const { |
- return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; |
+ if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { |
+ return true; |
+ } |
+ return !*kEnabled[fMode]; |
} |
} // namespace DM |