# HG changeset patch # User Matti Hamalainen # Date 1551790262 -7200 # Node ID dac89484f143c5295aa4e32f9c9cd3c023e93536 # Parent e38705223ce4361ab9237522b50963069f03c198 Fix nplanes and bpp in gfxconv. diff -r e38705223ce4 -r dac89484f143 tools/gfxconv.c --- 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