Switched from using SaveDC()/RestoreDC() to just calling SetWindowOrgEx() again in the WM_CTLCOLOR** shared handler. Doesn't fix performance the way I was hoping it would, but still better.
This commit is contained in:
parent
c89c59dea5
commit
1e7fcd818c
|
@ -98,8 +98,7 @@ void paintControlBackground(HWND hwnd, HDC dc)
|
||||||
{
|
{
|
||||||
HWND parent;
|
HWND parent;
|
||||||
RECT r;
|
RECT r;
|
||||||
POINT p;
|
POINT p, pOrig;
|
||||||
int saved;
|
|
||||||
WCHAR classname[128] = L""; // more than enough to avoid collisions
|
WCHAR classname[128] = L""; // more than enough to avoid collisions
|
||||||
|
|
||||||
parent = hwnd;
|
parent = hwnd;
|
||||||
|
@ -123,12 +122,9 @@ void paintControlBackground(HWND hwnd, HDC dc)
|
||||||
p.y = r.top;
|
p.y = r.top;
|
||||||
if (ScreenToClient(parent, &p) == 0)
|
if (ScreenToClient(parent, &p) == 0)
|
||||||
xpanic("error getting client origin of control in paintControlBackground()", GetLastError());
|
xpanic("error getting client origin of control in paintControlBackground()", GetLastError());
|
||||||
saved = SaveDC(dc);
|
if (SetWindowOrgEx(dc, p.x, p.y, &pOrig) == 0)
|
||||||
if (saved == 0)
|
|
||||||
xpanic("error saving DC info in paintControlBackground()", GetLastError());
|
|
||||||
if (SetWindowOrgEx(dc, p.x, p.y, NULL) == 0)
|
|
||||||
xpanic("error moving window origin in paintControlBackground()", GetLastError());
|
xpanic("error moving window origin in paintControlBackground()", GetLastError());
|
||||||
SendMessageW(parent, WM_PRINTCLIENT, (WPARAM) dc, PRF_CLIENT);
|
SendMessageW(parent, WM_PRINTCLIENT, (WPARAM) dc, PRF_CLIENT);
|
||||||
if (RestoreDC(dc, saved) == 0)
|
if (SetWindowOrgEx(dc, pOrig.x, pOrig.y, NULL) == 0)
|
||||||
xpanic("error restoring DC info in paintControlBackground()", GetLastError());
|
xpanic("error resetting window origin in paintControlBackground()", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue