Win32_Repaint(): only redraw the required rectangle
This commit is contained in:
parent
69640743c9
commit
24b197e6a6
@ -53,6 +53,7 @@ HWND GFX2_Get_Window_Handle()
|
|||||||
return Win32_hwnd;
|
return Win32_hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Blit our "framebuffer" bitmap to the Window.
|
||||||
static void Win32_Repaint(HWND hwnd)
|
static void Win32_Repaint(HWND hwnd)
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
@ -62,17 +63,22 @@ static void Win32_Repaint(HWND hwnd)
|
|||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
if (!GetUpdateRect(hwnd, &rect, FALSE)) return;
|
if (!GetUpdateRect(hwnd, &rect, FALSE)) return;
|
||||||
|
//GFX2_Log(GFX2_DEBUG, "Repaint rect : (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom);
|
||||||
dc = BeginPaint(hwnd, &ps);
|
dc = BeginPaint(hwnd, &ps);
|
||||||
dc2 = CreateCompatibleDC(dc);
|
dc2 = CreateCompatibleDC(dc);
|
||||||
old_bmp = (HBITMAP)SelectObject(dc2, Windows_DIB);
|
old_bmp = (HBITMAP)SelectObject(dc2, Windows_DIB);
|
||||||
BitBlt(dc, 0, 0, Windows_DIB_width, Windows_DIB_height,
|
if (!BitBlt(dc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||||
dc2, 0, 0,
|
dc2, rect.left, rect.top,
|
||||||
SRCCOPY);
|
SRCCOPY))
|
||||||
|
GFX2_Log(GFX2_INFO, "BitBlt(dc, %d, %d, %d, %d, dc2, %d, %d, SRCCOPY) FAILED\n",
|
||||||
|
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||||
|
rect.left, rect.top);
|
||||||
SelectObject(dc2, old_bmp);
|
SelectObject(dc2, old_bmp);
|
||||||
DeleteDC(dc2);
|
DeleteDC(dc2);
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// WindowProc callback function
|
||||||
static LRESULT CALLBACK Win32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK Win32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user