Index: src/lazy/SkDiscardablePixelRef.cpp |
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp |
index b6dec1b3a1129b85ccccbb65edf50255bdc1bad3..50988587a7c1030cf3fd56727e104011f31b4870 100644 |
--- a/src/lazy/SkDiscardablePixelRef.cpp |
+++ b/src/lazy/SkDiscardablePixelRef.cpp |
@@ -18,7 +18,6 @@ |
, fDMFactory(fact) |
, fRowBytes(rowBytes) |
, fDiscardableMemory(NULL) |
- , fDiscardableMemoryIsLocked(false) |
{ |
SkASSERT(fGenerator != NULL); |
SkASSERT(fRowBytes > 0); |
@@ -29,9 +28,8 @@ |
} |
SkDiscardablePixelRef::~SkDiscardablePixelRef() { |
- if (fDiscardableMemoryIsLocked) { |
+ if (this->isLocked()) { |
fDiscardableMemory->unlock(); |
- fDiscardableMemoryIsLocked = false; |
} |
SkDELETE(fDiscardableMemory); |
SkSafeUnref(fDMFactory); |
@@ -41,7 +39,6 @@ |
bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { |
if (fDiscardableMemory != NULL) { |
if (fDiscardableMemory->lock()) { |
- fDiscardableMemoryIsLocked = true; |
rec->fPixels = fDiscardableMemory->data(); |
rec->fColorTable = fCTable.get(); |
rec->fRowBytes = fRowBytes; |
@@ -49,20 +46,16 @@ |
} |
SkDELETE(fDiscardableMemory); |
fDiscardableMemory = NULL; |
- fDiscardableMemoryIsLocked = false; |
} |
const size_t size = this->info().getSafeSize(fRowBytes); |
if (fDMFactory != NULL) { |
fDiscardableMemory = fDMFactory->create(size); |
- fDiscardableMemoryIsLocked = true; |
} else { |
fDiscardableMemory = SkDiscardableMemory::Create(size); |
- fDiscardableMemoryIsLocked = true; |
} |
if (NULL == fDiscardableMemory) { |
- fDiscardableMemoryIsLocked = false; |
return false; // Memory allocation failed. |
} |
@@ -79,7 +72,6 @@ |
break; |
default: |
fDiscardableMemory->unlock(); |
- fDiscardableMemoryIsLocked = false; |
SkDELETE(fDiscardableMemory); |
fDiscardableMemory = NULL; |
return false; |
@@ -104,7 +96,6 @@ |
void SkDiscardablePixelRef::onUnlockPixels() { |
fDiscardableMemory->unlock(); |
- fDiscardableMemoryIsLocked = false; |
} |
bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst, |