From 0fc148affc222dd1108b6f1fc8ad2757f1fdc4f1 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 24 Sep 2005 13:51:31 +0000 Subject: Fix compile error and memory leak as by Nayr's patch. Verified to work on Windows, still needs to be tested by Mac (maybe needs the byte mask stuff) and I would like the code to be verified again, too. --- src/openglgraphics.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/openglgraphics.cpp') diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 072999d8..27eefc6e 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -156,13 +156,14 @@ SDL_Surface* OpenGLGraphics::getScreenshot() for (int i = 0; i < h; i++) { - memcpy(data + 3 * w * i, surface->pixels + 3 * w * (h - i), 3 * w); + memcpy((GLubyte*)data + 3 * w * i, + (GLubyte*)surface->pixels + 3 * w * (h - i), + 3 * w); } - surface->pixels = data; - - //SDL_FreeSurface(surface); - //free(data); + memcpy(surface->pixels, data, w * h * 3); + free(data); + return surface; } -- cgit v1.2.3-70-g09d2