diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-13 13:41:14 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-13 13:41:14 +0000 |
commit | c83a91f4721739f05f9df51d496d50b5d028b132 (patch) | |
tree | 65250ae1cb608dbebfa25e96c3c31335379ccd3a /src/lazy | |
parent | f01218725458fdb0c31b440e1b068f2c3d3c4145 (diff) |
Revert "Revert of https://codereview.chromium.org/112783004/"
This reverts commit 3293fe57a7507541e9040eab880dcd82c43881f4.
Conflicts:
src/core/SkScaledImageCache.cpp
BUG=
Review URL: https://codereview.chromium.org/108613005
git-svn-id: http://skia.googlecode.com/svn/trunk@12663 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/lazy')
-rw-r--r-- | src/lazy/SkCachingPixelRef.cpp | 8 | ||||
-rw-r--r-- | src/lazy/SkDiscardablePixelRef.cpp | 9 |
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, |