Skia
2DGraphicsLibrary
|
An SkPicture records drawing commands made to a canvas to be played back at a later time. More...
#include <SkPicture.h>
Classes | |
class | AbortCallback |
Subclasses of this can be passed to playback(). More... | |
struct | DeletionMessage |
Public Types | |
typedef bool(* | InstallPixelRefProc )(const void *src, size_t length, SkBitmap *dst) |
Function signature defining a function that sets up an SkBitmap from encoded data. More... | |
Public Member Functions | |
virtual void | playback (SkCanvas *, AbortCallback *=NULL) const =0 |
Replays the drawing commands on the specified canvas. More... | |
virtual SkRect | cullRect () const =0 |
Return a cull rect for this picture. More... | |
uint32_t | uniqueID () const |
Returns a non-zero value unique among all pictures. More... | |
sk_sp< SkData > | serialize (SkPixelSerializer *=nullptr) const |
Serialize the picture to SkData. More... | |
void | serialize (SkWStream *, SkPixelSerializer *=nullptr) const |
Serialize to a stream. More... | |
void | flatten (SkWriteBuffer &) const |
Serialize to a buffer. | |
virtual bool | willPlayBackBitmaps () const =0 |
Returns true if any bitmaps may be produced when this SkPicture is replayed. | |
virtual int | approximateOpCount () const =0 |
Return the approximate number of operations in this picture. More... | |
virtual size_t | approximateBytesUsed () const =0 |
Returns the approximate byte size of this picture, not including large ref'd objects. More... | |
virtual const SkBigPicture * | asSkBigPicture () const |
![]() | |
SkRefCntBase () | |
Default construct, initializing the reference count to 1. | |
virtual | ~SkRefCntBase () |
Destruct, asserting that the reference count is 1. | |
int32_t | getRefCnt () const |
Return the reference count. More... | |
void | validate () const |
bool | unique () const |
May return true if the caller is the only owner. More... | |
void | ref () const |
Increment the reference count. More... | |
void | unref () const |
Decrement the reference count. More... | |
Static Public Member Functions | |
static sk_sp< SkPicture > | MakeFromStream (SkStream *, SkImageDeserializer *) |
Recreate a picture that was serialized into a stream. More... | |
static sk_sp< SkPicture > | MakeFromStream (SkStream *) |
static sk_sp< SkPicture > | MakeFromData (const void *data, size_t size, SkImageDeserializer *=nullptr) |
static sk_sp< SkPicture > | MakeFromData (const SkData *data, SkImageDeserializer *=nullptr) |
static sk_sp< SkPicture > | MakeFromBuffer (SkReadBuffer &) |
Recreate a picture that was serialized into a buffer. More... | |
static bool | InternalOnly_StreamIsSKP (SkStream *, SkPictInfo *) |
Return true if the SkStream/Buffer represents a serialized picture, and fills out SkPictInfo. More... | |
static bool | InternalOnly_BufferIsSKP (SkReadBuffer *, SkPictInfo *) |
static void | SetPictureIOSecurityPrecautionsEnabled_Dangerous (bool set) |
static bool | PictureIOSecurityPrecautionsEnabled () |
Private Member Functions | |
void | serialize (SkWStream *, SkPixelSerializer *, SkRefCntSet *typefaces) const |
virtual int | numSlowPaths () const =0 |
SkPictInfo | createHeader () const |
SkPictureData * | backport () const |
Static Private Member Functions | |
static sk_sp< SkPicture > | MakeFromStream (SkStream *, SkImageDeserializer *, SkTypefacePlayback *) |
static bool | IsValidPictInfo (const SkPictInfo &info) |
static sk_sp< SkPicture > | Forwardport (const SkPictInfo &, const SkPictureData *, SkReadBuffer *buffer) |
Private Attributes | |
uint32_t | fUniqueID |
Static Private Attributes | |
static const uint32_t | MIN_PICTURE_VERSION = 51 |
static const uint32_t | CURRENT_PICTURE_VERSION = 55 |
Friends | |
class | SkBigPicture |
class | SkEmptyPicture |
template<typename > | |
class | SkMiniPicture |
class | SkPictureData |
class | SkPictureGpuAnalyzer |
struct | SkPathCounter |
Additional Inherited Members | |
![]() | |
void | internal_dispose_restore_refcnt_to_1 () const |
Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More... | |
An SkPicture records drawing commands made to a canvas to be played back at a later time.
This base class handles serialization and a few other miscellany.
typedef bool(* SkPicture::InstallPixelRefProc)(const void *src, size_t length, SkBitmap *dst) |
Function signature defining a function that sets up an SkBitmap from encoded data.
On success, the SkBitmap should have its Config, width, height, rowBytes and pixelref set. If the installed pixelref has decoded the data into pixels, then the src buffer need not be copied. If the pixelref defers the actual decode until its lockPixels() is called, then it must make a copy of the src buffer.
src | Encoded data. |
length | Size of the encoded data, in bytes. |
dst | SkBitmap to install the pixel ref on. |
bool | Whether or not a pixel ref was successfully installed. |
|
pure virtual |
Returns the approximate byte size of this picture, not including large ref'd objects.
|
pure virtual |
Return the approximate number of operations in this picture.
This number may be greater or less than the number of SkCanvas calls recorded: some calls may be recorded as more than one operation, or some calls may be optimized away.
|
pure virtual |
Return a cull rect for this picture.
Ops recorded into this picture that attempt to draw outside the cull might not be drawn.
|
static |
Return true if the SkStream/Buffer represents a serialized picture, and fills out SkPictInfo.
After this function returns, the data source is not rewound so it will have to be manually reset before passing to CreateFromStream or CreateFromBuffer. Note, CreateFromStream and CreateFromBuffer perform this check internally so these entry points are intended for stand alone tools. If false is returned, SkPictInfo is unmodified.
Recreate a picture that was serialized into a buffer.
If the creation requires bitmap decoding, the decoder must be set on the SkReadBuffer parameter by calling SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuffer().
SkReadBuffer | Serialized picture data. |
|
static |
Recreate a picture that was serialized into a stream.
Any serialized images in the stream will be passed the image-deserializer, or if that is null, to the default deserializer that will call SkImage::MakeFromEncoded().
|
pure virtual |
Replays the drawing commands on the specified canvas.
Note that this has the effect of unfurling this picture into the destination canvas. Using the SkCanvas::drawPicture entry point gives the destination canvas the option of just taking a ref.
canvas | the canvas receiving the drawing commands. |
callback | a callback that allows interruption of playback |
sk_sp<SkData> SkPicture::serialize | ( | SkPixelSerializer * | = nullptr | ) | const |
Serialize the picture to SkData.
If non nullptr, pixel-serializer will be used to customize how images reference by the picture are serialized/compressed.
void SkPicture::serialize | ( | SkWStream * | , |
SkPixelSerializer * | = nullptr |
||
) | const |
Serialize to a stream.
If non nullptr, pixel-serializer will be used to customize how images reference by the picture are serialized/compressed.
uint32_t SkPicture::uniqueID | ( | ) | const |
Returns a non-zero value unique among all pictures.