aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lazy
diff options
context:
space:
mode:
Diffstat (limited to 'src/lazy')
-rw-r--r--src/lazy/SkCachingPixelRef.cpp8
-rw-r--r--src/lazy/SkDiscardablePixelRef.cpp9
2 files changed, 8 insertions, 9 deletions
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index 667a94931b..b7eaf574aa 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -90,9 +90,7 @@ void* SkCachingPixelRef::onLockPixels(SkColorTable** colorTable) {
}
void SkCachingPixelRef::onUnlockPixels() {
- if (fScaledCacheId != NULL) {
- SkScaledImageCache::Unlock(
- static_cast<SkScaledImageCache::ID*>(fScaledCacheId));
- fScaledCacheId = NULL;
- }
+ SkASSERT(fScaledCacheId != NULL);
+ SkScaledImageCache::Unlock( static_cast<SkScaledImageCache::ID*>(fScaledCacheId));
+ fScaledCacheId = NULL;
}
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 0b193ade3c..f551436b3b 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -56,14 +56,15 @@ void* SkDiscardablePixelRef::onLockPixels(SkColorTable**) {
}
void* pixels = fDiscardableMemory->data();
if (!fGenerator->getPixels(fInfo, pixels, fRowBytes)) {
- return NULL; // TODO(halcanary) Find out correct thing to do.
+ fDiscardableMemory->unlock();
+ SkDELETE(fDiscardableMemory);
+ fDiscardableMemory = NULL;
+ return NULL;
}
return pixels;
}
void SkDiscardablePixelRef::onUnlockPixels() {
- if (fDiscardableMemory != NULL) {
- fDiscardableMemory->unlock();
- }
+ fDiscardableMemory->unlock();
}
bool SkInstallDiscardablePixelRef(SkImageGenerator* generator,