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.
This commit is contained in:
Patric Stout
2021-02-20 11:08:20 +01:00
committed by Patric Stout
parent 761efbb457
commit 790fa7102e
11 changed files with 58 additions and 23 deletions

View File

@@ -147,7 +147,7 @@ static void CheckPaletteAnim()
}
}
static void DrawSurfaceToScreen()
void VideoDriver_SDL::Paint()
{
PerformanceMeasurer framerate(PFE_VIDEO);
@@ -173,7 +173,7 @@ static void DrawSurfaceToScreen()
}
}
static void DrawSurfaceToScreenThread()
void VideoDriver_SDL::PaintThread()
{
/* First tell the main thread we're started */
std::unique_lock<std::recursive_mutex> lock(*_draw_mutex);
@@ -185,11 +185,16 @@ static void DrawSurfaceToScreenThread()
while (_draw_continue) {
CheckPaletteAnim();
/* Then just draw and wait till we stop */
DrawSurfaceToScreen();
this->Paint();
_draw_signal->wait(lock);
}
}
/* static */ void VideoDriver_SDL::PaintThreadThunk(VideoDriver_SDL *drv)
{
drv->PaintThread();
}
static const Dimension _default_resolutions[] = {
{ 640, 480},
{ 800, 600},
@@ -717,7 +722,7 @@ void VideoDriver_SDL::MainLoop()
_draw_signal = new std::condition_variable_any();
_draw_continue = true;
_draw_threaded = StartNewThread(&draw_thread, "ottd:draw-sdl", &DrawSurfaceToScreenThread);
_draw_threaded = StartNewThread(&draw_thread, "ottd:draw-sdl", &VideoDriver_SDL::PaintThreadThunk, this);
/* Free the mutex if we won't be able to use it. */
if (!_draw_threaded) {
@@ -782,7 +787,7 @@ void VideoDriver_SDL::MainLoop()
_draw_signal->notify_one();
} else {
CheckPaletteAnim();
DrawSurfaceToScreen();
this->Paint();
}
}