Index: src/lazy/SkDiscardablePixelRef.cpp |
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp |
index b51daa6faa7ded8aa34649ef7e381662a2c76d81..50988587a7c1030cf3fd56727e104011f31b4870 100644 |
--- a/src/lazy/SkDiscardablePixelRef.cpp |
+++ b/src/lazy/SkDiscardablePixelRef.cpp |
@@ -64,11 +64,17 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { |
SkPMColor colors[256]; |
int colorCount = 0; |
- if (!fGenerator->getPixels(info, pixels, fRowBytes, colors, &colorCount)) { |
- fDiscardableMemory->unlock(); |
- SkDELETE(fDiscardableMemory); |
- fDiscardableMemory = NULL; |
- return false; |
+ const SkImageGenerator::Result result = fGenerator->getPixels(info, pixels, fRowBytes, |
+ colors, &colorCount); |
+ switch (result) { |
+ case SkImageGenerator::kSuccess: |
+ case SkImageGenerator::kIncompleteInput: |
+ break; |
+ default: |
+ fDiscardableMemory->unlock(); |
+ SkDELETE(fDiscardableMemory); |
+ fDiscardableMemory = NULL; |
+ return false; |
} |
// Note: our ctable is not purgeable, as it is not stored in the discardablememory block. |