hide SkBitmap::Config entirely (behind a flag)

patch from issue 339463002

TBR=

I think the NoGPU failure is unrelated, so ignoring
NOTRY=True

Author: reed@google.com

Review URL: https://codereview.chromium.org/340533002
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index ce96efb..f481ee7 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -56,7 +56,7 @@
 
 DEFINE_GET_MEMBER(SkDrawBitmap);
 
-SkDrawBitmap::SkDrawBitmap() : format((SkBitmap::Config) -1), height(-1),
+SkDrawBitmap::SkDrawBitmap() : format((SkColorType) -1), height(-1),
     rowBytes(0),    width(-1), fColor(0), fColorSet(false) {
 }
 
@@ -88,7 +88,7 @@
     SkASSERT(width != -1);
     SkASSERT(height != -1);
     SkASSERT(rowBytes >= 0);
-    SkColorType colorType = SkBitmapConfigToColorType((SkBitmap::Config)format);
+    SkColorType colorType = SkColorType(format);
     fBitmap.setInfo(SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType), rowBytes);
     fBitmap.allocPixels();
     if (fColorSet)
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 0490e8f..789bf11 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -91,9 +91,11 @@
     sk_bzero(this, sizeof(*this));
 }
 
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
 SkBitmap::Config SkBitmap::config() const {
     return SkColorTypeToBitmapConfig(fInfo.colorType());
 }
+#endif
 
 #ifdef SK_SUPPORT_LEGACY_COMPUTE_CONFIG_SIZE
 int SkBitmap::ComputeBytesPerPixel(SkBitmap::Config config) {
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 34e5d0f..8e7cea6 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -343,6 +343,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) {
     switch (config) {
         case SkBitmap::kA8_Config:
@@ -360,6 +361,7 @@
             return kUnknown_GrPixelConfig;
     }
 }
+#endif
 
 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
 // alpha info, that will be considered.
diff --git a/src/image/SkImagePriv.cpp b/src/image/SkImagePriv.cpp
index 3ea61d5..f5b7858 100644
--- a/src/image/SkImagePriv.cpp
+++ b/src/image/SkImagePriv.cpp
@@ -9,6 +9,7 @@
 #include "SkCanvas.h"
 #include "SkPicture.h"
 
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
 SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType colorType) {
     switch (colorType) {
         case kAlpha_8_SkColorType:
@@ -45,6 +46,7 @@
     SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT));
     return gCT[config];
 }
+#endif
 
 SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
     const SkImageInfo info = bm.info();
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index b124187..fe61906 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -23,7 +23,9 @@
     , fSampleSize(1)
     , fDefaultPref(kUnknown_SkColorType)
     , fDitherImage(true)
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
     , fUsePrefTable(false)
+#endif
     , fSkipWritingZeroes(false)
     , fPreferQualityOverSpeed(false)
     , fRequireUnpremultipliedColors(false) {
@@ -47,11 +49,13 @@
 #endif
     other->setAllocator(fAllocator);
     other->setSampleSize(fSampleSize);
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
     if (fUsePrefTable) {
         other->setPrefConfigTable(fPrefTable);
     } else {
         other->fDefaultPref = fDefaultPref;
     }
+#endif
     other->setDitherImage(fDitherImage);
     other->setSkipWritingZeroes(fSkipWritingZeroes);
     other->setPreferQualityOverSpeed(fPreferQualityOverSpeed);
@@ -140,15 +144,18 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
 void SkImageDecoder::setPrefConfigTable(const PrefConfigTable& prefTable) {
     fUsePrefTable = true;
     fPrefTable = prefTable;
 }
+#endif
 
 // TODO: use colortype in fPrefTable, fDefaultPref so we can stop using SkBitmapConfigToColorType()
 //
 SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha) const {
     SkColorType ct = fDefaultPref;
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
 
     if (fUsePrefTable) {
         // Until we kill or change the PrefTable, we have to go into Config land for a moment.
@@ -169,6 +176,7 @@
         // now return to SkColorType land
         ct = SkBitmapConfigToColorType(config);
     }
+#endif
     return ct;
 }