diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-12-10 18:19:40 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-12-10 18:19:40 +0000 |
commit | 9d8461b2012adb25ba0b10deff31dc766f6ea8f2 (patch) | |
tree | 97434a8dfcc90dc9d7cfe97f3d08a0f6b3395e35 /converter/ppm/ilbmtoppm.c | |
parent | c1504a8ffa4694779448393e5781cb182610c486 (diff) | |
download | netpbm-mirror-9d8461b2012adb25ba0b10deff31dc766f6ea8f2.tar.gz netpbm-mirror-9d8461b2012adb25ba0b10deff31dc766f6ea8f2.tar.xz netpbm-mirror-9d8461b2012adb25ba0b10deff31dc766f6ea8f2.zip |
Release 10.35.78
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@1375 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ilbmtoppm.c')
-rw-r--r-- | converter/ppm/ilbmtoppm.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c index c88cdfb2..5001741a 100644 --- a/converter/ppm/ilbmtoppm.c +++ b/converter/ppm/ilbmtoppm.c @@ -94,7 +94,6 @@ static short wrotemask = 0; static IFF_ID typeid; /* ID_ILBM, ID_RGBN, ID_RGB8 */ static pixel *transpColor = NULL; /* transparent color */ -static short transpIndex = -1; static char *transpName = NULL; static bool debug = FALSE; @@ -776,15 +775,19 @@ check_cmap(bmhd, cmap) if( bmhd ) { if( bmhd->masking == mskHasTransparentColor || bmhd->masking == mskLasso ) { - transpIndex = bmhd->transparentColor; + unsigned short const transpIdx = bmhd->transparentColor; if( !transpName ) { MALLOCVAR_NOFAIL(transpColor); - if( transpIndex >= cmap->ncolors ) { - pm_message("using default transparent color (black)"); - PPM_ASSIGN(*transpColor, 0, 0, 0); + if (HAS_COLORMAP(cmap)) { + if( transpIdx >= cmap->ncolors ) { + pm_message("using default transparent color (black)"); + PPM_ASSIGN(*transpColor, 0, 0, 0); + } else + *transpColor = cmap->color[transpIdx]; + } else { + /* The color index is just a direct gray level */ + PPM_ASSIGN(*transpColor, transpIdx, transpIdx, transpIdx); } - else - *transpColor = cmap->color[transpIndex]; } } |