Add subsetting to SkScanlineDecoder

This CL allows the SkScanlineDecoder to decode partial
scanlines.

This is a first step in efficiently implementing subsetting
in SkScaledCodec.

BUG=skia:4209

Review URL: https://codereview.chromium.org/1390213002
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index 856f69b..0187891 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -435,10 +435,6 @@
 SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColor* inputColorPtr,
         int* inputColorCount, const Options& opts) {
     // Check for valid input parameters
-    if (opts.fSubset) {
-        // Subsets are not supported.
-        return kUnimplemented;
-    }
     if (!conversion_possible(dstInfo, this->getInfo())) {
         return gif_error("Cannot convert input type to output type.\n",
                 kInvalidConversion);
@@ -449,11 +445,9 @@
     return kSuccess;
 }
 
-SkCodec::Result SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo,
-        ZeroInitialized zeroInit) {
+SkCodec::Result SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts) {
     const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
-    fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex,
-            colorPtr, dstInfo, zeroInit));
+    fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, colorPtr, dstInfo, opts));
     if (nullptr != fSwizzler.get()) {
         return kSuccess;
     }
@@ -485,7 +479,7 @@
     // Initialize the swizzler
     if (fFrameIsSubset) {
         const SkImageInfo subsetDstInfo = dstInfo.makeWH(fFrameRect.width(), fFrameRect.height());
-        if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts.fZeroInitialized)) {
+        if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts)) {
             return gif_error("Could not initialize swizzler.\n", kUnimplemented);
         }
 
@@ -499,7 +493,7 @@
         dst = SkTAddOffset<void*>(dst, dstRowBytes * fFrameRect.top() +
                 dstBytesPerPixel * fFrameRect.left());
     } else {
-        if (kSuccess != this->initializeSwizzler(dstInfo, opts.fZeroInitialized)) {
+        if (kSuccess != this->initializeSwizzler(dstInfo, opts)) {
             return gif_error("Could not initialize swizzler.\n", kUnimplemented);
         }
     }
@@ -535,11 +529,11 @@
     // Initialize the swizzler
     if (fFrameIsSubset) {
         const SkImageInfo subsetDstInfo = dstInfo.makeWH(fFrameRect.width(), fFrameRect.height());
-        if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts.fZeroInitialized)) {
+        if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts)) {
             return gif_error("Could not initialize swizzler.\n", kUnimplemented);
         }
     } else {
-        if (kSuccess != this->initializeSwizzler(dstInfo, opts.fZeroInitialized)) {
+        if (kSuccess != this->initializeSwizzler(dstInfo, opts)) {
             return gif_error("Could not initialize swizzler.\n", kUnimplemented);
         }
     }