diff tools/lib64fmts.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 6dc64deb6718
children 6119b9b560fb
line wrap: on
line diff
--- a/tools/lib64fmts.c	Wed Sep 25 11:45:21 2019 +0300
+++ b/tools/lib64fmts.c	Wed Sep 25 12:11:35 2019 +0300
@@ -454,13 +454,13 @@
 }
 
 
-static int fmtGetPixelDrazLace(Uint8 *col,
+static int fmtGetPixelDrazLace(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
     (void) vshift;
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs, scroffs,
         6 - (rasterX & 6), 0,
         rasterX & 1, 0, img->bgcolor);
@@ -677,12 +677,12 @@
 }
 
 
-static int fmtGetPixelFLIDesigner(Uint8 *col,
+static int fmtGetPixelFLIDesigner(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_MC_PIXEL_DEFS(img)
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs, scroffs,
         vshift, rasterY & 7,
         0, 0, img->bgcolor);
@@ -772,7 +772,7 @@
 }
 
 
-static int fmtGetPixelBlackMailFLI(Uint8 *col,
+static int fmtGetPixelBlackMailFLI(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_MC_PIXEL_DEFS(img)
@@ -780,20 +780,20 @@
     Uint8 bgcol = (unsigned) rasterY < img->extraData[0].size ?
         img->extraData[0].data[rasterY] : img->bgcolor;
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs, scroffs,
         vshift, rasterY & 7,
         0, 0, bgcol);
 }
 
 
-static int fmtGetPixelTruePaint(Uint8 *col,
+static int fmtGetPixelTruePaint(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
     (void) vshift;
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs, scroffs,
         6 - (rasterX & 6), 0,
         rasterX & 1, 0, img->bgcolor);
@@ -930,7 +930,7 @@
 }
 
 
-static int fmtGetPixelFlinterlazer(Uint8 *col,
+static int fmtGetPixelFlinterlazer(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_MC_PIXEL_DEFS(img)
@@ -942,7 +942,7 @@
         (res = dmC64GetGenericMCPixel(&color2, img, bmoffs, scroffs, vshift, vbank + 8, 1, 0, bgcol)) != DMERR_OK)
         return res;
 
-    *col = (color1 * D64_NCOLORS) + color2;
+    *(scan->col) = (color1 * D64_NCOLORS) + color2;
     return DMERR_OK;
 }
 
@@ -1273,7 +1273,7 @@
 }
 
 
-static int fmtGetPixelFunPaint2(Uint8 *col,
+static int fmtGetPixelFunPaint2(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
@@ -1283,7 +1283,7 @@
 
     (void) vshift;
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs, scroffs,
         6 - (rasterX & 6),
         yb + (bitmap * 8),
@@ -1291,21 +1291,21 @@
 }
 
 
-static int fmtGetPixelBFLI(Uint8 *col,
+static int fmtGetPixelBFLI(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_MC_PIXEL_DEFS(img)
     const int vbb = rasterY < 200 ? 0 : 1;
     const int vbank = (rasterY & 7) + (vbb * 8);
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs & 0x1fff, scroffs & 0x3ff,
         vshift, vbank,
         vbb, 0, img->bgcolor);
 }
 
 
-static int fmtGetPixelPentelPaint(Uint8 *col,
+static int fmtGetPixelPentelPaint(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
@@ -1324,7 +1324,7 @@
     if ((res = dmC64GetGenericSCPixel(&color1, img, bmoffs, scroffs, vshift, 0, 0)) != DMERR_OK)
         return res;
 
-    *col = color3 ? color3 : ( color2 ? color2 : color1 );
+    *(scan->col) = color3 ? color3 : ( color2 ? color2 : color1 );
     return DMERR_OK;
 }
 
@@ -1526,7 +1526,7 @@
 }
 
 
-static int fmtGetSpritePixelCrestSHFLI(Uint8 *col,
+static int fmtGetSpritePixelCrestSHFLI(DMC64ScanLine *scan,
     const DMC64Image *img, const int sindex, const int cindex,
     const int spr_xd, const int spr_yd, const int mask)
 {
@@ -1537,7 +1537,7 @@
 
     if (img->extraData[14].data[offs] & mask)
     {
-        *col = img->extraData[15].data[cindex];
+        *(scan->col) = img->extraData[15].data[cindex];
         return DMERR_OK;
     }
 
@@ -1545,7 +1545,7 @@
 }
 
 
-static int fmtGetPixelCrestSHFLI(Uint8 *col,
+static int fmtGetPixelCrestSHFLI(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
@@ -1556,7 +1556,7 @@
 
     if (rasterY / 8 >= DM_CREST_SHFLI_IMG_HEIGHT)
     {
-        *col = 0x0f;
+        *(scan->col) = 0x0f;
         return DMERR_OK;
     }
 
@@ -1576,23 +1576,23 @@
         const int spr_index1 = img->extraData[sbank].data[spr_offs];
         const int spr_index2 = img->extraData[sbank].data[spr_offs + 4];
 
-        if ((res = fmtGetSpritePixelCrestSHFLI(col, img, spr_index1, 0, spr_xd, spr_yd, mask)) == DMERR_OK ||
+        if ((res = fmtGetSpritePixelCrestSHFLI(scan, img, spr_index1, 0, spr_xd, spr_yd, mask)) == DMERR_OK ||
             res != -1)
             return res;
 
-        if ((res = fmtGetSpritePixelCrestSHFLI(col, img, spr_index2, 1, spr_xd, spr_yd, mask)) == DMERR_OK ||
+        if ((res = fmtGetSpritePixelCrestSHFLI(scan, img, spr_index2, 1, spr_xd, spr_yd, mask)) == DMERR_OK ||
             res != -1)
             return res;
     }
 
-    if ((res = dmC64GetGenericSCPixel(col, img, bmoffs, scroffs, vshift, nbank, 0)) != DMERR_OK)
+    if ((res = dmC64GetGenericSCPixel(scan->col, img, bmoffs, scroffs, vshift, nbank, 0)) != DMERR_OK)
         return res;
 
     return DMERR_OK;
 }
 
 
-static int fmtGetPixelHCB(Uint8 *col,
+static int fmtGetPixelHCB(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_MC_PIXEL_DEFS(img)
@@ -1602,25 +1602,25 @@
     Uint8 bgcol = (unsigned) ry < img->extraData[0].size ?
         img->extraData[0].data[ry] : img->bgcolor;
 
-    return dmC64GetGenericMCPixel(col, img,
+    return dmC64GetGenericMCPixel(scan->col, img,
         bmoffs, scroffs,
         vshift, vbank,
         0, vbank, bgcol);
 }
 
 
-static int fmtGetPixelCrestHIFLIorCDHM(Uint8 *col,
+static int fmtGetPixelCrestHIFLIorCDHM(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
 
-    return dmC64GetGenericSCPixel(col, img,
+    return dmC64GetGenericSCPixel(scan->col, img,
         bmoffs, scroffs,
         vshift, rasterY & 7, 0);
 }
 
 
-static int fmtGetPixelECI(Uint8 *col,
+static int fmtGetPixelECI(DMC64ScanLine *scan,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
     DM_C64_GENERIC_SC_PIXEL_DEFS(img)
@@ -1632,7 +1632,7 @@
         (res = dmC64GetGenericSCPixel(&color2, img, bmoffs, scroffs, vshift, vbank + 8, 1)) != DMERR_OK)
         return res;
 
-    *col = (color1 * D64_NCOLORS) + color2;
+    *(scan->col) = (color1 * D64_NCOLORS) + color2;
     return DMERR_OK;
 }