Index: src/images/SkImageDecoder_libpng.cpp |
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp |
index b6aa329104288aead5ae32f788e0f80b9aba153d..4d5006dbda11f7e664a058e81d46d1094a1c5e1f 100644 |
--- a/src/images/SkImageDecoder_libpng.cpp |
+++ b/src/images/SkImageDecoder_libpng.cpp |
@@ -535,9 +535,13 @@ bool SkPNGImageDecoder::getBitmapConfig(png_structp png_ptr, png_infop info_ptr, |
*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; |
} |
} |