summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.cpp
diff options
context:
space:
mode:
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) {