From 85c88aa03b3794c2b2d0ce4e3a15d38f16d28b34 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 5 Feb 2022 12:53:47 +0200 Subject: Paint: Fixed a Metal clipping issue After intersecting with the root rect the clipping rectangle can be empty. --- src/ui/paint.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/paint.c b/src/ui/paint.c index 5e66f521..67b509fb 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c @@ -71,9 +71,6 @@ void endTarget_Paint(iPaint *d) { void setClip_Paint(iPaint *d, iRect rect) { addv_I2(&rect.pos, origin_Paint); - if (isEmpty_Rect(rect)) { - rect = init_Rect(0, 0, 1, 1); - } iRect targetRect = zero_Rect(); SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d)); if (target) { @@ -83,6 +80,9 @@ void setClip_Paint(iPaint *d, iRect rect) { else { rect = intersect_Rect(rect, rect_Root(get_Root())); } + if (isEmpty_Rect(rect)) { + rect = init_Rect(0, 0, 1, 1); + } SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); } -- cgit v1.2.3