Henri Verbeet : ddraw: Implement get_window_region() on top of GetRandomRgn ().
Module: wine Branch: master Commit: 204e53e449474253af6b2d7dc267a5fa37476649 URL: http://source.winehq.org/git/wine.git/?a=commit;h=204e53e449474253af6b2d7dc2... Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Feb 3 22:00:27 2012 +0100 ddraw: Implement get_window_region() on top of GetRandomRgn(). Instead of just GetClientRect(). This fixes a regression introduced by 3e9fe3e938f26a8c831f92367a13776d165cfdf8. We also need to clip against e.g. the screen edges instead of just the client rect. --- dlls/ddraw/clipper.c | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/dlls/ddraw/clipper.c b/dlls/ddraw/clipper.c index 81e9e8b..89a3bf3 100644 --- a/dlls/ddraw/clipper.c +++ b/dlls/ddraw/clipper.c @@ -99,29 +99,38 @@ static HRESULT WINAPI ddraw_clipper_SetHWnd(IDirectDrawClipper *iface, DWORD fla static HRGN get_window_region(HWND window) { - POINT origin = {0, 0}; - RECT client_rect; + POINT origin; + HRGN rgn; + HDC dc; - if (!GetClientRect(window, &client_rect)) + if (!(dc = GetDC(window))) { - /* This can happen if the window is destroyed, for example. */ - WARN("Failed to get client rect.\n"); + WARN("Failed to get dc.\n"); return NULL; } - if (!ClientToScreen(window, &origin)) + if (!(rgn = CreateRectRgn(0, 0, 0, 0))) { - ERR("Failed to translate origin.\n"); + ERR("Failed to create region.\n"); + ReleaseDC(window, dc); return NULL; } - if (!OffsetRect(&client_rect, origin.x, origin.y)) + if (GetRandomRgn(dc, rgn, SYSRGN) != 1) { - ERR("Failed to translate client rect.\n"); + ERR("Failed to get window region.\n"); + DeleteObject(rgn); + ReleaseDC(window, dc); return NULL; } - return CreateRectRgnIndirect(&client_rect); + if (GetVersion() & 0x80000000) + { + GetDCOrgEx(dc, &origin); + OffsetRgn(rgn, origin.x, origin.y); + } + + return rgn; } /*****************************************************************************
participants (1)
-
Alexandre Julliard