summaryrefslogtreecommitdiff
path: root/src/ui/paint.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-18 07:04:27 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-18 07:04:27 +0300
commitfacc3abb7faafb323cb87e26ddba8dac01af02e9 (patch)
tree387aa23e03b029f516ecca6880131fd6523e1c3f /src/ui/paint.c
parentced855c338b78e05c66d38618373728ef946ebaa (diff)
parent5d517c2f790a38d7fe3c3cc59a1b39fd49e20280 (diff)
Merge branch 'dev' into work/typesetter
# Conflicts: # src/ui/documentwidget.c # src/ui/inputwidget.c
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