]> localhost Git - WindEmu.git/commitdiff
fix 4bpp screen rendering
authorAsh Wolf <ninji@wuffs.org>
Fri, 20 Dec 2019 01:00:00 +0000 (01:00 +0000)
committerAsh Wolf <ninji@wuffs.org>
Fri, 20 Dec 2019 01:00:00 +0000 (01:00 +0000)
README.md
WindQt/mainwindow.cpp

index ae19f908036e76e4e57d9257da57a24512c5c54f..c8428f499e2527c54a6fcd489094828d8466aa68 100644 (file)
--- a/README.md
+++ b/README.md
@@ -26,7 +26,6 @@ Known issues:
 - State is not saved (just like a real Psion :p)
 - LCD controller is almost entirely unimplemented aside from the very basics to display the framebuffer
 - EPOC misbehaves massively with memory banks larger than 0x800000 (may be an OS design flaw? need to confirm)
-- 4bpp display mode does not decode correctly
 
 Copyright
 ---------
index 449161315155c4fb58be441ba8b76cd36d24f32f..e0227d40ba7675902510e0b5d747b07bd9b93838 100644 (file)
@@ -93,16 +93,11 @@ void MainWindow::updateScreen()
             for (int x = 0; x < img.width(); x++) {
                 uint8_t byte = lcdBuf[lineOffs + (x / ppb)];
                 int shift = (x & (ppb - 1)) * bpp;
-                int mask = (bpp << 1) - 1;
+                int mask = (1 << bpp) - 1;
                 int palIdx = (byte >> shift) & mask;
                 int palValue = palette[palIdx];
 
-                if (bpp <= 1)
-                    palValue |= (palValue << 1);
-                if (bpp <= 2)
-                    palValue |= (palValue << 2);
-                if (bpp <= 4)
-                    palValue |= (palValue << 4);
+                palValue |= (palValue << 4);
                 scanline[x] = palValue ^ 0xFF;
             }
         }