summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-09-21 23:16:38 +0200
committerBenjamin Otte <otte@redhat.com>2015-10-13 02:56:47 +0200
commit6f71effa78e8366caedc28962d1d74661a90df03 (patch)
tree50c8465595cfb6cd563b466e96fb9b49b69007d8 /gdk-pixbuf
parent6286d5289c772dc8549beb9138fc3cbc5212939c (diff)
downloadgdk-pixbuf-6f71effa78e8366caedc28962d1d74661a90df03.tar.gz
tga: Fill remaining pixels when closing incompletely loaded image
This way, the images are neatly transparent/black instead of random colors.
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/io-tga.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index 848b76e6e..b915d98ab 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -685,6 +685,17 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
TGAContext *ctx = (TGAContext *) data;
g_return_val_if_fail(ctx != NULL, FALSE);
+ if (ctx->pbuf)
+ {
+ TGAColor transparent_black = { 0, 0, 0, 0 };
+ gsize remaining;
+
+ for (remaining = tga_pixels_remaining (ctx); remaining; remaining--)
+ {
+ tga_write_pixel (ctx, &transparent_black);
+ }
+ }
+
g_free (ctx->hdr);
if (ctx->cmap)
colormap_free (ctx->cmap);