remove dead SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER code

BUG=skia:

Review URL: https://codereview.chromium.org/816273002
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index c5e9739..596d05e 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -16,9 +16,6 @@
 
 SkImageDecoder::SkImageDecoder()
     : fPeeker(NULL)
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    , fChooser(NULL)
-#endif
     , fAllocator(NULL)
     , fSampleSize(1)
     , fDefaultPref(kUnknown_SkColorType)
@@ -31,9 +28,6 @@
 
 SkImageDecoder::~SkImageDecoder() {
     SkSafeUnref(fPeeker);
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    SkSafeUnref(fChooser);
-#endif
     SkSafeUnref(fAllocator);
 }
 
@@ -42,9 +36,6 @@
         return;
     }
     other->setPeeker(fPeeker);
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    other->setChooser(fChooser);
-#endif
     other->setAllocator(fAllocator);
     other->setSampleSize(fSampleSize);
     other->setPreserveSrcDepth(fPreserveSrcDepth);
@@ -97,13 +88,6 @@
     return peeker;
 }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-SkImageDecoder::Chooser* SkImageDecoder::setChooser(Chooser* chooser) {
-    SkRefCnt_SafeAssign(fChooser, chooser);
-    return chooser;
-}
-#endif
-
 SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator* alloc) {
     SkRefCnt_SafeAssign(fAllocator, alloc);
     return alloc;
@@ -116,21 +100,6 @@
     fSampleSize = size;
 }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-// TODO: change Chooser virtual to take colorType, so we can stop calling SkColorTypeToBitmapConfig
-//
-bool SkImageDecoder::chooseFromOneChoice(SkColorType colorType, int width, int height) const {
-    Chooser* chooser = fChooser;
-    
-    if (NULL == chooser) {    // no chooser, we just say YES to decoding :)
-        return true;
-    }
-    chooser->begin(1);
-    chooser->inspect(0, SkColorTypeToBitmapConfig(colorType), width, height);
-    return chooser->choose() == 0;
-}
-#endif
-
 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap,
                                    SkColorTable* ctable) const {
     return bitmap->tryAllocPixels(fAllocator, ctable);
diff --git a/src/images/SkImageDecoder_astc.cpp b/src/images/SkImageDecoder_astc.cpp
index 30f42f0..96d28f8 100644
--- a/src/images/SkImageDecoder_astc.cpp
+++ b/src/images/SkImageDecoder_astc.cpp
@@ -117,13 +117,6 @@
     // Advance the buffer past the image dimensions
     buf += 9;
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    // should we allow the Chooser (if present) to pick a config for us???
-    if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
-        return kFailure;
-    }
-#endif
-
     // Setup the sampler...
     SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
 
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkImageDecoder_ktx.cpp
index 8566375..8ef592a 100644
--- a/src/images/SkImageDecoder_ktx.cpp
+++ b/src/images/SkImageDecoder_ktx.cpp
@@ -62,13 +62,6 @@
     const unsigned short width = ktxFile.width();
     const unsigned short height = ktxFile.height();
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    // should we allow the Chooser (if present) to pick a config for us???
-    if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
-        return kFailure;
-    }
-#endif
-
     // Set a flag if our source is premultiplied alpha
     const SkString premulKey("KTXPremultipliedAlpha");
     const bool bSrcIsPremul = ktxFile.getValueForKey(premulKey) == SkString("True");
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index fb5d18f..1d0e500 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -310,13 +310,6 @@
                 imageTop = 0;
             }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-            // FIXME: We could give the caller a choice of images or configs.
-            if (!this->chooseFromOneChoice(kIndex_8_SkColorType, width, height)) {
-                return error_return(*bm, "chooseFromOneChoice");
-            }
-#endif
-
             SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
 
             bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index b9b5c6a..a329706 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -97,67 +97,17 @@
         return kFailure;
     }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    int choice;
-    Chooser* chooser = this->getChooser();
-    //FIXME:if no chooser, consider providing the largest color image
-    //what are the odds that the largest image would be monochrome?
-    if (NULL == chooser) {
-        choice = 0;
-    } else {
-        chooser->begin(count);
-        for (int i = 0; i < count; i++)
-        {
-            //need to find out the config, width, and height from the stream
-            int width = readByte(buf, 6 + i*16);
-            int height = readByte(buf, 7 + i*16);
-            int offset = read4Bytes(buf, 18 + i*16);
-            int bitCount = read2Bytes(buf, offset+14);
-            SkBitmap::Config c;
-            //currently only provide ARGB_8888_, but maybe we want kIndex8_Config for 1 and 4, and possibly 8?
-            //or maybe we'll determine this based on the provided config
-            switch (bitCount)
-            {
-                case 1:
-                case 4:
-                    // In reality, at least for the moment, these will be decoded into kARGB_8888 bitmaps.
-                    // However, this will be used to distinguish between the lower quality 1bpp and 4 bpp
-                    // images and the higher quality images.
-                    c = SkBitmap::kIndex8_Config;
-                    break;
-                case 8:
-                case 24:
-                case 32:
-                    c = SkBitmap::kARGB_8888_Config;
-                    break;
-                default:
-                    SkDEBUGF(("Image with %ibpp not supported\n", bitCount));
-                    continue;
-            }
-            chooser->inspect(i, c, width, height);
-        }
-        choice = chooser->choose();
-    }
-
-    //you never know what the chooser is going to supply
-    if (choice >= count || choice < 0) {
-        return kFailure;
-    }
-#else
-    const int choice = 0;   // TODO: fold this value into the expressions below
-#endif
-
     //skip ahead to the correct header
     //commented out lines are not used, but if i switch to other read method, need to know how many to skip
     //otherwise, they could be used for error checking
