summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-09-24 13:51:31 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-09-24 13:51:31 +0000
commit0fc148affc222dd1108b6f1fc8ad2757f1fdc4f1 (patch)
tree33b69152db75b17dbbf477e7b1dabd0893b2336d /src
parent7ca971f04907031b80ffbcb159e5af2f595e3af8 (diff)
downloadmana-client-0fc148affc222dd1108b6f1fc8ad2757f1fdc4f1.tar.gz
mana-client-0fc148affc222dd1108b6f1fc8ad2757f1fdc4f1.tar.bz2
mana-client-0fc148affc222dd1108b6f1fc8ad2757f1fdc4f1.tar.xz
mana-client-0fc148affc222dd1108b6f1fc8ad2757f1fdc4f1.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/openglgraphics.cpp11
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;
}