Do not convert non gray PNG to A8.

If the user requested A8, but the source is not gray, switch to
ARGB8888.

BUG=https://b.corp.google.com/issue?id=9189955
R=reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk/src@11573 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/images/SkImageDecoder_libpng.cpp b/images/SkImageDecoder_libpng.cpp
index e942f21..fc220ea 100644
--- a/images/SkImageDecoder_libpng.cpp
+++ b/images/SkImageDecoder_libpng.cpp
@@ -532,9 +532,13 @@
                 *configp = SkBitmap::kARGB_8888_Config;
             }
         } else {
-            if (*configp != SkBitmap::kRGB_565_Config &&
-                *configp != SkBitmap::kARGB_4444_Config &&
-                *configp != SkBitmap::kA8_Config) {
+            if (SkBitmap::kA8_Config == *configp) {
+                if (k8BitGray_SrcDepth != srcDepth) {
+                    // Converting a non grayscale image to A8 is not currently supported.
+                    *configp = SkBitmap::kARGB_8888_Config;
+                }
+            } else if (*configp != SkBitmap::kRGB_565_Config &&
+                       *configp != SkBitmap::kARGB_4444_Config) {
                 *configp = SkBitmap::kARGB_8888_Config;
             }
         }