From 2b5cadfeb4bbc3b5d63301a643b988e9570851f0 Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Thu, 28 Jan 2010 04:30:07 +0000 Subject: [PATCH] small fix for my last commit, resizing is working again but screenshot do not work when rendering to main window, will fix in my next commit git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4977 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index b57a6c5b3f..466c5c5f44 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -238,6 +238,15 @@ void SetupDeviceObjects() // Kill off all POOL_DEFAULT device objects. void TeardownDeviceObjects() { + if(ScreenShootMEMSurface) + ScreenShootMEMSurface->Release(); + ScreenShootMEMSurface = NULL; + if(ScreenShootSurface) + ScreenShootSurface->Release(); + ScreenShootSurface = NULL; + if(ScreenShootTexture) + ScreenShootTexture->Release(); + ScreenShootTexture = NULL; D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface()); D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface()); FBManager::Destroy(); @@ -335,15 +344,6 @@ void Renderer::Shutdown() { - if(ScreenShootMEMSurface) - ScreenShootMEMSurface->Release(); - ScreenShootMEMSurface = NULL; - if(ScreenShootSurface) - ScreenShootSurface->Release(); - ScreenShootSurface = NULL; - if(ScreenShootTexture) - ScreenShootTexture->Release(); - ScreenShootTexture = NULL; TeardownDeviceObjects(); D3D::EndFrame(); D3D::Present(); @@ -412,6 +412,17 @@ void CheckForResize() Sleep(10); } + + if (EmuWindow::GetParentWnd()) + { + // Re-stretch window to parent window size again, if it has a parent window. + RECT rcParentWindow; + GetWindowRect(EmuWindow::GetParentWnd(), &rcParentWindow); + int width = rcParentWindow.right - rcParentWindow.left; + int height = rcParentWindow.bottom - rcParentWindow.top; + if (width != s_backbuffer_width || height != s_backbuffer_height) + ::MoveWindow(EmuWindow::GetWnd(), 0, 0, width, height, FALSE); + } RECT rcWindow; GetClientRect(EmuWindow::GetWnd(), &rcWindow); int client_width = rcWindow.right - rcWindow.left; @@ -588,6 +599,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface()); EFBTextureToD3DBackBuffer(sourceRc); + D3D::EndFrame(); DEBUGGER_LOG_AT((NEXT_XFB_CMD|NEXT_EFB_CMD|NEXT_FRAME), @@ -1033,7 +1045,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) g_VideoInitialize.pCopiedToXFB(false); - //TODO: Resize backbuffer if window size has changed. This code crashes, debug it. CheckForResize(); // ---------------------------------------------------------------------