1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

#178 fix blt/bltfast clipping

This commit is contained in:
FunkyFr3sh 2022-10-15 05:04:19 +02:00
parent cd5efade5d
commit fe82a8a607

View File

@ -115,12 +115,18 @@ HRESULT dds_Blt(
}
*/
if (dst_rect.right < 0)
dst_rect.right = 0;
if (dst_rect.left < 0)
{
src_rect.left += (LONG)(abs(dst_rect.left) * scale_w);
dst_rect.left = 0;
}
if (dst_rect.bottom < 0)
dst_rect.bottom = 0;
if (dst_rect.top < 0)
{
src_rect.top += (LONG)(abs(dst_rect.top) * scale_h);
@ -147,9 +153,15 @@ HRESULT dds_Blt(
if (src_surface)
{
if (src_rect.right < 0)
src_rect.right = 0;
if (src_rect.left < 0)
src_rect.left = 0;
if (src_rect.bottom < 0)
src_rect.bottom = 0;
if (src_rect.top < 0)
src_rect.top = 0;
@ -439,9 +451,15 @@ HRESULT dds_BltFast(
if (src_surface)
{
if (src_rect.right < 0)
src_rect.right = 0;
if (src_rect.left < 0)
src_rect.left = 0;
if (src_rect.bottom < 0)
src_rect.bottom = 0;
if (src_rect.top < 0)
src_rect.top = 0;
@ -463,9 +481,15 @@ HRESULT dds_BltFast(
RECT dst_rect = { dst_x, dst_y, (src_rect.right - src_rect.left) + dst_x, (src_rect.bottom - src_rect.top) + dst_y };
if (dst_rect.right < 0)
dst_rect.right = 0;
if (dst_rect.left < 0)
dst_rect.left = 0;
if (dst_rect.bottom < 0)
dst_rect.bottom = 0;
if (dst_rect.top < 0)
dst_rect.top = 0;