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

Unified Diff: src/images/SkImageDecoder_libpng.cpp

Issue 25726004: Fixes for decoding to A8. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | tools/skimage_main.cpp » ('j') | tools/skimage_main.cpp » ('J')
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 fc220eae1a098c73892ef130a62b4c6ba6568ab7..d3b45c3847488f013d3746fdd12ecac6e9500b25 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -435,6 +435,9 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
// return false, since the result will have premultiplied colors.
return false;
}
+ if (SkBitmap::kA8_Config == decodedBitmap->config()) {
reed1 2013/10/08 16:25:57 Shouldn't this block be done before line 431?
+ reallyHasAlpha = true;
reed1 2013/10/04 08:56:27 I thought this variable was set when we actually s
scroggo 2013/10/04 19:45:53 Setting the image to be opaque is an optimization
reed1 2013/10/07 13:31:39 Ah, I think I see. You're saying we don't always p
scroggo 2013/10/07 22:10:29 Sounds good to me. Uploaded https://codereview.chr
+ }
decodedBitmap->setIsOpaque(!reallyHasAlpha);
return true;
}
@@ -888,6 +891,9 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
if (0 != theTranspColor) {
reallyHasAlpha |= substituteTranspColor(&decodedBitmap, theTranspColor);
}
+ if (SkBitmap::kA8_Config == decodedBitmap.config()) {
+ reallyHasAlpha = true;
+ }
decodedBitmap.setIsOpaque(!reallyHasAlpha);
if (swapOnly) {
« no previous file with comments | « no previous file | tools/skimage_main.cpp » ('j') | tools/skimage_main.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698