diff options
Diffstat (limited to 'src/lazy')
-rw-r--r-- | src/lazy/SkCachingPixelRef.cpp | 12 | ||||
-rw-r--r-- | src/lazy/SkDiscardablePixelRef.cpp | 18 |
2 files changed, 9 insertions, 21 deletions
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp index 5fc0d2a87f..3edd0de4fb 100644 --- a/src/lazy/SkCachingPixelRef.cpp +++ b/src/lazy/SkCachingPixelRef.cpp @@ -53,15 +53,9 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) { fErrorInDecoding = true; return false; } - const SkImageGenerator::Result result = fImageGenerator->getPixels(info, - fLockedBitmap.getPixels(), fRowBytes); - switch (result) { - case SkImageGenerator::kIncompleteInput: - case SkImageGenerator::kSuccess: - break; - default: - fErrorInDecoding = true; - return false; + if (!fImageGenerator->getPixels(info, fLockedBitmap.getPixels(), fRowBytes)) { + fErrorInDecoding = true; + return false; } fLockedBitmap.setImmutable(); SkBitmapCache::Add(this, info.bounds(), fLockedBitmap); diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp index 73fa4ce84c..19bfc8ccc7 100644 --- a/src/lazy/SkDiscardablePixelRef.cpp +++ b/src/lazy/SkDiscardablePixelRef.cpp @@ -71,18 +71,12 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { SkPMColor colors[256]; int colorCount = 0; - const SkImageGenerator::Result result = fGenerator->getPixels(info, pixels, fRowBytes, NULL, - colors, &colorCount); - switch (result) { - case SkImageGenerator::kSuccess: - case SkImageGenerator::kIncompleteInput: - break; - default: - fDiscardableMemory->unlock(); - fDiscardableMemoryIsLocked = false; - SkDELETE(fDiscardableMemory); - fDiscardableMemory = NULL; - return false; + if (!fGenerator->getPixels(info, pixels, fRowBytes, colors, &colorCount)) { + fDiscardableMemory->unlock(); + fDiscardableMemoryIsLocked = false; + SkDELETE(fDiscardableMemory); + fDiscardableMemory = NULL; + return false; } // Note: our ctable is not purgeable, as it is not stored in the discardablememory block. |