Mercurial > hg > dmlib
changeset 2099:dac89484f143
Fix nplanes and bpp in gfxconv.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Mar 2019 14:51:02 +0200 |
parents | e38705223ce4 |
children | 81fb21dd3265 |
files | tools/gfxconv.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/gfxconv.c Tue Mar 05 12:14:31 2019 +0200 +++ b/tools/gfxconv.c Tue Mar 05 14:51:02 2019 +0200 @@ -138,7 +138,7 @@ { .scaleX = 1, .scaleY = 1, - .nplanes = 4, + .nplanes = 0, .bpp = 8, .planar = FALSE, .format = 0, @@ -865,7 +865,7 @@ optArg); return FALSE; } - optSpec.nplanes = tmpUInt; + optSpec.bpp = tmpUInt; break; case 14: @@ -1423,9 +1423,9 @@ } // Determine number of planes, if paletted - if (spec->format == DM_COLFMT_PALETTE) + if (spec->format == DM_COLFMT_PALETTE && + spec->nplanes == 0) { - spec->nplanes = 0; for (int n = 8; n >= 0;) { if ((image->pal->ncolors - 1) & (1 << n)) @@ -1438,6 +1438,9 @@ } } + if (spec->nplanes == 0) + spec->nplanes = 4; + spec->fmtid = fmt->fmtid; // Do some format-specific adjustments and other things