skia2/dm/DMCpuTask.cpp
commit-bot@chromium.org c1362424b8 DM: add --rtree.
BUG=
R=epoger@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/51243003

git-svn-id: http://skia.googlecode.com/svn/trunk@12033 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-30 20:45:28 +00:00

59 lines
1.8 KiB
C++

#include "DMCpuTask.h"
#include "DMPipeTask.h"
#include "DMReplayTask.h"
#include "DMSerializeTask.h"
#include "DMUtil.h"
#include "DMWriteTask.h"
namespace DM {
CpuTask::CpuTask(const char* name,
Reporter* reporter,
TaskRunner* taskRunner,
const skiagm::ExpectationsSource& expectations,
skiagm::GMRegistry::Factory gmFactory,
SkBitmap::Config config)
: Task(reporter, taskRunner)
, fGMFactory(gmFactory)
, fGM(fGMFactory(NULL))
, fName(UnderJoin(fGM->shortName(), name))
, fExpectations(expectations.get(Png(fName).c_str()))
, fConfig(config)
{}
void CpuTask::draw() {
SkBitmap bitmap;
SetupBitmap(fConfig, fGM.get(), &bitmap);
SkCanvas canvas(bitmap);
canvas.concat(fGM->getInitialTransform());
fGM->draw(&canvas);
canvas.flush();
if (!MeetsExpectations(fExpectations, bitmap)) {
this->fail();
}
this->spawnChild(SkNEW_ARGS(PipeTask, (*this, fGMFactory(NULL), bitmap, false, false)));
this->spawnChild(SkNEW_ARGS(PipeTask, (*this, fGMFactory(NULL), bitmap, true, false)));
this->spawnChild(SkNEW_ARGS(PipeTask, (*this, fGMFactory(NULL), bitmap, true, true)));
this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap, true)));
this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap, false)));
this->spawnChild(SkNEW_ARGS(SerializeTask, (*this, fGMFactory(NULL), bitmap)));
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
}
bool CpuTask::shouldSkip() const {
if (SkBitmap::kRGB_565_Config == fConfig && (fGM->getFlags() & skiagm::GM::kSkip565_Flag)) {
return true;
}
if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
return true;
}
return false;
}
} // namespace DM