# HG changeset patch # User Matti Hamalainen # Date 1558882284 -10800 # Node ID 05a6e00b09d0e181e830c60171d09eedf74b846e # Parent 91d5caf0ff823303ed4c864995aa5278e28307ff Change D64_FMT_* MASK constants and how they are used. diff -r 91d5caf0ff82 -r 05a6e00b09d0 tools/lib64gfx.c --- a/tools/lib64gfx.c Sun May 26 05:20:47 2019 +0300 +++ b/tools/lib64gfx.c Sun May 26 17:51:24 2019 +0300 @@ -36,8 +36,9 @@ char * dmC64GetImageTypeString(char *buf, const size_t len, const int type, const BOOL lng) { - static const char *fmtModesShort[] = { "HiRes", "MC", "ECM" }; - static const char *fmtModesLong[] = { "HiRes", "MultiColor", "Extended Color Mode" }; + static const char *fmtModesShort[] = { "ERROR", "HiR", "MC", "ECM" }; + static const char *fmtModesLong[] = { "ERROR", "HiRes", "MultiColor", "Extended Color Mode" }; + snprintf(buf, len, "%s %s%s%s", lng ? fmtModesLong[type & D64_FMT_MASK] : fmtModesShort[type & D64_FMT_MASK], @@ -1281,7 +1282,15 @@ if (src->fmt->getPixel != NULL) getPixel = src->fmt->getPixel; else - getPixel = (src->fmt->type & D64_FMT_MC) ? fmtGetGenericMCPixel : fmtGetGenericSCPixel; + switch (src->fmt->type & D64_FMT_MASK) + { + case D64_FMT_MC: getPixel = fmtGetGenericMCPixel; break; + case D64_FMT_HIRES: getPixel = fmtGetGenericSCPixel; break; + default: + return dmError(DMERR_INVALID_DATA, + "Invalid bitmap image type/fmt=%d.\n", + src->fmt->type); + } // Resolution interlaced pics need to halve the source width int rwidth = dst->width, rheight = dst->height; diff -r 91d5caf0ff82 -r 05a6e00b09d0 tools/lib64gfx.h --- a/tools/lib64gfx.h Sun May 26 05:20:47 2019 +0300 +++ b/tools/lib64gfx.h Sun May 26 17:51:24 2019 +0300 @@ -51,9 +51,9 @@ // Different supported flags/modes enum { - D64_FMT_HIRES = 0x0000, // Hi-res - D64_FMT_MC = 0x0001, // MultiColor - D64_FMT_ECM = 0x0002, // ECM mode (applies only to character mode) + D64_FMT_HIRES = 0x0001, // Hi-res + D64_FMT_MC = 0x0002, // MultiColor + D64_FMT_ECM = 0x0003, // ECM mode (applies only to character mode) D64_FMT_MASK = 0x000f, D64_FMT_ILACE = 0x0010, // Interlace