/** Returns a non-zero, unique value corresponding to the pixels in this pixelref.Eachtimethepixelsarechanged(andnotifyPixelsChangedis called),adifferentgenerationIDwillbereturned.
*/
uint32_t getGenerationID() const;
/** Returns true if this pixelref is marked as immutable, meaning that the contentsofitspixelswillnotchangeforthelifetimeofthepixelref.
*/ bool isImmutable() const { return fMutability != kMutable; }
/** Marks this pixelref is immutable, meaning that the contents of its pixelswillnotchangeforthelifetimeofthepixelref.Thisstatecan besetonapixelref,butitcannotbeclearedonceitisset.
*/ void setImmutable();
// Register a listener that may be called the next time our generation ID changes. // // We'll only call the listener if we're confident that we are the only SkPixelRef with this // generation ID. If our generation ID changes and we decide not to call the listener, we'll // never call it: you must add a new listener for each generation ID change. We also won't call // the listener when we're certain no one knows what our generation ID is. // // This can be used to invalidate caches keyed by SkPixelRef generation ID. // Takes ownership of listener. Threadsafe. void addGenIDChangeListener(sk_sp<SkIDChangeListener> listener);
// Call when this pixelref is part of the key to a resourcecache entry. This allows the cache // to know automatically those entries can be purged when this pixelref is changed or deleted. void notifyAddedToCache() {
fAddedToCache.store(true);
}
protected: void android_only_reset(int width, int height, size_t rowBytes);
private: int fWidth; int fHeight; void* fPixels;
size_t fRowBytes;
// Bottom bit indicates the Gen ID is unique. bool genIDIsUnique() const { return SkToBool(fTaggedGenID.load() & 1); } mutable std::atomic<uint32_t> fTaggedGenID;
SkIDChangeListener::List fGenIDChangeListeners;
// Set true by caches when they cache content that's derived from the current pixels.
std::atomic<bool> fAddedToCache;
enum Mutability {
kMutable, // PixelRefs begin mutable.
kTemporarilyImmutable, // Considered immutable, but can revert to mutable.
kImmutable, // Once set to this state, it never leaves.
} fMutability : 8; // easily fits inside a byte
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.