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) { |