c92e550d36
BUG=skia: R=robertphillips@google.com, reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/492023002
27 lines
817 B
C++
27 lines
817 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(fPicture->width(), FLAGS_skpMaxWidth),
|
|
height = SkTMin(fPicture->height(), FLAGS_skpMaxHeight);
|
|
SkBitmap bitmap;
|
|
AllocatePixels(kN32_SkColorType, width, height, &bitmap);
|
|
DrawPicture(*fPicture, &bitmap);
|
|
|
|
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
|
|
}
|
|
|
|
} // namespace DM
|