void SkBigPicture::Analysis::init(const SkRecord& record) { TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::init()"); SkBitmapHunter bitmap; SkPathCounter path; bool hasBitmap = false; for (int i = 0; i < record.count(); i++) { hasBitmap = hasBitmap || record.visit(i, bitmap); record.visit(i, path); } fWillPlaybackBitmaps = hasBitmap; fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects, 255); }
void SkRecordDraw(const SkRecord& record, SkCanvas* canvas, SkPicture const* const drawablePicts[], SkDrawable* const drawables[], int drawableCount, const SkBBoxHierarchy* bbh, SkPicture::AbortCallback* callback) { SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); if (bbh) { // Draw only ops that affect pixels in the canvas's current clip. // The SkRecord and BBH were recorded in identity space. This canvas // is not necessarily in that same space. getClipBounds() returns us // this canvas' clip bounds transformed back into identity space, which // lets us query the BBH. SkRect query; if (!canvas->getClipBounds(&query)) { query.setEmpty(); } SkTDArray<int> ops; bbh->search(query, &ops); SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount); for (int i = 0; i < ops.count(); i++) { if (callback && callback->abort()) { return; } // This visit call uses the SkRecords::Draw::operator() to call // methods on the |canvas|, wrapped by methods defined with the // DRAW() macro. record.visit(ops[i], draw); } } else { // Draw all ops. SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount); for (int i = 0; i < record.count(); i++) { if (callback && callback->abort()) { return; } // This visit call uses the SkRecords::Draw::operator() to call // methods on the |canvas|, wrapped by methods defined with the // DRAW() macro. record.visit(i, draw); } } }
void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect bounds[]) { SkRecords::FillBounds visitor(cullRect, record, bounds); for (int curOp = 0; curOp < record.count(); curOp++) { visitor.setCurrentOp(curOp); record.visit(curOp, visitor); } visitor.cleanUp(); }
void DumpRecord(const SkRecord& record, SkCanvas* canvas, bool timeWithCommand) { Dumper dumper(canvas, record.count(), timeWithCommand); for (int i = 0; i < record.count(); i++) { record.visit(i, dumper); } }
void SkRecordPartialDraw(const SkRecord& record, SkCanvas* canvas, SkPicture const* const drawablePicts[], int drawableCount, int start, int stop, const SkMatrix& initialCTM) { SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); stop = SkTMin(stop, record.count()); SkRecords::Draw draw(canvas, drawablePicts, nullptr, drawableCount, &initialCTM); for (int i = start; i < stop; i++) { record.visit(i, draw); } }
void SkRecordDraw(const SkRecord& record, SkCanvas* canvas) { for (Draw draw(canvas); draw.index() < record.count(); draw.next()) { record.visit(draw.index(), draw); } }
void apply(const SkRecord& record) { for (int i = 0; i < record.count(); i++) { record.visit(i, *this); } }