From 7ae373c153b0f26c25dab1408fd4e8b07176d1ec Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Thu, 5 Apr 2001 22:31:19 +0000 Subject: [PATCH] On request of Martin Weber : Fixed bug #52728 - problem 2001-04-06 Stanislav Brabec On request of Martin Weber : * plugins/common/tga.c: Fixed bug #52728 - problem in loading compressed and uncompressed 15 bit tga, compressed 16 bit tga files and removed a false warning for 32 bit tga files. --- ChangeLog | 7 +++++++ plug-ins/common/tga.c | 22 ++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f16e4d2e1..b1ace2b5fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-04-06 Stanislav Brabec + + On request of Martin Weber : + * plugins/common/tga.c: Fixed bug #52728 - problem in loading + compressed and uncompressed 15 bit tga, compressed 16 bit tga + files and removed a false warning for 32 bit tga files. + 2001-04-02 Sven Neumann * app/Makefile.am diff --git a/plug-ins/common/tga.c b/plug-ins/common/tga.c index c8dc887eb0..d9604b51c8 100644 --- a/plug-ins/common/tga.c +++ b/plug-ins/common/tga.c @@ -518,25 +518,15 @@ load_image (gchar *filename) } break; case TGA_TYPE_COLOR: - if (info.alphaBits == 0 && info.bpp == 32) - { - g_message ("TGA: Possibly incorrect alpha in \"%s\"\n", filename); - info.alphaBits = 8; - } - if (info.bpp != 16 && info.bpp != 24 - && (info.alphaBits != 8 || info.bpp != 32)) + if (info.bpp != 15 && info.bpp != 16 && info.bpp != 24 + && info.bpp != 32) { g_message ("TGA: Unhandled sub-format in \"%s\"\n", filename); return -1; } break; case TGA_TYPE_GRAY: - if (info.alphaBits == 0 && info.bpp == 16) - { - g_message ("TGA: Possibly incorrect alpha in \"%s\"\n", filename); - info.alphaBits = 8; - } - if (info.bpp != 8 && (info.alphaBits != 8 || info.bpp != 16)) + if (info.bpp != 8 && (info.alphaBits != 8 || (info.bpp != 16 || info.bpp != 15))) { g_message ("TGA: Unhandled sub-format in \"%s\"\n", filename); return -1; @@ -549,7 +539,7 @@ load_image (gchar *filename) } /* Plausible but unhandled formats */ - if (info.bytes * 8 != info.bpp) + if (info.bytes * 8 != info.bpp && !(info.bytes == 2 && info.bpp == 15)) { g_message ("TGA: No support yet for TGA with these parameters\n"); return -1; @@ -825,7 +815,7 @@ read_line (FILE *fp, if (info->imageType == TGA_TYPE_COLOR) { - if (info->bpp == 16) + if (info->bpp == 16 || info->bpp == 15) { upsample (row, buffer, info->width, info->bytes); } @@ -902,7 +892,7 @@ ReadImage (FILE *fp, bgr2rgb(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 1); else if (info->colorMapSize == 24) bgr2rgb(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 0); - else if (info->colorMapSize == 16) + else if (info->colorMapSize == 16 || info->colorMapSize == 15) upsample(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes); }