From eabad7582ddbda064562d12f7f2bbc138c140cd6 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Thu, 29 Sep 2022 21:27:05 +0200 Subject: [PATCH] fix clip+stretch blts --- src/ddsurface.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ddsurface.c b/src/ddsurface.c index 47b5804..e73078e 100644 --- a/src/ddsurface.c +++ b/src/ddsurface.c @@ -116,24 +116,30 @@ HRESULT dds_Blt( if (dst_rect.left < 0) { - src_rect.left += abs(dst_rect.left); + src_rect.left += (LONG)(abs(dst_rect.left) * scale_w); dst_rect.left = 0; } if (dst_rect.top < 0) { - src_rect.top += abs(dst_rect.top); + src_rect.top += (LONG)(abs(dst_rect.top) * scale_h); dst_rect.top = 0; } if (dst_rect.right > This->width) + { + src_rect.right -= (LONG)((dst_rect.right - This->width) * scale_w); dst_rect.right = This->width; + } if (dst_rect.left > dst_rect.right) dst_rect.left = dst_rect.right; if (dst_rect.bottom > This->height) + { + src_rect.bottom -= (LONG)((dst_rect.bottom - This->height) * scale_h); dst_rect.bottom = This->height; + } if (dst_rect.top > dst_rect.bottom) dst_rect.top = dst_rect.bottom;