Win32: set viewport on device reset, clear image before image size changes

This commit is contained in:
OV2 2011-04-30 01:26:42 +02:00
parent 13e8c2dc34
commit 1482cae24d
1 changed files with 7 additions and 7 deletions

View File

@ -293,8 +293,6 @@ bool CDirect3D::Initialize(HWND hWnd)
init_done = true; init_done = true;
SetViewport();
ApplyDisplayChanges(); ApplyDisplayChanges();
return true; return true;
@ -730,6 +728,9 @@ void CDirect3D::Render(SSurface Src)
drawSurface->UnlockRect(0); 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 the output size of the render method changes we need to update the viewport
if(afterRenderHeight != dstRect.bottom || afterRenderWidth != dstRect.right) { if(afterRenderHeight != dstRect.bottom || afterRenderWidth != dstRect.right) {
afterRenderHeight = dstRect.bottom; afterRenderHeight = dstRect.bottom;
@ -737,9 +738,6 @@ void CDirect3D::Render(SSurface Src)
SetViewport(); SetViewport();
} }
if(!GUI.Stretch||GUI.AspectRatio)
pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
pDevice->BeginScene(); pDevice->BeginScene();
pDevice->SetTexture(0, drawSurface); pDevice->SetTexture(0, drawSurface);
@ -926,7 +924,6 @@ bool CDirect3D::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
if(!ResetDevice()) if(!ResetDevice())
return false; return false;
SetViewport();
return true; return true;
} }
@ -999,6 +996,9 @@ bool CDirect3D::ResetDevice()
//recreate the surface //recreate the surface
CreateDrawSurface(); CreateDrawSurface();
SetViewport();
return true; return true;
} }
@ -1041,7 +1041,7 @@ bool CDirect3D::SetFullscreen(bool fullscreen)
//present here to get a fullscreen blank even if no rendering is done //present here to get a fullscreen blank even if no rendering is done
pDevice->Present(NULL,NULL,NULL,NULL); pDevice->Present(NULL,NULL,NULL,NULL);
SetupVertices();
return true; return true;
} }