From f081e538762599eb2e64766e02f209bfa47b6ba4 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sun, 2 Dec 2018 20:22:47 -0800 Subject: [PATCH] Fix for NetHackW.exe menu icon rendering. --- win/win32/mhmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/win/win32/mhmap.c b/win/win32/mhmap.c index 28989d40b..d401c4c3c 100644 --- a/win/win32/mhmap.c +++ b/win/win32/mhmap.c @@ -729,8 +729,6 @@ onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam) data->tileDC = CreateCompatibleDC(hDC); ReleaseDC(hWnd, hDC); - SelectObject(data->tileDC, GetNHApp()->bmpMapTiles); - SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) data); clearAll(data); @@ -989,11 +987,15 @@ onPaint(HWND hWnd) PNHMapWindow data = (PNHMapWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); /* update back buffer */ + HBITMAP savedBitmap = SelectObject(data->tileDC, GetNHApp()->bmpMapTiles); + for (int i = 0; i < COLNO; i++) for (int j = 0; j < ROWNO; j++) if (data->mapDirty[i][j]) paint(data, i, j); + SelectObject(data->tileDC, savedBitmap); + PAINTSTRUCT ps; HDC hFrontBufferDC = BeginPaint(hWnd, &ps); -- 2.40.0