Revert "Revert of setConfig -> setInfo (https://codereview.chromium.org/308683005/)"

This reverts commit eecaea4148805834f223681f70b6488ceba12d09.

R=robertphillips@google.com, scroggo@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/301283003

git-svn-id: http://skia.googlecode.com/svn/trunk@14989 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/dm/DMGpuGMTask.cpp b/dm/DMGpuGMTask.cpp
index c72f675..a7b1d7b 100644
--- a/dm/DMGpuGMTask.cpp
+++ b/dm/DMGpuGMTask.cpp
@@ -37,7 +37,7 @@
     canvas->flush();
 
     SkBitmap bitmap;
-    bitmap.setConfig(info);
+    bitmap.setInfo(info);
     canvas->readPixels(&bitmap, 0, 0);
 
     this->spawnChild(SkNEW_ARGS(ExpectationsTask, (*this, fExpectations, bitmap)));
diff --git a/dm/DMWriteTask.cpp b/dm/DMWriteTask.cpp
index 7c9bb62..98ea929 100644
--- a/dm/DMWriteTask.cpp
+++ b/dm/DMWriteTask.cpp
@@ -97,7 +97,7 @@
                     info, rowBytes, NULL/*ctable*/, subset));
         SkASSERT(pixels);
 
-        bitmap->setConfig(info, rowBytes);
+        bitmap->setInfo(info, rowBytes);
         bitmap->setPixelRef(pixels);
         return true;
     }
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 4833975..65a233f 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -590,7 +590,7 @@
             // the device is as large as the current rendertarget, so
             // we explicitly only readback the amount we expect (in
             // size) overwrite our previous allocation
-            bitmap->setConfig(SkImageInfo::MakeN32Premul(size.fWidth, size.fHeight));
+            bitmap->setInfo(SkImageInfo::MakeN32Premul(size.fWidth, size.fHeight));
             canvas->readPixels(bitmap, 0, 0);
         }
 #endif
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 75b89b7..72711f7 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -314,6 +314,7 @@
         'SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES',
         'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
         'SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE',
+        'SK_SUPPORT_LEGACY_SETCONFIG_INFO',
         # Needed until we fix skbug.com/2440.
         'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
         # Transitional, for deprecated SkCanvas::SaveFlags methods.
diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi
index 8337a46..783d352 100644
--- a/gyp/skia_for_chromium_defines.gypi
+++ b/gyp/skia_for_chromium_defines.gypi
@@ -15,6 +15,7 @@
     'skia_for_chromium_defines': [
       'SK_SUPPORT_LEGACY_GETTOPDEVICE',
       'SK_SUPPORT_LEGACY_ASIMAGEINFO',
+      'SK_SUPPORT_LEGACY_SETCONFIG_INFO',
       'SK_SUPPORT_LEGACY_N32_NAME',
       'SK_IGNORE_CORRECT_HIGH_QUALITY_IMAGE_SCALE',
       'SK_SUPPORT_LEGACY_INSTALLPIXELSPARAMS',
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index b487285..a6acb87 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -276,7 +276,13 @@
                                kPremul_SkAlphaType);
     }
 
