Made paintContainerBackground() in windows/container.c respect the clip rect.

This commit is contained in:
Pietro Gagliardi 2015-05-06 11:30:09 -04:00
parent 74fc1aea45
commit 047913d1a6
1 changed files with 12 additions and 11 deletions

View File

@ -67,7 +67,7 @@ static void endParentDraw(struct parentDraw *pd)
static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
{
HWND parent;
RECT parentRect, hwndScreenRect;
RECT hwndScreenRect;
struct parentDraw pd;
HBRUSH brush;
@ -90,22 +90,23 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
return brush;
}
// TODO this needs to respect clipping
static void paintContainerBackground(HWND hwnd, HDC dc, RECT *paintRect)
{
HWND parent;
RECT r;
POINT prevOrigin;
RECT paintRectParent;
struct parentDraw pd;
parent = realParent(hwnd);
parentDraw(dc, parent, &pd);
if (GetWindowRect(hwnd, &r) == 0)
logLastError("error getting window rect in paintContainerBackground()");
mapWindowRect(NULL, parent, &r);
// TODO check errors
SetWindowOrgEx(dc, r.left, r.top, &prevOrigin);
SendMessageW(parent, WM_PRINTCLIENT, (WPARAM) dc, PRF_CLIENT);
SetWindowOrgEx(dc, prevOrigin.x, prevOrigin.y, NULL);
paintRectParent = *paintRect;
mapWindowRect(hwnd, parent, &paintRectParent);
if (BitBlt(dc, paintRect->left, paintRect->top, paintRect->right - paintRect->left, paintRect->bottom - paintRect->top,
pd.cdc, paintRectParent.left, paintRectParent.top,
SRCCOPY) == 0)
logLastError("error drawing parent background over uiContainer in paintContainerBackground()");
endParentDraw(&pd);
}
// from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing and https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx