8 #ifndef SkPixelRef_DEFINED
9 #define SkPixelRef_DEFINED
13 #include "include/private/SkIDChangeListener.h"
14 #include "include/private/base/SkAPI.h"
15 #include "include/private/base/SkTo.h"
21 class SkDiscardableMemory;
30 SkPixelRef(
int width,
int height,
void* addr,
size_t rowBytes);
34 int width()
const {
return fWidth; }
35 int height()
const {
return fHeight; }
36 void*
pixels()
const {
return fPixels; }
77 fAddedToCache.store(
true);
92 bool genIDIsUnique()
const {
return SkToBool(fTaggedGenID.load() & 1); }
93 mutable std::atomic<uint32_t> fTaggedGenID;
95 SkIDChangeListener::List fGenIDChangeListeners;
98 std::atomic<bool> fAddedToCache;
102 kTemporarilyImmutable,
106 void needsNewGenID();
107 void callGenIDChangeListeners();
109 void setTemporarilyImmutable();
110 void restoreMutability();
111 friend class SkSurface_Raster;
113 void setImmutableWithID(uint32_t genID);
This class is the smart container for pixel memory, and is used with SkBitmap.
Definition: SkPixelRef.h:28
void notifyPixelsChanged()
Call this if you have changed the contents of the pixels.
void notifyAddedToCache()
Definition: SkPixelRef.h:76
uint32_t getGenerationID() const
Returns a non-zero, unique value corresponding to the pixels in this pixelref.
void setImmutable()
Marks this pixelref is immutable, meaning that the contents of its pixels will not change for the lif...
SkISize dimensions() const
Definition: SkPixelRef.h:33
bool isImmutable() const
Returns true if this pixelref is marked as immutable, meaning that the contents of its pixels will no...
Definition: SkPixelRef.h:55
void * pixels() const
Definition: SkPixelRef.h:36
void addGenIDChangeListener(sk_sp< SkIDChangeListener > listener)
int width() const
Definition: SkPixelRef.h:34
SkPixelRef(int width, int height, void *addr, size_t rowBytes)
virtual SkDiscardableMemory * diagnostic_only_getDiscardable() const
Definition: SkPixelRef.h:80
void android_only_reset(int width, int height, size_t rowBytes)
int height() const
Definition: SkPixelRef.h:35
size_t rowBytes() const
Definition: SkPixelRef.h:37
friend void SkBitmapCache_setImmutableWithID(SkPixelRef *, uint32_t)
Definition: SkRefCnt.h:119
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220