aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPixelRef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkPixelRef.cpp')
-rw-r--r--src/core/SkPixelRef.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index f56298165c..a2638c9431 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkBitmapCache.h"
#include "SkPixelRef.h"
#include "SkThread.h"
@@ -222,6 +223,7 @@ void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) {
*fGenIDChangeListeners.append() = listener;
}
+// we need to be called *before* the genID gets changed or zerod
void SkPixelRef::callGenIDChangeListeners() {
// We don't invalidate ourselves if we think another SkPixelRef is sharing our genID.
if (fUniqueGenerationID) {
@@ -231,6 +233,15 @@ void SkPixelRef::callGenIDChangeListeners() {
}
// Listeners get at most one shot, so whether these triggered or not, blow them away.
fGenIDChangeListeners.deleteAll();
+
+ // if fGenerationID is 0, then perhaps we never had one, and we are in the destructor
+ if (fGenerationID) {
+ // If the ResourceCache ever generalizes/standardizes on accessing the gen-id field,
+ // then it would be more efficient to roll these together, and only grab the mutex
+ // and fixing the resources once...
+ SkBitmapCache::NotifyGenIDStale(fGenerationID);
+ SkMipMapCache::NotifyGenIDStale(fGenerationID);
+ }
}
void SkPixelRef::notifyPixelsChanged() {