From 0d9c038a1890ea54b60c05fd47532d00407532f3 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Thu, 22 Nov 2018 13:39:03 +0100 Subject: [PATCH] fix stretching for Genie Engine --- src/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index 60b5e93..75aa30e 100644 --- a/src/main.c +++ b/src/main.c @@ -107,23 +107,23 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam) { - ChildWindowExists = TRUE; - IDirectDrawSurfaceImpl *this = (IDirectDrawSurfaceImpl *)lParam; - HDC hDC = GetDC(hWnd); - RECT size; - GetClientRect(hWnd, &size); - RECT pos; - GetWindowRect(hWnd, &pos); - MapWindowPoints(HWND_DESKTOP, ddraw->hWnd, (LPPOINT)&pos, 2); + if (GetClientRect(hWnd, &size) && GetWindowRect(hWnd, &pos) && size.right > 1 && size.bottom > 1) + { + ChildWindowExists = TRUE; - BitBlt(hDC, 0, 0, size.right, size.bottom, this->hDC, pos.left, pos.top, SRCCOPY); + HDC hDC = GetDC(hWnd); - ReleaseDC(hWnd, hDC); + MapWindowPoints(HWND_DESKTOP, ddraw->hWnd, (LPPOINT)&pos, 2); + + BitBlt(hDC, 0, 0, size.right, size.bottom, this->hDC, pos.left, pos.top, SRCCOPY); + + ReleaseDC(hWnd, hDC); + } return FALSE; }