hide SkBitmap::setConfig

patch from issue 325733002

TBR=scroggo

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/322963002
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;
 }