summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Fox <dyntryx@gmail.com>2009-01-07 09:49:36 +0000
committerSean Fox <dyntryx@gmail.com>2009-01-07 09:49:36 +0000
commit9a2811c3832ac1cc3fdc274f627e75ffa1d43efc (patch)
tree74c6ce9e440f39dd09c01ed738544228d5ecab3f
parent2247ced70842f51bdd90577b6a9e20b465674e46 (diff)
downloadlibnsgif-9a2811c3832ac1cc3fdc274f627e75ffa1d43efc.tar.gz
libnsgif-9a2811c3832ac1cc3fdc274f627e75ffa1d43efc.tar.bz2
If a frame's disposal method is GIF_FRAME_CLEAR and the frame has a transparency index, the frame will be restored to transparency instead of the background colour
svn path=/trunk/libnsgif/; revision=5975
-rw-r--r--libnsgif.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libnsgif.c b/libnsgif.c
index 8079347..1eb46c5 100644
--- a/libnsgif.c
+++ b/libnsgif.c
@@ -992,7 +992,10 @@ gif_result gif_decode_frame(gif_animation *gif, unsigned int frame) {
if (gif->frames[frame].disposal_method == GIF_FRAME_CLEAR) {
for (y = 0; y < height; y++) {
frame_scanline = frame_data + offset_x + ((offset_y + y) * gif->width);
- memset(frame_scanline, colour_table[gif->background_index], width * 4);
+ if (gif->frames[frame].transparency)
+ memset(frame_scanline, GIF_TRANSPARENT_COLOUR, width * 4);
+ else
+ memset(frame_scanline, colour_table[gif->background_index], width * 4);
}
}
}