wined3d: Merge source rectangle operations into a single block in IWineD3DBaseSurfaceImpl_Blt().
This commit is contained in:
parent
c48ff6c12a
commit
3884bb3bdc
|
@ -993,19 +993,46 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
||||||
FIXME("Filters not supported in software blit\n");
|
FIXME("Filters not supported in software blit\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First check for the validity of source / destination rectangles. This was
|
/* First check for the validity of source / destination rectangles.
|
||||||
* verified using a test application + by MSDN.
|
* This was verified using a test application + by MSDN. */
|
||||||
*/
|
|
||||||
if ((Src != NULL) && (SrcRect != NULL) &&
|
if (SrcRect)
|
||||||
((SrcRect->bottom > Src->currentDesc.Height)||(SrcRect->bottom < 0) ||
|
|
||||||
(SrcRect->top > Src->currentDesc.Height)||(SrcRect->top < 0) ||
|
|
||||||
(SrcRect->left > Src->currentDesc.Width) ||(SrcRect->left < 0) ||
|
|
||||||
(SrcRect->right > Src->currentDesc.Width) ||(SrcRect->right < 0) ||
|
|
||||||
(SrcRect->right < SrcRect->left) ||(SrcRect->bottom < SrcRect->top)))
|
|
||||||
{
|
{
|
||||||
WARN("Application gave us bad source rectangle for Blt.\n");
|
if (Src)
|
||||||
return WINEDDERR_INVALIDRECT;
|
{
|
||||||
|
if (SrcRect->right < SrcRect->left || SrcRect->bottom < SrcRect->top
|
||||||
|
|| SrcRect->left > Src->currentDesc.Width || SrcRect->left < 0
|
||||||
|
|| SrcRect->top > Src->currentDesc.Height || SrcRect->top < 0
|
||||||
|
|| SrcRect->right > Src->currentDesc.Width || SrcRect->right < 0
|
||||||
|
|| SrcRect->bottom > Src->currentDesc.Height || SrcRect->bottom < 0)
|
||||||
|
{
|
||||||
|
WARN("Application gave us bad source rectangle for Blt.\n");
|
||||||
|
return WINEDDERR_INVALIDRECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SrcRect->right || !SrcRect->bottom
|
||||||
|
|| SrcRect->left == (int)Src->currentDesc.Width
|
||||||
|
|| SrcRect->top == (int)Src->currentDesc.Height)
|
||||||
|
{
|
||||||
|
TRACE("Nothing to be done.\n");
|
||||||
|
return WINED3D_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xsrc = *SrcRect;
|
||||||
}
|
}
|
||||||
|
else if (Src)
|
||||||
|
{
|
||||||
|
xsrc.left = 0;
|
||||||
|
xsrc.top = 0;
|
||||||
|
xsrc.right = Src->currentDesc.Width;
|
||||||
|
xsrc.bottom = Src->currentDesc.Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(&xsrc, 0, sizeof(xsrc));
|
||||||
|
}
|
||||||
|
|
||||||
/* For the Destination rect, it can be out of bounds on the condition that a clipper
|
/* For the Destination rect, it can be out of bounds on the condition that a clipper
|
||||||
* is set for the given surface.
|
* is set for the given surface.
|
||||||
*/
|
*/
|
||||||
|
@ -1032,14 +1059,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Src && SrcRect && (SrcRect->bottom <= 0 || SrcRect->right <= 0
|
|
||||||
|| SrcRect->top >= (int)Src->currentDesc.Height
|
|
||||||
|| SrcRect->left >= (int)Src->currentDesc.Width))
|
|
||||||
{
|
|
||||||
TRACE("Nothing to be done.\n");
|
|
||||||
return WINED3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DestRect)
|
if (DestRect)
|
||||||
{
|
{
|
||||||
xdst = *DestRect;
|
xdst = *DestRect;
|
||||||
|
@ -1052,25 +1071,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|
||||||
xdst.right = This->currentDesc.Width;
|
xdst.right = This->currentDesc.Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SrcRect)
|
|
||||||
{
|
|
||||||
xsrc = *SrcRect;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Src)
|
|
||||||
{
|
|
||||||
xsrc.top = 0;
|
|
||||||
xsrc.bottom = Src->currentDesc.Height;
|
|
||||||
xsrc.left = 0;
|
|
||||||
xsrc.right = Src->currentDesc.Width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memset(&xsrc,0,sizeof(xsrc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The easy case : the source-less blits.... */
|
/* The easy case : the source-less blits.... */
|
||||||
if (Src == NULL && DestRect)
|
if (Src == NULL && DestRect)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue