summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-08-14 17:42:25 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-08-14 17:42:25 +0300
commit0df04130e8a6e3f2accdce7e51397db191fff09e (patch)
tree42368b473921a1d1aa390033ed9e9d06b9b97b1c /src
parent018aae1866421e702f113ed325ac11bcd0f80a78 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/ui/labelwidget.c14
1 files 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. */
30#include "keys.h" 30#include "keys.h"
31#include "touch.h" 31#include "touch.h"
32 32
33#include <SDL_version.h>
34
33struct Impl_LabelWidget { 35struct Impl_LabelWidget {
34 iWidget widget; 36 iWidget widget;
35 iString srcLabel; 37 iString srcLabel;
@@ -295,8 +297,16 @@ static void draw_LabelWidget_(const iLabelWidget *d) {
295 iRect frameRect = adjusted_Rect(rect, zero_I2(), init1_I2(-1)); 297 iRect frameRect = adjusted_Rect(rect, zero_I2(), init1_I2(-1));
296 if (isButton) { 298 if (isButton) {
297 iInt2 points[] = { 299 iInt2 points[] = {
298 bottomLeft_Rect(frameRect), topLeft_Rect(frameRect), topRight_Rect(frameRect), 300 bottomLeft_Rect(frameRect),
299 bottomRight_Rect(frameRect), bottomLeft_Rect(frameRect) 301 topLeft_Rect(frameRect),
302 topRight_Rect(frameRect),
303#if SDL_VERSION_ATLEAST(2, 0, 16) && defined (iPlatformApple)
304 /* A very curious regression in SDL 2.0.16 on macOS. */
305 addX_I2(bottomRight_Rect(frameRect), -1),
306#else
307 bottomRight_Rect(frameRect),
308#endif
309 bottomLeft_Rect(frameRect)
300 }; 310 };
301 drawLines_Paint(&p, points + 2, 3, frame2); 311 drawLines_Paint(&p, points + 2, 3, frame2);
302 drawLines_Paint( 312 drawLines_Paint(