2014-02-28 20:31:31 +00:00
|
|
|
#include "DMCpuGMTask.h"
|
2013-10-28 19:51:26 +00:00
|
|
|
#include "DMPipeTask.h"
|
2014-04-30 13:20:45 +00:00
|
|
|
#include "DMQuiltTask.h"
|
2013-10-21 18:40:25 +00:00
|
|
|
#include "DMSerializeTask.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
#include "DMUtil.h"
|
2013-10-18 20:52:44 +00:00
|
|
|
#include "DMWriteTask.h"
|
2013-10-16 13:02:15 +00:00
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
CpuGMTask::CpuGMTask(const char* config,
|
|
|
|
Reporter* reporter,
|
|
|
|
TaskRunner* taskRunner,
|
|
|
|
skiagm::GMRegistry::Factory gmFactory,
|
|
|
|
SkColorType colorType)
|
|
|
|
: CpuTask(reporter, taskRunner)
|
2013-10-16 13:02:15 +00:00
|
|
|
, fGMFactory(gmFactory)
|
|
|
|
, fGM(fGMFactory(NULL))
|
2014-02-26 23:01:57 +00:00
|
|
|
, fName(UnderJoin(fGM->getName(), config))
|
2014-02-16 00:59:25 +00:00
|
|
|
, fColorType(colorType)
|
2013-10-16 13:02:15 +00:00
|
|
|
{}
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
void CpuGMTask::draw() {
|
2014-08-11 15:08:43 +00:00
|
|
|
SkBitmap bm;
|
|
|
|
AllocatePixels(fColorType, fGM->getISize().width(), fGM->getISize().height(), &bm);
|
2013-10-16 13:02:15 +00:00
|
|
|
|
2014-08-11 15:08:43 +00:00
|
|
|
SkCanvas canvas(bm);
|
2014-09-11 19:30:12 +00:00
|
|
|
CanvasPreflight(&canvas);
|
2013-10-16 13:02:15 +00:00
|
|
|
canvas.concat(fGM->getInitialTransform());
|
|
|
|
fGM->draw(&canvas);
|
|
|
|
canvas.flush();
|
|
|
|
|
2013-12-02 13:50:38 +00:00
|
|
|
#define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __VA_ARGS__)))
|
2014-08-11 15:08:43 +00:00
|
|
|
SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kInProcess_Mode);
|
|
|
|
SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kCrossProcess_Mode);
|
|
|
|
SPAWN(PipeTask, fGMFactory(NULL), bm, PipeTask::kSharedAddress_Mode);
|
2014-06-24 19:28:34 +00:00
|
|
|
|
2014-09-29 15:44:46 +00:00
|
|
|
SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kNone_BBH);
|
|
|
|
SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kRTree_BBH);
|
|
|
|
SPAWN(QuiltTask, fGMFactory(NULL), bm, QuiltTask::kTileGrid_BBH);
|
|
|
|
|
|
|
|
SPAWN(SerializeTask, fGMFactory(NULL), bm);
|
2014-08-11 15:08:43 +00:00
|
|
|
|
Update DM JSON format.
Ex. dm --match patch -w bad --key arch x86 gpu nvidia model z620 --properties git_hash abcd build_number 20 ->
{
"build_number" : "20",
"git_hash" : "abcd",
"key" : {
"arch" : "x86",
"gpu" : "nvidia",
"model" : "z620"
},
"results" : [
{
"key" : {
"config" : "565",
"name" : "ninepatch-stretch"
},
"md5" : "f78cfafcbabaf815f3dfcf61fb59acc7",
"options" : {
"source_type" : "GM"
}
},
{
"key" : {
"config" : "8888",
"name" : "ninepatch-stretch"
},
"md5" : "3e8a42f35a1e76f00caa191e6310d789",
"options" : {
"source_type" : "GM"
}
},
...
This breaks -r, but that's okay. Going to follow up this CL with one that removes that entirely.
BUG=skia:
R=stephana@google.com, jcgregorio@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/551873003
2014-09-09 14:59:46 +00:00
|
|
|
SPAWN(WriteTask, "GM", bm);
|
2013-12-02 13:50:38 +00:00
|
|
|
#undef SPAWN
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
bool CpuGMTask::shouldSkip() const {
|
2014-02-16 00:59:25 +00:00
|
|
|
if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSkip565_Flag)) {
|
2013-10-16 13:02:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|