From dbe24a08917d286a43568202b91a5b0db60822c6 Mon Sep 17 00:00:00 2001 From: dgis Date: Mon, 7 Jan 2019 22:39:15 +0000 Subject: [PATCH] Fix 4bits and 8bits images format. --- ReadMe.txt | 6 +++--- app/src/main/cpp/win32-layer.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index b1de55c..38fec39 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,14 +5,13 @@ This win32 layer will allow to easily update from the original Emu48 source code It can open or save the exact same state files (state.e48/e49) than the original Windows application! NOT WORKING -- Disassembler -- Debugger - Macro - Infrared Printer - Serial Ports (Wire or Ir) +- Disassembler +- Debugger TODO -- Support 8bits images - Add recent files - Bug: Port1 is not enable from the state.e48 file! - Option to allow rotation @@ -40,3 +39,4 @@ DONE - Settings show KML log should be true by default. - Sound - Bug: No refresh with the clock (Fix timers) +- Support 8bits images diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index 9223e96..9eca352 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -1254,7 +1254,7 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc for (float y = yDest; y < dst_maxy; y++) { float src_curx = xSrc; - BYTE parity = 0; + BYTE parity = xSrc; for (float x = xDest; x < dst_maxx; x++, parity++) { // Point sampling - you can also impl as bilinear or other @@ -1267,6 +1267,7 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc switch (sourceBitCount) { case 4: { BYTE colorIndex = (parity & 0x1 ? sourcePixel[0] & (BYTE)0x0F : sourcePixel[0] >> 4); + //BYTE colorIndex = (parity & 0x1 ? sourcePixel[0] >> 4 : sourcePixel[0] & (BYTE)0x0F); if (palPalEntry) { destinationPixel[0] = palPalEntry[colorIndex].peRed; //TODO Exchange Blue and Red? destinationPixel[1] = palPalEntry[colorIndex].peGreen; @@ -1516,9 +1517,9 @@ UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq && hdc->realizedPalette->paletteLog->palNumEntries > 0 && iStart < hdc->realizedPalette->paletteLog->palNumEntries) { PALETTEENTRY * palPalEntry = hdc->realizedPalette->paletteLog->palPalEntry; for (int i = iStart, j = 0; i < cEntries; i++, j++) { - palPalEntry[i].peRed = prgbq[j].rgbRed; + palPalEntry[i].peRed = prgbq[j].rgbBlue; palPalEntry[i].peGreen = prgbq[j].rgbGreen; - palPalEntry[i].peBlue = prgbq[j].rgbBlue; + palPalEntry[i].peBlue = prgbq[j].rgbRed; palPalEntry[i].peFlags = 0; } }