diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-05 12:53:47 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-05 12:53:47 +0200 |
commit | 85c88aa03b3794c2b2d0ce4e3a15d38f16d28b34 (patch) | |
tree | 62c1e2f474f8518dcb75c1076859fde1bc655af9 /src/ui | |
parent | 0bb338ebbcc5173ae89de58d0a6d10535129958a (diff) |
Paint: Fixed a Metal clipping issue
After intersecting with the root rect the clipping rectangle can be empty.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/paint.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) { | |||
71 | 71 | ||
72 | void setClip_Paint(iPaint *d, iRect rect) { | 72 | void setClip_Paint(iPaint *d, iRect rect) { |
73 | addv_I2(&rect.pos, origin_Paint); | 73 | addv_I2(&rect.pos, origin_Paint); |
74 | if (isEmpty_Rect(rect)) { | ||
75 | rect = init_Rect(0, 0, 1, 1); | ||
76 | } | ||
77 | iRect targetRect = zero_Rect(); | 74 | iRect targetRect = zero_Rect(); |
78 | SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d)); | 75 | SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d)); |
79 | if (target) { | 76 | if (target) { |
@@ -83,6 +80,9 @@ void setClip_Paint(iPaint *d, iRect rect) { | |||
83 | else { | 80 | else { |
84 | rect = intersect_Rect(rect, rect_Root(get_Root())); | 81 | rect = intersect_Rect(rect, rect_Root(get_Root())); |
85 | } | 82 | } |
83 | if (isEmpty_Rect(rect)) { | ||
84 | rect = init_Rect(0, 0, 1, 1); | ||
85 | } | ||
86 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); | 86 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); |
87 | } | 87 | } |
88 | 88 | ||