Commit a224541d authored by Dave Neary's avatar Dave Neary Committed by David Neary
Browse files

Applied a patch from Yohei Honda <yoh2@d2.dion.ne.jp> to handle 16 bit



2003-06-12  Dave Neary  <bolsh@gimp.org>

        * plug-ins/common/tga.c: Applied a patch from Yohei Honda
        <yoh2@d2.dion.ne.jp> to handle 16 bit TGAs which use the
        spare bit to do alpha. Closes bug #114913.
parent 9b206bd4
2003-06-12 Dave Neary <bolsh@gimp.org>
* plug-ins/common/tga.c: Applied a patch from Yohei Honda
<yoh2@d2.dion.ne.jp> to handle 16 bit TGAs which use the
spare bit to do alpha. Closes bug #114913.
2003-06-12 Michael Natterer <mitch@gimp.org>
 
* app/core/gimpdrawable.c (gimp_drawable_configure): removed the
......@@ -739,7 +739,8 @@ static void
upsample (guchar *dest,
guchar *src,
guint width,
guint bytes)
guint bytes,
guint8 alphaBits)
{
gint x;
......@@ -754,7 +755,16 @@ upsample (guchar *dest,
dest[2] = ((src[0] << 3) & 0xf8);
dest[2] += (dest[2] >> 5);
dest += 3;
switch (alphaBits)
{
case 1:
dest[3] = (src[1] & 0x80)? 0: 255;
dest += 4;
break;
default:
dest += 3;
}
src += bytes;
}
}
......@@ -818,7 +828,7 @@ read_line (FILE *fp,
{
if (info->bpp == 16 || info->bpp == 15)
{
upsample (row, buffer, info->width, info->bytes);
upsample (row, buffer, info->width, info->bytes, info->alphaBits);
}
else
{
......@@ -894,7 +904,7 @@ ReadImage (FILE *fp,
else if (info->colorMapSize == 24)
bgr2rgb(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 0);
else if (info->colorMapSize == 16 || info->colorMapSize == 15)
upsample(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes);
upsample(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, info->alphaBits);
}
else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment