2014-05-14 17:55:32 +00:00
|
|
|
#include "DMSKPTask.h"
|
|
|
|
#include "DMUtil.h"
|
|
|
|
#include "DMWriteTask.h"
|
|
|
|
|
2014-06-24 19:28:34 +00:00
|
|
|
#include "SkCommandLineFlags.h"
|
|
|
|
#include "SkPictureRecorder.h"
|
|
|
|
|
2014-08-07 21:27:03 +00:00
|
|
|
DEFINE_int32(skpMaxWidth, 1000, "Max SKPTask viewport width.");
|
|
|
|
DEFINE_int32(skpMaxHeight, 1000, "Max SKPTask viewport height.");
|
2014-06-24 19:28:34 +00:00
|
|
|
|
2014-05-14 17:55:32 +00:00
|
|
|
namespace DM {
|
|
|
|
|
2014-09-08 16:12:28 +00:00
|
|
|
SKPTask::SKPTask(Reporter* r,
|
|
|
|
TaskRunner* tr,
|
|
|
|
const SkPicture* pic,
|
|
|
|
SkString filename)
|
|
|
|
: CpuTask(r, tr)
|
|
|
|
, fPicture(SkRef(pic))
|
|
|
|
, fName(FileToTaskName(filename)) {}
|
2014-05-14 17:55:32 +00:00
|
|
|
|
|
|
|
void SKPTask::draw() {
|
2014-08-29 15:03:56 +00:00
|
|
|
const int width = SkTMin(SkScalarCeilToInt(fPicture->cullRect().width()), FLAGS_skpMaxWidth),
|
|
|
|
height = SkTMin(SkScalarCeilToInt(fPicture->cullRect().height()), FLAGS_skpMaxHeight);
|
2014-05-14 17:55:32 +00:00
|
|
|
SkBitmap bitmap;
|
2014-08-07 21:27:03 +00:00
|
|
|
AllocatePixels(kN32_SkColorType, width, height, &bitmap);
|
2014-06-24 19:28:34 +00:00
|
|
|
DrawPicture(*fPicture, &bitmap);
|
2014-05-14 17:55:32 +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
|
|
|
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "SKP", bitmap)));
|
2014-05-14 17:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|