diff -r 166725555e57 -r 2e70ef81e281 hedgewars/uRenderUtils.pas --- a/hedgewars/uRenderUtils.pas Sat Dec 03 17:45:32 2016 +0100 +++ b/hedgewars/uRenderUtils.pas Sun Dec 04 01:07:36 2016 +0100 @@ -164,8 +164,10 @@ dY:= destY - srcY; // let's figure out where the rectangle we can actually copy ends - lX:= ( min( min(srcX + srcW, src^.w), min(destX + srcW, dest^.w) - dx ) ) - 1; - lY:= ( min( min(srcY + srcH, src^.h), min(destY + srcH, dest^.h) - dY ) ) - 1; + lX:= min(srcX + srcW, src^.w) - 1; + if lX + dx >= dest^.w then lX:= dest^.w - dx - 1; + lY:= min(srcY + srcH, src^.h) - 1; + if lY + dy >= dest^.h then lY:= dest^.h - dy - 1; for iX:= srcX to lX do for iY:= srcY to lY do