diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-16 16:43:11 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | d6b67758881ba24d532d42e211a5fddcc1cdd309 (patch) | |
tree | 7fe12be86517d23cd4dbc6d4f9def52186e30d0c /src/screenshot.cpp | |
parent | 73ed748deb65f14f280b8cefebb0a6beff16a4a5 (diff) | |
download | openttd-d6b67758881ba24d532d42e211a5fddcc1cdd309.tar.xz |
Change: Lock the video buffer when drawing inside the game loop to properly account for threaded drawing.
Diffstat (limited to 'src/screenshot.cpp')
-rw-r--r-- | src/screenshot.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp index ef76b9f0e..8c64115a4 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -25,6 +25,7 @@ #include "window_func.h" #include "tile_map.h" #include "landscape.h" +#include "video/video_driver.hpp" #include "table/strings.h" @@ -881,6 +882,8 @@ void MakeScreenshotWithConfirm(ScreenshotType t) */ bool MakeScreenshot(ScreenshotType t, const char *name) { + VideoDriver::VideoBufferLocker lock; + if (t == SC_VIEWPORT) { /* First draw the dirty parts of the screen and only then change the name * of the screenshot. This way the screenshot will always show the name |