# HG changeset patch # User Matti Hamalainen # Date 1503132860 -10800 # Node ID be30466fbc470b36be8f8cb94f464806854f84fc # Parent 38614c07c2e2fbac42ddb2e48fbd281a5da6f166 Cleanups. diff -r 38614c07c2e2 -r be30466fbc47 src/libgfx.c --- a/src/libgfx.c Sat Aug 19 11:46:49 2017 +0300 +++ b/src/libgfx.c Sat Aug 19 11:54:20 2017 +0300 @@ -839,11 +839,11 @@ { DMPCXData pcx; DMPCXHeader hdr; + DMImageConvSpec spec; int res; - DMImageConvSpec spec; + // Always force planar for PCX memcpy(&spec, pspec, sizeof(DMImageConvSpec)); - spec.format = spec.paletted ? DM_IFMT_PALETTE : DM_IFMT_RGB; spec.planar = TRUE; // Create output file diff -r 38614c07c2e2 -r be30466fbc47 tools/gfxconv.c --- a/tools/gfxconv.c Sat Aug 19 11:46:49 2017 +0300 +++ b/tools/gfxconv.c Sat Aug 19 11:54:20 2017 +0300 @@ -1075,6 +1075,23 @@ } +void dmOutputImageBitFormat(const int format, const BOOL info) +{ + if (info) + { + char *str; + switch (format) + { + case DM_IFMT_PALETTE : str = "Indexed 8bpp"; break; + case DM_IFMT_RGB : str = "24bit RGB"; break; + case DM_IFMT_RGBA : str = "32bit RGBA"; break; + default : str = "???"; break; + } + dmMsg(2, "%s output.\n", str); + } +} + + int dmWriteImage(const char *filename, DMImage *image, DMImageConvSpec *spec, int iformat, BOOL info) { if (info) @@ -1098,18 +1115,19 @@ { #ifdef DM_USE_LIBPNG case IMGFMT_PNG: - if (info) dmMsg(2, "%s output.\n", spec->paletted ? "Indexed 8bpp" : "32bit RGBA"); spec->format = spec->paletted ? DM_IFMT_PALETTE : DM_IFMT_RGBA; + dmOutputImageBitFormat(spec->format, info); return dmWritePNGImage(filename, image, spec); #endif case IMGFMT_PPM: - if (info) dmMsg(2, "24bit RGB output.\n"); spec->format = DM_IFMT_RGB; + dmOutputImageBitFormat(spec->format, info); return dmWritePPMImage(filename, image, spec); case IMGFMT_PCX: - if (info) dmMsg(2, "%s output.\n", spec->paletted ? "Indexed 8bpp" : "24bit RGB"); + spec->format = spec->paletted ? DM_IFMT_PALETTE : DM_IFMT_RGB; + dmOutputImageBitFormat(spec->format, info); return dmWritePCXImage(filename, image, spec); case IMGFMT_RAW: