192cbf67b2
Plus: - minor ReplayTask refactoring to share code with SerializeTask - move --replay to ReplayTask and --serialize to SerializeTask like WriteTask - when --writePath is given, write failures for Replay and Serialize tasks - function names have fewer blatant Skia style violations BUG= R=bsalomon@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/32613003 git-svn-id: http://skia.googlecode.com/svn/trunk@11890 2bbb7eff-a529-9590-31e7-b0007b416f81
39 lines
948 B
C++
39 lines
948 B
C++
#include "DMReplayTask.h"
|
|
#include "DMWriteTask.h"
|
|
#include "DMUtil.h"
|
|
|
|
#include "SkCommandLineFlags.h"
|
|
#include "SkPicture.h"
|
|
|
|
DEFINE_bool(replay, false, "If true, run picture replay tests.");
|
|
|
|
namespace DM {
|
|
|
|
ReplayTask::ReplayTask(const Task& parent,
|
|
skiagm::GM* gm,
|
|
SkBitmap reference)
|
|
: Task(parent)
|
|
, fName(UnderJoin(parent.name().c_str(), "replay"))
|
|
, fGM(gm)
|
|
, fReference(reference)
|
|
{}
|
|
|
|
void ReplayTask::draw() {
|
|
SkPicture recorded;
|
|
RecordPicture(fGM.get(), &recorded);
|
|
|
|
SkBitmap bitmap;
|
|
SetupBitmap(fReference.config(), fGM.get(), &bitmap);
|
|
DrawPicture(&recorded, &bitmap);
|
|
if (!BitmapsEqual(bitmap, fReference)) {
|
|
this->fail();
|
|
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
|
|
}
|
|
}
|
|
|
|
bool ReplayTask::shouldSkip() const {
|
|
return !FLAGS_replay || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag;
|
|
}
|
|
|
|
} // namespace DM
|