Module: wine Branch: master Commit: b4e596e70e912e3cc362d81d43bfead3a21b608c URL: http://source.winehq.org/git/wine.git/?a=commit;h=b4e596e70e912e3cc362d81d43...
Author: H. Verbeet hverbeet@gmail.com Date: Thu Jul 26 00:38:50 2007 +0200
wined3d: Flip the scissor rect when rendering offscreen.
---
dlls/wined3d/context.c | 2 ++ dlls/wined3d/device.c | 17 ++++++++++++----- dlls/wined3d/state.c | 7 ++++++- 3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 32791b7..1c5abd0 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -700,6 +700,7 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf Context_MarkStateDirty(context, WINED3DTS_PROJECTION); Context_MarkStateDirty(context, STATE_VDECL); Context_MarkStateDirty(context, STATE_VIEWPORT); + Context_MarkStateDirty(context, STATE_SCISSORRECT); }
} else { @@ -787,6 +788,7 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf Context_MarkStateDirty(context, WINED3DTS_PROJECTION); Context_MarkStateDirty(context, STATE_VDECL); Context_MarkStateDirty(context, STATE_VIEWPORT); + Context_MarkStateDirty(context, STATE_SCISSORRECT); } } if (readTexture) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9f6d63b..be4214e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4509,11 +4509,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun if (!curRect) { /* In drawable flag is set below */
- glScissor(This->stateBlock->viewport.X, - (((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Height - - (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)), - This->stateBlock->viewport.Width, - This->stateBlock->viewport.Height); + if (This->render_offscreen) { + glScissor(This->stateBlock->viewport.X, + This->stateBlock->viewport.Y, + This->stateBlock->viewport.Width, + This->stateBlock->viewport.Height); + } else { + glScissor(This->stateBlock->viewport.X, + (((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Height - + (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)), + This->stateBlock->viewport.Width, + This->stateBlock->viewport.Height); + } checkGLcall("glScissor"); glClear(glMask); checkGLcall("glClear"); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 3d6101d..71a6916 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3442,7 +3442,12 @@ static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D winHeight = windowRect.bottom - windowRect.top; TRACE("(%p) Setting new Scissor Rect to %d:%d-%d:%d\n", stateblock->wineD3DDevice, pRect->left, pRect->bottom - winHeight, pRect->right - pRect->left, pRect->bottom - pRect->top); - glScissor(pRect->left, winHeight - pRect->bottom, pRect->right - pRect->left, pRect->bottom - pRect->top); + + if (stateblock->wineD3DDevice->render_offscreen) { + glScissor(pRect->left, pRect->top, pRect->right - pRect->left, pRect->bottom - pRect->top); + } else { + glScissor(pRect->left, winHeight - pRect->bottom, pRect->right - pRect->left, pRect->bottom - pRect->top); + } checkGLcall("glScissor"); }