2014-06-03 20:57:14 +00:00
|
|
|
/*
|
|
|
|
* 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,
|
2014-08-26 17:38:07 +00:00
|
|
|
SkStreamAsset* pdf,
|
2014-06-03 20:57:14 +00:00
|
|
|
RasterizePdfProc proc)
|
|
|
|
: CpuTask(parent)
|
|
|
|
, fName(UnderJoin(parent.name().c_str(), "rasterize"))
|
2014-08-26 17:38:07 +00:00
|
|
|
, fPdf(pdf)
|
|
|
|
, fRasterize(proc) {
|
|
|
|
SkASSERT(fPdf.get());
|
|
|
|
SkASSERT(fPdf->unique());
|
|
|
|
}
|
2014-06-03 20:57:14 +00:00
|
|
|
|
|
|
|
void PDFRasterizeTask::draw() {
|
|
|
|
SkBitmap bitmap;
|
|
|
|
|
2014-08-26 17:38:07 +00:00
|
|
|
if (fRasterize(fPdf.get(), &bitmap)) {
|
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, "PDF", bitmap)));
|
2014-06-06 16:28:43 +00:00
|
|
|
} else {
|
|
|
|
this->fail();
|
2014-06-03 20:57:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|