Improve the win32 layer and make the version 1.7beta

This commit is contained in:
dgis 2019-10-30 00:08:00 +01:00
parent d8dffd44bb
commit 1065c26765
3 changed files with 25 additions and 4 deletions

View file

@ -54,7 +54,7 @@ NOT WORKING YET
CHANGES
Version 1.7 (2019-11-27)
Version 1.7 (2019-11-29)
- Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62.
- Allow to take a screenshot of the fullscreen including the skin.

View file

@ -54,7 +54,7 @@ NOT WORKING YET
CHANGES
Version 1.7 (2019-11-27)
Version 1.7 (2019-11-29)
- Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62.
- Allow to take a screenshot of the fullscreen including the skin.

View file

@ -1683,7 +1683,8 @@ int GetObject(HGDIOBJ h, int c, LPVOID pv) {
} return 0;
}
HGDIOBJ GetCurrentObject(HDC hdc, UINT type) {
//TODO
if(hdc)
return hdc->selectedBitmap;
return NULL;
}
BOOL DeleteObject(HGDIOBJ ho) {
@ -1768,9 +1769,13 @@ HDC CreateCompatibleDC(HDC hdc) {
return handle;
}
HDC GetDC(HWND hWnd) {
if(!hWnd)
return NULL;
return hWnd->windowDC;
}
int ReleaseDC(HWND hWnd, HDC hDC) {
if(!hWnd)
return NULL;
hWnd->windowDC = NULL; //?
return TRUE;
}
@ -2291,7 +2296,23 @@ HBITMAP CreateCompatibleBitmap( HDC hdc, int cx, int cy) {
return newHBITMAP;
}
int GetDIBits(HDC hdc, HBITMAP hbm, UINT start, UINT cLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT usage) {
//TODO
//TODO Not sure at all for this function
if(hbm && lpbmi) {
CONST BITMAPINFO *pbmi = hbm->bitmapInfo;
if(!lpvBits) {
size_t bitmapInfoSize = sizeof(BITMAPINFOHEADER);
memcpy(lpbmi, pbmi, bitmapInfoSize);
} else {
// We consider the source and destination dib with the same format
size_t stride = (size_t)(4 * ((pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount + 31) / 32));
VOID * sourceDibBits = (VOID *)hbm->bitmapBits;
VOID * destinationDibBits = lpvBits;
for(int y = 0; y < cLines; y++) {
size_t lineSize = (start + y) * stride;
memcpy(destinationDibBits + lineSize, sourceDibBits + lineSize, stride);
}
}
}
return 0;
}
COLORREF GetPixel(HDC hdc, int x ,int y) {