diff options
author | scroggo <scroggo@google.com> | 2014-10-22 12:07:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-22 12:07:00 -0700 |
commit | 2a1208017dd676f94a53bbb228197c3978dbdd8a (patch) | |
tree | c19f32da3e4187f459e526f13aab58cc24d8aa7d /samplecode | |
parent | 7a2df0c672d05301362b5ad13e01bfc62871200a (diff) |
Qualify the return value of SkImageDecoder::decode
Add a new enum to differentiate between a complete decode and a
partial decode (with the third value being failure). Return this
value from SkImageDecoder::onDecode (in all subclasses, plus
SkImageDecoder_empty) and ::decode.
For convenience, if the enum is treated as a boolean, success and
partial success are both considered true.
Note that the static helper functions (DecodeFile etc) still return
true and false (for one thing, this allows us to continue to use
SkImageDecoder::DecodeMemory as an SkPicture::InstallPixelRefProc in
SkPicture::CreateFromStream).
Also correctly report failure in SkASTCImageDecoder::onDecode when
SkTextureCompressor::DecompressBufferFromFormat fails.
BUG=skia:3037
BUG:b/17419670
Review URL: https://codereview.chromium.org/647023006
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleUnpremul.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samplecode/SampleUnpremul.cpp b/samplecode/SampleUnpremul.cpp index 992444d05d..ffe4428b48 100644 --- a/samplecode/SampleUnpremul.cpp +++ b/samplecode/SampleUnpremul.cpp @@ -182,7 +182,7 @@ private: decoder->setRequireUnpremultipliedColors(true); } fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType, - SkImageDecoder::kDecodePixels_Mode); + SkImageDecoder::kDecodePixels_Mode) != SkImageDecoder::kFailure; this->inval(NULL); } |