-    bool setConfig(const SkImageInfo& info, size_t rowBytes = 0);
+    bool setInfo(const SkImageInfo&, size_t rowBytes = 0);
+
+#ifdef SK_SUPPORT_LEGACY_SETCONFIG_INFO
+    bool setConfig(const SkImageInfo& info, size_t rowBytes = 0) {
+        return this->setInfo(info, rowBytes);
+    }
+#endif
 
     /**
      *  Allocate a pixelref to match the specified image info. If the Factory
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 522dfb1..07f6f17 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -202,7 +202,7 @@
     return true;
 }
 
-bool SkBitmap::setConfig(const SkImageInfo& origInfo, size_t rowBytes) {
+bool SkBitmap::setInfo(const SkImageInfo& origInfo, size_t rowBytes) {
     SkImageInfo info = origInfo;
 
     if (!validate_alphaType(info.fColorType, info.fAlphaType,
@@ -241,8 +241,7 @@
 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes,
                          SkAlphaType alphaType) {
     SkColorType ct = SkBitmapConfigToColorType(config);
-    return this->setConfig(SkImageInfo::Make(width, height, ct, alphaType),
-                           rowBytes);
+    return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowBytes);
 }
 
 bool SkBitmap::setAlphaType(SkAlphaType alphaType) {
@@ -419,7 +418,7 @@
     if (kIndex_8_SkColorType == info.fColorType && NULL == ctable) {
         return reset_return_false(this);
     }
-    if (!this->setConfig(info)) {
+    if (!this->setInfo(info)) {
         return reset_return_false(this);
     }
 
@@ -444,7 +443,7 @@
 
 bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb, SkColorTable* ct,
                              void (*releaseProc)(void* addr, void* context), void* context) {
-    if (!this->setConfig(info, rb)) {
+    if (!this->setInfo(info, rb)) {
         this->reset();
         return false;
     }
@@ -884,8 +883,8 @@
         SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset);
         if (pixelRef != NULL) {
             SkBitmap dst;
-            dst.setConfig(SkImageInfo::Make(subset.width(), subset.height(),
-                                            this->colorType(), this->alphaType()));
+            dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(),
+                                          this->colorType(), this->alphaType()));
             dst.setIsVolatile(this->isVolatile());
             dst.setPixelRef(pixelRef)->unref();
             SkDEBUGCODE(dst.validate());
@@ -900,8 +899,8 @@
     SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height()));
 
     SkBitmap dst;
-    dst.setConfig(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this->alphaType()),
-                  this->rowBytes());
+    dst.setInfo(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this->alphaType()),
+                this->rowBytes());
     dst.setIsVolatile(this->isVolatile());
 
     if (fPixelRef) {
@@ -994,7 +993,7 @@
     dstInfo.fColorType = dstColorType;
 
     SkBitmap tmpDst;
-    if (!tmpDst.setConfig(dstInfo)) {
+    if (!tmpDst.setInfo(dstInfo)) {
         return false;
     }
 
@@ -1102,13 +1101,13 @@
                 // Use the same rowBytes as the original.
                 rowBytes = fRowBytes;
             } else {
-                // With the new config, an appropriate fRowBytes will be computed by setConfig.
+                // With the new config, an appropriate fRowBytes will be computed by setInfo.
                 rowBytes = 0;
             }
 
             SkImageInfo info = fInfo;
             info.fColorType = dstCT;
-            if (!dst->setConfig(info, rowBytes)) {
+            if (!dst->setInfo(info, rowBytes)) {
                 return false;
             }
             dst->setPixelRef(pixelRef, fPixelRefOrigin)->unref();
@@ -1218,7 +1217,7 @@
         dstM.fRowBytes = SkAlign4(dstM.fBounds.width());
     } else {
     NO_FILTER_CASE:
-        tmpBitmap.setConfig(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes);
+        tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes);
         if (!tmpBitmap.allocPixels(allocator, NULL)) {
             // Allocation of pixels for alpha bitmap failed.
             SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
@@ -1241,8 +1240,8 @@
     }
     SkAutoMaskFreeImage dstCleanup(dstM.fImage);
 
-    tmpBitmap.setConfig(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()),
-                        dstM.fRowBytes);
+    tmpBitmap.setInfo(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()),
+                      dstM.fRowBytes);
     if (!tmpBitmap.allocPixels(allocator, NULL)) {
         // Allocation of pixels for alpha bitmap failed.
         SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n",
@@ -1334,7 +1333,7 @@
 
     SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowBytes(),
                                                               ctable.get(), data.get()));
-    bitmap->setConfig(pr->info());
+    bitmap->setInfo(pr->info());
     bitmap->setPixelRef(pr, 0, 0);
     return true;
 }
@@ -1358,7 +1357,7 @@
         return;
     }
 
-    bool configIsValid = this->setConfig(info, rowBytes);
+    bool configIsValid = this->setInfo(info, rowBytes);
     buffer.validate(configIsValid);
 
     int reftype = buffer.readInt();
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 1099435..0f3cc2b 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -78,7 +78,7 @@
     SkBitmap bitmap;
 
     if (kUnknown_SkColorType == info.colorType()) {
-        if (!bitmap.setConfig(info)) {
+        if (!bitmap.setInfo(info)) {
             return NULL;
         }
     } else {
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index ebcccf2..be32a89 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -296,9 +296,9 @@
 
     // Convolve into the result.
     SkBitmap result;
-    result.setConfig(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()),
-                                          SkScalarCeilToInt(destSubset.height()),
-                                          source.alphaType()));
+    result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()),
+                                        SkScalarCeilToInt(destSubset.height()),
+                                        source.alphaType()));
     result.allocPixels(allocator, NULL);
     if (!result.readyToDraw()) {
         return false;
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 7e10504..6ed6a85 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -499,7 +499,7 @@
     inc_canvas();
 
     SkBitmap bitmap;
-    bitmap.setConfig(SkImageInfo::MakeUnknown(width, height));
+    bitmap.setInfo(SkImageInfo::MakeUnknown(width, height));
     this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
 }
 
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 5692fe1..fa2ac98 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1216,9 +1216,8 @@
         // now draw our bitmap(src) into mask(dst), transformed by the matrix
         {
             SkBitmap    device;
-            device.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(),
-                             mask.fBounds.height(), mask.fRowBytes);
-            device.setPixels(mask.fImage);
+            device.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), mask.fBounds.height()),
+                                 mask.fImage, mask.fRowBytes);
 
             SkCanvas c(device);
             // need the unclipped top/left for the translate
@@ -1666,9 +1665,8 @@
     SkASSERT(SkMask::kARGB32_Format == mask.fFormat);
 
     SkBitmap bm;
-    bm.setConfig(SkBitmap::kARGB_8888_Config,
-                 mask.fBounds.width(), mask.fBounds.height(), mask.fRowBytes);
-    bm.setPixels((SkPMColor*)mask.fImage);
+    bm.installPixels(SkImageInfo::MakeN32Premul(mask.fBounds.width(), mask.fBounds.height()),
+                     (SkPMColor*)mask.fImage, mask.fRowBytes);
 
     fDraw->drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), *fPaint);
 }
@@ -2673,8 +2671,8 @@
     SkMatrix        matrix;
     SkPaint         paint;
 
-    bm.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(), mask.fBounds.height(), mask.fRowBytes);
-    bm.setPixels(mask.fImage);
+    bm.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), mask.fBounds.height()),
+                     mask.fImage, mask.fRowBytes);
 
     clip.setRect(SkIRect::MakeWH(mask.fBounds.width(), mask.fBounds.height()));
     matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft),
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 582f899..6356c1a 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -309,7 +309,7 @@
 
 void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
-    result->setConfig(info);
+    result->setInfo(info);
     result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
 }
 
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index ff62f4d..cb88eb4 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -123,21 +123,21 @@
 SkMipMap* SkMipMap::Build(const SkBitmap& src) {
     void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src);
 
-    const SkBitmap::Config config = src.config();
-    switch (config) {
-        case SkBitmap::kARGB_8888_Config:
+    const SkColorType ct = src.colorType();
+    const SkAlphaType at = src.alphaType();
+    switch (ct) {
+        case kRGBA_8888_SkColorType:
+        case kBGRA_8888_SkColorType:
             proc = downsampleby2_proc32;
             break;
-        case SkBitmap::kRGB_565_Config:
+        case kRGB_565_SkColorType:
             proc = downsampleby2_proc16;
             break;
-        case SkBitmap::kARGB_4444_Config:
+        case kARGB_4444_SkColorType:
             proc = downsampleby2_proc4444;
             break;
-        case SkBitmap::kIndex8_Config:
-        case SkBitmap::kA8_Config:
         default:
-            return NULL; // don't build mipmaps for these configs
+            return NULL; // don't build mipmaps for any other colortypes (yet)
     }
 
     SkAutoLockPixels alp(src);
@@ -157,7 +157,7 @@
             if (0 == width || 0 == height) {
                 break;
             }
-            size += SkBitmap::ComputeRowBytes(config, width) * height;
+            size += SkColorTypeMinRowBytes(ct, width) * height;
             countLevels += 1;
         }
     }
@@ -180,7 +180,7 @@
     for (int i = 0; i < countLevels; ++i) {
         width >>= 1;
         height >>= 1;
-        rowBytes = SkToU32(SkBitmap::ComputeRowBytes(config, width));
+        rowBytes = SkToU32(SkColorTypeMinRowBytes(ct, width));
 
         levels[i].fPixels   = addr;
         levels[i].fWidth    = width;
@@ -189,8 +189,7 @@
         levels[i].fScale    = (float)width / src.width();
 
         SkBitmap dstBM;
-        dstBM.setConfig(config, width, height, rowBytes);
-        dstBM.setPixels(addr);
+        dstBM.installPixels(SkImageInfo::Make(width, height, ct, at), addr, rowBytes);
 
         srcBM.lockPixels();
         for (int y = 0; y < height; y++) {
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 88894d1..a3ae8ae 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -276,7 +276,7 @@
         }
     }
     // Could not read the SkBitmap. Use a placeholder bitmap.
-    bitmap->setConfig(SkImageInfo::MakeUnknown(width, height));
+    bitmap->setInfo(SkImageInfo::MakeUnknown(width, height));
     return false;
 }
 
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index fee1ff7..3e20bf6 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -584,7 +584,6 @@
     matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft),
                         -SkIntToScalar(mask.fBounds.fTop));
 
-    SkBitmap::Config config = SkBitmap::kA8_Config;
     paint.setAntiAlias(SkMask::kBW_Format != mask.fFormat);
     switch (mask.fFormat) {
         case SkMask::kBW_Format:
@@ -608,18 +607,17 @@
     SkRasterClip clip;
     clip.setRect(SkIRect::MakeWH(dstW, dstH));
 
+    const SkImageInfo info = SkImageInfo::MakeA8(dstW, dstH);
     SkBitmap bm;
-    bm.setConfig(config, dstW, dstH, dstRB);
 
     if (0 == dstRB) {
-        if (!bm.allocPixels()) {
+        if (!bm.allocPixels(info)) {
             // can't allocate offscreen, so empty the mask and return
             sk_bzero(mask.fImage, mask.computeImageSize());
             return;
         }
-        bm.lockPixels();
     } else {
-        bm.setPixels(mask.fImage);
+        bm.installPixels(info, mask.fImage, dstRB);
     }
     sk_bzero(bm.getPixels(), bm.getSafeSize());
 
diff --git a/src/core/SkValidationUtils.h b/src/core/SkValidationUtils.h
index 683da29..e9e5986 100644
--- a/src/core/SkValidationUtils.h
+++ b/src/core/SkValidationUtils.h
@@ -23,12 +23,6 @@
     return (mode >= 0) && (mode <= SkXfermode::kLastMode);
 }
 
-/** Returns true if config's value is in the SkBitmap::Config enum.
-  */
-static inline bool SkIsValidConfig(SkBitmap::Config config) {
-    return (config >= 0) && (config <= static_cast<int>(SkBitmap::kConfigCount));
-}
-
 /** Returns true if the rect's dimensions are between 0 and SK_MaxS32
   */
 static inline bool SkIsValidIRect(const SkIRect& rect) {
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 62161df..bdc612f 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -106,7 +106,7 @@
 
 static SkBitmap make_fake_bitmap(int width, int height) {
     SkBitmap bitmap;
-    bitmap.setConfig(SkImageInfo::MakeUnknown(width, height));
+    bitmap.setInfo(SkImageInfo::MakeUnknown(width, height));
     return bitmap;
 }
 
@@ -1589,11 +1589,7 @@
     xy[1] = (SkShader::TileMode)3;
 
     SkBitmap bm;
-    bm.setConfig(SkBitmap::kA8_Config,
-                 mask.fBounds.width(),
-                 mask.fBounds.height(),
-                 mask.fRowBytes);
-    bm.setPixels(mask.fImage);
+    bm.installMaskPixels(mask);
 
     SkTScopedComPtr<IXpsOMTileBrush> maskBrush;
     HR(this->createXpsImageBrush(bm, m, xy, 0xFF, &maskBrush));
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 6864554..a37dff5 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -92,10 +92,10 @@
         }
 
 #if SK_SUPPORT_GPU && !defined(SK_USE_SIMPLEX_NOISE)
