Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
SkBigPicture Class Referencefinal

#include <SkBigPicture.h>

Inheritance diagram for SkBigPicture:
SkPicture SkRefCnt SkRefCntBase

Classes

class  SnapshotArray
 

Public Member Functions

 SkBigPicture (const SkRect &cull, sk_sp< SkRecord >, std::unique_ptr< SnapshotArray >, sk_sp< SkBBoxHierarchy >, size_t approxBytesUsedBySubPictures)
 
void playback (SkCanvas *, AbortCallback *) const override
 
SkRect cullRect () const override
 
int approximateOpCount (bool nested) const override
 
size_t approximateBytesUsed () const override
 
const SkBigPictureasSkBigPicture () const override
 
const SkBBoxHierarchybbh () const
 
const SkRecordrecord () const
 
- Public Member Functions inherited from SkPicture
 ~SkPicture () override
 
virtual void playback (SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
 
virtual SkRect cullRect () const =0
 
uint32_t uniqueID () const
 
sk_sp< SkDataserialize (const SkSerialProcs *procs=nullptr) const
 
void serialize (SkWStream *stream, const SkSerialProcs *procs=nullptr) const
 
virtual int approximateOpCount (bool nested=false) const =0
 
virtual size_t approximateBytesUsed () const =0
 
sk_sp< SkShadermakeShader (SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const
 
sk_sp< SkShadermakeShader (SkTileMode tmx, SkTileMode tmy, SkFilterMode mode) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Static Public Member Functions inherited from SkPicture
static sk_sp< SkPictureMakeFromStream (SkStream *stream, const SkDeserialProcs *procs=nullptr)
 
static sk_sp< SkPictureMakeFromData (const SkData *data, const SkDeserialProcs *procs=nullptr)
 
static sk_sp< SkPictureMakeFromData (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
static sk_sp< SkPictureMakePlaceholder (SkRect cull)
 

Detailed Description

Definition at line 27 of file SkBigPicture.h.

Constructor & Destructor Documentation

◆ SkBigPicture()

SkBigPicture::SkBigPicture ( const SkRect cull,
sk_sp< SkRecord record,
std::unique_ptr< SnapshotArray drawablePicts,
sk_sp< SkBBoxHierarchy bbh,
size_t  approxBytesUsedBySubPictures 
)

Definition at line 19 of file SkBigPicture.cpp.

24 : fCullRect(cull)
25 , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures)
26 , fRecord(std::move(record))
27 , fDrawablePicts(std::move(drawablePicts))
28 , fBBH(std::move(bbh))
29{}
const SkRecord * record() const
Definition: SkBigPicture.h:58
const SkBBoxHierarchy * bbh() const
Definition: SkBigPicture.h:57

Member Function Documentation

◆ approximateBytesUsed()

size_t SkBigPicture::approximateBytesUsed ( ) const
overridevirtual

Returns the approximate byte size of SkPicture. Does not include large objects referenced by SkPicture.

Returns
approximate size

example: https://fiddle.skia.org/c/@Picture_approximateBytesUsed

Implements SkPicture.

Definition at line 69 of file SkBigPicture.cpp.

69 {
70 size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubPictures;
71 if (fBBH) { bytes += fBBH->bytesUsed(); }
72 return bytes;
73}
virtual size_t bytesUsed() const =0
size_t bytesUsed() const
Definition: SkRecord.cpp:25

◆ approximateOpCount()

int SkBigPicture::approximateOpCount ( bool  nested) const
overridevirtual

Returns the approximate number of operations in SkPicture. Returned value may be greater or less than the number of SkCanvas calls recorded: some calls may be recorded as more than one operation, other calls may be optimized away.

Parameters
nestedif true, include the op-counts of nested pictures as well, else just return count the ops in the top-level picture.
Returns
approximate operation count

example: https://fiddle.skia.org/c/@Picture_approximateOpCount

Implements SkPicture.

Definition at line 58 of file SkBigPicture.cpp.

58 {
59 if (nested) {
61 for (int i = 0; i < fRecord->count(); i++) {
62 fRecord->visit(i, visitor);
63 }
64 return visitor.fCount;
65 } else {
66 return fRecord->count();
67 }
68}
auto visit(int i, F &&f) const -> decltype(f(SkRecords::NoOp()))
Definition: SkRecord.h:45
int count() const
Definition: SkRecord.h:38

◆ asSkBigPicture()

const SkBigPicture * SkBigPicture::asSkBigPicture ( ) const
inlineoverridevirtual

Reimplemented from SkPicture.

Definition at line 54 of file SkBigPicture.h.

54{ return this; }

◆ bbh()

const SkBBoxHierarchy * SkBigPicture::bbh ( ) const
inline

Definition at line 57 of file SkBigPicture.h.

57{ return fBBH.get(); }
T * get() const
Definition: SkRefCnt.h:303

◆ cullRect()

SkRect SkBigPicture::cullRect ( ) const
overridevirtual

Returns cull SkRect for this picture, passed in when SkPicture was created. Returned SkRect does not specify clipping SkRect for SkPicture; cull is hint of SkPicture bounds.

SkPicture is free to discard recorded drawing commands that fall outside cull.

Returns
bounds passed when SkPicture was created

example: https://fiddle.skia.org/c/@Picture_cullRect

Implements SkPicture.

Definition at line 57 of file SkBigPicture.cpp.

57{ return fCullRect; }

◆ playback()

void SkBigPicture::playback ( SkCanvas canvas,
AbortCallback callback 
) const
overridevirtual

Replays the drawing commands on the specified canvas. In the case that the commands are recorded, each command in the SkPicture is sent separately to canvas.

To add a single command to draw SkPicture to recording canvas, call SkCanvas::drawPicture instead.

Parameters
canvasreceiver of drawing commands
callbackallows interruption of playback

example: https://fiddle.skia.org/c/@Picture_playback

Implements SkPicture.

Definition at line 31 of file SkBigPicture.cpp.

31 {
32 SkASSERT(canvas);
33
34 // If the query contains the whole picture, don't bother with the BBH.
35 const bool useBBH = !canvas->getLocalClipBounds().contains(this->cullRect());
36
37 SkRecordDraw(*fRecord,
38 canvas,
39 this->drawablePicts(),
40 nullptr,
41 this->drawableCount(),
42 useBBH ? fBBH.get() : nullptr,
43 callback);
44}
#define SkASSERT(cond)
Definition: SkAssert.h:116
void SkRecordDraw(const SkRecord &record, SkCanvas *canvas, SkPicture const *const drawablePicts[], SkDrawable *const drawables[], int drawableCount, const SkBBoxHierarchy *bbh, SkPicture::AbortCallback *callback)
SkRect cullRect() const override
SkRect getLocalClipBounds() const
Definition: SkCanvas.cpp:1586
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
bool contains(SkScalar x, SkScalar y) const
Definition: extension.cpp:19

◆ record()

const SkRecord * SkBigPicture::record ( ) const
inline

Definition at line 58 of file SkBigPicture.h.

58{ return fRecord.get(); }

The documentation for this class was generated from the following files: