diff options
-rw-r--r-- | src/openglgraphics.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
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; } |