-        fPermutationsBitmap.setConfig(SkImageInfo::MakeA8(kBlockSize, 1));
+        fPermutationsBitmap.setInfo(SkImageInfo::MakeA8(kBlockSize, 1));
         fPermutationsBitmap.setPixels(fLatticeSelector);
 
-        fNoiseBitmap.setConfig(SkImageInfo::MakeN32Premul(kBlockSize, 4));
+        fNoiseBitmap.setInfo(SkImageInfo::MakeN32Premul(kBlockSize, 4));
         fNoiseBitmap.setPixels(fNoise[0][0]);
 #endif
     }
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index ada9859..038044d 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -619,7 +619,7 @@
     if (!gCache->find(storage.get(), size, bitmap)) {
         // force our cahce32pixelref to be built
         (void)cache->getCache32();
-        bitmap->setConfig(SkImageInfo::MakeN32Premul(kCache32Count, 1));
+        bitmap->setInfo(SkImageInfo::MakeN32Premul(kCache32Count, 1));
         bitmap->setPixelRef(cache->getCache32PixelRef());
 
         gCache->add(storage.get(), size, *bitmap);
diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp
index 84a13be..30a1d39 100644
--- a/src/gpu/GrPictureUtils.cpp
+++ b/src/gpu/GrPictureUtils.cpp
@@ -41,10 +41,7 @@
         fInfo.fHasNestedLayers = false;
         fInfo.fIsNested = (2 == fSaveLayerDepth);
 
-        fEmptyBitmap.setConfig(SkImageInfo::Make(fInfo.fSize.fWidth,
-                                                 fInfo.fSize.fHeight,
-                                                 kUnknown_SkColorType,
-                                                 kIgnore_SkAlphaType));
+        fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(fInfo.fSize.fWidth, fInfo.fSize.fHeight));
         fAccelData = accelData;
         fAlreadyDrawn = false;
     }
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 45da4cf..59c078f 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -739,7 +739,7 @@
     texture->asImageInfo(&info);
 
     SkBitmap result;
