hide SkBitmap::setConfig

patch from issue 325733002

TBR=scroggo

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/322963002
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index 327e813..ce96efb 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -88,7 +88,8 @@
     SkASSERT(width != -1);
     SkASSERT(height != -1);
     SkASSERT(rowBytes >= 0);
-    fBitmap.setConfig((SkBitmap::Config) format, width, height, rowBytes);
+    SkColorType colorType = SkBitmapConfigToColorType((SkBitmap::Config)format);
+    fBitmap.setInfo(SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType), rowBytes);
     fBitmap.allocPixels();
     if (fColorSet)
         fBitmap.eraseColor(fColor);
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index e63b2c4..ab7a511 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -217,11 +217,13 @@
     return true;
 }
 
+#ifdef SK_SUPPORT_LEGACY_SETCONFIG
 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes,
                          SkAlphaType alphaType) {
     SkColorType ct = SkBitmapConfigToColorType(config);
     return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowBytes);
 }
+#endif
 
 bool SkBitmap::setAlphaType(SkAlphaType alphaType) {
     if (!validate_alphaType(fInfo.fColorType, alphaType, &alphaType)) {
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 89e113b..ca2cfca 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -282,9 +282,7 @@
         return false;
     }
 
-    result->setConfig(src.config(), bounds.width(), bounds.height());
-    result->allocPixels();
-    if (!result->getPixels()) {
+    if (!result->allocPixels(src.info().makeWH(bounds.width(), bounds.height()))) {
         return false;
     }
 
diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp
index 551b01c..e1ab921 100644
--- a/src/fonts/SkGScalerContext.cpp
+++ b/src/fonts/SkGScalerContext.cpp
@@ -119,9 +119,8 @@
         fProxy->getPath(glyph, &path);
 
         SkBitmap bm;
-        bm.setConfig(SkBitmap::kARGB_8888_Config, glyph.fWidth, glyph.fHeight,
-                     glyph.rowBytes());
-        bm.setPixels(glyph.fImage);
+        bm.installPixels(SkImageInfo::MakeN32Premul(glyph.fWidth, glyph.fHeight),
+                         glyph.fImage, glyph.rowBytes());
         bm.eraseColor(0);
 
         SkCanvas canvas(bm);
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 66ebe3b..a07fe67 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -12,13 +12,15 @@
 #include "SkImageEncoder.h"
 #include <stdio.h>
 
-void GrSurface::asImageInfo(SkImageInfo* info) const {
-    if (!GrPixelConfig2ColorType(this->config(), &info->fColorType)) {
+SkImageInfo GrSurface::info() const {
+    SkImageInfo info;
+    if (!GrPixelConfig2ColorType(this->config(), &info.fColorType)) {
         sk_throw();
     }
-    info->fWidth = this->width();
-    info->fHeight = this->height();
-    info->fAlphaType = kPremul_SkAlphaType;
+    info.fWidth = this->width();
+    info.fHeight = this->height();
+    info.fAlphaType = kPremul_SkAlphaType;
+    return info;
 }
 
 bool GrSurface::savePixels(const char* filename) {
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 8d3f75a..44120a2 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -125,39 +125,13 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static SkBitmap::Config grConfig2skConfig(GrPixelConfig config, bool* isOpaque) {
-    switch (config) {
-        case kAlpha_8_GrPixelConfig:
-            *isOpaque = false;
-            return SkBitmap::kA8_Config;
-        case kRGB_565_GrPixelConfig:
-            *isOpaque = true;
-            return SkBitmap::kRGB_565_Config;
-        case kRGBA_4444_GrPixelConfig:
-            *isOpaque = false;
-            return SkBitmap::kARGB_4444_Config;
-        case kSkia8888_GrPixelConfig:
-            // we don't currently have a way of knowing whether
-            // a 8888 is opaque based on the config.
-            *isOpaque = false;
-            return SkBitmap::kARGB_8888_Config;
-        default:
-            *isOpaque = false;
-            return SkBitmap::kNo_Config;
-    }
-}
-
 /*
  * GrRenderTarget does not know its opaqueness, only its config, so we have
  * to make conservative guesses when we return an "equivalent" bitmap.
  */
 static SkBitmap make_bitmap(GrContext* context, GrRenderTarget* renderTarget) {
-    bool isOpaque;
-    SkBitmap::Config config = grConfig2skConfig(renderTarget->config(), &isOpaque);
-
     SkBitmap bitmap;
-    bitmap.setConfig(config, renderTarget->width(), renderTarget->height(), 0,
-                     isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
+    bitmap.setInfo(renderTarget->info());
     return bitmap;
 }
 
@@ -212,9 +186,8 @@
         surface = fRenderTarget;
     }
 
-    SkImageInfo info;
-    surface->asImageInfo(&info);
-    SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, surface, SkToBool(flags & kCached_Flag)));
+    SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef,
+                                (surface->info(), surface, SkToBool(flags & kCached_Flag)));
 
     this->setPixelRef(pr)->unref();
 }
@@ -728,12 +701,9 @@
 }
 
 SkBitmap wrap_texture(GrTexture* texture) {
-    SkImageInfo info;
-    texture->asImageInfo(&info);
-
     SkBitmap result;
-    result.setInfo(info);
-    result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
+    result.setInfo(texture->info());
+    result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unref();
     return result;
 }
 
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 491d9aa..5d38b40 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -124,15 +124,16 @@
     fSampleSize = size;
 }
 
-bool SkImageDecoder::chooseFromOneChoice(SkBitmap::Config config, int width,
-                                         int height) const {
+// 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, config, width, height);
+    chooser->inspect(0, SkColorTypeToBitmapConfig(colorType), width, height);
     return chooser->choose() == 0;
 }
 
@@ -148,8 +149,10 @@
     fPrefTable = prefTable;
 }
 
-SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth,
-                                               bool srcHasAlpha) const {
+// TODO: use colortype in fPrefTable, fDefaultPref and GetDeviceConfig()
+//       so we can stop using SkBitmapConfigToColorType()
+//
+SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha) const {
     SkBitmap::Config config = SkBitmap::kNo_Config;
 
     if (fUsePrefTable) {
@@ -173,7 +176,7 @@
     if (SkBitmap::kNo_Config == config) {
         config = SkImageDecoder::GetDeviceConfig();
     }
-    return config;
+    return SkBitmapConfigToColorType(config);
 }
 
 bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm,
@@ -232,7 +235,7 @@
     }
     // if the destination has no pixels then we must allocate them.
     if (dst->isNull()) {
-        dst->setConfig(src->config(), w, h, 0, src->alphaType());
+        dst->setInfo(src->info().makeWH(w, h));
 
         if (!this->allocPixelRef(dst, NULL)) {
             SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkImageDecoder_ktx.cpp
index 6ff2459..0dd987c 100644
--- a/src/images/SkImageDecoder_ktx.cpp
+++ b/src/images/SkImageDecoder_ktx.cpp
@@ -63,7 +63,7 @@
     const unsigned short height = ktxFile.height();
 
     // should we allow the Chooser (if present) to pick a config for us???
-    if (!this->chooseFromOneChoice(SkBitmap::kARGB_8888_Config, width, height)) {
+    if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
         return false;
     }
 
@@ -71,10 +71,8 @@
     SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
 
     // Set the config...
-    bm->setConfig(SkBitmap::kARGB_8888_Config,
-                  sampler.scaledWidth(), sampler.scaledHeight(),
-                  0,
-                  ktxFile.isRGBA8()? kPremul_SkAlphaType : kOpaque_SkAlphaType);
+    bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight(),
+                                     ktxFile.isRGBA8()? kPremul_SkAlphaType : kOpaque_SkAlphaType));
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
     }
diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index 34a88ac..f9dd247 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -123,18 +123,17 @@
 
     int width = callback.width();
     int height = callback.height();
-    SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, false);
+    SkColorType colorType = this->getPrefColorType(k32Bit_SrcDepth, false);
 
     // only accept prefConfig if it makes sense for us
-    if (SkBitmap::kARGB_4444_Config != config &&
-            SkBitmap::kRGB_565_Config != config) {
-        config = SkBitmap::kARGB_8888_Config;
+    if (kARGB_4444_SkColorType != colorType && kRGB_565_SkColorType != colorType) {
+        colorType = kN32_SkColorType;
     }
 
     SkScaledBitmapSampler sampler(width, height, getSampleSize());
 
-    bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight(), 0,
-                  kOpaque_SkAlphaType);
+    bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
+                                  colorType, kOpaque_SkAlphaType));
 
     if (justBounds) {
         return true;
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index a045c27..bbcd223 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -310,14 +310,14 @@
             }
 
             // FIXME: We could give the caller a choice of images or configs.
-            if (!this->chooseFromOneChoice(SkBitmap::kIndex8_Config, width, height)) {
+            if (!this->chooseFromOneChoice(kIndex_8_SkColorType, width, height)) {
                 return error_return(*bm, "chooseFromOneChoice");
             }
 
             SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
 
-            bm->setConfig(SkBitmap::kIndex8_Config, sampler.scaledWidth(),
-                          sampler.scaledHeight());
+            bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
+                                          kIndex_8_SkColorType, kPremul_SkAlphaType));
 
             if (SkImageDecoder::kDecodeBounds_Mode == mode) {
                 return true;
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index 2b65a36..c6dd6f0 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -246,7 +246,7 @@
     //if the andbitmap (mask) is all zeroes, then we can easily do an index bitmap
     //however, with small images with large colortables, maybe it's better to still do argb_8888
 
-    bm->setConfig(SkBitmap::kARGB_8888_Config, w, h, calculateRowBytesFor8888(w, bitCount));
+    bm->setInfo(SkImageInfo::MakeN32Premul(w, h), calculateRowBytesFor8888(w, bitCount));
 
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         delete[] colors;
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index b08835b..befe6dc 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -248,12 +248,12 @@
 #endif
 
     /**
-     *  Determine the appropriate bitmap config and out_color_space based on
+     *  Determine the appropriate bitmap colortype and out_color_space based on
      *  both the preference of the caller and the jpeg_color_space on the
      *  jpeg_decompress_struct passed in.
      *  Must be called after jpeg_read_header.
      */
-    SkBitmap::Config getBitmapConfig(jpeg_decompress_struct*);
+    SkColorType getBitmapColorType(jpeg_decompress_struct*);
 
     typedef SkImageDecoder INHERITED;
 };
@@ -400,7 +400,7 @@
 #endif
 }
 
-SkBitmap::Config SkJPEGImageDecoder::getBitmapConfig(jpeg_decompress_struct* cinfo) {
+SkColorType SkJPEGImageDecoder::getBitmapColorType(jpeg_decompress_struct* cinfo) {
     SkASSERT(cinfo != NULL);
 
     SrcDepth srcDepth = k32Bit_SrcDepth;
@@ -408,26 +408,26 @@
         srcDepth = k8BitGray_SrcDepth;
     }
 
-    SkBitmap::Config config = this->getPrefConfig(srcDepth, /*hasAlpha*/ false);
-    switch (config) {
-        case SkBitmap::kA8_Config:
-            // Only respect A8 config if the original is grayscale,
+    SkColorType colorType = this->getPrefColorType(srcDepth, /*hasAlpha*/ false);
+    switch (colorType) {
+        case kAlpha_8_SkColorType:
+            // Only respect A8 colortype if the original is grayscale,
             // in which case we will treat the grayscale as alpha
             // values.
             if (cinfo->jpeg_color_space != JCS_GRAYSCALE) {
-                config = SkBitmap::kARGB_8888_Config;
+                colorType = kN32_SkColorType;
             }
             break;
-        case SkBitmap::kARGB_8888_Config:
+        case kN32_SkColorType:
             // Fall through.
-        case SkBitmap::kARGB_4444_Config:
+        case kARGB_4444_SkColorType:
             // Fall through.
-        case SkBitmap::kRGB_565_Config:
-            // These are acceptable destination configs.
+        case kRGB_565_SkColorType:
+            // These are acceptable destination colortypes.
             break;
         default:
-            // Force all other configs to 8888.
-            config = SkBitmap::kARGB_8888_Config;
+            // Force all other colortypes to 8888.
+            colorType = kN32_SkColorType;
             break;
     }
 
@@ -441,37 +441,37 @@
             cinfo->out_color_space = JCS_CMYK;
             break;
         case JCS_GRAYSCALE:
-            if (SkBitmap::kA8_Config == config) {
+            if (kAlpha_8_SkColorType == colorType) {
                 cinfo->out_color_space = JCS_GRAYSCALE;
                 break;
             }
             // The data is JCS_GRAYSCALE, but the caller wants some sort of RGB
-            // config. Fall through to set to the default.
+            // colortype. Fall through to set to the default.
         default:
             cinfo->out_color_space = JCS_RGB;
             break;
     }
-    return config;
+    return colorType;
 }
 
-#ifdef ANDROID_RGB
 /**
- *  Based on the config and dither mode, adjust out_color_space and
- *  dither_mode of cinfo.
+ *  Based on the colortype and dither mode, adjust out_color_space and
+ *  dither_mode of cinfo. Only does work in ANDROID_RGB
  */
 static void adjust_out_color_space_and_dither(jpeg_decompress_struct* cinfo,
-                                              SkBitmap::Config config,
+                                              SkColorType colorType,
                                               const SkImageDecoder& decoder) {
     SkASSERT(cinfo != NULL);
+#ifdef ANDROID_RGB
     cinfo->dither_mode = JDITHER_NONE;
     if (JCS_CMYK == cinfo->out_color_space) {
         return;
     }
-    switch(config) {
-        case SkBitmap::kARGB_8888_Config:
+    switch (colorType) {
+        case kN32_SkColorType:
             cinfo->out_color_space = JCS_RGBA_8888;
             break;
-        case SkBitmap::kRGB_565_Config:
+        case kRGB_565_SkColorType:
             cinfo->out_color_space = JCS_RGB_565;
             if (decoder.getDitherImage()) {
                 cinfo->dither_mode = JDITHER_ORDERED;
@@ -480,8 +480,8 @@
         default:
             break;
     }
-}
 #endif
+}
 
 
 /**
@@ -569,20 +569,19 @@
 
     turn_off_visual_optimizations(&cinfo);
 
-    const SkBitmap::Config config = this->getBitmapConfig(&cinfo);
+    const SkColorType colorType = this->getBitmapColorType(&cinfo);
+    const SkAlphaType alphaType = kAlpha_8_SkColorType == colorType ?
+                                      kPremul_SkAlphaType : kOpaque_SkAlphaType;
 
-#ifdef ANDROID_RGB
-    adjust_out_color_space_and_dither(&cinfo, config, *this);
-#endif
+    adjust_out_color_space_and_dither(&cinfo, colorType, *this);
 
     if (1 == sampleSize && SkImageDecoder::kDecodeBounds_Mode == mode) {
         // Assume an A8 bitmap is not opaque to avoid the check of each
         // individual pixel. It is very unlikely to be opaque, since
         // an opaque A8 bitmap would not be very interesting.
         // Otherwise, a jpeg image is opaque.
-        return bm->setConfig(config, cinfo.image_width, cinfo.image_height, 0,
-                             SkBitmap::kA8_Config == config ?
-                                kPremul_SkAlphaType : kOpaque_SkAlphaType);
+        return bm->setInfo(SkImageInfo::Make(cinfo.image_width, cinfo.image_height,
+                                             colorType, alphaType));
     }
 
     /*  image_width and image_height are the original dimensions, available
@@ -606,17 +605,16 @@
             // individual pixel. It is very unlikely to be opaque, since
             // an opaque A8 bitmap would not be very interesting.
             // Otherwise, a jpeg image is opaque.
-            return bm->setConfig(config, smpl.scaledWidth(), smpl.scaledHeight(),
-                                 0, SkBitmap::kA8_Config == config ?
-                                    kPremul_SkAlphaType : kOpaque_SkAlphaType);
+            return bm->setInfo(SkImageInfo::Make(smpl.scaledWidth(), smpl.scaledHeight(),
+                                                 colorType, alphaType));
         } else {
             return return_false(cinfo, *bm, "start_decompress");
         }
     }
     sampleSize = recompute_sampleSize(sampleSize, cinfo);
 
-    // should we allow the Chooser (if present) to pick a config for us???
-    if (!this->chooseFromOneChoice(config, cinfo.output_width, cinfo.output_height)) {
+    // 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_false(cinfo, *bm, "chooseFromOneChoice");
     }
 
@@ -625,8 +623,8 @@
     // individual pixel. It is very unlikely to be opaque, since
     // an opaque A8 bitmap would not be very interesting.
     // Otherwise, a jpeg image is opaque.
-    bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight(), 0,
-                  SkBitmap::kA8_Config != config ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
+    bm->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
+                                  colorType, alphaType));
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
     }
@@ -641,10 +639,8 @@
        a significant performance boost.
     */
     if (sampleSize == 1 &&
-        ((config == SkBitmap::kARGB_8888_Config &&
-                cinfo.out_color_space == JCS_RGBA_8888) ||
-        (config == SkBitmap::kRGB_565_Config &&
-                cinfo.out_color_space == JCS_RGB_565)))
+        ((kN32_SkColorType == colorType && cinfo.out_color_space == JCS_RGBA_8888) ||
+         (kRGB_565_SkColorType == colorType && cinfo.out_color_space == JCS_RGB_565)))
     {
         JSAMPLE* rowptr = (JSAMPLE*)bm->getPixels();
         INT32 const bpr =  bm->rowBytes();
@@ -764,7 +760,7 @@
     // based on the config in onDecodeSubset. This should be fine, since
     // jpeg_init_read_tile_scanline will check out_color_space again after
     // that change (when it calls jinit_color_deconverter).
-    (void) this->getBitmapConfig(cinfo);
+    (void) this->getBitmapColorType(cinfo);
 
     turn_off_visual_optimizations(cinfo);
 
@@ -815,10 +811,8 @@
 
     set_dct_method(*this, cinfo);
 
-    const SkBitmap::Config config = this->getBitmapConfig(cinfo);
-#ifdef ANDROID_RGB
-    adjust_out_color_space_and_dither(cinfo, config, *this);
-#endif
+    const SkColorType colorType = this->getBitmapColorType(cinfo);
+    adjust_out_color_space_and_dither(cinfo, colorType, *this);
 
     int startX = rect.fLeft;
     int startY = rect.fTop;
@@ -833,14 +827,13 @@
     SkScaledBitmapSampler sampler(width, height, skiaSampleSize);
 
     SkBitmap bitmap;
-    bitmap.setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
     // Assume an A8 bitmap is not opaque to avoid the check of each
     // individual pixel. It is very unlikely to be opaque, since
     // an opaque A8 bitmap would not be very interesting.
     // Otherwise, a jpeg image is opaque.
-    bitmap.setConfig(config, sampler.scaledWidth(), sampler.scaledHeight(), 0,
-                     config == SkBitmap::kA8_Config ? kPremul_SkAlphaType :
-                     kOpaque_SkAlphaType);
+    bitmap.setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(), colorType,
+                                     kAlpha_8_SkColorType == colorType ?
+                                         kPremul_SkAlphaType : kOpaque_SkAlphaType));
 
     // Check ahead of time if the swap(dest, src) is possible or not.
     // If yes, then we will stick to AllocPixelRef since it's cheaper with the
