From 1f49b00fa9f53e14cac5eaab834ec49fce0697d1 Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Tue, 28 Nov 2023 12:48:12 +1100 Subject: [PATCH] Another tweak to taking screenshots --- src/i_video.c | 2 +- src/i_video.h | 1 + src/v_video.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index d0d2d718ed..d0d6b3d029 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -145,6 +145,7 @@ uint32_t rmask; uint32_t gmask; uint32_t bmask; uint32_t amask; +uint32_t pixelformat; int bpp = 0; static int displaywidth; @@ -1235,7 +1236,6 @@ static void SetVideoMode(const bool createwindow, const bool output) int rendererflags = SDL_RENDERER_TARGETTEXTURE; int windowflags = (SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); int width, height; - uint32_t pixelformat; SDL_RendererInfo rendererinfo; const char *displayname = SDL_GetDisplayName((displayindex = vid_display - 1)); bool instead = false; diff --git a/src/i_video.h b/src/i_video.h index 55190f0edf..1cff1e95ef 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -147,6 +147,7 @@ extern uint32_t rmask; extern uint32_t gmask; extern uint32_t bmask; extern uint32_t amask; +extern uint32_t pixelformat; extern int bpp; extern bool usinggamecontroller; diff --git a/src/v_video.c b/src/v_video.c index 002334b92f..34dcfdfefa 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1767,7 +1767,7 @@ static bool V_SavePNG(SDL_Window *sdlwindow, SDL_Renderer *sdlrenderer, const ch if (width && height && (screenshot = SDL_CreateRGBSurface(0, (vid_widescreen ? width : height * 4 / 3), height, bpp, rmask, gmask, bmask, amask))) { - if (!SDL_RenderReadPixels(sdlrenderer, NULL, 0, screenshot->pixels, screenshot->pitch)) + if (!SDL_RenderReadPixels(sdlrenderer, NULL, pixelformat, screenshot->pixels, screenshot->pitch)) result = !IMG_SavePNG(screenshot, path); SDL_FreeSurface(screenshot);