Mercurial > hg > dmlib
diff tools/lib64gfx.c @ 2343:94a653883a32
Change Uint8 pointer in getPixel functions to DMC64ScanLine pointer in
preparation for future changes related to sprites on scanlines.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 25 Sep 2019 12:11:35 +0300 |
parents | a56f3bcb5476 |
children | 13e54305e5fc |
line wrap: on
line diff
--- a/tools/lib64gfx.c Wed Sep 25 11:45:21 2019 +0300 +++ b/tools/lib64gfx.c Wed Sep 25 12:11:35 2019 +0300 @@ -1330,32 +1330,32 @@ } -static int fmtGetGenericSCPixel(Uint8 *col, +static int fmtGetGenericSCPixel(DMC64ScanLine *scan, const DMC64Image *img, const int rasterX, const int rasterY) { DM_C64_GENERIC_SC_PIXEL_DEFS(img) return dmC64GetGenericSCPixel( - col, img, + scan->col, img, bmoffs, scroffs, vshift, 0, 0); } -static int fmtGetGenericMCPixel(Uint8 *col, +static int fmtGetGenericMCPixel(DMC64ScanLine *scan, const DMC64Image *img, const int rasterX, const int rasterY) { DM_C64_GENERIC_MC_PIXEL_DEFS(img) return dmC64GetGenericMCPixel( - col, img, + scan->col, img, bmoffs, scroffs, vshift, 0, 0, 0, img->bgcolor); } -static int fmtGetGenericCharPixel(Uint8 *col, +static int fmtGetGenericCharPixel(DMC64ScanLine *scan, const DMC64Image *img, const int rasterX, const int rasterY) { DM_C64_GENERIC_CHAR_PIXEL(img) @@ -1369,21 +1369,21 @@ { case D64_FMT_HIRES: return dmC64GetGenericCharSCPixel( - col, img, + scan->col, img, scroffs, rasterX, 0, (chr * D64_CHR_SIZE) + (rasterY & 7), chr, 0, img->bgcolor); case D64_FMT_MC: return dmC64GetGenericCharMCPixel( - col, img, + scan->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, + scan->col, img, scroffs, rasterX, 0, ((chr & 0x3f) * D64_CHR_SIZE) + (rasterY & 7), chr, 0, img->bgcolor, img->d022, img->d023, img->d024); @@ -1401,8 +1401,11 @@ static int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec) { DMC64GetPixelFunc getPixel; + DMC64ScanLine scan; + (void) spec; dmMemset(dst->data, 0, dst->size); + dmMemset(&scan, 0, sizeof(scan)); // Check pixel getter function if (src->fmt->getPixel != NULL) @@ -1424,11 +1427,11 @@ // Perform conversion for (int yc = 0; yc < dst->height; yc++) { - Uint8 *dp = dst->data + (yc * dst->pitch); - for (int xc = 0; xc < dst->width; xc++, dp++) + scan.col = dst->data + (yc * dst->pitch); + for (int xc = 0; xc < dst->width; xc++, scan.col++) { int res; - if ((res = getPixel(dp, src, xc, yc)) != DMERR_OK) + if ((res = getPixel(&scan, src, xc, yc)) != DMERR_OK) return res; } }