| Index: src/codec/SkCodec_wbmp.cpp
|
| diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
|
| index 1696dfb58515cd6ebf699bf1f2da54d16610b35c..af22e402ae64a40a0993ac83bb8879e20c8fae3d 100644
|
| --- a/src/codec/SkCodec_wbmp.cpp
|
| +++ b/src/codec/SkCodec_wbmp.cpp
|
| @@ -86,11 +86,8 @@ SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info,
|
| }
|
| }
|
|
|
| -SkCodec::Result SkWbmpCodec::readRow(uint8_t* row) {
|
| - if (this->stream()->read(row, fSrcRowBytes) != fSrcRowBytes) {
|
| - return kIncompleteInput;
|
| - }
|
| - return kSuccess;
|
| +bool SkWbmpCodec::readRow(uint8_t* row) {
|
| + return this->stream()->read(row, fSrcRowBytes) == fSrcRowBytes;
|
| }
|
|
|
| SkWbmpCodec::SkWbmpCodec(const SkImageInfo& info, SkStream* stream)
|
| @@ -109,7 +106,8 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
|
| size_t rowBytes,
|
| const Options& options,
|
| SkPMColor ctable[],
|
| - int* ctableCount) {
|
| + int* ctableCount,
|
| + int* rowsDecoded) {
|
| if (options.fSubset) {
|
| // Subsets are not supported.
|
| return kUnimplemented;
|
| @@ -137,9 +135,9 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
|
| SkAutoTMalloc<uint8_t> src(fSrcRowBytes);
|
| void* dstRow = dst;
|
| for (int y = 0; y < size.height(); ++y) {
|
| - Result rowResult = this->readRow(src.get());
|
| - if (kSuccess != rowResult) {
|
| - return rowResult;
|
| + if (!this->readRow(src.get())) {
|
| + *rowsDecoded = y;
|
| + return kIncompleteInput;
|
| }
|
| swizzler->swizzle(dstRow, src.get());
|
| dstRow = SkTAddOffset<void>(dstRow, rowBytes);
|
| @@ -162,17 +160,16 @@ SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) {
|
| return new SkWbmpCodec(info, streamDeleter.detach());
|
| }
|
|
|
| -SkCodec::Result SkWbmpCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
|
| +int SkWbmpCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
|
| void* dstRow = dst;
|
| for (int y = 0; y < count; ++y) {
|
| - Result rowResult = this->readRow(fSrcBuffer.get());
|
| - if (kSuccess != rowResult) {
|
| - return rowResult;
|
| + if (!this->readRow(fSrcBuffer.get())) {
|
| + return y;
|
| }
|
| fSwizzler->swizzle(dstRow, fSrcBuffer.get());
|
| dstRow = SkTAddOffset<void>(dstRow, dstRowBytes);
|
| }
|
| - return kSuccess;
|
| + return count;
|
| }
|
|
|
| SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
|
| @@ -210,4 +207,3 @@ SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
|
|
|
| return kSuccess;
|
| }
|
| -
|
|
|