Skia
2D Graphics Library
SkPixelRef Class Reference

This class is the smart container for pixel memory, and is used with SkBitmap. More...

#include <SkPixelRef.h>

Inheritance diagram for SkPixelRef:

Public Member Functions

 SkPixelRef (int width, int height, void *addr, size_t rowBytes)
 
 ~SkPixelRef () override
 
SkISize dimensions () const
 
int width () const
 
int height () const
 
void * pixels () 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. More...
 
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 (sk_sp< SkIDChangeListener > listener)
 
void notifyAddedToCache ()
 
virtual SkDiscardableMemory * diagnostic_only_getDiscardable () 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

void android_only_reset (int width, int height, size_t rowBytes)
 

Friends

class SkSurface_Raster
 
void SkBitmapCache_setImmutableWithID (SkPixelRef *, uint32_t)
 

Detailed Description

This class is the smart container for pixel memory, and is used with SkBitmap.

This class can be shared/accessed between multiple threads.

Constructor & Destructor Documentation

◆ SkPixelRef()

SkPixelRef::SkPixelRef ( int  width,
int  height,
void *  addr,
size_t  rowBytes 
)

◆ ~SkPixelRef()

SkPixelRef::~SkPixelRef ( )
override

Member Function Documentation

◆ addGenIDChangeListener()

void SkPixelRef::addGenIDChangeListener ( sk_sp< SkIDChangeListener >  listener)

◆ android_only_reset()

void SkPixelRef::android_only_reset ( int  width,
int  height,
size_t  rowBytes 
)
protected

◆ diagnostic_only_getDiscardable()

virtual SkDiscardableMemory* SkPixelRef::diagnostic_only_getDiscardable ( ) const
inlinevirtual

◆ dimensions()

SkISize SkPixelRef::dimensions ( ) const
inline

◆ getGenerationID()

uint32_t SkPixelRef::getGenerationID ( ) const

Returns a non-zero, unique value corresponding to the pixels in this pixelref.

Each time the pixels are changed (and notifyPixelsChanged is called), a different generation ID will be returned.

◆ height()

int SkPixelRef::height ( ) const
inline

◆ isImmutable()

bool SkPixelRef::isImmutable ( ) const
inline

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.

◆ notifyAddedToCache()

void SkPixelRef::notifyAddedToCache ( )
inline

◆ notifyPixelsChanged()

void SkPixelRef::notifyPixelsChanged ( )

Call this if you have changed the contents of the pixels.

This will in- turn cause a different generation ID value to be returned from getGenerationID().

◆ pixels()

void* SkPixelRef::pixels ( ) const
inline

◆ ref()

void SkRefCntBase::ref ( ) const
inlineinherited

Increment the reference count.

Must be balanced by a call to unref().

◆ rowBytes()

size_t SkPixelRef::rowBytes ( ) const
inline

◆ setImmutable()

void SkPixelRef::setImmutable ( )

Marks this pixelref is immutable, meaning that the contents of its pixels will not change for the lifetime of the pixelref.

This state can be set on a pixelref, but it cannot be cleared once it is set.

◆ unique()

bool SkRefCntBase::unique ( ) const
inlineinherited

May return true if the caller is the only owner.

Ensures that all previous owner's actions are complete.

◆ unref()

void SkRefCntBase::unref ( ) const
inlineinherited

Decrement the reference count.

If the reference count is 1 before the decrement, then delete the object. Note that if this is the case, then the object needs to have been allocated via new, and not on the stack.

◆ width()

int SkPixelRef::width ( ) const
inline

Friends And Related Function Documentation

◆ SkBitmapCache_setImmutableWithID

void SkBitmapCache_setImmutableWithID ( SkPixelRef ,
uint32_t   
)
friend

◆ SkSurface_Raster

friend class SkSurface_Raster
friend

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