changeset 2115:51b8826bd4c1

Some fixes in charmap to image decoding.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 26 May 2019 02:44:34 +0300
parents 27cf33c3a646
children b49d7cb20a73
files tools/lib64gfx.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Sun May 26 02:43:08 2019 +0300
+++ b/tools/lib64gfx.c	Sun May 26 02:44:34 2019 +0300
@@ -1304,8 +1304,8 @@
                 // Hi-res charmap
                 const int x = xc / 8;
                 const int scroffs = scroffsy + x;
+                const int vshift = 7 - (xc & 7);
                 const int chr = src->screen[0].data[scroffs];
-                const int vshift = 7 - (xc & 7);
 
                 if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 1)
                     *dp++ = src->color[0].data[scroffs];
@@ -1314,11 +1314,11 @@
             }
             else
             {
-                // Multicolor variants
+                // Multicolor charmap
                 const int x = xc / 4;
                 const int scroffs = scroffsy + x;
                 const int chr = src->screen[0].data[scroffs];
-                const int col = src->color[0].data[scroffs] & 15;
+                const int col = src->color[0].data[scroffs];
 
                 if (col & 8)
                 {
@@ -1328,14 +1328,14 @@
                         case 0: *dp++ = src->bgcolor; break;
                         case 1: *dp++ = src->d022; break;
                         case 2: *dp++ = src->d023; break;
-                        case 3: *dp++ = col;
+                        case 3: *dp++ = col & 15;
                     }
                 }
                 else
                 {
                     const int vshift = 7 - (xc & 7);
                     if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 1)
-                        *dp++ = src->color[0].data[scroffs];
+                        *dp++ = col & 7;
                     else
                         *dp++ = src->bgcolor;
                 }