From f1e28849822fb9acc6a63e175443e9bd1fd11c04 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 27 Nov 2020 09:26:20 +0200 Subject: Paint: Negative clipping rectangle position --- src/ui/paint.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ui') diff --git a/src/ui/paint.c b/src/ui/paint.c index 9c6711f1..1ac12a66 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c @@ -62,6 +62,11 @@ void endTarget_Paint(iPaint *d) { } void setClip_Paint(iPaint *d, iRect rect) { + if (rect.pos.y < 0) { + const int off = rect.pos.y; + rect.pos.y -= off; + rect.size.y = iMax(0, rect.size.y + off); + } SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); } -- cgit v1.2.3