DM: add --serialize
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
diff --git a/dm/DMCpuTask.cpp b/dm/DMCpuTask.cpp
index 316f341..f6edf23 100644
--- a/dm/DMCpuTask.cpp
+++ b/dm/DMCpuTask.cpp
@@ -1,11 +1,8 @@
#include "DMCpuTask.h"
#include "DMReplayTask.h"
+#include "DMSerializeTask.h"
#include "DMUtil.h"
#include "DMWriteTask.h"
-#include "SkCommandLineFlags.h"
-
-DEFINE_bool(replay, false, "If true, run replay tests for each CpuTask.");
-// TODO(mtklein): add the other various options
namespace DM {
@@ -18,30 +15,26 @@
: Task(reporter, taskRunner)
, fGMFactory(gmFactory)
, fGM(fGMFactory(NULL))
- , fName(underJoin(fGM->shortName(), name))
- , fExpectations(expectations.get(png(fName).c_str()))
+ , fName(UnderJoin(fGM->shortName(), name))
+ , fExpectations(expectations.get(Png(fName).c_str()))
, fConfig(config)
{}
void CpuTask::draw() {
SkBitmap bitmap;
- bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt(fGM->height()));
- bitmap.allocPixels();
- bitmap.eraseColor(0x00000000);
- SkCanvas canvas(bitmap);
+ SetupBitmap(fConfig, fGM.get(), &bitmap);
+ SkCanvas canvas(bitmap);
canvas.concat(fGM->getInitialTransform());
fGM->draw(&canvas);
canvas.flush();
- if (!meetsExpectations(fExpectations, bitmap)) {
+ if (!MeetsExpectations(fExpectations, bitmap)) {
this->fail();
}
- if (FLAGS_replay) {
- this->spawnChild(SkNEW_ARGS(ReplayTask,
- ("replay", *this, fGMFactory(NULL), bitmap)));
- }
+ this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap)));
+ this->spawnChild(SkNEW_ARGS(SerializeTask, (*this, fGMFactory(NULL), bitmap)));
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
}