From f722fb1155cb3d198c450a68d7db82a0bf6318bf Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Thu, 11 Jun 2020 14:37:45 +0200 Subject: concerted effort to reduce unneccessary redraws on transparent backgrounds --- alf/alflayout.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'alf/alflayout.cpp') diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp index ba2854b..38e69a2 100644 --- a/alf/alflayout.cpp +++ b/alf/alflayout.cpp @@ -104,6 +104,7 @@ ALF_Layout_ForwardFontToControl(ALFLayout *layout, HWND window, ALFControlPriv * switch (control->flags & ALF_LAYOUT_SIZETYPE_MASK) { case ALF_LAYOUT_SIZE_EDIT: case ALF_LAYOUT_SIZE_CHECKBOX: + case ALF_LAYOUT_SIZE_PUSHBUTTON: ALF_Layout_Invalidate(layout, window); break; default: @@ -627,12 +628,12 @@ ALF_Layout_Apply(ALFLayout* layout, HWND window) if (!ALF_Compat_Is40()) flags |= SWP_NOCOPYBITS; + RECT oldR; + GetWindowRect(c->hwnd, &oldR); + MapWindowRect(NULL, window, &oldR); + // transparent background: invalidate if control moved if (layout->bgcolor == ALF_COLOR_TRANSPARENT) { - RECT oldR; - GetWindowRect(c->hwnd, &oldR); - MapWindowRect(NULL, window, &oldR); - if (oldR.left != r.left || oldR.top != r.top) { if (c->flags & ALF_LAYOUT_SENDBGCHANGE) { ALF_InvalidateBackground(c->hwnd); @@ -643,10 +644,12 @@ ALF_Layout_Apply(ALFLayout* layout, HWND window) } } - hdwp = DeferWindowPos(hdwp, - c->hwnd, 0, - r.left, r.top, r.right - r.left, r.bottom - r.top, - flags); + if (!EqualRect(&r, &oldR)) { + hdwp = DeferWindowPos(hdwp, + c->hwnd, 0, + r.left, r.top, r.right - r.left, r.bottom - r.top, + flags); + } } } -- cgit v1.2.3