-    result.setConfig(info);
+    result.setInfo(info);
     result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
     return result;
 }
@@ -1844,7 +1844,7 @@
 
 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* result) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
-    result->setConfig(info);
+    result->setInfo(info);
     result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
 }
 
diff --git a/src/image/SkImagePriv.h b/src/image/SkImagePriv.h
index 9f9cd12..031832bd 100644
--- a/src/image/SkImagePriv.h
+++ b/src/image/SkImagePriv.h
@@ -11,8 +11,6 @@
 #include "SkBitmap.h"
 #include "SkImage.h"
 
-extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&);
-
 // Call this if you explicitly want to use/share this pixelRef in the image
 extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*,
                                        size_t rowBytes);
@@ -23,7 +21,7 @@
  *  be shared if either the bitmap is marked as immutable, or canSharePixelRef
  *  is true.
  *
- *  If the bitmap's config cannot be converted into a corresponding
+ *  If the bitmap's colortype cannot be converted into a corresponding
  *  SkImageInfo, or the bitmap's pixels cannot be accessed, this will return
  *  NULL.
  */
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 3be7d84..68fc1b3 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -31,7 +31,7 @@
             return false;
         }
 
-        if (SkImageInfoToBitmapConfig(info) == SkBitmap::kNo_Config) {
+        if (kUnknown_SkColorType == info.colorType()) {
             return false;
         }
 
@@ -104,7 +104,7 @@
 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes)
     : INHERITED(info.fWidth, info.fHeight)
 {
-    fBitmap.setConfig(info, rowBytes);
+    fBitmap.setInfo(info, rowBytes);
     fBitmap.setPixelRef(pr);
     fBitmap.lockPixels();
 }
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 7419737..0b6efe1 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -79,8 +79,7 @@
 SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t rb)
     : INHERITED(info)
 {
-    fBitmap.setConfig(info, rb);
-    fBitmap.setPixels(pixels);
+    fBitmap.installPixels(info, pixels, rb);
     fWeOwnThePixels = false;    // We are "Direct"
 }
 
