summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-19 19:49:47 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-19 19:49:47 (GMT)
commit822b394b677054d9d2314bb4a0013e600fd9266a (patch)
tree7cfe82a316527ad87c9196fc94dc63b054b4bdf1
parent135c1700bfeff8d69ed2fb8c181f75c422a7d887 (diff)
downloadlibnsbmp-822b394b677054d9d2314bb4a0013e600fd9266a.tar.gz
libnsbmp-822b394b677054d9d2314bb4a0013e600fd9266a.tar.bz2
allow 32bpp icon to use their alpha channel for opacity
modified patch from Fran├žois Revol
-rw-r--r--src/libnsbmp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libnsbmp.c b/src/libnsbmp.c
index 7318347..0e241a1 100644
--- a/src/libnsbmp.c
+++ b/src/libnsbmp.c
@@ -555,6 +555,8 @@ static bmp_result bmp_decode_rgb32(bmp_image *bmp, uint8_t **start, int bytes)
}
if (bmp->opaque) {
scanline[x] |= (0xff << 24);
+ } else {
+ scanline[x] |= data[3] << 24;
}
data += 4;
scanline[x] = read_uint32((uint8_t *)&scanline[x],0);
@@ -816,6 +818,11 @@ static bmp_result bmp_decode_mask(bmp_image *bmp, uint8_t *data, int bytes)
uint32_t x, y, swidth;
uint32_t cur_byte = 0;
+ if (bmp->bpp == 32) {
+ /* should already have proper alpha */
+ return BMP_OK;
+ }
+
swidth = bmp->bitmap_callbacks.bitmap_get_bpp(bmp->bitmap) * bmp->width;
top = bmp->bitmap_callbacks.bitmap_get_buffer(bmp->bitmap);
if (!top)