Remove support for decoding to kIndex_8

Fix up callsites, and remove tests that no longer make sense.

Bug: skia:6828
Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295
Reviewed-on: https://skia-review.googlesource.com/21664
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 89889d2..081f237 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -94,10 +94,6 @@
     //        expanding to 8 bits and take advantage of the SkSwizzler to work from 4.
     const auto encodedInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color, alpha, 8);
 
-    // Although the encodedInfo is always kPalette_Color, it is possible that kIndex_8 is
-    // unsupported if the frame is subset and there is no transparent pixel.
-    const auto colorType = reader->firstFrameSupportsIndex8() ? kIndex_8_SkColorType
-                                                              : kN32_SkColorType;
     // The choice of unpremul versus premul is arbitrary, since all colors are either fully
     // opaque or fully transparent (i.e. kBinary), but we stored the transparent colors as all
     // zeroes, which is arguably premultiplied.
@@ -105,7 +101,7 @@
                                                         : kOpaque_SkAlphaType;
 
     const auto imageInfo = SkImageInfo::Make(reader->screenWidth(), reader->screenHeight(),
-                                             colorType, alphaType,
+                                             kN32_SkColorType, alphaType,
                                              SkColorSpace::MakeSRGB());
     return new SkGifCodec(encodedInfo, imageInfo, reader.release());
 }
@@ -189,8 +185,7 @@
 }
 
 
-SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColor* inputColorPtr,
-        int* inputColorCount, const Options& opts) {
+SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, const Options& opts) {
     if (opts.fSubset) {
         return gif_error("Subsets not supported.\n", kUnimplemented);
     }
@@ -251,11 +246,6 @@
     this->initializeSwizzler(dstInfo, frameIndex);
 
     SkASSERT(fCurrColorTable);
-    if (inputColorCount) {
-        *inputColorCount = fCurrColorTable->count();
-    }
-    copy_color_table(dstInfo, fCurrColorTable.get(), inputColorPtr, inputColorCount);
-
     return kSuccess;
 }
 
@@ -297,10 +287,8 @@
 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
                                         void* pixels, size_t dstRowBytes,
                                         const Options& opts,
-                                        SkPMColor* inputColorPtr,
-                                        int* inputColorCount,
                                         int* rowsDecoded) {
-    Result result = this->prepareToDecode(dstInfo, inputColorPtr, inputColorCount, opts);
+    Result result = this->prepareToDecode(dstInfo, opts);
     switch (result) {
         case kSuccess:
             break;
@@ -328,10 +316,8 @@
 
 SkCodec::Result SkGifCodec::onStartIncrementalDecode(const SkImageInfo& dstInfo,
                                                      void* pixels, size_t dstRowBytes,
-                                                     const SkCodec::Options& opts,
-                                                     SkPMColor* inputColorPtr,
-                                                     int* inputColorCount) {
-    Result result = this->prepareToDecode(dstInfo, inputColorPtr, inputColorCount, opts);
+                                                     const SkCodec::Options& opts) {
+    Result result = this->prepareToDecode(dstInfo, opts);
     if (result != kSuccess) {
         return result;
     }
@@ -423,28 +409,8 @@
 }
 
 uint64_t SkGifCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
-    // Note: Using fCurrColorTable relies on having called initializeColorTable already.
-    // This is (currently) safe because this method is only called when filling, after
-    // initializeColorTable has been called.
-    // FIXME: Is there a way to make this less fragile?
-    if (dstInfo.colorType() == kIndex_8_SkColorType && fCurrColorTableIsReal) {
-        // We only support index 8 for the first frame, for backwards
-        // compatibity on Android, so we are using the color table for the first frame.
-        SkASSERT(this->options().fFrameIndex == 0);
-        // Use the transparent index for the first frame.
-        const int transPixel = fReader->frameContext(0)->transparentPixel();
-        if (transPixel >= 0 && transPixel < fCurrColorTable->count()) {
-            return transPixel;
-        }
-        // Fall through to return SK_ColorTRANSPARENT (i.e. 0). This choice is arbitrary,
-        // but we have to pick something inside the color table, and this one is as good
-        // as any.
-    }
     // Using transparent as the fill value matches the behavior in Chromium,
     // which ignores the background color.
-    // If the colorType is kIndex_8, and there was no color table (i.e.
-    // fCurrColorTableIsReal is false), this value (zero) corresponds to the
-    // only entry in the dummy color table provided to the client.
     return SK_ColorTRANSPARENT;
 }