# HG changeset patch # User Matti Hamalainen # Date 1559495525 -10800 # Node ID 894781b7310a8e71b97efc841351a2da97c50615 # Parent 009ee261704c08f153c54adc8e5402dd812a6846 Possibly fix RAW output when clipping nplanes/bpp. diff -r 009ee261704c -r 894781b7310a tools/gfxconv.c --- a/tools/gfxconv.c Sat Jun 01 03:56:05 2019 +0300 +++ b/tools/gfxconv.c Sun Jun 02 20:12:05 2019 +0300 @@ -1444,12 +1444,15 @@ } // Determine number of planes, if paletted - if (spec->format == DM_COLFMT_PALETTE && - spec->nplanes == 0 && image->pal != NULL) - spec->nplanes = dmGetNPlanesFromNColors(image->pal->ncolors); - else - if (image->format == DM_COLFMT_GRAYSCALE) - spec->nplanes = 8; + if (spec->nplanes == 0) + { + if (image->format == DM_COLFMT_PALETTE && + image->pal != NULL) + spec->nplanes = dmGetNPlanesFromNColors(image->pal->ncolors); + else + if (image->format == DM_COLFMT_GRAYSCALE) + spec->nplanes = image->bpp; + } if (spec->nplanes <= 0) spec->nplanes = 4; @@ -1514,12 +1517,13 @@ if (info) { char *str; - switch (spec->format) + switch (image->format) { - case DM_COLFMT_PALETTE : str = "indexed/paletted"; break; - case DM_COLFMT_RGB : str = "24bit RGB"; break; - case DM_COLFMT_RGBA : str = "32bit RGBA"; break; - default : str = "???"; break; + case DM_COLFMT_PALETTE : str = "indexed/paletted"; break; + case DM_COLFMT_RGB : str = "24bit RGB"; break; + case DM_COLFMT_RGBA : str = "32bit RGBA"; break; + case DM_COLFMT_GRAYSCALE : str = "grayscale"; break; + default : str = "???"; break; } dmMsg(2, "Using %s output.\n", str); }