skia2/dm/DMPDFRasterizeTask.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

39 lines
887 B
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "DMPDFRasterizeTask.h"
#include "DMUtil.h"
#include "DMWriteTask.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkStream.h"
namespace DM {
PDFRasterizeTask::PDFRasterizeTask(const Task& parent,
SkStreamAsset* pdf,
RasterizePdfProc proc)
: CpuTask(parent)
, fName(UnderJoin(parent.name().c_str(), "rasterize"))
, fPdf(pdf)
, fRasterize(proc) {
SkASSERT(fPdf.get());
SkASSERT(fPdf->unique());
}
void PDFRasterizeTask::draw() {
SkBitmap bitmap;
if (fRasterize(fPdf.get(), &bitmap)) {
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "PDF", bitmap)));
} else {
this->fail();
}
}
} // namespace DM