summaryrefslogtreecommitdiff
path: root/src/ui/paint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/paint.c')
-rw-r--r--src/ui/paint.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c
index faaf403d..c575d5fc 100644
--- a/src/ui/paint.c
+++ b/src/ui/paint.c
@@ -62,20 +62,19 @@ void endTarget_Paint(iPaint *d) {
62} 62}
63 63
64void setClip_Paint(iPaint *d, iRect rect) { 64void setClip_Paint(iPaint *d, iRect rect) {
65 if (rect.pos.y < 0) { 65 rect = intersect_Rect(rect, rect_Root(get_Root()));
66 const int off = rect.pos.y; 66 if (isEmpty_Rect(rect)) {
67 rect.pos.y -= off; 67 rect = init_Rect(0, 0, 1, 1);
68 rect.size.y = iMax(0, rect.size.y + off);
69 }
70 if (rect.pos.x < 0) {
71 const int off = rect.pos.x;
72 rect.pos.x -= off;
73 rect.size.x = iMax(0, rect.size.x + off);
74 } 68 }
75 SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); 69 SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect);
76} 70}
77 71
78void unsetClip_Paint(iPaint *d) { 72void unsetClip_Paint(iPaint *d) {
73 if (numRoots_Window(get_Window()) > 1) {
74 const iRect rect = rect_Root(get_Root());
75 SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect);
76 return;
77 }
79#if SDL_VERSION_ATLEAST(2, 0, 12) 78#if SDL_VERSION_ATLEAST(2, 0, 12)
80 SDL_RenderSetClipRect(renderer_Paint_(d), NULL); 79 SDL_RenderSetClipRect(renderer_Paint_(d), NULL);
81#else 80#else