From afa8e57ef28a9324c7aeab13f4becc48addacd57 Mon Sep 17 00:00:00 2001 From: msiglreith Date: Fri, 27 Nov 2015 15:20:07 +0100 Subject: [PATCH] fix rectangle calculation for reading of the backbuffer --- src/engine/client/backend_sdl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index b8cd78c49..70907d659 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -453,11 +453,11 @@ void CCommandProcessorFragment_OpenGL::Cmd_Screenshot(const CCommandBuffer::SCom GLint aViewport[4] = {0,0,0,0}; glGetIntegerv(GL_VIEWPORT, aViewport); - int x = pCommand->m_X; - int y = aViewport[3] - pCommand->m_Y; int w = pCommand->m_W == -1 ? aViewport[2] : pCommand->m_W; int h = pCommand->m_H == -1 ? aViewport[3] : pCommand->m_H; - + int x = pCommand->m_X; + int y = aViewport[3] - pCommand->m_Y - h; + // we allocate one more row to use when we are flipping the texture unsigned char *pPixelData = (unsigned char *)mem_alloc(w*(h+1)*3, 1); unsigned char *pTempRow = pPixelData+w*h*3;