From 7995cd2d13f70e6a8819db24841095102c4ca61f Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Wed, 29 Jul 2009 00:49:12 +0000 Subject: [PATCH] Fix for latest commit : turns out Destroy() already frees the data, also add sskkiipp's offset patch for the "dump frames" git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3900 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 3392dc6153..8ac080e1a8 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -917,10 +917,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) s_criticalScreenshot.Enter(); int w = xfbSource->sourceRc.GetWidth(); int h = xfbSource->sourceRc.GetHeight(); - int t = yOffset; + u8 *data = (u8 *) malloc(3 * w * h); glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(0, t, w, h, GL_BGR, GL_UNSIGNED_BYTE, data); + glReadPixels(0, Renderer::GetTargetHeight() - h + yOffset, w, h, GL_BGR, GL_UNSIGNED_BYTE, data); if (glGetError() == GL_NO_ERROR) { if (!s_bLastFrameDumped) @@ -967,7 +967,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) int h = OpenGL_GetBackbufferHeight(); u8 *data = (u8 *) malloc(3 * w * h); glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, data); + glReadPixels(0, Renderer::GetTargetHeight() - h, w, h, GL_RGB, GL_UNSIGNED_BYTE, data); if (glGetError() == GL_NO_ERROR) { if (!s_bLastFrameDumped) { sprintf(movie_file_name, "%s/framedump.raw", FULL_FRAMES_DIR); @@ -1333,9 +1333,8 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset) a.Destroy(); #else bool result = SaveTGA(filename, W, H, data); -#endif - // Do not forget to release the data... free(data); +#endif return result; }