summaryrefslogtreecommitdiff
path: root/libavcodec/iff.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-01-14 10:38:42 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-01-14 10:38:42 +0100
commit28002030f22a18f8086dff4ba5bc18940584445c (patch)
tree0b5eb28079e1391ff08648c5960b24053c4f54aa /libavcodec/iff.c
parent6ba74be511216d761eeed8e71439b6f6a65385b0 (diff)
Support transparency in iff images.
Fixes ticket #707. Reviewed-by: Peter Ross
Diffstat (limited to 'libavcodec/iff.c')
-rw-r--r--libavcodec/iff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 7a11d4310e..c0e4eb4d38 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -165,6 +165,9 @@ static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample);
}
}
+ if (s->masking == MASK_HAS_TRANSPARENT_COLOR &&
+ s->transparency < 1 << avctx->bits_per_coded_sample)
+ pal[s->transparency] &= 0xFFFFFF;
return 0;
}
@@ -216,10 +219,7 @@ static int extract_header(AVCodecContext *const avctx,
s->flags = bytestream_get_byte(&buf);
s->transparency = bytestream_get_be16(&buf);
s->masking = bytestream_get_byte(&buf);
- if (s->masking == MASK_HAS_TRANSPARENT_COLOR) {
- av_log(avctx, AV_LOG_ERROR, "Transparency not supported\n");
- return AVERROR_PATCHWELCOME;
- } else if (s->masking != MASK_NONE) {
+ if (s->masking != MASK_NONE && s->masking != MASK_HAS_TRANSPARENT_COLOR) {
av_log(avctx, AV_LOG_ERROR, "Masking not supported\n");
return AVERROR_PATCHWELCOME;
}