Skip to content

Commit

Permalink
Another tweak to taking screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Nov 28, 2023
1 parent b2ec244 commit 1f49b00
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/i_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/v_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1f49b00

Please sign in to comment.