From 46e8d6778772de45c02f7dd206b35c004f176746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 13 Feb 2006 13:25:21 +0100 Subject: [PATCH] wined3d: Update the glOrtho between 2 rhw draws if the viewport was changed. --- dlls/wined3d/device.c | 1 + dlls/wined3d/drawprim.c | 3 ++- dlls/wined3d/surface.c | 3 ++- dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2f6910bd89c..04a2fe839c6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2695,6 +2695,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED TRACE("Recording... not performing anything\n"); return D3D_OK; } + This->viewport_changed = TRUE; ENTER_GL(); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 13289678785..4a7468b2660 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -200,10 +200,11 @@ static BOOL primitiveInitState(IWineD3DDevice *iface, BOOL vtx_transformed, BOOL if (!useVS && vtx_transformed) { /* If the last draw was transformed as well, no need to reapply all the matrixes */ - if (!This->last_was_rhw) { + if ( (!This->last_was_rhw) || (This->viewport_changed) ) { double X, Y, height, width, minZ, maxZ; This->last_was_rhw = TRUE; + This->viewport_changed = FALSE; /* Transformed already into viewport coordinates, so we do not need transform matrices. Reset all matrices to identity and leave the default matrix in world diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 4cb1b3e6f08..766874a12bd 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -708,10 +708,11 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { /* glDrawPixels transforms the raster position as though it was a vertex - we want to draw at screen position 0,0 - Set up ortho (rhw) mode as per drawprim (and leave set - it will sort itself out due to last_was_rhw */ - if (!myDevice->last_was_rhw) { + if ( (!myDevice->last_was_rhw) || (myDevice->viewport_changed) ) { double X, Y, height, width, minZ, maxZ; myDevice->last_was_rhw = TRUE; + myDevice->viewport_changed = FALSE; /* Transformed already into viewport coordinates, so we do not need transform matrices. Reset all matrices to identity and leave the default matrix in world diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 9ba687c2d67..990c6e39a80 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -494,6 +494,7 @@ typedef struct IWineD3DDeviceImpl BOOL proj_valid; BOOL view_ident; /* true iff view matrix is identity */ BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */ + BOOL viewport_changed; /* Was the viewport changed since the last draw? */ GLenum tracking_parm; /* Which source is tracking current colour */ LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */ #define DISABLED_TRACKING 0 /* Disabled */