Flutter Engine
The Flutter Engine
|
#include <SkDrawable.h>
Classes | |
class | GpuDrawHandler |
Public Member Functions | |
void | draw (SkCanvas *, const SkMatrix *=nullptr) |
void | draw (SkCanvas *, SkScalar x, SkScalar y) |
std::unique_ptr< GpuDrawHandler > | snapGpuDrawHandler (GrBackendApi backendApi, const SkMatrix &matrix, const SkIRect &clipBounds, const SkImageInfo &bufferInfo) |
sk_sp< SkPicture > | makePictureSnapshot () |
uint32_t | getGenerationID () |
SkRect | getBounds () |
size_t | approximateBytesUsed () |
void | notifyDrawingChanged () |
SkFlattenable::Type | getFlattenableType () const override |
Factory | getFactory () const override |
const char * | getTypeName () const override |
Public Member Functions inherited from SkFlattenable | |
SkFlattenable () | |
virtual Factory | getFactory () const =0 |
virtual const char * | getTypeName () const =0 |
virtual void | flatten (SkWriteBuffer &) const |
virtual Type | getFlattenableType () const =0 |
sk_sp< SkData > | serialize (const SkSerialProcs *=nullptr) const |
size_t | serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const |
Public Member Functions inherited from SkRefCntBase | |
SkRefCntBase () | |
virtual | ~SkRefCntBase () |
bool | unique () const |
void | ref () const |
void | unref () const |
Static Public Member Functions | |
static SkFlattenable::Type | GetFlattenableType () |
static sk_sp< SkDrawable > | Deserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr) |
Static Public Member Functions inherited from SkFlattenable | |
static Factory | NameToFactory (const char name[]) |
static const char * | FactoryToName (Factory) |
static void | Register (const char name[], Factory) |
static sk_sp< SkFlattenable > | Deserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr) |
Protected Member Functions | |
SkDrawable () | |
virtual SkRect | onGetBounds ()=0 |
virtual size_t | onApproximateBytesUsed () |
virtual void | onDraw (SkCanvas *)=0 |
virtual std::unique_ptr< GpuDrawHandler > | onSnapGpuDrawHandler (GrBackendApi, const SkMatrix &, const SkIRect &, const SkImageInfo &) |
virtual std::unique_ptr< GpuDrawHandler > | onSnapGpuDrawHandler (GrBackendApi, const SkMatrix &) |
virtual sk_sp< SkPicture > | onMakePictureSnapshot () |
Additional Inherited Members | |
Public Types inherited from SkFlattenable | |
enum | Type { kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type , kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type } |
typedef sk_sp< SkFlattenable >(* | Factory) (SkReadBuffer &) |
Base-class for objects that draw into SkCanvas.
The object has a generation ID, which is guaranteed to be unique across all drawables. To allow for clients of the drawable that may want to cache the results, the drawable must change its generation ID whenever its internal state changes such that it will draw differently.
Definition at line 37 of file SkDrawable.h.
|
protected |
Definition at line 32 of file SkDrawable.cpp.
size_t SkDrawable::approximateBytesUsed | ( | ) |
Return approximately how many bytes would be freed if this drawable is destroyed. The base implementation returns 0 to indicate that this is unknown.
Definition at line 75 of file SkDrawable.cpp.
|
inlinestatic |
Definition at line 138 of file SkDrawable.h.
Draws into the specified content. The drawing sequence will be balanced upon return (i.e. the saveLevel() on the canvas will match what it was when draw() was called, and the current matrix and clip settings will not be changed.
Definition at line 43 of file SkDrawable.cpp.
Definition at line 55 of file SkDrawable.cpp.
SkRect SkDrawable::getBounds | ( | ) |
Return the (conservative) bounds of what the drawable will draw. If the drawable can change what it draws (e.g. animation or in response to some external change), then this must return a bounds that is always valid for all possible states.
Definition at line 71 of file SkDrawable.cpp.
|
inlineoverridevirtual |
Implement this to return a factory function pointer that can be called to recreate your class given a buffer (previously written to by your override of flatten().
Implements SkFlattenable.
Reimplemented in IntDrawable, PaintDrawable, CompoundDrawable, and RootDrawable.
Definition at line 145 of file SkDrawable.h.
|
inlinestatic |
Definition at line 130 of file SkDrawable.h.
|
inlineoverridevirtual |
Implements SkFlattenable.
Definition at line 134 of file SkDrawable.h.
uint32_t SkDrawable::getGenerationID | ( | ) |
Return a unique value for this instance. If two calls to this return the same value, it is presumed that calling the draw() method will render the same thing as well.
Subclasses that change their state should call notifyDrawingChanged() to ensure that a new value will be returned the next time it is called.
Definition at line 64 of file SkDrawable.cpp.
|
inlineoverridevirtual |
Returns the name of the object's class.
Implements SkFlattenable.
Reimplemented in IntDrawable, PaintDrawable, CompoundDrawable, and RootDrawable.
Definition at line 146 of file SkDrawable.h.
Returns an SkPicture with the contents of this SkDrawable.
Definition at line 60 of file SkDrawable.cpp.
void SkDrawable::notifyDrawingChanged | ( | ) |
Calling this invalidates the previous generation ID, and causes a new one to be computed the next time getGenerationID() is called. Typically this is called by the object itself, in response to its internal state changing.
Definition at line 82 of file SkDrawable.cpp.
|
protectedvirtual |
Reimplemented in SkRecordedDrawable.
Definition at line 78 of file SkDrawable.cpp.
|
protectedpure virtual |
Implemented in SkAnimatedImage, IntDrawable, PaintDrawable, CompoundDrawable, RootDrawable, MyDrawable, SkRecordedDrawable, DrawAtlasDrawable, and CircDrawable.
|
protectedpure virtual |
Implemented in MyDrawable, SkAnimatedImage, SkRecordedDrawable, IntDrawable, PaintDrawable, CompoundDrawable, RootDrawable, DrawAtlasDrawable, and CircDrawable.
Default implementation calls onDraw() with a canvas that records into a picture. Subclasses may override if they have a more efficient way to return a picture for the current state of their drawable. Note: this picture must draw the same as what would be drawn from onDraw().
Reimplemented in SkRecordedDrawable.
Definition at line 88 of file SkDrawable.cpp.
|
inlineprotectedvirtual |
Definition at line 162 of file SkDrawable.h.
|
inlineprotectedvirtual |
Definition at line 155 of file SkDrawable.h.
|
inline |
Snaps off a GpuDrawHandler to represent the state of the SkDrawable at the time the snap is called. This is used for executing GPU backend specific draws intermixed with normal Skia GPU draws. The GPU API, which will be used for the draw, as well as the full matrix, device clip bounds and imageInfo of the target buffer are passed in as inputs.
Definition at line 89 of file SkDrawable.h.