From a8614c89ddb5999e895a9ecdcbbf8af0ef96a000 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 13 Jan 2020 19:50:25 +0100 Subject: [PATCH] Fix incorrect pitch size when creating savepic --- source/common/rendering/gl/renderer/gl_renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/rendering/gl/renderer/gl_renderer.cpp b/source/common/rendering/gl/renderer/gl_renderer.cpp index 79402cbec..9dc164d50 100644 --- a/source/common/rendering/gl/renderer/gl_renderer.cpp +++ b/source/common/rendering/gl/renderer/gl_renderer.cpp @@ -238,7 +238,7 @@ void FGLRenderer::WriteSavePic ( FileWriter *file, int width, int height) int numpixels = width * height; uint8_t* scr = (uint8_t*)Xmalloc(numpixels * 3); glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, scr); - M_CreatePNG(file, scr + ((height - 1) * width), nullptr, SS_RGB, width, height, -width, vid_gamma); + M_CreatePNG(file, scr + ((height - 1) * width * 3), nullptr, SS_RGB, width, height, -width * 3, vid_gamma); Xfree(scr); }