diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 07:04:27 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 07:04:27 +0300 |
commit | facc3abb7faafb323cb87e26ddba8dac01af02e9 (patch) | |
tree | 387aa23e03b029f516ecca6880131fd6523e1c3f /src/ui/paint.c | |
parent | ced855c338b78e05c66d38618373728ef946ebaa (diff) | |
parent | 5d517c2f790a38d7fe3c3cc59a1b39fd49e20280 (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.c | 17 |
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 | ||
64 | void setClip_Paint(iPaint *d, iRect rect) { | 64 | void 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 | ||
78 | void unsetClip_Paint(iPaint *d) { | 72 | void 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 |