Do not support index8 for generateScaledPixels

Since the in/out parameter is a const SkPixmap without the proper
color table, there is no way to tell the client about it without
modifying the const SkPixmap. Rather than cheating, just return
false.

Change-Id: I63fdf57febc59e1ee9af13aa6eb9b253d19bcb17
Reviewed-on: https://skia-review.googlesource.com/6414
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/src/codec/SkCodecImageGenerator.cpp b/src/codec/SkCodecImageGenerator.cpp
index fcbd7c3..0758878 100644
--- a/src/codec/SkCodecImageGenerator.cpp
+++ b/src/codec/SkCodecImageGenerator.cpp
@@ -61,26 +61,13 @@
 }
 
 bool SkCodecImageGenerator::onGenerateScaledPixels(const SkPixmap& pixmap) {
-    SkPMColor colorStorage[256];
-    int colorCount = 256;
-    const auto result = fCodec->getPixels(pixmap.info(), pixmap.writable_addr(),
-                                          pixmap.rowBytes(), nullptr, colorStorage, &colorCount);
-    switch (result) {
-        case SkCodec::kSuccess:
-        case SkCodec::kIncompleteInput:
-            break;
-        default:
-            return false;
+    if (pixmap.colorType() == kIndex_8_SkColorType) {
+        // There is no way to tell the client about the color table with this API.
+        return false;
     }
 
-    if (pixmap.colorType() == kIndex_8_SkColorType) {
-        // SkPixmap does not take ownership, so we need to hang onto this.
-        // FIXME: With a better API on SkCodec, the SkCodec could share its SkColorTable.
-        fColorTable.reset(new SkColorTable(colorStorage, colorCount));
-        const_cast<SkPixmap&>(pixmap).reset(pixmap.info(), pixmap.addr(), pixmap.rowBytes(),
-                                            fColorTable.get());
-    }
-    return true;
+    return this->onGetPixels(pixmap.info(), pixmap.writable_addr(), pixmap.rowBytes(),
+                             nullptr, nullptr);
 }