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) static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
{ {
HWND parent; HWND parent;
RECT parentRect, hwndScreenRect; RECT hwndScreenRect;
struct parentDraw pd; struct parentDraw pd;
HBRUSH brush; HBRUSH brush;
@ -90,22 +90,23 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
return brush; return brush;
} }
// TODO this needs to respect clipping
static void paintContainerBackground(HWND hwnd, HDC dc, RECT *paintRect) static void paintContainerBackground(HWND hwnd, HDC dc, RECT *paintRect)
{ {
HWND parent; HWND parent;
RECT r; RECT paintRectParent;
POINT prevOrigin; struct parentDraw pd;
parent = realParent(hwnd); parent = realParent(hwnd);
parentDraw(dc, parent, &pd);
if (GetWindowRect(hwnd, &r) == 0) paintRectParent = *paintRect;
logLastError("error getting window rect in paintContainerBackground()"); mapWindowRect(hwnd, parent, &paintRectParent);
mapWindowRect(NULL, parent, &r); if (BitBlt(dc, paintRect->left, paintRect->top, paintRect->right - paintRect->left, paintRect->bottom - paintRect->top,
// TODO check errors pd.cdc, paintRectParent.left, paintRectParent.top,
SetWindowOrgEx(dc, r.left, r.top, &prevOrigin); SRCCOPY) == 0)
SendMessageW(parent, WM_PRINTCLIENT, (WPARAM) dc, PRF_CLIENT); logLastError("error drawing parent background over uiContainer in paintContainerBackground()");
SetWindowOrgEx(dc, prevOrigin.x, prevOrigin.y, NULL);
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 // 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