From 790fa7102ec934544b427dd5fa9fc4f7099fd4da Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 20 Feb 2021 11:08:20 +0100 Subject: 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. --- src/video/win32_v.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/video/win32_v.cpp') 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 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(*_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(); } } -- cgit v1.2.3-54-g00ecf