1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fixed overlap detection in Blitter

Fixes graphics corruption in TalesWeaver (issue #72).
This commit is contained in:
narzoul 2020-06-21 13:42:49 +02:00
parent 2ce97329a9
commit 4ca4e5d6ca

View File

@ -516,6 +516,20 @@ namespace
srcRect.bottom += srcRect.top;
srcRect.right += srcRect.left;
LONG rowError = 0;
if (src < dst)
{
rowError = (dstRect.right - srcRect.left > static_cast<LONG>(pitch)) ? 1 : 0;
}
else
{
rowError = (srcRect.right - dstRect.left > static_cast<LONG>(pitch)) ? -1 : 0;
}
srcRect.left += rowError * pitch;
srcRect.right += rowError * pitch;
srcRect.top -= rowError;
srcRect.bottom -= rowError;
RECT r = {};
if (!IntersectRect(&r, &dstRect, &srcRect))
{