From d4fdaafdb76a927be6fea15013807641bbcc6bd9 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 20 Dec 2012 23:05:42 +0100 Subject: [PATCH] Always write all colours for animated gif files, including transparent ones. This fixes the colour of the transparent background (as seen with ffplay), and makes the background of some non-keyframes transparent that was incorrectly shown as opaque for some samples. --- libavcodec/gifdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 9a3aef075f..077aef0200 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -241,8 +241,9 @@ static int gif_read_image(GifState *s) pr = ptr + width; for (px = ptr, idx = s->idx_line; px < pr; px++, idx++) { - if (*idx != s->transparent_color_index) - *px = pal[*idx]; + *px = pal[*idx]; + if (*idx == s->transparent_color_index) + *px &= 0xFFFFFF; } if (is_interleaved) {