GDI: does not freeze after a few seconds anymore, but the window still freezes when moving the mouse into it

This commit is contained in:
Brad Parker 2017-01-08 22:20:43 -05:00
parent 8eba18a54f
commit 6fe2a974a5
2 changed files with 26 additions and 8 deletions

View File

@ -528,13 +528,12 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
// All painting occurs here, between BeginPaint and EndPaint.
FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1));
//FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1));
EndPaint(hwnd, &ps);
return 0;
break;
}
case WM_ERASEBKGND:
break;
case WM_DROPFILES:
case WM_SYSCOMMAND:
case WM_CHAR:

View File

@ -258,12 +258,23 @@ static bool gdi_gfx_frame(void *data, const void *frame,
if (draw)
{
HDC winDC = GetDC(hwnd);
HDC dc = CreateCompatibleDC(winDC);
HDC memDC = CreateCompatibleDC(winDC);
HBITMAP bmp = CreateCompatibleBitmap(winDC, width, height);
HBITMAP bmp_old;
BITMAPINFO info;
gfx_ctx_mode_t mode;
RECT rect;
HBRUSH brush;
SelectObject(dc, bmp);
GetClientRect(hwnd, &rect);
bmp_old = SelectObject(memDC, bmp);
brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
FillRect(memDC, &rect, brush);
DeleteObject(brush);
video_context_driver_get_video_size(&mode);
@ -311,14 +322,22 @@ static bool gdi_gfx_frame(void *data, const void *frame,
info.bmiColors[2].rgbReserved = 0x00;
}
*/
StretchDIBits(dc, 0, 0, mode.width, mode.height, 0, 0, width, height,
StretchDIBits(memDC, 0, 0, mode.width, mode.height, 0, 0, width, height,
frame_to_copy, &info, DIB_RGB_COLORS, SRCCOPY);
BitBlt(winDC,
rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
memDC, 0, 0, SRCCOPY);
SelectObject(memDC, bmp_old);
DeleteObject(bmp);
DeleteDC(dc);
DeleteDC(memDC);
ReleaseDC(hwnd, winDC);
}
InvalidateRect(hwnd, NULL, true);
//InvalidateRect(hwnd, NULL, true);
video_context_driver_update_window_title();