Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: src/images/SkImageDecoder_libpng.cpp

Issue 24882002: Do not convert non gray PNG to A8. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: respond to comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698