From d8a3a1ee93d3b6dd2235e1ac5d563240326d6d0f Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 15 Aug 2021 07:08:35 +0300 Subject: macOS: Workaround for an apparent SDL regression On macOS with SDL 2.0.16, there's a problem with the bottom right corner of a rectangle drawn as a line strip being off by one. SDL_RenderDrawLines() is behaving oddly on macOS with SDL 2.0.16. --- src/ui/paint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/paint.c b/src/ui/paint.c index c575d5fc..869238d5 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c @@ -91,9 +91,13 @@ void drawRect_Paint(const iPaint *d, iRect rect, int color) { if (br.y == d->dst->size.y) br.y--; const SDL_Point edges[] = { { left_Rect(rect), top_Rect(rect) }, - { br.x, top_Rect(rect) }, - { br.x, br.y }, + { br.x, top_Rect(rect) }, + { br.x, br.y }, +#if SDL_VERSION_ATLEAST(2, 0, 16) && defined (iPlatformApple) + { left_Rect(rect), br.y - 1 }, /* regression in SDL 2.0.16? */ +#else { left_Rect(rect), br.y }, +#endif { left_Rect(rect), top_Rect(rect) } }; setColor_Paint_(d, color); -- cgit v1.2.3