mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Codechange: [Win32] simplify when/where GdiFlush() is called
This commit is contained in:
parent
ec1dd0bf61
commit
23d6f4eac9
@ -1211,6 +1211,9 @@ void VideoDriver_Win32::MainLoop()
|
|||||||
}
|
}
|
||||||
if (_exit_game) break;
|
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();
|
cur_ticks = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
/* If more than a millisecond has passed, increase the _realtime_tick. */
|
/* 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;
|
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 game loop is the part that can run asynchronously.
|
||||||
* The rest except sleeping can't. */
|
* The rest except sleeping can't. */
|
||||||
this->UnlockVideoBuffer();
|
this->UnlockVideoBuffer();
|
||||||
@ -1247,9 +1247,6 @@ void VideoDriver_Win32::MainLoop()
|
|||||||
|
|
||||||
if (_force_full_redraw) MarkWholeScreenDirty();
|
if (_force_full_redraw) MarkWholeScreenDirty();
|
||||||
|
|
||||||
/* Flush GDI buffer to ensure we don't conflict with the drawing thread. */
|
|
||||||
GdiFlush();
|
|
||||||
|
|
||||||
this->InputLoop();
|
this->InputLoop();
|
||||||
::InputLoop();
|
::InputLoop();
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
@ -1269,9 +1266,6 @@ void VideoDriver_Win32::MainLoop()
|
|||||||
auto now = std::chrono::steady_clock::now();
|
auto now = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
if (next_tick > now) {
|
if (next_tick > now) {
|
||||||
/* Flush GDI buffer to ensure we don't conflict with the drawing thread. */
|
|
||||||
GdiFlush();
|
|
||||||
|
|
||||||
this->UnlockVideoBuffer();
|
this->UnlockVideoBuffer();
|
||||||
std::this_thread::sleep_for(next_tick - now);
|
std::this_thread::sleep_for(next_tick - now);
|
||||||
this->LockVideoBuffer();
|
this->LockVideoBuffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user