]> granicus.if.org Git - nethack/commitdiff
Fix for NetHackW.exe menu icon rendering.
authorBart House <bart@barthouse.com>
Mon, 3 Dec 2018 04:22:47 +0000 (20:22 -0800)
committerBart House <bart@barthouse.com>
Mon, 3 Dec 2018 04:22:47 +0000 (20:22 -0800)
win/win32/mhmap.c

index 28989d40bd2bd831e34cf929ead27dbed4a8ae25..d401c4c3ce76a979a033010f5a657c02212f0ef8 100644 (file)
@@ -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);