From 0df04130e8a6e3f2accdce7e51397db191fff09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Sat, 14 Aug 2021 17:42:25 +0300 Subject: [PATCH 1/1] 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. --- src/ui/labelwidget.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index a9a2d033..d6cc31cb 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c @@ -30,6 +30,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "keys.h" #include "touch.h" +#include + struct Impl_LabelWidget { iWidget widget; iString srcLabel; @@ -295,8 +297,16 @@ static void draw_LabelWidget_(const iLabelWidget *d) { iRect frameRect = adjusted_Rect(rect, zero_I2(), init1_I2(-1)); if (isButton) { iInt2 points[] = { - bottomLeft_Rect(frameRect), topLeft_Rect(frameRect), topRight_Rect(frameRect), - bottomRight_Rect(frameRect), bottomLeft_Rect(frameRect) + bottomLeft_Rect(frameRect), + topLeft_Rect(frameRect), + topRight_Rect(frameRect), +#if SDL_VERSION_ATLEAST(2, 0, 16) && defined (iPlatformApple) + /* A very curious regression in SDL 2.0.16 on macOS. */ + addX_I2(bottomRight_Rect(frameRect), -1), +#else + bottomRight_Rect(frameRect), +#endif + bottomLeft_Rect(frameRect) }; drawLines_Paint(&p, points + 2, 3, frame2); drawLines_Paint( -- 2.34.1