Skia
2DGraphicsLibrary
|
We explicitly use the same allocator for our pixels that SkMask does, so that we can freely assign memory allocated by one class to the other. More...
#include <SkMallocPixelRef.h>
Public Types | |
typedef void(* | ReleaseProc )(void *addr, void *context) |
Return a new SkMallocPixelRef with the provided pixel storage, rowBytes, and optional colortable. More... | |
Static Public Member Functions | |
static sk_sp< SkPixelRef > | MakeDirect (const SkImageInfo &, void *addr, size_t rowBytes, sk_sp< SkColorTable >) |
Return a new SkMallocPixelRef with the provided pixel storage, rowBytes, and optional colortable. More... | |
static sk_sp< SkPixelRef > | MakeAllocate (const SkImageInfo &, size_t rowBytes, sk_sp< SkColorTable >) |
Return a new SkMallocPixelRef, automatically allocating storage for the pixels. More... | |
static sk_sp< SkPixelRef > | MakeZeroed (const SkImageInfo &, size_t rowBytes, sk_sp< SkColorTable >) |
Identical to MakeAllocate, except all pixel bytes are zeroed. | |
static sk_sp< SkPixelRef > | MakeWithProc (const SkImageInfo &info, size_t rowBytes, sk_sp< SkColorTable >, void *addr, ReleaseProc proc, void *context) |
static sk_sp< SkPixelRef > | MakeWithData (const SkImageInfo &info, size_t rowBytes, sk_sp< SkColorTable >, sk_sp< SkData > data) |
Return a new SkMallocPixelRef that will use the provided SkData, rowBytes, and optional colortable as pixel storage. More... | |
Private Types | |
typedef SkPixelRef | INHERITED |
Private Member Functions | |
SkMallocPixelRef (const SkImageInfo &, void *addr, size_t rb, sk_sp< SkColorTable >, ReleaseProc proc, void *context) | |
Static Private Member Functions | |
static sk_sp< SkPixelRef > | MakeUsing (void *(*alloc)(size_t), const SkImageInfo &, size_t rowBytes, sk_sp< SkColorTable >) |
Private Attributes | |
ReleaseProc | fReleaseProc |
void * | fReleaseProcContext |
Additional Inherited Members | |
Public Member Functions inherited from SkPixelRef | |
SkPixelRef (int width, int height, void *addr, size_t rowBytes, sk_sp< SkColorTable >=nullptr) | |
int | width () const |
int | height () const |
void * | pixels () const |
SkColorTable * | colorTable () const |
size_t | rowBytes () const |
uint32_t | getGenerationID () const |
Returns a non-zero, unique value corresponding to the pixels in this pixelref. More... | |
void | notifyPixelsChanged () |
Call this if you have changed the contents of the pixels. More... | |
bool | isImmutable () const |
Returns true if this pixelref is marked as immutable, meaning that the contents of its pixels will not change for the lifetime of the pixelref. | |
void | setImmutable () |
Marks this pixelref is immutable, meaning that the contents of its pixels will not change for the lifetime of the pixelref. More... | |
void | addGenIDChangeListener (GenIDChangeListener *listener) |
void | notifyAddedToCache () |
virtual SkDiscardableMemory * | diagnostic_only_getDiscardable () const |
Public Member Functions inherited from SkRefCntBase | |
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 inherited from SkPixelRef | |
virtual void | onNotifyPixelsChanged () |
Protected Member Functions inherited from SkRefCntBase | |
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... | |
We explicitly use the same allocator for our pixels that SkMask does, so that we can freely assign memory allocated by one class to the other.
typedef void(* SkMallocPixelRef::ReleaseProc)(void *addr, void *context) |
Return a new SkMallocPixelRef with the provided pixel storage, rowBytes, and optional colortable.
On destruction, ReleaseProc will be called.
If ReleaseProc is NULL, the pixels will never be released. This can be useful if the pixels were stack allocated. However, such an SkMallocPixelRef must not live beyond its pixels (e.g. by copying an SkBitmap pointing to it, or drawing to an SkPicture).
Returns NULL on failure.
|
static |
Return a new SkMallocPixelRef, automatically allocating storage for the pixels.
If rowBytes are 0, an optimal value will be chosen automatically. If rowBytes is > 0, then it will be respected, or NULL will be returned if rowBytes is invalid for the specified info.
This pixelref will ref() the specified colortable (if not NULL).
Returns NULL on failure.
|
static |
Return a new SkMallocPixelRef with the provided pixel storage, rowBytes, and optional colortable.
The caller is responsible for managing the lifetime of the pixel storage buffer, as this pixelref will not try to delete it.
Returns NULL on failure.
|
static |