From 479d1226faaa937ef6820b14f36099ef3f575883 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Sat, 18 Apr 2020 17:34:55 +0200 Subject: implement background color reduce flickering by keeping pixels if we know the background didn't change panel text is now gone, it would require us to redraw every transparent widget on top, which is a bad tradeoff since that panel text isn't very useful anyway. --- alf/alf.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'alf/alf.cpp') diff --git a/alf/alf.cpp b/alf/alf.cpp index d40522f..311c65b 100644 --- a/alf/alf.cpp +++ b/alf/alf.cpp @@ -415,3 +415,27 @@ ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) || msg == WM_CTLCOLORLISTBOX || msg == WM_CTLCOLORSCROLLBAR || msg == WM_CTLCOLORSTATIC; } + +void +ALF_FillRect(HDC dc, const RECT *rc, ALFColor color) +{ + if (color == ALF_COLOR_TRANSPARENT) + return; + + COLORREF gdicolor = ALF_ColorToGdi(color); + COLORREF oldBkColor = SetBkColor(dc, gdicolor); + ExtTextOut(dc, 0, 0, ETO_OPAQUE, rc, NULL, 0, NULL); + SetBkColor(dc, oldBkColor); +} + +COLORREF +ALF_ColorToGdi(ALFColor color) +{ + if (color == ALF_COLOR_TRANSPARENT) { + return (COLORREF)-1; + } else if (color & 0x80000000) { + return GetSysColor((color & 0x7f000000) >> 24); + } else { + return (COLORREF)color; + } +} -- cgit v1.2.3