From 0864908ca50049d3d907fc5c3749bc8a436b4738 Mon Sep 17 00:00:00 2001 From: scroggo Date: Fri, 13 Feb 2015 11:13:34 -0800 Subject: Make SkImageGenerator::getPixels() return an enum. The new enum describes the nature of the failure. This is in preparation for writing a replacement for SkImageDecoder, which will use this interface. Update the comments for getPixels() to specify what it means to pass an SkImageInfo with a different size. Make SkImageGenerator Noncopyable. Leave onGetYUV8Planes alone, since we have separate discussions regarding modifying that API. Make callers of SkImageDecoder consistently handle kPartialSuccess. Previously, some callers considered it a failure, and others considered it a success. BUG=skia:3257 Review URL: https://codereview.chromium.org/919693002 --- src/lazy/SkCachingPixelRef.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/lazy/SkCachingPixelRef.cpp') diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp index 5ab96562ec..570fc6fbd7 100644 --- a/src/lazy/SkCachingPixelRef.cpp +++ b/src/lazy/SkCachingPixelRef.cpp @@ -52,9 +52,15 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) { fErrorInDecoding = true; return false; } - if (!fImageGenerator->getPixels(info, fLockedBitmap.getPixels(), fRowBytes)) { - 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; } fLockedBitmap.setImmutable(); SkBitmapCache::Add( -- cgit v1.2.3