wined3d: Explicitly pass the context to get_drawable_size().

This commit is contained in:
Henri Verbeet 2009-07-24 10:44:15 +02:00 committed by Alexandre Julliard
parent fb77678e9f
commit 2c71b85334
4 changed files with 34 additions and 31 deletions

View File

@ -4888,6 +4888,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa
UINT drawable_width, drawable_height;
IWineD3DSurfaceImpl *depth_stencil = (IWineD3DSurfaceImpl *) This->stencilBufferTarget;
IWineD3DSwapChainImpl *swapchain = NULL;
struct WineD3DContext *context;
/* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the
* drawable. After the clear we'll mark the drawable up to date, so we have to make sure that this is true
@ -4923,9 +4924,9 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa
}
}
ActivateContext(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
context = ActivateContext(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
target->get_drawable_size(target, &drawable_width, &drawable_height);
target->get_drawable_size(context, &drawable_width, &drawable_height);
ENTER_GL();
@ -7695,28 +7696,29 @@ void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) {
}
}
void get_drawable_size_pbuffer(IWineD3DSurfaceImpl *This, UINT *width, UINT *height) {
IWineD3DDeviceImpl *dev = This->resource.wineD3DDevice;
/* The drawable size of a pbuffer render target is the current pbuffer size
*/
*width = dev->pbufferWidth;
*height = dev->pbufferHeight;
void get_drawable_size_pbuffer(struct WineD3DContext *context, UINT *width, UINT *height)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->current_rt)->resource.wineD3DDevice;
/* The drawable size of a pbuffer render target is the current pbuffer size. */
*width = device->pbufferWidth;
*height = device->pbufferHeight;
}
void get_drawable_size_fbo(IWineD3DSurfaceImpl *This, UINT *width, UINT *height) {
/* The drawable size of a fbo target is the opengl texture size, which is the power of two size
*/
*width = This->pow2Width;
*height = This->pow2Height;
void get_drawable_size_fbo(struct WineD3DContext *context, UINT *width, UINT *height)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)context->current_rt;
/* The drawable size of a fbo target is the opengl texture size, which is the power of two size. */
*width = surface->pow2Width;
*height = surface->pow2Height;
}
void get_drawable_size_backbuffer(IWineD3DSurfaceImpl *This, UINT *width, UINT *height) {
IWineD3DDeviceImpl *dev = This->resource.wineD3DDevice;
void get_drawable_size_backbuffer(struct WineD3DContext *context, UINT *width, UINT *height)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)context->surface;
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
* current context's drawable, which is the size of the back buffer of the swapchain
* the active context belongs to. The back buffer of the swapchain is stored as the
* surface the context belongs to.
*/
*width = ((IWineD3DSurfaceImpl *) dev->activeContext->surface)->currentDesc.Width;
*height = ((IWineD3DSurfaceImpl *) dev->activeContext->surface)->currentDesc.Height;
* surface the context belongs to. */
*width = surface->currentDesc.Width;
*height = surface->currentDesc.Height;
}

View File

@ -4532,7 +4532,7 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, W
stateblock->viewport.Width, stateblock->viewport.Height);
} else {
target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
target->get_drawable_size(target, &width, &height);
target->get_drawable_size(context, &width, &height);
glViewport(stateblock->viewport.X,
(height - (stateblock->viewport.Y + stateblock->viewport.Height)),
@ -4674,7 +4674,7 @@ static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
UINT width;
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
target->get_drawable_size(target, &width, &height);
target->get_drawable_size(context, &width, &height);
/* Warning: glScissor uses window coordinates, not viewport coordinates, so our viewport correction does not apply
* Warning2: Even in windowed mode the coords are relative to the window, not the screen
*/

View File

@ -402,10 +402,11 @@ WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *
return ctx;
}
void get_drawable_size_swapchain(IWineD3DSurfaceImpl *This, UINT *width, UINT *height) {
void get_drawable_size_swapchain(struct WineD3DContext *context, UINT *width, UINT *height)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)context->surface;
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window size)
*/
*width = This->currentDesc.Width;
*height = This->currentDesc.Height;
* (Actually: The window size, but the surface is created in window size) */
*width = surface->currentDesc.Width;
*height = surface->currentDesc.Height;
}

View File

@ -1957,7 +1957,7 @@ struct IWineD3DSurfaceImpl
UINT pow2Height;
/* A method to retrieve the drawable size. Not in the Vtable to make it changeable */
void (*get_drawable_size)(IWineD3DSurfaceImpl *This, UINT *width, UINT *height);
void (*get_drawable_size)(struct WineD3DContext *context, UINT *width, UINT *height);
/* Oversized texture */
RECT glRect;
@ -2051,10 +2051,10 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
void WINAPI IWineD3DBaseSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb);
const void *WINAPI IWineD3DBaseSurfaceImpl_GetData(IWineD3DSurface *iface);
void get_drawable_size_swapchain(IWineD3DSurfaceImpl *This, UINT *width, UINT *height);
void get_drawable_size_backbuffer(IWineD3DSurfaceImpl *This, UINT *width, UINT *height);
void get_drawable_size_pbuffer(IWineD3DSurfaceImpl *This, UINT *width, UINT *height);
void get_drawable_size_fbo(IWineD3DSurfaceImpl *This, UINT *width, UINT *height);
void get_drawable_size_swapchain(struct WineD3DContext *context, UINT *width, UINT *height);
void get_drawable_size_backbuffer(struct WineD3DContext *context, UINT *width, UINT *height);
void get_drawable_size_pbuffer(struct WineD3DContext *context, UINT *width, UINT *height);
void get_drawable_size_fbo(struct WineD3DContext *context, UINT *width, UINT *height);
void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back);