Seemingly fixed redraw issues with uiContainer on Windows control background painting. Now to paint uiContainer's background itself.
This commit is contained in:
parent
2968d48d9e
commit
2d49baa2f1
|
@ -16,7 +16,6 @@ struct container {
|
||||||
static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
|
static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
|
||||||
{
|
{
|
||||||
HWND parent;
|
HWND parent;
|
||||||
RECT window;
|
|
||||||
RECT r;
|
RECT r;
|
||||||
int class;
|
int class;
|
||||||
HDC cdc;
|
HDC cdc;
|
||||||
|
@ -34,19 +33,9 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetWindowRect(hwnd, &window) == 0)
|
if (GetWindowRect(parent, &r) == 0)
|
||||||
logLastError("error getting control's window rect in paintControlBackground()");
|
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
|
// TODO check errors
|
||||||
cdc = CreateCompatibleDC(dc);
|
cdc = CreateCompatibleDC(dc);
|
||||||
bitmap = CreateCompatibleBitmap(dc, r.right - r.left, r.bottom - r.top);
|
bitmap = CreateCompatibleBitmap(dc, r.right - r.left, r.bottom - r.top);
|
||||||
|
@ -59,6 +48,17 @@ static HBRUSH getControlBackgroundBrush(HWND hwnd, HDC dc)
|
||||||
DeleteDC(cdc);
|
DeleteDC(cdc);
|
||||||
brush = CreatePatternBrush(bitmap);
|
brush = CreatePatternBrush(bitmap);
|
||||||
DeleteObject(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);
|
SetBrushOrgEx(dc, -r.left, -r.top, NULL);
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
|
|
Loading…
Reference in New Issue