merge in lmp-mr1-release history after reset to lmp-mr1-dev
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 339cea1..375b3ea 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -126,6 +126,17 @@
*/
uint32_t getGenerationID() const;
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ /** Returns a non-zero, unique value corresponding to this SkPixelRef,
+ which is unchanged when the pixels are changed and even when this
+ object is deleted.
+
+ Can be used as a key which must remain unique across changes and
+ deletions.
+ */
+ uint32_t getStableID() const { return fStableID; }
+#endif
+
/**
* 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
@@ -343,6 +354,9 @@
mutable uint32_t fGenerationID;
mutable bool fUniqueGenerationID;
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ const uint32_t fStableID;
+#endif
SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owned
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index bfa4ae2..420d32e 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -83,7 +83,12 @@
// just need a > 0 value, so pick a funny one to aid in debugging
#define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789
-SkPixelRef::SkPixelRef(const SkImageInfo& info) : fInfo(info) {
+SkPixelRef::SkPixelRef(const SkImageInfo& info)
+ : fInfo(info)
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ , fStableID(SkNextPixelRefGenerationID())
+#endif
+{
this->setMutex(NULL);
fRec.zero();
fLockCount = 0;
@@ -93,7 +98,12 @@
}
-SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) : fInfo(info) {
+SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex)
+ : fInfo(info)
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ , fStableID(SkNextPixelRefGenerationID())
+#endif
+{
this->setMutex(mutex);
fRec.zero();
fLockCount = 0;
@@ -111,6 +121,9 @@
SkPixelRef::SkPixelRef(SkReadBuffer& buffer, SkBaseMutex* mutex)
: INHERITED(buffer)
, fInfo(read_info(buffer))
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ , fStableID(SkNextPixelRefGenerationID())
+#endif
{
this->setMutex(mutex);
fRec.zero();