Flutter Engine
The Flutter Engine
Classes | Namespaces | Functions
SkRecordDraw.h File Reference
#include "include/core/SkBBHFactory.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkM44.h"
#include "include/core/SkPicture.h"
#include "include/private/base/SkNoncopyable.h"

Go to the source code of this file.

Classes

class  SkRecords::Draw
 

Namespaces

namespace  SkRecords
 

Functions

void SkRecordFillBounds (const SkRect &cullRect, const SkRecord &, SkRect bounds[], SkBBoxHierarchy::Metadata[])
 
void SkRecordDraw (const SkRecord &, SkCanvas *, SkPicture const *const drawablePicts[], SkDrawable *const drawables[], int drawableCount, const SkBBoxHierarchy *, SkPicture::AbortCallback *)
 

Function Documentation

◆ SkRecordDraw()

void SkRecordDraw ( const SkRecord record,
SkCanvas canvas,
SkPicture const *const  drawablePicts[],
SkDrawable *const  drawables[],
int  drawableCount,
const SkBBoxHierarchy bbh,
SkPicture::AbortCallback callback 
)

Definition at line 45 of file SkRecordDraw.cpp.

51 {
52 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
53
54 if (bbh) {
55 // Draw only ops that affect pixels in the canvas's current clip.
56 // The SkRecord and BBH were recorded in identity space. This canvas
57 // is not necessarily in that same space. getLocalClipBounds() returns us
58 // this canvas' clip bounds transformed back into identity space, which
59 // lets us query the BBH.
60 SkRect query = canvas->getLocalClipBounds();
61
62 std::vector<int> ops;
63 bbh->search(query, &ops);
64
65 SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
66 for (int i = 0; i < (int)ops.size(); i++) {
67 if (callback && callback->abort()) {
68 return;
69 }
70 // This visit call uses the SkRecords::Draw::operator() to call
71 // methods on the |canvas|, wrapped by methods defined with the
72 // DRAW() macro.
73 record.visit(ops[i], draw);
74 }
75 } else {
76 // Draw all ops.
77 SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
78 for (int i = 0; i < record.count(); i++) {
79 if (callback && callback->abort()) {
80 return;
81 }
82 // This visit call uses the SkRecords::Draw::operator() to call
83 // methods on the |canvas|, wrapped by methods defined with the
84 // DRAW() macro.
85 record.visit(i, draw);
86 }
87 }
88}
SkPathOp ops[]
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
virtual void search(const SkRect &query, std::vector< int > *results) const =0
SkRect getLocalClipBounds() const
Definition: SkCanvas.cpp:1586
auto visit(int i, F &&f) const -> decltype(f(SkRecords::NoOp()))
Definition: SkRecord.h:45
int count() const
Definition: SkRecord.h:38
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ SkRecordFillBounds()

void SkRecordFillBounds ( const SkRect cullRect,
const SkRecord record,
SkRect  bounds[],
SkBBoxHierarchy::Metadata  meta[] 
)

Definition at line 577 of file SkRecordDraw.cpp.

578 {
579 {
580 SkRecords::FillBounds visitor(cullRect, record, bounds, meta);
581 for (int i = 0; i < record.count(); i++) {
582 visitor.setCurrentOp(i);
583 record.visit(i, visitor);
584 }
585 }
586}
Optional< SkRect > bounds
Definition: SkRecords.h:189