summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-06 16:15:43 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-06 16:16:07 +0100
commit84ffd4a723fd2cfa690dc013b078ea660d1cce6b (patch)
tree6411301d088d08f9d2f743ce4feaea6db4edcd81
parentbbabaa0dba6b2106c570f92f429a759d322aba6b (diff)
downloadmana-84ffd4a723fd2cfa690dc013b078ea660d1cce6b.tar.gz
mana-84ffd4a723fd2cfa690dc013b078ea660d1cce6b.tar.bz2
mana-84ffd4a723fd2cfa690dc013b078ea660d1cce6b.tar.xz
mana-84ffd4a723fd2cfa690dc013b078ea660d1cce6b.zip
Fixed crash when taking a screenshot
Wrong format was passed to SDL_RenderReadPixels. Issue introduced in 2c51c98625b225cecfb9628c30d62d4e30f7e3e1. Closes #52
-rw-r--r--src/graphics.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 6f488cc1..02144cab 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -319,7 +319,11 @@ SDL_Surface *Graphics::getScreenshot()
SDL_Surface *screenshot = SDL_CreateRGBSurface(0, mWidth,
mHeight, 24, rmask, gmask, bmask, amask);
- SDL_RenderReadPixels(mRenderer, nullptr, SDL_PIXELFORMAT_RGB888, screenshot->pixels, screenshot->pitch);
+
+ SDL_RenderReadPixels(mRenderer, nullptr,
+ screenshot->format->format,
+ screenshot->pixels,
+ screenshot->pitch);
return screenshot;
}