Commit eef63583 authored by Dave Neary's avatar Dave Neary Committed by David Neary

Fixed bug #105360. Previously, alpha was taking up an index entry even if



2003-02-22  Dave Neary  <bolsh@gimp.org>

        * plug-ins/common/png.c: Fixed bug #105360. Previously,
        alpha was taking up an index entry even if there were
        no transparent entries. Sorry about that :)
parent d9c37118
2003-02-22 Dave Neary <bolsh@gimp.org>
* plug-ins/common/png.c: Fixed bug #105360. Previously,
alpha was taking up an index entry even if there were
no transparent entries. Sorry about that :)
2003-02-21 Manish Singh <yosh@gimp.org>
* configure.in: oops, put back in perl binary location stuff for
......
......@@ -137,19 +137,21 @@ static gboolean runme = FALSE;
*/
MAIN ()
/* Try to find a colour in the palette which isn't actually
* used in the image, so that we can use it as the transparency
* index. Taken from gif.c */
static int find_unused_ia_colour (guchar * pixels,
int numpixels,
int *colors)
static int find_unused_ia_colour (guchar * pixels,
int numpixels,
int *colors)
{
int i;
gboolean ix_used[256];
gboolean ix_used[256]; // max of 256 palette entries
gboolean trans_used = FALSE;
for (i = 0; i < 256; i++)
for (i = 0; i < *colors; i++)
{
ix_used[i] = (gboolean) FALSE;
ix_used[i] = FALSE;
}
for (i = 0; i < numpixels; i++)
......@@ -157,12 +159,18 @@ MAIN ()
/* If there is no alpha, then the index associated with
* this pixel is taken */
if (pixels[i * 2 + 1])
ix_used[pixels[i * 2]] = (gboolean) TRUE;
ix_used[pixels[i * 2]] = TRUE;
else
trans_used = TRUE;
}
for (i = 255; i >= 0; i--)
// If there is no transparency, ignore alpha.
if (trans_used == FALSE)
return -1;
for (i = 0; i < *colors; i++)
{
if (ix_used[i] == (gboolean) FALSE)
if (ix_used[i] == FALSE)
{
return i;
}
......
Markdown is supported
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