From 1482cae24d3d7a85944af401739cfe74027d3bba Mon Sep 17 00:00:00 2001 From: OV2 Date: Sat, 30 Apr 2011 01:26:42 +0200 Subject: [PATCH] Win32: set viewport on device reset, clear image before image size changes --- win32/CDirect3D.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/win32/CDirect3D.cpp b/win32/CDirect3D.cpp index 335a7d08..28a6743e 100644 --- a/win32/CDirect3D.cpp +++ b/win32/CDirect3D.cpp @@ -293,8 +293,6 @@ bool CDirect3D::Initialize(HWND hWnd) init_done = true; - SetViewport(); - ApplyDisplayChanges(); return true; @@ -730,6 +728,9 @@ void CDirect3D::Render(SSurface Src) drawSurface->UnlockRect(0); } + if(!GUI.Stretch||GUI.AspectRatio) + pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); + //if the output size of the render method changes we need to update the viewport if(afterRenderHeight != dstRect.bottom || afterRenderWidth != dstRect.right) { afterRenderHeight = dstRect.bottom; @@ -737,9 +738,6 @@ void CDirect3D::Render(SSurface Src) SetViewport(); } - if(!GUI.Stretch||GUI.AspectRatio) - pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); - pDevice->BeginScene(); pDevice->SetTexture(0, drawSurface); @@ -926,7 +924,6 @@ bool CDirect3D::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight) if(!ResetDevice()) return false; - SetViewport(); return true; } @@ -999,6 +996,9 @@ bool CDirect3D::ResetDevice() //recreate the surface CreateDrawSurface(); + + SetViewport(); + return true; } @@ -1041,7 +1041,7 @@ bool CDirect3D::SetFullscreen(bool fullscreen) //present here to get a fullscreen blank even if no rendering is done pDevice->Present(NULL,NULL,NULL,NULL); - SetupVertices(); + return true; }