summaryrefslogtreecommitdiff
path: root/libavcodec/bmp.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-12-02 00:21:24 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-12-02 00:21:24 +0100
commit8b08f81949bcfa6fec42ff3f1c9bef5be8140300 (patch)
tree697831535ffeddbc98d091e7ba9a58a342463552 /libavcodec/bmp.c
parent69035f3ec7e9e9fab70e4b8f88a96fa2d66a6447 (diff)
Support transparency in 32bit bmp files.
Diffstat (limited to 'libavcodec/bmp.c')
-rw-r--r--libavcodec/bmp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index 22973aa52d..3418edc181 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -154,7 +154,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
rgb[2] = 0;
}
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = PIX_FMT_BGRA;
break;
case 24:
avctx->pix_fmt = PIX_FMT_BGR24;
@@ -319,7 +319,13 @@ static int bmp_decode_frame(AVCodecContext *avctx,
dst[0] = src[rgb[2]];
dst[1] = src[rgb[1]];
dst[2] = src[rgb[0]];
- dst += 3;
+/* The Microsoft documentation states:
+ * "The high byte in each DWORD is not used."
+ * Both GIMP and ImageMagick store the alpha transparency value
+ * in the high byte for 32bit bmp files.
+ */
+ dst[3] = src[3];
+ dst += 4;
src += 4;
}