Mercurial > hg > dmlib
diff tools/lib64gfx.c @ 2172:de88333acc44
Move the PETSCII getpixel function to lib64gfx.c and remove the
fmtGetGenericChar*() helper functions that were not being used really.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 11 Jun 2019 21:06:35 +0300 |
parents | a39bf85308e5 |
children | 58fab91830d5 |
line wrap: on
line diff
--- a/tools/lib64gfx.c Tue Jun 11 07:38:44 2019 +0300 +++ b/tools/lib64gfx.c Tue Jun 11 21:06:35 2019 +0300 @@ -1335,45 +1335,44 @@ } -static int fmtGetGenericCharSCPixel(Uint8 *col, const DMC64Image *img, - const int rasterX, const int rasterY) -{ - DM_C64_GENERIC_CHAR_PIXEL(img) - const int chr = img->screen[0].data[scroffs]; - - return dmC64GetGenericCharSCPixel( - col, img, - scroffs, rasterX, - 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr, - 0, img->bgcolor); -} - - -static int fmtGetGenericCharMCPixel(Uint8 *col, const DMC64Image *img, - const int rasterX, const int rasterY) +static int fmtGetGenericCharPixel(Uint8 *col, + const DMC64Image *img, const int rasterX, const int rasterY) { DM_C64_GENERIC_CHAR_PIXEL(img) - const int chr = img->screen[0].data[scroffs]; + int chr = img->screen[0].data[scroffs]; + + if (!img->extraInfo[D64_EI_CHAR_CUSTOM] && + img->extraInfo[D64_EI_CHAR_CASE]) + chr += 256; // lower case, so add 256 to char ROM offset - return dmC64GetGenericCharMCPixel( - col, img, - scroffs, rasterX, - 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr, - 0, img->bgcolor, img->d022, img->d023); -} - + switch (img->extraInfo[D64_EI_CHAR_MODE]) + { + case D64_FMT_HIRES: + return dmC64GetGenericCharSCPixel( + col, img, + scroffs, rasterX, + 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr, + 0, img->bgcolor); -static int fmtGetGenericCharECMPixel(Uint8 *col, const DMC64Image *img, - const int rasterX, const int rasterY) -{ - DM_C64_GENERIC_CHAR_PIXEL(img) - const int chr = img->screen[0].data[scroffs]; + case D64_FMT_MC: + return dmC64GetGenericCharMCPixel( + col, img, + scroffs, rasterX, + 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr, + 0, img->bgcolor, img->d022, img->d023); - return dmC64GetGenericCharECMPixel( - col, img, - scroffs, rasterX, - 0, ((chr & 0x3f) * D64_CHR_SIZE) + (rasterY & 7), chr, - 0, img->bgcolor, img->d022, img->d023, img->d024); + case D64_FMT_ECM: + return dmC64GetGenericCharECMPixel( + col, img, + scroffs, rasterX, + 0, ((chr & 0x3f) * D64_CHR_SIZE) + (rasterY & 7), chr, + 0, img->bgcolor, img->d022, img->d023, img->d024); + + default: + return dmError(DMERR_INVALID_DATA, + "Invalid character map image type/fmt=0x%x.\n", + img->fmt->type); + } } @@ -1402,16 +1401,7 @@ getPixel = src->fmt->getPixel; else if (src->fmt->type & D64_FMT_CHAR) - switch (src->fmt->type & D64_FMT_MASK) - { - case D64_FMT_MC : getPixel = fmtGetGenericCharMCPixel; break; - case D64_FMT_HIRES : getPixel = fmtGetGenericCharSCPixel; break; - case D64_FMT_ECM : getPixel = fmtGetGenericCharECMPixel; break; - default: - return dmError(DMERR_INVALID_DATA, - "Invalid character map image type/fmt=0x%x.\n", - src->fmt->type); - } + getPixel = fmtGetGenericCharPixel; else switch (src->fmt->type & D64_FMT_MASK) {