-
/*
* Copyright 2008 The Android Open Source Project
*
* found in the LICENSE file.
*/
-
#ifndef SkPixelRef_DEFINED
#define SkPixelRef_DEFINED
*/
uint32_t getGenerationID() const;
- /** 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().
- */
+ /**
+ * 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().
+ */
void notifyPixelsChanged();
+ /**
+ * Change the info's AlphaType. Note that this does not automatically
+ * invalidate the generation ID. If the pixel values themselves have
+ * changed, then you must explicitly call notifyPixelsChanged() as well.
+ */
+ void changeAlphaType(SkAlphaType at);
+
/** 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 addGenIDChangeListener(GenIDChangeListener* listener);
protected:
-#ifdef SK_SUPPORT_LEGACY_ONLOCKPIXELS
- virtual void* onLockPixels(SkColorTable**);
- virtual bool onNewLockPixels(LockRec*);
-#else
/**
* On success, returns true and fills out the LockRec for the pixels. On
* failure returns false and ignores the LockRec parameter.
* method need not do that.
*/
virtual bool onNewLockPixels(LockRec*) = 0;
-#endif
/**
* Balancing the previous successful call to onNewLockPixels. The locked
SkBaseMutex* mutex() const { return fMutex; }
// serialization
- SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*);
- virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+ SkPixelRef(SkReadBuffer&, SkBaseMutex*);
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
// only call from constructor. Flags this to always be locked, removing
// the need to grab the mutex and call onLockPixels/onUnlockPixels.
private:
SkBaseMutex* fMutex; // must remain in scope for the life of this object
+ // mostly const. fInfo.fAlpahType can be changed at runtime.
const SkImageInfo fInfo;
// LockRec is only valid if we're in a locked state (isLocked())