-    int w = readByte(buf, 6 + choice*16);
-    int h = readByte(buf, 7 + choice*16);
-    int colorCount = readByte(buf, 8 + choice*16);
+    int w = readByte(buf, 6);
+    int h = readByte(buf, 7);
+    int colorCount = readByte(buf, 8);
     //int reservedToo = readByte(buf, 9 + choice*16);   //0
     //int planes = read2Bytes(buf, 10 + choice*16);       //1 - but often 0
     //int fakeBitCount = read2Bytes(buf, 12 + choice*16); //should be real - usually 0
-    const size_t size = read4Bytes(buf, 14 + choice*16);           //matters?
-    const size_t offset = read4Bytes(buf, 18 + choice*16);
+    const size_t size = read4Bytes(buf, 14);           //matters?
+    const size_t offset = read4Bytes(buf, 18);
     // promote the sum to 64-bits to avoid overflow
     if (offset > length || size > length || ((uint64_t)offset + size) > length) {
         return kFailure;
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index e6bc882..f25fb9f 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -640,13 +640,6 @@
     }
     sampleSize = recompute_sampleSize(sampleSize, cinfo);
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    // should we allow the Chooser (if present) to pick a colortype for us???
-    if (!this->chooseFromOneChoice(colorType, cinfo.output_width, cinfo.output_height)) {
-        return return_failure(cinfo, *bm, "chooseFromOneChoice");
-    }
-#endif
-
     SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampleSize);
     // Assume an A8 bitmap is not opaque to avoid the check of each
     // individual pixel. It is very unlikely to be opaque, since
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 8a3e40e..e997fdb 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -614,12 +614,6 @@
         }
     }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    if (!this->chooseFromOneChoice(*colorTypep, origWidth, origHeight)) {
-        return false;
-    }
-#endif
-
     // If the image has alpha and the decoder wants unpremultiplied
     // colors, the only supported colortype is 8888.
     if (this->getRequireUnpremultipliedColors() && *hasAlphap) {
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 2a7bb0f..d5caf70 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -303,12 +303,6 @@
         }
     }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    if (!this->chooseFromOneChoice(colorType, width, height)) {
-        return false;
-    }
-#endif
-
     SkAlphaType alphaType = kOpaque_SkAlphaType;
     if (SkToBool(fHasAlpha)) {
         if (this->getRequireUnpremultipliedColors()) {
@@ -390,14 +384,6 @@
         if (!allocResult) {
             return return_false(*decodedBitmap, "allocPixelRef");
         }
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    } else {
-        // This is also called in setDecodeConfig in above block.
-        // i.e., when bitmap->isNull() is true.
-        if (!chooseFromOneChoice(bitmap->colorType(), width, height)) {
-            return false;
-        }
-#endif
     }
 
     SkAutoLockPixels alp(*bitmap);
diff --git a/src/images/SkImageDecoder_pkm.cpp b/src/images/SkImageDecoder_pkm.cpp
index 746ae40..17ef2f3 100644
--- a/src/images/SkImageDecoder_pkm.cpp
+++ b/src/images/SkImageDecoder_pkm.cpp
@@ -47,13 +47,6 @@
     const unsigned short width = etc1_pkm_get_width(buf);
     const unsigned short height = etc1_pkm_get_height(buf);
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-    // should we allow the Chooser (if present) to pick a config for us???
-    if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
-        return kFailure;
-    }
-#endif
-
     // Setup the sampler...
     SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
 
diff --git a/src/ports/SkImageDecoder_empty.cpp b/src/ports/SkImageDecoder_empty.cpp
index 722b7d4..069cf7f 100644
--- a/src/ports/SkImageDecoder_empty.cpp
+++ b/src/ports/SkImageDecoder_empty.cpp
@@ -68,12 +68,6 @@
     return NULL;
 }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-SkImageDecoder::Chooser* SkImageDecoder::setChooser(Chooser*) {
-    return NULL;
-}
-#endif
-
 SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator*) {
     return NULL;
 }
@@ -85,12 +79,6 @@
     return false;
 }
 
-#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
-bool SkImageDecoder::chooseFromOneChoice(SkColorType, int, int) const {
-    return false;
-}
-#endif
-
 bool SkImageDecoder::allocPixelRef(SkBitmap*, SkColorTable*) const {
     return false;
 }