@@ -89,7 +88,7 @@
 {
     const SkImageInfo& info = pr->info();
 
-    fBitmap.setConfig(info, info.minRowBytes());
+    fBitmap.setInfo(info, info.minRowBytes());
     fBitmap.setPixelRef(pr);
     fWeOwnThePixels = true;
 
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 0299025..353eabf 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -311,7 +311,7 @@
     } else {
         info.fAlphaType = kOpaque_SkAlphaType;
     }
-    return decodedBitmap->setConfig(info);
+    return decodedBitmap->setInfo(info);
 }
 
 bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
index 458aa2a..2cb8ec8 100644
--- a/src/images/SkImageRef.cpp
+++ b/src/images/SkImageRef.cpp
@@ -32,7 +32,7 @@
 
     // This sets the colortype/alphatype to exactly match our info, so that this
     // can get communicated down to the codec.
-    fBitmap.setConfig(info);
+    fBitmap.setInfo(info);
 
 #ifdef DUMP_IMAGEREF_LIFECYCLE
     SkDebugf("add ImageRef %p [%d] data=%d\n",
@@ -190,7 +190,7 @@
 
     // This sets the colortype/alphatype to exactly match our info, so that this
     // can get communicated down to the codec.
-    fBitmap.setConfig(this->info());
+    fBitmap.setInfo(this->info());
 }
 
 void SkImageRef::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index f1510fb..76510f6 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -14,7 +14,7 @@
     SkASSERT(dst != NULL);
     if ((NULL == generator)
         || !(generator->getInfo(&info))
-        || !dst->setConfig(info, 0)) {
+        || !dst->setInfo(info)) {
         SkDELETE(generator);
         return false;
     }
