wined3d: Add a helper function for getting a valid rectangle.

This commit is contained in:
Roderick Colenbrander 2010-03-25 23:00:42 +01:00 committed by Alexandre Julliard
parent a7d3b616c4
commit 682c969e9a
1 changed files with 16 additions and 30 deletions

View File

@ -273,6 +273,19 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w,
} }
} }
static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_in, RECT *rect_out)
{
if (rect_in)
*rect_out = *rect_in;
else
{
rect_out->left = 0;
rect_out->top = 0;
rect_out->right = This->currentDesc.Width;
rect_out->bottom = This->currentDesc.Height;
}
}
/* GL locking and context activation is done by the caller */ /* GL locking and context activation is done by the caller */
static void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter) static void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter)
{ {
@ -4027,17 +4040,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
TRACE("Blt from surface %p to rendertarget %p\n", Src, This); TRACE("Blt from surface %p to rendertarget %p\n", Src, This);
if(SrcRect) { surface_get_rect(Src, SrcRect, &SourceRectangle);
SourceRectangle.left = SrcRect->left;
SourceRectangle.right = SrcRect->right;
SourceRectangle.top = SrcRect->top;
SourceRectangle.bottom = SrcRect->bottom;
} else {
SourceRectangle.left = 0;
SourceRectangle.right = Src->currentDesc.Width;
SourceRectangle.top = 0;
SourceRectangle.bottom = Src->currentDesc.Height;
}
/* When blitting from an offscreen surface to a rendertarget, the source /* When blitting from an offscreen surface to a rendertarget, the source
* surface is not required to have a palette. Our rendering / conversion * surface is not required to have a palette. Our rendering / conversion
@ -4324,17 +4327,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD
RECT SrcRect, DstRect; RECT SrcRect, DstRect;
DWORD Flags=0; DWORD Flags=0;
if(rsrc) { surface_get_rect(srcImpl, rsrc, &SrcRect);
SrcRect.left = rsrc->left;
SrcRect.top= rsrc->top;
SrcRect.bottom = rsrc->bottom;
SrcRect.right = rsrc->right;
} else {
SrcRect.left = 0;
SrcRect.top = 0;
SrcRect.right = srcImpl->currentDesc.Width;
SrcRect.bottom = srcImpl->currentDesc.Height;
}
DstRect.left = dstx; DstRect.left = dstx;
DstRect.top=dsty; DstRect.top=dsty;
@ -4755,14 +4748,7 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
struct wined3d_context *context; struct wined3d_context *context;
RECT src_rect, dst_rect; RECT src_rect, dst_rect;
if(rect_in) { surface_get_rect(This, rect_in, &src_rect);
src_rect = *rect_in;
} else {
src_rect.left = 0;
src_rect.top = 0;
src_rect.right = This->currentDesc.Width;
src_rect.bottom = This->currentDesc.Height;
}
context = context_acquire(device, (IWineD3DSurface*)This, CTXUSAGE_BLIT); context = context_acquire(device, (IWineD3DSurface*)This, CTXUSAGE_BLIT);
if (context->render_offscreen) if (context->render_offscreen)