diff options
author | 2015-02-13 11:13:34 -0800 | |
---|---|---|
committer | 2015-02-13 11:13:34 -0800 | |
commit | 0864908ca50049d3d907fc5c3749bc8a436b4738 (patch) | |
tree | a04d0629768ac04cbb13ba235e970fe46e8460c5 /src/lazy/SkCachingPixelRef.cpp | |
parent | 9bafc30c7900375d316d47e24412ddfd8bd0b1f2 (diff) |
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
Diffstat (limited to 'src/lazy/SkCachingPixelRef.cpp')
-rw-r--r-- | src/lazy/SkCachingPixelRef.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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( |