summaryrefslogtreecommitdiff
path: root/src/video/sdl_v.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-02-20 11:08:20 +0100
committerPatric Stout <github@truebrain.nl>2021-02-20 17:08:44 +0100
commit790fa7102ec934544b427dd5fa9fc4f7099fd4da (patch)
tree7eeb947fad5f31e517e23d0e9d44693f510889f7 /src/video/sdl_v.cpp
parent761efbb4571397fe9e5f19049ca64663e12cbc1e (diff)
downloadopenttd-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/sdl_v.cpp')
-rw-r--r--src/video/sdl_v.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 8190dc4d6..0aa216df2 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -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();
}
}