Fill incomplete images in SkCodec parent class

Rather than implementing some sort of "fill" in every
SkCodec subclass for incomplete images, let's make the
parent class handle this situation.

This includes an API change to SkCodec.h

SkCodec::getScanlines() now returns the number of lines it
read successfully, rather than an SkCodec::Result enum.
getScanlines() most often fails on an incomplete input, in
which case it is useful to know how many lines were
successfully decoded - this provides more information than
kIncomplete vs kSuccess.  We do lose information when the
API is used improperly, as we are no longer able to return
kInvalidParameter or kScanlineNotStarted.

Known Issues:
Does not work for incomplete fFrameIsSubset gifs.
Does not work for incomplete icos.

BUG=skia:

Review URL: https://codereview.chromium.org/1332053002
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index d7f446b..14b7209 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -86,11 +86,8 @@
                                       opts.fZeroInitialized);
 }
 
-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 @@
                                          size_t rowBytes,
                                          const Options& options,
                                          SkPMColor ctable[],
-                                         int* ctableCount) {
+                                         int* ctableCount,
+                                         int* rowsDecoded) {
     if (options.fSubset) {
         // Subsets are not supported.
         return kUnimplemented;
@@ -133,9 +131,9 @@
     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);
@@ -158,17 +156,16 @@
     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,
@@ -201,4 +198,3 @@
 
     return kSuccess;
 }
-