changeset 2313:866e036d7706

Clean up some code duplication.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 Jul 2019 11:52:15 +0300
parents cd266022e4a8
children 87533af8db64
files tools/lib64fmts.c
diffstat 1 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Tue Jul 09 10:43:20 2019 +0300
+++ b/tools/lib64fmts.c	Tue Jul 09 11:52:15 2019 +0300
@@ -456,17 +456,12 @@
 static int fmtGetPixelDrazLace(Uint8 *col,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
-    const int
-        x = rasterX / 8,
-        y = rasterY / 8,
-        yoffs = y * img->fmt->chWidth,
-        bmoffs = yoffs * 8 + (rasterY & 7) + (x * 8),
-        scroffs = yoffs + x,
-        vshift = 6 - (rasterX & 6);
+    DM_C64_GENERIC_SC_PIXEL_DEFS(img)
+    (void) vshift;
 
     return dmC64GetGenericMCPixel(col, img,
         bmoffs, scroffs,
-        vshift, 0,
+        6 - (rasterX & 6), 0,
         rasterX & 1, 0, img->bgcolor);
 }
 
@@ -792,17 +787,12 @@
 static int fmtGetPixelTruePaint(Uint8 *col,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
-    const int
-        x = rasterX / 8,
-        y = rasterY / 8,
-        yoffs = y * img->fmt->chWidth,
-        bmoffs = yoffs * 8 + (rasterY & 7) + (x * 8),
-        scroffs = yoffs + x,
-        vshift = 6 - (rasterX & 6);
+    DM_C64_GENERIC_SC_PIXEL_DEFS(img)
+    (void) vshift;
 
     return dmC64GetGenericMCPixel(col, img,
         bmoffs, scroffs,
-        vshift, 0,
+        6 - (rasterX & 6), 0,
         rasterX & 1, 0, img->bgcolor);
 }