diff --git a/mozilla/modules/libimg/src/gif.c b/mozilla/modules/libimg/src/gif.c index 22c6ca4749d..80d030e1320 100644 --- a/mozilla/modules/libimg/src/gif.c +++ b/mozilla/modules/libimg/src/gif.c @@ -706,7 +706,7 @@ gif_clear_screen(gif_struct *gs) int src_trans_pixel_index; uint8 *rowbuf = gs->rowbuf; NI_PixmapHeader *src_header = ic->src_header; - IL_IRGB *saved_src_trans_pixel; + IL_IRGB *saved_src_trans_pixel, *saved_img_trans_pixel; /* Catch images that fall outside the logical screen. */ if ((erase_x_offset + erase_width) > gs->screen_width) @@ -714,12 +714,15 @@ gif_clear_screen(gif_struct *gs) /* We have to temporarily pretend the image is transparent so we can clear using the context's background color. */ + saved_img_trans_pixel = ic->image->header.transparent_pixel; saved_src_trans_pixel = src_header->transparent_pixel; src_header->transparent_pixel = NULL; + ic->image->header.transparent_pixel = NULL; /* Pick an index for the source image's temporary transparent pixel. The actual choice is immaterial since it will only be used for the clear screen operation. */ + src_trans_pixel_index = 0; if (!il_gif_init_transparency(ic, src_trans_pixel_index)) return MK_OUT_OF_MEMORY; @@ -739,6 +742,7 @@ gif_clear_screen(gif_struct *gs) /* Reset the source image's transparent pixel to its former state. */ il_gif_destroy_transparency(ic); src_header->transparent_pixel = saved_src_trans_pixel; + ic->image->header.transparent_pixel = saved_img_trans_pixel; } return 0; }