From 23d6f4eac9c85b050bf9efa8f0e94e333d969244 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 20 Feb 2021 11:22:06 +0100 Subject: Codechange: [Win32] simplify when/where GdiFlush() is called --- src/video/win32_v.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/video/win32_v.cpp') diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 2024aec18..e3728a646 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -1211,6 +1211,9 @@ void VideoDriver_Win32::MainLoop() } if (_exit_game) break; + /* Flush GDI buffer to ensure we don't conflict with the drawing thread. */ + GdiFlush(); + cur_ticks = std::chrono::steady_clock::now(); /* If more than a millisecond has passed, increase the _realtime_tick. */ @@ -1229,9 +1232,6 @@ void VideoDriver_Win32::MainLoop() if (next_game_tick < cur_ticks - ALLOWED_DRIFT * this->GetGameInterval()) next_game_tick = cur_ticks; } - /* Flush GDI buffer to ensure we don't conflict with the drawing thread. */ - GdiFlush(); - /* The game loop is the part that can run asynchronously. * The rest except sleeping can't. */ this->UnlockVideoBuffer(); @@ -1247,9 +1247,6 @@ void VideoDriver_Win32::MainLoop() if (_force_full_redraw) MarkWholeScreenDirty(); - /* Flush GDI buffer to ensure we don't conflict with the drawing thread. */ - GdiFlush(); - this->InputLoop(); ::InputLoop(); UpdateWindows(); @@ -1269,9 +1266,6 @@ void VideoDriver_Win32::MainLoop() auto now = std::chrono::steady_clock::now(); if (next_tick > now) { - /* Flush GDI buffer to ensure we don't conflict with the drawing thread. */ - GdiFlush(); - this->UnlockVideoBuffer(); std::this_thread::sleep_for(next_tick - now); this->LockVideoBuffer(); -- cgit v1.2.3-54-g00ecf