Seemingly fixed redraw issues with uiContainer on Windows control background painting. Now to paint uiContainer's background itself.

This commit is contained in:
Pietro Gagliardi 2015-05-05 00:16:25 -04:00
parent 2968d48d9e
commit 2d49baa2f1
1 changed files with 12 additions and 12 deletions

View File

@ -16,7 +16,6 @@ struct container {
static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
{
HWND parent;
RECT window;
RECT r;
int class;
HDC cdc;
@ -34,19 +33,9 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
break;
}
if (GetWindowRect(hwnd, &window) == 0)
if (GetWindowRect(parent, &r) == 0)
logLastError("error getting control's window rect in paintControlBackground()");
// the above is a window rect in screen coordinates; convert to parent coordinates
r = window;
SetLastError(0);
if (MapWindowRect(NULL, parent, &r) == 0) {
le = GetLastError();
SetLastError(le); // just to be safe
if (le != 0)
logLastError("error getting client origin of control in paintControlBackground()");
}
// TODO check errors
cdc = CreateCompatibleDC(dc);
bitmap = CreateCompatibleBitmap(dc, r.right - r.left, r.bottom - r.top);
@ -59,6 +48,17 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
DeleteDC(cdc);
brush = CreatePatternBrush(bitmap);
DeleteObject(bitmap);
if (GetWindowRect(hwnd, &r) == 0)
logLastError("error getting control's window rect in paintControlBackground()");
// the above is a window rect in screen coordinates; convert to parent coordinates
SetLastError(0);
if (MapWindowRect(NULL, parent, &r) == 0) {
le = GetLastError();
SetLastError(le); // just to be safe
if (le != 0)
logLastError("error getting client origin of control in paintControlBackground()");
}
SetBrushOrgEx(dc, -r.left, -r.top, NULL);
return brush;