aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-03 17:13:38 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-03 17:13:38 +0000
commit546f70c82318d2fcdd9718966907d1edccd26cb6 (patch)
tree455f42dc8c1199e18d11162f67fe6316fac9cd55 /src/images
parent3390b9ac9ad69a6e772c2b957d75d19611239025 (diff)
Fixes for decoding to A8.
src/images/SkImageDecoder_libpng.cpp: A8 images are not opaque, so do not set the opaque flag. This fixes a bug where copyTo does not work as expected (when copying an A8 decoded image to ARGB_8888), leading to a bitmap hash that does not represent the image correctly (in skimage). tools/skimage_main.cpp: In write_bitmap, which is creating the image for visual comparison, copy A8 to 8888, since A8 cannot be encoded. In the section that tests reencoding, do not test reencoding A8, which is known to not work. R=mtklein@google.com, djsollen@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/25726004 git-svn-id: http://skia.googlecode.com/svn/trunk@11589 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkImageDecoder_libpng.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index fc220eae1a..d3b45c3847 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()) {
+ reallyHasAlpha = true;
+ }
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) {