Implemented some changes to uiArea on Windows, thanks to instructions from Rick Brewster. Removing uiAreaHandler.RedrawOnResize() comes next.

This commit is contained in:
Pietro Gagliardi 2015-12-04 20:45:31 -05:00
parent d1c93a9956
commit c2100a19be
2 changed files with 7 additions and 4 deletions

View File

@ -589,9 +589,11 @@ static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
// see https://msdn.microsoft.com/en-us/library/windows/desktop/dd370994%28v=vs.85%29.aspx
ID2D1HwndRenderTarget_Resize(a->rt, &size);
}
if ((*(a->ah->RedrawOnResize))(a->ah, a))
if (InvalidateRect(a->hwnd, NULL, TRUE) == 0)
logLastError("error redrawing area on resize in areaWndProc()");
// according to Rick Brewster, we must always redraw the entire client area after calling ID2D1RenderTarget::Resize() (see http://stackoverflow.com/a/33222983/3408572)
// we used to have a uiAreaHandler.RedrawOnResize() method to decide this; now you know why we don't anymore
// TODO consider changing the scrolling model
if (InvalidateRect(a->hwnd, NULL, TRUE) == 0)
logLastError("error redrawing area on resize in areaWndProc()");
return 0;
case WM_HSCROLL:
hscroll(a, wParam, lParam);

View File

@ -55,7 +55,8 @@ ID2D1HwndRenderTarget *makeHWNDRenderTarget(HWND hwnd)
hprops.hwnd = hwnd;
hprops.pixelSize.width = r.right - r.left;
hprops.pixelSize.height = r.bottom - r.top;
hprops.presentOptions = D2D1_PRESENT_OPTIONS_NONE;
// according to Rick Brewster, some drivers will misbehave if we don't specify this (see http://stackoverflow.com/a/33222983/3408572)
hprops.presentOptions = D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS;
hr = ID2D1Factory_CreateHwndRenderTarget(d2dfactory,
&props,