@@ -869,10 +862,8 @@
        a significant performance boost.
     */
     if (skiaSampleSize == 1 &&
-        ((config == SkBitmap::kARGB_8888_Config &&
-                cinfo->out_color_space == JCS_RGBA_8888) ||
-        (config == SkBitmap::kRGB_565_Config &&
-                cinfo->out_color_space == JCS_RGB_565)))
+        ((kN32_SkColorType == colorType && cinfo->out_color_space == JCS_RGBA_8888) ||
+         (kRGB_565_SkColorType == colorType && cinfo->out_color_space == JCS_RGB_565)))
     {
         JSAMPLE* rowptr = (JSAMPLE*)bitmap.getPixels();
         INT32 const bpr = bitmap.rowBytes();
@@ -1116,14 +1107,14 @@
 }
 
 static WriteScanline ChooseWriter(const SkBitmap& bm) {
-    switch (bm.config()) {
-        case SkBitmap::kARGB_8888_Config:
+    switch (bm.colorType()) {
+        case kN32_SkColorType:
             return Write_32_YUV;
-        case SkBitmap::kRGB_565_Config:
+        case kRGB_565_SkColorType:
             return Write_16_YUV;
-        case SkBitmap::kARGB_4444_Config:
+        case kARGB_4444_SkColorType:
             return Write_4444_YUV;
-        case SkBitmap::kIndex8_Config:
+        case kIndex_8_SkColorType:
             return Write_Index_YUV;
         default:
             return NULL;
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index cd09f5f..70cc1b9 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2006 The Android Open Source Project
  *
@@ -6,7 +5,6 @@
  * found in the LICENSE file.
  */
 
-
 #include "SkImageDecoder.h"
 #include "SkImageEncoder.h"
 #include "SkColor.h"
@@ -59,7 +57,7 @@
         : fStream(stream)
         , fPng_ptr(png_ptr)
         , fInfo_ptr(info_ptr)
-        , fConfig(SkBitmap::kNo_Config) {
+        , fColorType(kUnknown_SkColorType) {
         SkASSERT(stream != NULL);
         stream->ref();
     }
@@ -72,7 +70,7 @@
     SkAutoTUnref<SkStreamRewindable>    fStream;
     png_structp                         fPng_ptr;
     png_infop                           fInfo_ptr;
-    SkBitmap::Config                    fConfig;
+    SkColorType                         fColorType;
 };
 
 class SkPNGImageDecoder : public SkImageDecoder {
@@ -102,9 +100,8 @@
     bool decodePalette(png_structp png_ptr, png_infop info_ptr,
                        bool * SK_RESTRICT hasAlphap, bool *reallyHasAlphap,
                        SkColorTable **colorTablep);
-    bool getBitmapConfig(png_structp png_ptr, png_infop info_ptr,
-                         SkBitmap::Config *config, bool *hasAlpha,
-                         SkPMColor *theTranspColor);
+    bool getBitmapConfig(png_structp, png_infop, SkColorType*, bool* hasAlpha,
+                         SkPMColor* theTranspColor);
 
     typedef SkImageDecoder INHERITED;
 };
@@ -186,13 +183,12 @@
     return reallyHasAlpha;
 }
 
-static bool canUpscalePaletteToConfig(SkBitmap::Config dstConfig,
-                                      bool srcHasAlpha) {
-    switch (dstConfig) {
-        case SkBitmap::kARGB_8888_Config:
-        case SkBitmap::kARGB_4444_Config:
+static bool canUpscalePaletteToConfig(SkColorType dstColorType, bool srcHasAlpha) {
+    switch (dstColorType) {
+        case kN32_SkColorType:
+        case kARGB_4444_SkColorType:
             return true;
-        case SkBitmap::kRGB_565_Config:
+        case kRGB_565_SkColorType:
             // only return true if the src is opaque (since 565 is opaque)
             return !srcHasAlpha;
         default:
@@ -317,26 +313,24 @@
     }
 
     png_uint_32 origWidth, origHeight;
-    int bitDepth, colorType, interlaceType;
+    int bitDepth, pngColorType, interlaceType;
     png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
-                 &colorType, &interlaceType, int_p_NULL, int_p_NULL);
+                 &pngColorType, &interlaceType, int_p_NULL, int_p_NULL);
 
-    SkBitmap::Config    config;
+    SkColorType         colorType;
     bool                hasAlpha = false;
     SkPMColor           theTranspColor = 0; // 0 tells us not to try to match
 
-    if (!this->getBitmapConfig(png_ptr, info_ptr, &config, &hasAlpha, &theTranspColor)) {
+    if (!this->getBitmapConfig(png_ptr, info_ptr, &colorType, &hasAlpha, &theTranspColor)) {
         return false;
     }
 
+    SkAlphaType alphaType = this->getRequireUnpremultipliedColors() ?
+                                kUnpremul_SkAlphaType : kPremul_SkAlphaType;
     const int sampleSize = this->getSampleSize();
     SkScaledBitmapSampler sampler(origWidth, origHeight, sampleSize);
-    decodedBitmap->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
-
-    // we should communicate alphaType, even if we early-return in bounds-only-mode.
-    if (this->getRequireUnpremultipliedColors()) {
-        decodedBitmap->setAlphaType(kUnpremul_SkAlphaType);
-    }
+    decodedBitmap->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
+                                             colorType, alphaType));
 
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
@@ -350,14 +344,14 @@
     bool reallyHasAlpha = false;
     SkColorTable* colorTable = NULL;
 
-    if (colorType == PNG_COLOR_TYPE_PALETTE) {
+    if (pngColorType == PNG_COLOR_TYPE_PALETTE) {
         decodePalette(png_ptr, info_ptr, &hasAlpha, &reallyHasAlpha, &colorTable);
     }
 
     SkAutoUnref aur(colorTable);
 
     if (!this->allocPixelRef(decodedBitmap,
-                             SkBitmap::kIndex8_Config == config ? colorTable : NULL)) {
+                             kIndex_8_SkColorType == colorType ? colorTable : NULL)) {
         return false;
     }
 
@@ -376,15 +370,15 @@
     */
     png_read_update_info(png_ptr, info_ptr);
 
-    if ((SkBitmap::kA8_Config == config || SkBitmap::kIndex8_Config == config)
-        && 1 == sampleSize) {
-        if (SkBitmap::kA8_Config == config) {
+    if ((kAlpha_8_SkColorType == colorType || kIndex_8_SkColorType == colorType) &&
+            1 == sampleSize) {
+        if (kAlpha_8_SkColorType == colorType) {
             // For an A8 bitmap, we assume there is an alpha for speed. It is
             // possible the bitmap is opaque, but that is an unlikely use case
             // since it would not be very interesting.
             reallyHasAlpha = true;
             // A8 is only allowed if the original was GRAY.
-            SkASSERT(PNG_COLOR_TYPE_GRAY == colorType);
+            SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
         }
         for (int i = 0; i < number_passes; i++) {
             for (png_uint_32 y = 0; y < origHeight; y++) {
@@ -399,9 +393,9 @@
         if (colorTable != NULL) {
             sc = SkScaledBitmapSampler::kIndex;
             srcBytesPerPixel = 1;
-        } else if (SkBitmap::kA8_Config == config) {
+        } else if (kAlpha_8_SkColorType == colorType) {
             // A8 is only allowed if the original was GRAY.
-            SkASSERT(PNG_COLOR_TYPE_GRAY == colorType);
+            SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
             sc = SkScaledBitmapSampler::kGray;
             srcBytesPerPixel = 1;
         } else if (hasAlpha) {
@@ -492,8 +486,8 @@
 
 
 bool SkPNGImageDecoder::getBitmapConfig(png_structp png_ptr, png_infop info_ptr,
-                                        SkBitmap::Config* SK_RESTRICT configp,
-                                        bool* SK_RESTRICT hasAlphap,
+                                        SkColorType* colorTypep,
+                                        bool* hasAlphap,
                                         SkPMColor* SK_RESTRICT theTranspColorp) {
     png_uint_32 origWidth, origHeight;
     int bitDepth, colorType;
@@ -518,10 +512,10 @@
 
     if (colorType == PNG_COLOR_TYPE_PALETTE) {
         bool paletteHasAlpha = hasTransparencyInPalette(png_ptr, info_ptr);
-        *configp = this->getPrefConfig(kIndex_SrcDepth, paletteHasAlpha);
+        *colorTypep = this->getPrefColorType(kIndex_SrcDepth, paletteHasAlpha);
         // now see if we can upscale to their requested config
-        if (!canUpscalePaletteToConfig(*configp, paletteHasAlpha)) {
-            *configp = SkBitmap::kIndex8_Config;
+        if (!canUpscalePaletteToConfig(*colorTypep, paletteHasAlpha)) {
+            *colorTypep = kIndex_8_SkColorType;
         }
     } else {
         png_color_16p transpColor = NULL;
@@ -585,21 +579,21 @@
             //SkASSERT(!*hasAlphap);
         }
 
-        *configp = this->getPrefConfig(srcDepth, *hasAlphap);
+        *colorTypep = this->getPrefColorType(srcDepth, *hasAlphap);
         // now match the request against our capabilities
         if (*hasAlphap) {
-            if (*configp != SkBitmap::kARGB_4444_Config) {
-                *configp = SkBitmap::kARGB_8888_Config;
+            if (*colorTypep != kARGB_4444_SkColorType) {
+                *colorTypep = kN32_SkColorType;
             }
         } else {
-            if (SkBitmap::kA8_Config == *configp) {
+            if (kAlpha_8_SkColorType == *colorTypep) {
                 if (k8BitGray_SrcDepth != srcDepth) {
                     // Converting a non grayscale image to A8 is not currently supported.
-                    *configp = SkBitmap::kARGB_8888_Config;
+                    *colorTypep = kN32_SkColorType;
                 }
-            } else if (*configp != SkBitmap::kRGB_565_Config &&
-                       *configp != SkBitmap::kARGB_4444_Config) {
-                *configp = SkBitmap::kARGB_8888_Config;
+            } else if (*colorTypep != kRGB_565_SkColorType &&
+                       *colorTypep != kARGB_4444_SkColorType) {
+                *colorTypep = kN32_SkColorType;
             }
         }
     }
@@ -613,30 +607,29 @@
         }
     }
 
-    if (!this->chooseFromOneChoice(*configp, origWidth, origHeight)) {
+    if (!this->chooseFromOneChoice(*colorTypep, origWidth, origHeight)) {
         return false;
     }
 
     // If the image has alpha and the decoder wants unpremultiplied
     // colors, the only supported config is 8888.
     if (this->getRequireUnpremultipliedColors() && *hasAlphap) {
-        *configp = SkBitmap::kARGB_8888_Config;
+        *colorTypep = kN32_SkColorType;
     }
 
     if (fImageIndex != NULL) {
-        if (SkBitmap::kNo_Config == fImageIndex->fConfig) {
+        if (kUnknown_SkColorType == fImageIndex->fColorType) {
             // This is the first time for this subset decode. From now on,
             // all decodes must be in the same config.
-            fImageIndex->fConfig = *configp;
-        } else if (fImageIndex->fConfig != *configp) {
-            // Requesting a different config for a subsequent decode is not
+            fImageIndex->fColorType = *colorTypep;
+        } else if (fImageIndex->fColorType != *colorTypep) {
+            // Requesting a different colortype for a subsequent decode is not
             // supported. Report failure before we make changes to png_ptr.
             return false;
         }
     }
 
-    bool convertGrayToRGB = PNG_COLOR_TYPE_GRAY == colorType
-                            && *configp != SkBitmap::kA8_Config;
+    bool convertGrayToRGB = PNG_COLOR_TYPE_GRAY == colorType && *colorTypep != kAlpha_8_SkColorType;
 
     // Unless the user is requesting A8, convert a grayscale image into RGB.
     // GRAY_ALPHA will always be converted to RGB
@@ -774,9 +767,9 @@
     }
 
     png_uint_32 origWidth, origHeight;
-    int bitDepth, colorType, interlaceType;
+    int bitDepth, pngColorType, interlaceType;
     png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
-                 &colorType, &interlaceType, int_p_NULL, int_p_NULL);
+                 &pngColorType, &interlaceType, int_p_NULL, int_p_NULL);
 
     SkIRect rect = SkIRect::MakeWH(origWidth, origHeight);
 
@@ -786,11 +779,11 @@
         return false;
     }
 
-    SkBitmap::Config    config;
+    SkColorType         colorType;
     bool                hasAlpha = false;
     SkPMColor           theTranspColor = 0; // 0 tells us not to try to match
 
-    if (!this->getBitmapConfig(png_ptr, info_ptr, &config, &hasAlpha, &theTranspColor)) {
+    if (!this->getBitmapConfig(png_ptr, info_ptr, &colorType, &hasAlpha, &theTranspColor)) {
         return false;
     }
 
@@ -798,7 +791,8 @@
     SkScaledBitmapSampler sampler(origWidth, rect.height(), sampleSize);
 
     SkBitmap decodedBitmap;
-    decodedBitmap.setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
+    decodedBitmap.setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
+                                            colorType, kPremul_SkAlphaType));
 
     // from here down we are concerned with colortables and pixels
 
@@ -808,7 +802,7 @@
     bool reallyHasAlpha = false;
     SkColorTable* colorTable = NULL;
 
-    if (colorType == PNG_COLOR_TYPE_PALETTE) {
+    if (pngColorType == PNG_COLOR_TYPE_PALETTE) {
         decodePalette(png_ptr, info_ptr, &hasAlpha, &reallyHasAlpha, &colorTable);
     }
 
@@ -821,7 +815,7 @@
     int h = rect.height() / sampleSize;
     const bool swapOnly = (rect == region) && (w == decodedBitmap.width()) &&
                           (h == decodedBitmap.height()) && bm->isNull();
-    const bool needColorTable = SkBitmap::kIndex8_Config == config;
+    const bool needColorTable = kIndex_8_SkColorType == colorType;
     if (swapOnly) {
         if (!this->allocPixelRef(&decodedBitmap, needColorTable ? colorTable : NULL)) {
             return false;
@@ -856,15 +850,15 @@
 
     int actualTop = rect.fTop;
 
-    if ((SkBitmap::kA8_Config == config || SkBitmap::kIndex8_Config == config)
+    if ((kAlpha_8_SkColorType == colorType || kIndex_8_SkColorType == colorType)
         && 1 == sampleSize) {
-        if (SkBitmap::kA8_Config == config) {
+        if (kAlpha_8_SkColorType == colorType) {
             // For an A8 bitmap, we assume there is an alpha for speed. It is
             // possible the bitmap is opaque, but that is an unlikely use case
             // since it would not be very interesting.
             reallyHasAlpha = true;
             // A8 is only allowed if the original was GRAY.
-            SkASSERT(PNG_COLOR_TYPE_GRAY == colorType);
+            SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
         }
 
         for (int i = 0; i < number_passes; i++) {
@@ -886,9 +880,9 @@
         if (colorTable != NULL) {
             sc = SkScaledBitmapSampler::kIndex;
             srcBytesPerPixel = 1;
-        } else if (SkBitmap::kA8_Config == config) {
+        } else if (kAlpha_8_SkColorType == colorType) {
             // A8 is only allowed if the original was GRAY.
-            SkASSERT(PNG_COLOR_TYPE_GRAY == colorType);
+            SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
             sc = SkScaledBitmapSampler::kGray;
             srcBytesPerPixel = 1;
         } else if (hasAlpha) {
@@ -957,11 +951,11 @@
         reallyHasAlpha |= substituteTranspColor(&decodedBitmap, theTranspColor);
     }
     if (reallyHasAlpha && this->getRequireUnpremultipliedColors()) {
-        switch (decodedBitmap.config()) {
-            case SkBitmap::kIndex8_Config:
+        switch (decodedBitmap.colorType()) {
+            case kIndex_8_SkColorType:
                 // Fall through.
-            case SkBitmap::kARGB_4444_Config:
-                // We have chosen not to support unpremul for these configs.
+            case kARGB_4444_SkColorType:
+                // We have chosen not to support unpremul for these colortypess.
                 return false;
             default: {
                 // Fall through to finish the decode. This config either
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 353eabf..8baa10c 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -278,40 +278,33 @@
     return true;
 }
 
-bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap,
-                                         int width, int height) {
-    SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, SkToBool(fHasAlpha));
+bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap, int width, int height) {
+    SkColorType colorType = this->getPrefColorType(k32Bit_SrcDepth, SkToBool(fHasAlpha));
 
     // YUV converter supports output in RGB565, RGBA4444 and RGBA8888 formats.
     if (fHasAlpha) {
-        if (config != SkBitmap::kARGB_4444_Config) {
-            config = SkBitmap::kARGB_8888_Config;
+        if (colorType != kARGB_4444_SkColorType) {
+            colorType = kN32_SkColorType;
         }
     } else {
-        if (config != SkBitmap::kRGB_565_Config &&
-            config != SkBitmap::kARGB_4444_Config) {
-            config = SkBitmap::kARGB_8888_Config;
+        if (colorType != kRGB_565_SkColorType && colorType != kARGB_4444_SkColorType) {
+            colorType = kN32_SkColorType;
         }
     }
 
-    if (!this->chooseFromOneChoice(config, width, height)) {
+    if (!this->chooseFromOneChoice(colorType, width, height)) {
         return false;
     }
 
-    SkImageInfo info;
-    info.fWidth = width;
-    info.fHeight = height;
-    info.fColorType = SkBitmapConfigToColorType(config);
+    SkAlphaType alphaType = kOpaque_SkAlphaType;
     if (SkToBool(fHasAlpha)) {
         if (this->getRequireUnpremultipliedColors()) {
-            info.fAlphaType = kUnpremul_SkAlphaType;
+            alphaType = kUnpremul_SkAlphaType;
         } else {
-            info.fAlphaType = kPremul_SkAlphaType;
+            alphaType = kPremul_SkAlphaType;
         }
-    } else {
-        info.fAlphaType = kOpaque_SkAlphaType;
     }
-    return decodedBitmap->setInfo(info);
+    return decodedBitmap->setInfo(SkImageInfo::Make(width, height, colorType, alphaType));
 }
 
 bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
@@ -389,7 +382,7 @@
     } else {
         // This is also called in setDecodeConfig in above block.
         // i.e., when bitmap->isNull() is true.
-        if (!chooseFromOneChoice(bitmap->config(), width, height)) {
+        if (!chooseFromOneChoice(bitmap->colorType(), width, height)) {
             return false;
         }
     }
diff --git a/src/images/SkImageDecoder_pkm.cpp b/src/images/SkImageDecoder_pkm.cpp
index c299c23..79da8da 100644
--- a/src/images/SkImageDecoder_pkm.cpp
+++ b/src/images/SkImageDecoder_pkm.cpp
@@ -47,7 +47,7 @@
     const unsigned short height = etc1_pkm_get_height(buf);
 
     // should we allow the Chooser (if present) to pick a config for us???
-    if (!this->chooseFromOneChoice(SkBitmap::kARGB_8888_Config, width, height)) {
+    if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
         return false;
     }
 
@@ -55,8 +55,8 @@
     SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
 
     // Set the config...
-    bm->setConfig(SkBitmap::kARGB_8888_Config, sampler.scaledWidth(), sampler.scaledHeight(),
-                  0, kOpaque_SkAlphaType);
+    bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight(),
+                                     kOpaque_SkAlphaType));
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
     }
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index 8dce62c..0bf1389 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -111,8 +111,8 @@
     int width = head.fWidth;
     int height = head.fHeight;
 
-    decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height, 0,
-                             kOpaque_SkAlphaType);
+    decodedBitmap->setInfo(SkImageInfo::Make(width, height,
+                                             kIndex_8_SkColorType, kOpaque_SkAlphaType));
 
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index ba8ce46..7fd8718 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -842,17 +842,23 @@
 
 void test_row_proc_choice();
 void test_row_proc_choice() {
+    const SkColorType colorTypes[] = {
+        kAlpha_8_SkColorType, kIndex_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType,
+        kN32_SkColorType
+    };
+
     SkBitmap dummyBitmap;
     DummyDecoder dummyDecoder;
     size_t procCounter = 0;
     for (int sc = SkScaledBitmapSampler::kGray; sc <= SkScaledBitmapSampler::kRGB_565; ++sc) {
-        for (int c = SkBitmap::kA8_Config; c <= SkBitmap::kARGB_8888_Config; ++c) {
+        for (size_t c = 0; c < SK_ARRAY_COUNT(colorTypes); ++c) {
             for (int unpremul = 0; unpremul <= 1; ++unpremul) {
                 for (int dither = 0; dither <= 1; ++dither) {
                     // Arbitrary width/height/sampleSize to allow SkScaledBitmapSampler to
                     // be considered valid.
                     SkScaledBitmapSampler sampler(10, 10, 1);
-                    dummyBitmap.setConfig((SkBitmap::Config) c, 10, 10);
+                    dummyBitmap.setInfo(SkImageInfo::Make(10, 10,
+                                                          colorTypes[c], kPremul_SkAlphaType));
                     dummyDecoder.setDitherImage(SkToBool(dither));
                     dummyDecoder.setRequireUnpremultipliedColors(SkToBool(unpremul));
                     sampler.begin(&dummyBitmap, (SkScaledBitmapSampler::SrcConfig) sc,
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index e4323d8..b27ae96 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -295,11 +295,11 @@
     }
 }
 
-inline SkMask::Format SkMaskFormat_for_SkBitmapConfig(SkBitmap::Config config) {
-    switch (config) {
-        case SkBitmap::kA8_Config:
+inline SkMask::Format SkMaskFormat_for_SkColorType(SkColorType colorType) {
+    switch (colorType) {
+        case kAlpha_8_SkColorType:
             return SkMask::kA8_Format;
-        case SkBitmap::kARGB_8888_Config:
+        case kN32_SkColorType:
             return SkMask::kARGB32_Format;
         default:
             SkDEBUGFAIL("unsupported SkBitmap::Config");
@@ -307,30 +307,30 @@
     }
 }
 
-inline SkBitmap::Config SkBitmapConfig_for_FTPixelMode(FT_Pixel_Mode pixel_mode) {
+inline SkColorType SkColorType_for_FTPixelMode(FT_Pixel_Mode pixel_mode) {
     switch (pixel_mode) {
         case FT_PIXEL_MODE_MONO:
         case FT_PIXEL_MODE_GRAY:
-            return SkBitmap::kA8_Config;
+            return kAlpha_8_SkColorType;
         case FT_PIXEL_MODE_BGRA:
-            return SkBitmap::kARGB_8888_Config;
+            return kN32_SkColorType;
         default:
             SkDEBUGFAIL("unsupported FT_PIXEL_MODE");
-            return SkBitmap::kA8_Config;
+            return kAlpha_8_SkColorType;
     }
 }
 
-inline SkBitmap::Config SkBitmapConfig_for_SkMaskFormat(SkMask::Format format) {
+inline SkColorType SkColorType_for_SkMaskFormat(SkMask::Format format) {
     switch (format) {
         case SkMask::kBW_Format:
         case SkMask::kA8_Format:
         case SkMask::kLCD16_Format:
-            return SkBitmap::kA8_Config;
+            return kAlpha_8_SkColorType;
         case SkMask::kARGB32_Format:
-            return SkBitmap::kARGB_8888_Config;
+            return kN32_SkColorType;
         default:
             SkDEBUGFAIL("unsupported destination SkBitmap::Config");
-            return SkBitmap::kA8_Config;
+            return kAlpha_8_SkColorType;
     }
 }
 
@@ -426,15 +426,16 @@
 
             // Copy the FT_Bitmap into an SkBitmap (either A8 or ARGB)
             SkBitmap unscaledBitmap;
-            unscaledBitmap.setConfig(SkBitmapConfig_for_FTPixelMode(pixel_mode),
-                                     face->glyph->bitmap.width, face->glyph->bitmap.rows);
-            unscaledBitmap.allocPixels();
+            unscaledBitmap.allocPixels(SkImageInfo::Make(face->glyph->bitmap.width,
+                                                         face->glyph->bitmap.rows,
+                                                         SkColorType_for_FTPixelMode(pixel_mode),
+                                                         kPremul_SkAlphaType));
 
             SkMask unscaledBitmapAlias;
             unscaledBitmapAlias.fImage = reinterpret_cast<uint8_t*>(unscaledBitmap.getPixels());
             unscaledBitmapAlias.fBounds.set(0, 0, unscaledBitmap.width(), unscaledBitmap.height());
             unscaledBitmapAlias.fRowBytes = unscaledBitmap.rowBytes();
-            unscaledBitmapAlias.fFormat = SkMaskFormat_for_SkBitmapConfig(unscaledBitmap.config());
+            unscaledBitmapAlias.fFormat = SkMaskFormat_for_SkColorType(unscaledBitmap.colorType());
             copyFTBitmap(face->glyph->bitmap, unscaledBitmapAlias);
 
             // Wrap the glyph's mask in a bitmap, unless the glyph's mask is BW or LCD.
@@ -446,8 +447,10 @@
                 bitmapRowBytes = glyph.rowBytes();
             }
             SkBitmap dstBitmap;
-            dstBitmap.setConfig(SkBitmapConfig_for_SkMaskFormat(maskFormat),
-                                glyph.fWidth, glyph.fHeight, bitmapRowBytes);
+            dstBitmap.setInfo(SkImageInfo::Make(glyph.fWidth, glyph.fHeight,
+                                                SkColorType_for_SkMaskFormat(maskFormat),
+                                                kPremul_SkAlphaType),
+                              bitmapRowBytes);
             if (SkMask::kBW_Format == maskFormat || SkMask::kLCD16_Format == maskFormat) {
                 dstBitmap.allocPixels();
             } else {
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index a21536b..8545ac8 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -68,9 +68,8 @@
 
     const int width = SkToInt(CGImageGetWidth(image));
     const int height = SkToInt(CGImageGetHeight(image));
-    SkImageInfo skinfo = SkImageInfo::MakeN32Premul(width, height);
 
-    bm->setInfo(skinfo);
+    bm->setInfo(SkImageInfo::MakeN32Premul(width, height));
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
     }
diff --git a/src/ports/SkImageDecoder_empty.cpp b/src/ports/SkImageDecoder_empty.cpp
index a3503e4..d8f3315 100644
--- a/src/ports/SkImageDecoder_empty.cpp
+++ b/src/ports/SkImageDecoder_empty.cpp
@@ -94,7 +94,7 @@
     return false;
 }
 
-bool SkImageDecoder::chooseFromOneChoice(SkBitmap::Config, int, int) const {
+bool SkImageDecoder::chooseFromOneChoice(SkColorType, int, int) const {
     return false;
 }
 
@@ -102,11 +102,6 @@
     return false;
 }
 
-SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth, bool) const {
-    return SkBitmap::kNo_Config;
-}
-
-
 /////////////////////////////////////////////////////////////////////////
 
 // Empty implementation for SkMovie.