Skia
2DGraphicsLibrary
|
Subclasses of SkDrawLooper can be attached to a SkPaint. More...
#include <SkDrawLooper.h>
Classes | |
struct | BlurShadowRec |
class | Context |
Holds state during a draw. More... | |
Public Member Functions | |
virtual Context * | makeContext (SkCanvas *, SkArenaAlloc *) const =0 |
Called right before something is being drawn. More... | |
bool | canComputeFastBounds (const SkPaint &paint) const |
The fast bounds functions are used to enable the paint to be culled early in the drawing pipeline. More... | |
void | computeFastBounds (const SkPaint &paint, const SkRect &src, SkRect *dst) const |
virtual bool | asABlurShadow (BlurShadowRec *) const |
If this looper can be interpreted as having two layers, such that. More... | |
![]() | |
virtual Factory | getFactory () const =0 |
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(). | |
virtual const char * | getTypeName () const |
Returns the name of the object's class. More... | |
virtual void | flatten (SkWriteBuffer &) const |
Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()). | |
![]() | |
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... | |
Protected Member Functions | |
sk_sp< SkDrawLooper > | makeColorSpace (SkColorSpaceXformer *xformer) const |
virtual sk_sp< SkDrawLooper > | onMakeColorSpace (SkColorSpaceXformer *) const =0 |
![]() | |
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... | |
Private Types | |
typedef SkFlattenable | INHERITED |
Friends | |
class | SkColorSpaceXformer |
Additional Inherited Members | |
![]() | |
enum | Type { kSkColorFilter_Type, kSkDrawable_Type, kSkDrawLooper_Type, kSkImageFilter_Type, kSkMaskFilter_Type, kSkPathEffect_Type, kSkPixelRef_Type, kSkRasterizer_Type, kSkShaderBase_Type, kSkUnused_Type, kSkUnused_Xfermode_Type, kSkNormalSource_Type } |
typedef sk_sp< SkFlattenable >(* | Factory )(SkReadBuffer &) |
![]() | |
static Factory | NameToFactory (const char name[]) |
static const char * | FactoryToName (Factory) |
static bool | NameToType (const char name[], Type *type) |
static void | Register (const char name[], Factory, Type) |
Subclasses of SkDrawLooper can be attached to a SkPaint.
Where they are, and something is drawn to a canvas with that paint, the looper subclass will be called, allowing it to modify the canvas and/or paint for that draw call. More than that, via the next() method, the looper can modify the draw to be invoked multiple times (hence the name loop-er), allow it to perform effects like shadows or frame/fills, that require more than one pass.
|
virtual |
If this looper can be interpreted as having two layers, such that.
If any of the above are not met, return false and ignore the BlurShadowRec parameter.
Reimplemented in SkLayerDrawLooper.
bool SkDrawLooper::canComputeFastBounds | ( | const SkPaint & | paint | ) | const |
The fast bounds functions are used to enable the paint to be culled early in the drawing pipeline.
If a subclass can support this feature it must return true for the canComputeFastBounds() function. If that function returns false then computeFastBounds behavior is undefined otherwise it is expected to have the following behavior. Given the parent paint and the parent's bounding rect the subclass must fill in and return the storage rect, where the storage rect is with the union of the src rect and the looper's bounding rect.
Called right before something is being drawn.
Returns a Context whose next() method should be called until it returns false.
Implemented in SkLayerDrawLooper.