From 8b6b51bec236fe4ef449787ce9f51d01849a9bdd Mon Sep 17 00:00:00 2001 From: David Capello Date: Sat, 15 Jan 2011 13:36:33 -0300 Subject: [PATCH] Fix loading of GIF files with transparent background color (without global palette). --- src/file/gif_format.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/file/gif_format.cpp b/src/file/gif_format.cpp index e3fb38cba..7eef42082 100644 --- a/src/file/gif_format.cpp +++ b/src/file/gif_format.cpp @@ -118,7 +118,13 @@ static bool load_GIF(FileOp *fop) } sprite->getFolder()->add_layer(layer); - layer->configureAsBackground(); + + // If the GIF image has a global palette (colors_count > 0), it has + // a valid background_index color. + if (gif->palette.colors_count > 0) + layer->configureAsBackground(); + else + gif->background_index = 0; image_clear(current_image, gif->background_index); image_clear(current_image_old, gif->background_index);