mirror of
https://github.com/dgis/emu48android
synced 2024-12-26 09:58:49 +01:00
This commit is contained in:
parent
0ad9b3b54c
commit
327e3ca0bc
3 changed files with 49 additions and 6 deletions
|
@ -687,6 +687,8 @@ BOOL DeleteObject(HGDIOBJ ho) {
|
||||||
switch(ho->handleType) {
|
switch(ho->handleType) {
|
||||||
case HGDIOBJ_TYPE_PALETTE: {
|
case HGDIOBJ_TYPE_PALETTE: {
|
||||||
ho->handleType = 0;
|
ho->handleType = 0;
|
||||||
|
if(ho->paletteLog)
|
||||||
|
free(ho->paletteLog);
|
||||||
ho->paletteLog = NULL;
|
ho->paletteLog = NULL;
|
||||||
free(ho);
|
free(ho);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -710,7 +712,11 @@ HPALETTE CreatePalette(CONST LOGPALETTE * plpal) {
|
||||||
HGDIOBJ handle = (HGDIOBJ)malloc(sizeof(_HGDIOBJ));
|
HGDIOBJ handle = (HGDIOBJ)malloc(sizeof(_HGDIOBJ));
|
||||||
memset(handle, 0, sizeof(_HGDIOBJ));
|
memset(handle, 0, sizeof(_HGDIOBJ));
|
||||||
handle->handleType = HGDIOBJ_TYPE_PALETTE;
|
handle->handleType = HGDIOBJ_TYPE_PALETTE;
|
||||||
handle->paletteLog = (PLOGPALETTE)plpal; // Can be free -> we have to make a copy
|
if(plpal && plpal->palNumEntries >= 0 && plpal->palNumEntries <= 256) {
|
||||||
|
size_t structSize = sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * (size_t)(plpal->palNumEntries - 1);
|
||||||
|
handle->paletteLog = malloc(structSize);
|
||||||
|
memcpy(handle->paletteLog, plpal, structSize);
|
||||||
|
}
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
HPALETTE SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd) {
|
HPALETTE SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd) {
|
||||||
|
@ -806,6 +812,9 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
float destinationStride = androidBitmapInfo.stride; // Destination always 4 bytes RGBA
|
float destinationStride = androidBitmapInfo.stride; // Destination always 4 bytes RGBA
|
||||||
LOGD("StretchBlt(%08x, x:%d, y:%d, w:%d, h:%d, %08x, x:%d, y:%d, w:%d, h:%d) -> sourceBytes: %d", hdcDest->hdcCompatible, xDest, yDest, wDest, hDest, hdcSrc, xSrc, ySrc, wSrc, hSrc, sourceBytes);
|
LOGD("StretchBlt(%08x, x:%d, y:%d, w:%d, h:%d, %08x, x:%d, y:%d, w:%d, h:%d) -> sourceBytes: %d", hdcDest->hdcCompatible, xDest, yDest, wDest, hDest, hdcSrc, xSrc, ySrc, wSrc, hSrc, sourceBytes);
|
||||||
|
|
||||||
|
PALETTEENTRY * palPalEntry = hdcSrc->selectedPalette && hdcSrc->selectedPalette->paletteLog && hdcSrc->selectedPalette->paletteLog->palPalEntry ?
|
||||||
|
hdcSrc->selectedPalette->paletteLog->palPalEntry : NULL;
|
||||||
|
|
||||||
for (float y = yDest; y < dst_maxy; y++)
|
for (float y = yDest; y < dst_maxy; y++)
|
||||||
{
|
{
|
||||||
float src_curx = xSrc;
|
float src_curx = xSrc;
|
||||||
|
@ -820,10 +829,18 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
// -> ARGB_8888
|
// -> ARGB_8888
|
||||||
switch (sourceBytes) {
|
switch (sourceBytes) {
|
||||||
case 1:
|
case 1:
|
||||||
destinationPixel[0] = sourcePixel[0];
|
if(palPalEntry) {
|
||||||
destinationPixel[1] = sourcePixel[0];
|
BYTE colorIndex = sourcePixel[0];
|
||||||
destinationPixel[2] = sourcePixel[0];
|
destinationPixel[0] = palPalEntry[colorIndex].peRed;
|
||||||
destinationPixel[3] = 255;
|
destinationPixel[1] = palPalEntry[colorIndex].peGreen;
|
||||||
|
destinationPixel[2] = palPalEntry[colorIndex].peBlue;
|
||||||
|
destinationPixel[3] = 255;
|
||||||
|
} else {
|
||||||
|
destinationPixel[0] = sourcePixel[0];
|
||||||
|
destinationPixel[1] = sourcePixel[0];
|
||||||
|
destinationPixel[2] = sourcePixel[0];
|
||||||
|
destinationPixel[3] = 255;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
destinationPixel[0] = sourcePixel[0];
|
destinationPixel[0] = sourcePixel[0];
|
||||||
|
@ -855,7 +872,17 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq) {
|
UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq) {
|
||||||
//TODO
|
if(prgbq
|
||||||
|
&& hdc && hdc->selectedPalette && hdc->selectedPalette->paletteLog && hdc->selectedPalette->paletteLog->palPalEntry
|
||||||
|
&& hdc->selectedPalette->paletteLog->palNumEntries > 0 && iStart < hdc->selectedPalette->paletteLog->palNumEntries) {
|
||||||
|
PALETTEENTRY * palPalEntry = hdc->selectedPalette->paletteLog->palPalEntry;
|
||||||
|
for (int i = iStart, j = 0; i < cEntries; i++, j++) {
|
||||||
|
palPalEntry[i].peRed = prgbq[j].rgbRed;
|
||||||
|
palPalEntry[i].peGreen = prgbq[j].rgbGreen;
|
||||||
|
palPalEntry[i].peBlue = prgbq[j].rgbBlue;
|
||||||
|
palPalEntry[i].peFlags = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
HBITMAP CreateDIBitmap( HDC hdc, CONST BITMAPINFOHEADER *pbmih, DWORD flInit, CONST VOID *pjBits, CONST BITMAPINFO *pbmi, UINT iUsage) {
|
HBITMAP CreateDIBitmap( HDC hdc, CONST BITMAPINFOHEADER *pbmih, DWORD flInit, CONST VOID *pjBits, CONST BITMAPINFO *pbmi, UINT iUsage) {
|
||||||
|
|
|
@ -573,6 +573,11 @@ extern HPALETTE CreatePalette(CONST LOGPALETTE * plpal);
|
||||||
|
|
||||||
// DC
|
// DC
|
||||||
|
|
||||||
|
enum DC_TYPE {
|
||||||
|
DC_TYPE_INVALID = 0,
|
||||||
|
DC_TYPE_MEMORY,
|
||||||
|
DC_TYPE_DISPLAY
|
||||||
|
};
|
||||||
enum HDC_TYPE {
|
enum HDC_TYPE {
|
||||||
HDC_TYPE_INVALID = 0,
|
HDC_TYPE_INVALID = 0,
|
||||||
HDC_TYPE_DC
|
HDC_TYPE_DC
|
||||||
|
@ -582,6 +587,7 @@ typedef struct _HDC * HDC;
|
||||||
struct _HDC{
|
struct _HDC{
|
||||||
enum HDC_TYPE handleType;
|
enum HDC_TYPE handleType;
|
||||||
HDC hdcCompatible;
|
HDC hdcCompatible;
|
||||||
|
enum DC_TYPE dcType;
|
||||||
HBITMAP selectedBitmap;
|
HBITMAP selectedBitmap;
|
||||||
HPALETTE selectedPalette;
|
HPALETTE selectedPalette;
|
||||||
};
|
};
|
||||||
|
|
|
@ -157,6 +157,16 @@ public class MainScreenView extends SurfaceView {
|
||||||
vkmap.put(KeyEvent.KEYCODE_NUMPAD_7, 0x67); // VK_NUMPAD7
|
vkmap.put(KeyEvent.KEYCODE_NUMPAD_7, 0x67); // VK_NUMPAD7
|
||||||
vkmap.put(KeyEvent.KEYCODE_NUMPAD_8, 0x68); // VK_NUMPAD8
|
vkmap.put(KeyEvent.KEYCODE_NUMPAD_8, 0x68); // VK_NUMPAD8
|
||||||
vkmap.put(KeyEvent.KEYCODE_NUMPAD_9, 0x69); // VK_NUMPAD9
|
vkmap.put(KeyEvent.KEYCODE_NUMPAD_9, 0x69); // VK_NUMPAD9
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_0, 0x60); // VK_NUMPAD0
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_1, 0x61); // VK_NUMPAD1
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_2, 0x62); // VK_NUMPAD2
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_3, 0x63); // VK_NUMPAD3
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_4, 0x64); // VK_NUMPAD4
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_5, 0x65); // VK_NUMPAD5
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_6, 0x66); // VK_NUMPAD6
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_7, 0x67); // VK_NUMPAD7
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_8, 0x68); // VK_NUMPAD8
|
||||||
|
vkmap.put(KeyEvent.KEYCODE_9, 0x69); // VK_NUMPAD9
|
||||||
vkmap.put(KeyEvent.KEYCODE_NUMPAD_MULTIPLY, 0x6A); // VK_MULTIPLY
|
vkmap.put(KeyEvent.KEYCODE_NUMPAD_MULTIPLY, 0x6A); // VK_MULTIPLY
|
||||||
vkmap.put(KeyEvent.KEYCODE_NUMPAD_ADD, 0x6B); // VK_ADD
|
vkmap.put(KeyEvent.KEYCODE_NUMPAD_ADD, 0x6B); // VK_ADD
|
||||||
vkmap.put(KeyEvent.KEYCODE_NUMPAD_SUBTRACT, 0x6D); // VK_SUBTRACT
|
vkmap.put(KeyEvent.KEYCODE_NUMPAD_SUBTRACT, 0x6D); // VK_SUBTRACT
|
||||||
|
|
Loading…
Reference in a new issue