skia2/dm/DMSKPTask.cpp
mtklein ea65bfa8de 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 07:59:46 -07:00

32 lines
945 B
C++

#include "DMSKPTask.h"
#include "DMUtil.h"
#include "DMWriteTask.h"
#include "SkCommandLineFlags.h"
#include "SkPictureRecorder.h"
DEFINE_int32(skpMaxWidth, 1000, "Max SKPTask viewport width.");
DEFINE_int32(skpMaxHeight, 1000, "Max SKPTask viewport height.");
namespace DM {
SKPTask::SKPTask(Reporter* r,
TaskRunner* tr,
const SkPicture* pic,
SkString filename)
: CpuTask(r, tr)
, fPicture(SkRef(pic))
, fName(FileToTaskName(filename)) {}
void SKPTask::draw() {
const int width = SkTMin(SkScalarCeilToInt(fPicture->cullRect().width()), FLAGS_skpMaxWidth),
height = SkTMin(SkScalarCeilToInt(fPicture->cullRect().height()), FLAGS_skpMaxHeight);
SkBitmap bitmap;
AllocatePixels(kN32_SkColorType, width, height, &bitmap);
DrawPicture(*fPicture, &bitmap);
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "SKP", bitmap)));
}
} // namespace DM