summaryrefslogtreecommitdiff
path: root/src/video/sdl2_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/sdl2_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/sdl2_v.cpp')
-rw-r--r--src/video/sdl2_v.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index 8bee575e2..1cc6c5598 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -124,7 +124,7 @@ void VideoDriver_SDL::CheckPaletteAnim()
this->MakeDirty(0, 0, _screen.width, _screen.height);
}
-static void Paint()
+void VideoDriver_SDL::Paint()
{
PerformanceMeasurer framerate(PFE_VIDEO);
@@ -161,7 +161,7 @@ static void Paint()
MemSetT(&_dirty_rect, 0);
}
-static void PaintThread()
+void VideoDriver_SDL::PaintThread()
{
/* First tell the main thread we're started */
std::unique_lock<std::recursive_mutex> lock(*_draw_mutex);
@@ -172,11 +172,16 @@ static void PaintThread()
while (_draw_continue) {
/* Then just draw and wait till we stop */
- Paint();
+ 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 },
@@ -820,7 +825,7 @@ void VideoDriver_SDL::LoopOnce()
if (_draw_mutex != nullptr && !HasModalProgress()) {
_draw_signal->notify_one();
} else {
- Paint();
+ this->Paint();
}
}
@@ -861,7 +866,7 @@ void VideoDriver_SDL::MainLoop()
_draw_signal = new std::condition_variable_any();
_draw_continue = true;
- _draw_threaded = StartNewThread(&draw_thread, "ottd:draw-sdl", &PaintThread);
+ _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) {