Mercurial > hg > dmlib
changeset 2306:e798a41f27a5
Clean up some code duplication.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 08 Jul 2019 12:25:46 +0300 |
parents | 3bcad61594b4 |
children | 319fd953ba29 |
files | tools/lib64fmts.c tools/lib64gfx.h |
diffstat | 2 files changed, 10 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/lib64fmts.c Mon Jul 08 10:28:00 2019 +0300 +++ b/tools/lib64fmts.c Mon Jul 08 12:25:46 2019 +0300 @@ -1282,23 +1282,17 @@ static int fmtGetPixelFunPaint2(Uint8 *col, const DMC64Image *img, const int rasterX, const int rasterY) { - const int - x = rasterX / 8, - y = rasterY / 8, - yb = rasterY & 7, - yoffs = y * img->fmt->chWidth, - bmoffs = yoffs * 8 + yb + (x * 8), - scroffs = yoffs + x, - bitmap = rasterX & 1, - vbank = yb + (bitmap * 8), - vshift = 6 - (rasterX & 6); - + DM_C64_GENERIC_SC_PIXEL_DEFS(img) + const int bitmap = rasterX & 1; Uint8 bgcol = (unsigned) rasterY < img->extraData[0].size ? img->extraData[0].data[rasterY] : img->bgcolor; + (void) vshift; + return dmC64GetGenericMCPixel(col, img, bmoffs, scroffs, - vshift, vbank, + 6 - (rasterX & 6), + yb + (bitmap * 8), bitmap, 0, bgcol); }
--- a/tools/lib64gfx.h Mon Jul 08 10:28:00 2019 +0300 +++ b/tools/lib64gfx.h Mon Jul 08 12:25:46 2019 +0300 @@ -433,8 +433,9 @@ const int \ x = rasterX / 8, \ y = rasterY / 8, \ + yb = rasterY & 7, \ yoffs = y * ximg->fmt->chWidth, \ - bmoffs = yoffs * 8 + (rasterY & 7) + (x * 8), \ + bmoffs = yoffs * 8 + yb + (x * 8), \ scroffs = yoffs + x, \ vshift = 7 - (rasterX & 7); @@ -443,8 +444,9 @@ const int \ x = rasterX / 4, \ y = rasterY / 8, \ + yb = rasterY & 7, \ yoffs = y * (ximg)->fmt->chWidth, \ - bmoffs = yoffs * 8 + (rasterY & 7) + (x * 8), \ + bmoffs = yoffs * 8 + yb + (x * 8), \ scroffs = yoffs + x, \ vshift = 6 - ((rasterX * 2) & 6);