8 #ifndef SkPixelRef_DEFINED
9 #define SkPixelRef_DEFINED
11 #include "../private/SkAtomics.h"
12 #include "../private/SkMutex.h"
13 #include "../private/SkTDArray.h"
15 #include "SkFilterQuality.h"
16 #include "SkImageInfo.h"
26 class SkDiscardableMemory;
40 int width()
const {
return fWidth; }
41 int height()
const {
return fHeight; }
42 void* pixels()
const {
return fPixels; }
43 SkColorTable* colorTable()
const {
return fCTable.get(); }
44 size_t rowBytes()
const {
return fRowBytes; }
50 uint32_t getGenerationID()
const;
52 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
61 uint32_t getStableID()
const {
return fStableID; }
69 void notifyPixelsChanged();
92 virtual void onChange() = 0;
100 void notifyAddedToCache() {
101 fAddedToCache.store(
true);
104 virtual SkDiscardableMemory* diagnostic_only_getDiscardable()
const {
return NULL; }
108 virtual void onNotifyPixelsChanged();
110 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
123 bool genIDIsUnique()
const {
return SkToBool(fTaggedGenID.load() & 1); }
124 mutable SkAtomic<uint32_t> fTaggedGenID;
126 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
127 const uint32_t fStableID;
130 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners;
133 SkAtomic<bool> fAddedToCache;
137 kTemporarilyImmutable,
141 void needsNewGenID();
142 void callGenIDChangeListeners();
144 void setTemporarilyImmutable();
145 void restoreMutability();
146 friend class SkSurface_Raster;
148 friend class SkImage_Raster;
149 friend class SkSpecialImage_Raster;
151 void setImmutableWithID(uint32_t genID);
152 friend class SkImage_Gpu;
153 friend class SkImage_Lazy;
154 friend class SkSpecialImage_Gpu;
155 friend void SkBitmapCache_setImmutableWithID(
SkPixelRef*, uint32_t);
SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by 8-bit bitmaps...
Definition: SkColorTable.h:25
Definition: SkRefCnt.h:125
#define SkToBool(cond)
Returns 0 or 1 based on the condition.
Definition: SkTypes.h:227
This class is the smart container for pixel memory, and is used with SkBitmap.
Definition: SkPixelRef.h:33
Definition: SkPixelRef.h:90
bool isImmutable() const
Returns true if this pixelref is marked as immutable, meaning that the contents of its pixels will no...
Definition: SkPixelRef.h:74
SkIRect holds four 32 bit integer coordinates for a rectangle.
Definition: SkRect.h:20
Definition: GrTexture.h:19