changeset 2222:75b5bb490f38

Add & 15 to deeper helper functions and remove it from unnecessary places.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 12:08:59 +0300
parents b858ade0fb0b
children 5477e792def3
files tools/lib64fmts.c tools/lib64gfx.h
diffstat 2 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Fri Jun 14 09:04:15 2019 +0300
+++ b/tools/lib64fmts.c	Fri Jun 14 12:08:59 2019 +0300
@@ -741,7 +741,7 @@
     return dmC64GetGenericMCPixel(col, img,
         bmoffs, scroffs,
         vshift, rasterY & 7,
-        0, 0, bgcol & 15);
+        0, 0, bgcol);
 }
 
 
@@ -1179,7 +1179,7 @@
     return dmC64GetGenericMCPixel(col, img,
         bmoffs, scroffs,
         vshift, vbank,
-        bitmap, 0, bgcol & 15);
+        bitmap, 0, bgcol);
 }
 
 
@@ -1497,7 +1497,7 @@
     return dmC64GetGenericMCPixel(col, img,
         bmoffs, scroffs,
         vshift, vbank,
-        0, vbank, bgcol & 15);
+        0, vbank, bgcol);
 }
 
 
--- a/tools/lib64gfx.h	Fri Jun 14 09:04:15 2019 +0300
+++ b/tools/lib64gfx.h	Fri Jun 14 12:08:59 2019 +0300
@@ -460,7 +460,7 @@
 {
     switch ((img->bitmap[bitmap].data[bmoffs] >> vshift) & 3)
     {
-        case  0: *col = bgcolor; break;
+        case  0: *col = bgcolor & 15; break;
         case  1: *col = img->screen[vbank].data[scroffs] >> 4; break;
         case  2: *col = img->screen[vbank].data[scroffs] & 15; break;
         default: *col = img->color[cbank].data[scroffs] & 15; break;
@@ -484,9 +484,9 @@
 
     const int vshift = 7 - (rasterX & 7);
     if ((img->charData[chrbank].data[chroffs] >> vshift) & 1)
-        *col = img->color[cbank].data[scroffs];
+        *col = img->color[cbank].data[scroffs] & 15;
     else
-        *col = bgcolor;
+        *col = bgcolor & 15;
 
     return DMERR_OK;
 }
@@ -511,9 +511,9 @@
         const int vshift = 6 - (rasterX & 6);
         switch ((img->charData[chrbank].data[chroffs] >> vshift) & 3)
         {
-            case 0: *col = bgcolor; break;
-            case 1: *col = bgd022; break;
-            case 2: *col = bgd023; break;
+            case 0: *col = bgcolor & 15; break;
+            case 1: *col = bgd022 & 15; break;
+            case 2: *col = bgd023 & 15; break;
             case 3: *col = ccol & 7;
         }
     }
@@ -523,7 +523,7 @@
         if ((img->charData[chrbank].data[chroffs] >> vshift) & 1)
             *col = ccol & 7;
         else
-            *col = bgcolor;
+            *col = bgcolor & 15;
     }
 
     return DMERR_OK;
@@ -549,10 +549,10 @@
     else
     switch ((chr >> 6) & 3)
     {
-        case 0: *col = bgcolor; break;
-        case 1: *col = bgd022; break;
-        case 2: *col = bgd023; break;
-        case 3: *col = bgd024; break;
+        case 0: *col = bgcolor & 15; break;
+        case 1: *col = bgd022 & 15; break;
+        case 2: *col = bgd023 & 15; break;
+        case 3: *col = bgd024 & 15; break;
     }
 
     return DMERR_OK;