114c3cd054
Reason for revert: plenty of data Original issue's description: > Sketch DM refactor. > > BUG=skia:3255 > > > I think this supports everything DM used to, but has completely refactored how > it works to fit the design in the bug. > > Configs like "tiles-gpu" are automatically wired up. > > I wouldn't suggest looking at this as a diff. There's just a bunch of deleted > files, a few new files, and one new file that shares a name with a deleted file > (DM.cpp). > > NOTREECHECKS=true > > Committed: https://skia.googlesource.com/skia/+/709d2c3e5062c5b57f91273bfc11a751f5b2bb88 TBR=bsalomon@google.com,mtklein@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia:3255 Review URL: https://codereview.chromium.org/853883004
32 lines
945 B
C++
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
|