mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
update bltfast clipping
This commit is contained in:
parent
eabad7582d
commit
94ae5cf31f
@ -419,9 +419,25 @@ HRESULT dds_BltFast(
|
||||
RECT src_rect = { 0, 0, src_surface ? src_surface->width : 0, src_surface ? src_surface->height : 0 };
|
||||
|
||||
if (lpSrcRect && src_surface)
|
||||
{
|
||||
memcpy(&src_rect, lpSrcRect, sizeof(src_rect));
|
||||
|
||||
int dst_x = dwX;
|
||||
int dst_y = dwY;
|
||||
|
||||
if (dst_x < 0)
|
||||
{
|
||||
src_rect.left += abs(dst_x);
|
||||
dst_x = 0;
|
||||
}
|
||||
|
||||
if (dst_y < 0)
|
||||
{
|
||||
src_rect.top += abs(dst_y);
|
||||
dst_y = 0;
|
||||
}
|
||||
|
||||
if (src_surface)
|
||||
{
|
||||
if (src_rect.left < 0)
|
||||
src_rect.left = 0;
|
||||
|
||||
@ -441,29 +457,6 @@ HRESULT dds_BltFast(
|
||||
src_rect.top = src_rect.bottom;
|
||||
}
|
||||
|
||||
int dst_x = dwX;
|
||||
int dst_y = dwY;
|
||||
|
||||
if (dst_x < 0)
|
||||
{
|
||||
src_rect.left += abs(dst_x);
|
||||
|
||||
if (src_rect.left > src_rect.right)
|
||||
src_rect.left = src_rect.right;
|
||||
|
||||
dst_x = 0;
|
||||
}
|
||||
|
||||
if (dst_y < 0)
|
||||
{
|
||||
src_rect.top += abs(dst_y);
|
||||
|
||||
if (src_rect.top > src_rect.bottom)
|
||||
src_rect.top = src_rect.bottom;
|
||||
|
||||
dst_y = 0;
|
||||
}
|
||||
|
||||
int src_x = src_rect.left;
|
||||
int src_y = src_rect.top;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user