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:
Pietro Gagliardi 2014-10-30 08:36:14 -04:00
parent c89c59dea5
commit 1e7fcd818c
1 changed files with 4 additions and 8 deletions

View File

@ -98,8 +98,7 @@ void paintControlBackground(HWND hwnd, HDC dc)
{
HWND parent;
RECT r;
POINT p;
int saved;
POINT p, pOrig;
WCHAR classname[128] = L""; // more than enough to avoid collisions
parent = hwnd;
@ -123,12 +122,9 @@ void paintControlBackground(HWND hwnd, HDC dc)
p.y = r.top;
if (ScreenToClient(parent, &p) == 0)
xpanic("error getting client origin of control in paintControlBackground()", GetLastError());
saved = SaveDC(dc);
if (saved == 0)
xpanic("error saving DC info in paintControlBackground()", GetLastError());
if (SetWindowOrgEx(dc, p.x, p.y, NULL) == 0)
if (SetWindowOrgEx(dc, p.x, p.y, &pOrig) == 0)
xpanic("error moving window origin in paintControlBackground()", GetLastError());
SendMessageW(parent, WM_PRINTCLIENT, (WPARAM) dc, PRF_CLIENT);
if (RestoreDC(dc, saved) == 0)
xpanic("error restoring DC info in paintControlBackground()", GetLastError());
if (SetWindowOrgEx(dc, pOrig.x, pOrig.y, NULL) == 0)
xpanic("error resetting window origin in paintControlBackground()", GetLastError());
}