@@ -54,7 +54,7 @@
                                                      &bitmap);
     if (NULL == fScaledCacheId) {
         // Cache has been purged, must re-decode.
-        if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) {
+        if ((!bitmap.setInfo(info, fRowBytes)) || !bitmap.allocPixels()) {
             fErrorInDecoding = true;
             return false;
         }
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 53e9d1a..f0d7aff 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -102,7 +102,7 @@
     SkAutoTDelete<SkImageGenerator> autoGenerator(generator);
     if ((NULL == autoGenerator.get())
         || (!autoGenerator->getInfo(&info))
-        || (!dst->setConfig(info, 0))) {
+        || (!dst->setInfo(info))) {
         return false;
     }
     SkASSERT(dst->colorType() != kUnknown_SkColorType);
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index e5402a0..ab4d71d 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -725,7 +725,7 @@
     }
 
     SkBitmap bitmap;
-    bitmap.setConfig(info);
+    bitmap.setInfo(info);
     return bitmap;
 }
 
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index fe22ea0..a21536b 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -70,7 +70,7 @@
     const int height = SkToInt(CGImageGetHeight(image));
     SkImageInfo skinfo = SkImageInfo::MakeN32Premul(width, height);
 
-    bm->setConfig(skinfo);
+    bm->setInfo(skinfo);
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return true;
     }
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index 74b2c39..3309af4 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -186,7 +186,7 @@
 
     //Exit early if we're only looking for the bitmap bounds.
     if (SUCCEEDED(hr)) {
-        bm->setConfig(SkImageInfo::MakeN32Premul(width, height));
+        bm->setInfo(SkImageInfo::MakeN32Premul(width, height));
         if (kDecodeBounds_WICMode == wicMode) {
             return true;
         }
diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h
index 894b8f0..4e52ba0 100644
--- a/src/utils/SkGatherPixelRefsAndRects.h
+++ b/src/utils/SkGatherPixelRefsAndRects.h
@@ -28,9 +28,7 @@
         fSize.set(width, height);
         fPRCont = prCont;
         SkSafeRef(fPRCont);
-        fEmptyBitmap.setConfig(SkImageInfo::Make(width, height,
-                                                 kUnknown_SkColorType,
-                                                 kIgnore_SkAlphaType));
+        fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(width, height));
     }
 
     virtual ~SkGatherPixelRefsAndRectsDevice() {
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index fc1611d..512b228 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -54,7 +54,7 @@
 
     GatherPixelRefDevice(int width, int height, PixelRefSet* prset) {
         fSize.set(width, height);
-        fEmptyBitmap.setConfig(SkImageInfo::MakeUnknown(width, height));
+        fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(width, height));
         fPRSet = prset;
     }
 
diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp
index 2a1fae2..27783d4 100644
--- a/src/views/sdl/SkOSWindow_SDL.cpp
+++ b/src/views/sdl/SkOSWindow_SDL.cpp
@@ -23,22 +23,23 @@
 }
 
 static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
