diff tools/lib64fmts.c @ 2306:e798a41f27a5

Clean up some code duplication.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 08 Jul 2019 12:25:46 +0300
parents 7c26b5f86ff7
children 319fd953ba29
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);
 }