Black cockpit canvas + flicker-free pane painting
SS_BLACKRECT paints the system window-frame color - gray on modern Windows - so the viewscreen child is now a plain STATIC subclassed to erase true black. The MFD/map panes flickered because Paint() cleared the on-screen surface before redrawing at the fill cadence; the pane now composes off screen and lands in a single BitBlt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+27
-1
@@ -3801,6 +3801,26 @@ void
|
||||
//########################################################################
|
||||
//############################ SVGA640x480x16 ############################
|
||||
//########################################################################
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Single-window cockpit: the viewscreen child erases true black
|
||||
// (SS_BLACKRECT paints the system window-frame gray on modern Windows).
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
static WNDPROC gViewscreenBaseProc = NULL;
|
||||
|
||||
static LRESULT CALLBACK
|
||||
ViewscreenBlackProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (message == WM_ERASEBKGND)
|
||||
{
|
||||
RECT client;
|
||||
GetClientRect(hwnd, &client);
|
||||
FillRect((HDC) wParam, &client, (HBRUSH) GetStockObject(BLACK_BRUSH));
|
||||
return 1;
|
||||
}
|
||||
return CallWindowProcA(gViewscreenBaseProc, hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
SVGA16::SVGA16(
|
||||
int mode,
|
||||
int init_width,
|
||||
@@ -3916,14 +3936,20 @@ SVGA16::SVGA16(
|
||||
|
||||
if (cockpit != NULL)
|
||||
{
|
||||
// plain STATIC (SS_BLACKRECT actually paints the system
|
||||
// window-frame GRAY on modern Windows), subclassed below to
|
||||
// erase true black
|
||||
cockpitViewscreen = CreateWindowExA(
|
||||
0, "STATIC", "",
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_BLACKRECT,
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
|
||||
0, 0,
|
||||
view_w, view_h,
|
||||
cockpit, NULL, GetModuleHandleA(NULL), NULL);
|
||||
if (cockpitViewscreen != NULL)
|
||||
{
|
||||
gViewscreenBaseProc = (WNDPROC) SetWindowLongPtrA(
|
||||
cockpitViewscreen, GWLP_WNDPROC,
|
||||
(LONG_PTR) ViewscreenBlackProc);
|
||||
gMainPresentWindow = cockpitViewscreen;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user