15a1405999
patch from issue 167033002 BUG=skia: R=reed@google.com Author: reed@chromium.org Review URL: https://codereview.chromium.org/168653002 git-svn-id: http://skia.googlecode.com/svn/trunk@13463 2bbb7eff-a529-9590-31e7-b0007b416f81
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
#include "DMCpuTask.h"
|
|
#include "DMExpectationsTask.h"
|
|
#include "DMPipeTask.h"
|
|
#include "DMReplayTask.h"
|
|
#include "DMSerializeTask.h"
|
|
#include "DMTileGridTask.h"
|
|
#include "DMUtil.h"
|
|
#include "DMWriteTask.h"
|
|
|
|
namespace DM {
|
|
|
|
CpuTask::CpuTask(const char* name,
|
|
Reporter* reporter,
|
|
TaskRunner* taskRunner,
|
|
const Expectations& expectations,
|
|
skiagm::GMRegistry::Factory gmFactory,
|
|
SkColorType colorType)
|
|
: Task(reporter, taskRunner)
|
|
, fGMFactory(gmFactory)
|
|
, fGM(fGMFactory(NULL))
|
|
, fName(UnderJoin(fGM->shortName(), name))
|
|
, fExpectations(expectations)
|
|
, fColorType(colorType)
|
|
{}
|
|
|
|
void CpuTask::draw() {
|
|
SkBitmap bitmap;
|
|
SetupBitmap(fColorType, fGM.get(), &bitmap);
|
|
|
|
SkCanvas canvas(bitmap);
|
|
canvas.concat(fGM->getInitialTransform());
|
|
fGM->draw(&canvas);
|
|
canvas.flush();
|
|
|
|
#define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __VA_ARGS__)))
|
|
SPAWN(ExpectationsTask, fExpectations, bitmap);
|
|
|
|
SPAWN(PipeTask, fGMFactory(NULL), bitmap, false, false);
|
|
SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, false);
|
|
SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, true);
|
|
SPAWN(ReplayTask, fGMFactory(NULL), bitmap, false);
|
|
SPAWN(ReplayTask, fGMFactory(NULL), bitmap, true);
|
|
SPAWN(SerializeTask, fGMFactory(NULL), bitmap);
|
|
SPAWN(TileGridTask, fGMFactory(NULL), bitmap, SkISize::Make(16,16));
|
|
|
|
SPAWN(WriteTask, bitmap);
|
|
#undef SPAWN
|
|
}
|
|
|
|
bool CpuTask::shouldSkip() const {
|
|
if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSkip565_Flag)) {
|
|
return true;
|
|
}
|
|
if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace DM
|