-    SkBitmap::Config config;
+    SkColorType ct;
+    SkAlphaType at;
 
     switch (src->format->BytesPerPixel) {
         case 2:
-            config = SkBitmap::kRGB_565_Config;
+            ct = kRGB_565_SkColorType;
+            at = kOpaque_SkAlphaType;
             break;
         case 4:
-            config = SkBitmap::kARGB_8888_Config;
+            ct = kN32_SkColorType;
+            at = kPremul_SkAlphaType;
             break;
         default:
             return false;
     }
 
-    dst->setConfig(config, src->w, src->h, src->pitch);
-    dst->setPixels(src->pixels);
-    return true;
+    return dst->installPixels(SkImageInfo::Make(src->w, src->h, ct, at), src->pixels, src->pitch);
 }
 
 SkOSWindow::SkOSWindow(void* screen) {
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 74f4ac9..40cfbe0 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -336,9 +336,8 @@
             // Test with a very large configuration without pixel buffer
             // attached.
             SkBitmap tstSafeSize;
-            tstSafeSize.setConfig(SkImageInfo::Make(100000000U, 100000000U,
-                                                    gPairs[i].fColorType,
-                                                    kPremul_SkAlphaType));
+            tstSafeSize.setInfo(SkImageInfo::Make(100000000U, 100000000U,
+                                                  gPairs[i].fColorType, kPremul_SkAlphaType));
             int64_t safeSize = tstSafeSize.computeSafeSize64();
             if (safeSize < 0) {
                 ERRORF(reporter, "getSafeSize64() negative: %s",
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index dce1069..ef560aa 100644
--- a/tests/BitmapTest.cpp
+++ b/tests/BitmapTest.cpp
@@ -13,11 +13,10 @@
     SkBitmap bm;
     int width = 1 << 29;    // *4 will be the high-bit of 32bit int
 
-    SkImageInfo info = SkImageInfo::Make(width, 1, kAlpha_8_SkColorType,
-                                         kPremul_SkAlphaType);
-    REPORTER_ASSERT(reporter, bm.setConfig(info));
+    SkImageInfo info = SkImageInfo::MakeA8(width, 1);
+    REPORTER_ASSERT(reporter, bm.setInfo(info));
     info.fColorType = kRGB_565_SkColorType;
-    REPORTER_ASSERT(reporter, bm.setConfig(info));
+    REPORTER_ASSERT(reporter, bm.setInfo(info));
 
     // for a 4-byte config, this width will compute a rowbytes of 0x80000000,
     // which does not fit in a int32_t. setConfig should detect this, and fail.
@@ -26,7 +25,7 @@
     //       in a uint32_t (or larger), but for now this is the constraint.
 
     info.fColorType = kN32_SkColorType;
-    REPORTER_ASSERT(reporter, !bm.setConfig(info));
+    REPORTER_ASSERT(reporter, !bm.setInfo(info));
 }
 
 /**
@@ -37,8 +36,7 @@
     for (int width = 0; width < 2; ++width) {
         for (int height = 0; height < 2; ++height) {
             SkBitmap bm;
-            bool setConf = bm.setConfig(SkImageInfo::MakeN32Premul(width,
-                                                                   height));
+            bool setConf = bm.setInfo(SkImageInfo::MakeN32Premul(width, height));
             REPORTER_ASSERT(reporter, setConf);
             if (setConf) {
                 REPORTER_ASSERT(reporter, bm.allocPixels(NULL));
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index a1c28dd..7219c9e 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -101,7 +101,7 @@
     SkISize size = canvas->getDeviceSize();
 
     SkBitmap bm;
-    bm.setConfig(SkImageInfo::MakeN32Premul(size.width(), size.height()));
+    bm.setInfo(SkImageInfo::MakeN32Premul(size.width(), size.height()));
     SkCanvas c(bm);
 
     Canvas2CanvasClipVisitor visitor(&c);
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 21c7747..b30f551 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -509,7 +509,7 @@
         SkStream::NewFromFile(path.c_str()));
     if (sk_exists(path.c_str())) {
         SkBitmap bm;
-        SkAssertResult(bm.setConfig(SkImageInfo::MakeN32Premul(1, 1)));
+        SkAssertResult(bm.setInfo(SkImageInfo::MakeN32Premul(1, 1)));
         REPORTER_ASSERT(reporter,
             NULL != install_pixel_ref(&bm, stream.detach(), 1, true));
         SkAutoLockPixels alp(bm);
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 98cd90e..1ef32ab 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1185,7 +1185,7 @@
     // This bitmap has a width and height but no pixels. As a result, attempting to record it will
     // fail.
     SkBitmap bm;
-    bm.setConfig(SkImageInfo::MakeN32Premul(100, 100));
+    bm.setInfo(SkImageInfo::MakeN32Premul(100, 100));
     SkPictureRecorder recorder;
     SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, NULL, 0);
     recordingCanvas->drawBitmap(bm, 0, 0);
@@ -1616,7 +1616,7 @@
 static void test_draw_bitmaps(SkCanvas* canvas) {
     SkBitmap empty;
     draw_bitmaps(empty, canvas);
-    empty.setConfig(SkImageInfo::MakeN32Premul(10, 10));
+    empty.setInfo(SkImageInfo::MakeN32Premul(10, 10));
     draw_bitmaps(empty, canvas);
 }
 
diff --git a/tests/PipeTest.cpp b/tests/PipeTest.cpp
index fd98fca..00a1a3f 100644
--- a/tests/PipeTest.cpp
+++ b/tests/PipeTest.cpp
@@ -16,8 +16,7 @@
 // Ensures that the pipe gracefully handles drawing an invalid bitmap.
 static void testDrawingBadBitmap(SkCanvas* pipeCanvas) {
     SkBitmap badBitmap;
-    badBitmap.setConfig(SkImageInfo::Make(5, 5, kUnknown_SkColorType,
-                                          kPremul_SkAlphaType));
+    badBitmap.setInfo(SkImageInfo::MakeUnknown(5, 5));
     pipeCanvas->drawBitmap(badBitmap, 0, 0);
 }
 
@@ -44,7 +43,7 @@
 
 DEF_TEST(Pipe, reporter) {
     SkBitmap bitmap;
-    bitmap.setConfig(SkImageInfo::MakeN32Premul(64, 64));
+    bitmap.setInfo(SkImageInfo::MakeN32Premul(64, 64));
     SkCanvas canvas(bitmap);
 
     PipeController pipeController(&canvas);
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 804a7c4..3e22f7c 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -238,7 +238,7 @@
     if (alloc) {
         bitmap->allocPixels(info);
     } else {
-        bitmap->setConfig(info, rowBytes);
+        bitmap->setInfo(info, rowBytes);
     }
 }
 
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index c8f8e49..ce91490 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -390,12 +390,12 @@
         SkImageInfo info = SkImageInfo::MakeN32Premul(kBitmapSize, kBitmapSize);
 
         SkBitmap validBitmap;
-        validBitmap.setConfig(info);
+        validBitmap.setInfo(info);
 
         // Create a bitmap with a really large height
         info.fHeight = 1000000000;
         SkBitmap invalidBitmap;
-        invalidBitmap.setConfig(info);
+        invalidBitmap.setInfo(info);
 
         // The deserialization should succeed, and the rendering shouldn't crash,
         // even when the device fails to initialize, due to its size
diff --git a/tests/ShaderOpacityTest.cpp b/tests/ShaderOpacityTest.cpp
index 506c7cd..90d25d7 100644
--- a/tests/ShaderOpacityTest.cpp
+++ b/tests/ShaderOpacityTest.cpp
@@ -14,7 +14,7 @@
     SkImageInfo info = SkImageInfo::MakeN32Premul(2, 2);
 
     SkBitmap bmp;
-    bmp.setConfig(info);
+    bmp.setInfo(info);
 
     // test 1: bitmap without pixel data
     SkShader* shader = SkShader::CreateBitmapShader(bmp,
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index a0e3051..1a52793 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -290,7 +290,7 @@
 // sure that the two rowBytes match (and the infos match).
 //
 static bool allocRowBytes(SkBitmap* bm, const SkImageInfo& info, size_t rowBytes) {
-    if (!bm->setConfig(info, rowBytes)) {
+    if (!bm->setInfo(info, rowBytes)) {
         return false;
     }
     SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, rowBytes, NULL);