# HG changeset patch # User Matti Hamalainen # Date 1560276395 -10800 # Node ID de88333acc440196279bea2f55c6318295b8c9dd # Parent a39bf85308e5806556de104a17bd96df1512d457 Move the PETSCII getpixel function to lib64gfx.c and remove the fmtGetGenericChar*() helper functions that were not being used really. diff -r a39bf85308e5 -r de88333acc44 tools/lib64fmts.c --- a/tools/lib64fmts.c Tue Jun 11 07:38:44 2019 +0300 +++ b/tools/lib64fmts.c Tue Jun 11 21:06:35 2019 +0300 @@ -111,45 +111,6 @@ } -static int fmtGetPixelPETSCII(Uint8 *col, - const DMC64Image *img, const int rasterX, const int rasterY) -{ - DM_C64_GENERIC_CHAR_PIXEL(img) - 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 - - 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); - - 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); - - 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 DMERR_INVALID_DATA; - } -} - - static const Uint8 fmtPetsciiKrisszHu_ID1[] = { 0x01, 0x08, 0x0b, 0x08, 0x0A, 0x00, 0x9E, 0x32, 0x30, 0x36, @@ -2418,7 +2379,7 @@ D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, 1, 1, NULL, NULL, - fmtGetPixelPETSCII, + NULL, { { DO_COPY , DS_SCREEN_RAM , 0x60, 0, 0, 0, NULL, NULL }, { DO_COPY , DS_COLOR_RAM , 0x60 + 1000, 0, 0, 0, NULL, NULL }, @@ -2445,7 +2406,7 @@ D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, 1, 1, NULL, NULL, - fmtGetPixelPETSCII, + NULL, { { DO_COPY , DS_SCREEN_RAM , 0x2001 - 2, 0, 0, 0, NULL, NULL }, { DO_COPY , DS_COLOR_RAM , 0x23e9 - 2, 0, 0, 0, NULL, NULL }, diff -r a39bf85308e5 -r de88333acc44 tools/lib64gfx.c --- 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) {