diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-20 11:08:20 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-02-20 17:08:44 +0100 |
commit | 790fa7102ec934544b427dd5fa9fc4f7099fd4da (patch) | |
tree | 7eeb947fad5f31e517e23d0e9d44693f510889f7 /src/video/win32_v.cpp | |
parent | 761efbb4571397fe9e5f19049ca64663e12cbc1e (diff) | |
download | openttd-790fa7102ec934544b427dd5fa9fc4f7099fd4da.tar.xz |
Codechange: be consistent in naming the paint function Paint()
Also move this function to be a class member. This to allow
further deduplicating of code in a later commit.
Diffstat (limited to 'src/video/win32_v.cpp')
-rw-r--r-- | src/video/win32_v.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index cca12c40c..8e887f0aa 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -332,7 +332,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen) } /** Do palette animation and blit to the window. */ -static void PaintWindow() +void VideoDriver_Win32::Paint() { PerformanceMeasurer framerate(PFE_VIDEO); @@ -385,7 +385,7 @@ static void PaintWindow() MemSetT(&_dirty_rect, 0); } -static void PaintWindowThread() +void VideoDriver_Win32::PaintThread() { /* First tell the main thread we're started */ std::unique_lock<std::recursive_mutex> lock(*_draw_mutex); @@ -395,7 +395,7 @@ static void PaintWindowThread() _draw_signal->wait(*_draw_mutex); while (_draw_continue) { - PaintWindow(); + this->Paint(); /* Flush GDI buffer to ensure drawing here doesn't conflict with any GDI usage in the main WndProc. */ GdiFlush(); @@ -404,6 +404,11 @@ static void PaintWindowThread() } } +/* static */ void VideoDriver_Win32::PaintThreadThunk(VideoDriver_Win32 *drv) +{ + drv->PaintThread(); +} + /** Forward key presses to the window system. */ static LRESULT HandleCharMsg(uint keycode, WChar charcode) { @@ -1176,7 +1181,7 @@ void VideoDriver_Win32::MainLoop() this->draw_lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex); _draw_continue = true; - _draw_threaded = StartNewThread(&draw_thread, "ottd:draw-win32", &PaintWindowThread); + _draw_threaded = StartNewThread(&draw_thread, "ottd:draw-win32", &VideoDriver_Win32::PaintThreadThunk, this); /* Free the mutex if we won't be able to use it. */ if (!_draw_threaded) { @@ -1254,7 +1259,7 @@ void VideoDriver_Win32::MainLoop() if (_draw_mutex != nullptr && !HasModalProgress()) { _draw_signal->notify_one(); } else { - PaintWindow(); + this->Paint(); } } |