- fixed F2DDrawer::SetClipRect.

This commit is contained in:
Christoph Oelckers 2022-10-20 16:44:05 +02:00
parent 54e0201204
commit 936e89e3d4

View file

@ -393,10 +393,14 @@ DEFINE_ACTION_FUNCTION(FCanvas, DrawShapeFill)
void F2DDrawer::SetClipRect(int x, int y, int w, int h) void F2DDrawer::SetClipRect(int x, int y, int w, int h)
{ {
clipleft = clamp(x, 0, GetWidth()); if (x < 0) { w += x; x = 0; }
clipwidth = clamp(w, -1, GetWidth() - x); if (y < 0) { h += y; y = 0; }
cliptop = clamp(y, 0, GetHeight()); if (x >= GetWidth()) { x = GetWidth(); w = 0; }
clipheight = clamp(h, -1, GetHeight() - y); if (y >= GetHeight()) { x = GetHeight(); h = 0; }
clipleft = x;
clipwidth = w;
cliptop = y;
clipheight = h;
} }
DEFINE_ACTION_FUNCTION(_Screen, SetClipRect) DEFINE_ACTION_FUNCTION(_Screen, SetClipRect)