From 20f118801d8b18b0dd77ae35c8049ca5d6d9ad44 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sun, 15 Aug 2021 08:45:12 +0300

Subject: [PATCH 1/1] SDL 2.0.16 line drawing regression (OpenGL renderer)

This is not specific to macOS, but seems to affect OpenGL rendering on all platforms.


src/macos.m | 1 +

src/ui/labelwidget.c | 11 ++++++-----

src/ui/paint.c | 12 +++++++-----

src/ui/window.c | 7 +++++++

src/ui/window.h | 2 ++

5 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/macos.m b/src/macos.m

index 6bec3c12..d588fa4a 100644

--- a/src/macos.m

+++ b/src/macos.m

@@ -60,6 +60,7 @@ static NSString *currentSystemAppearance_(void) {

}

iBool shouldDefaultToMetalRenderer_MacOS(void) {

 return iFalse; /*

 const iInt2 ver = macVer_();

 return ver.x > 10 || ver.y > 13;*/

diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c

index d6cc31cb..edc36a49 100644

--- a/src/ui/labelwidget.c

+++ b/src/ui/labelwidget.c

@@ -300,14 +300,15 @@ static void draw_LabelWidget_(const iLabelWidget *d) {

             bottomLeft_Rect(frameRect),

             topLeft_Rect(frameRect),

             topRight_Rect(frameRect),

-#if SDL_VERSION_ATLEAST(2, 0, 16) && defined (iPlatformApple)

-#else

             bottomRight_Rect(frameRect),

-#endif

             bottomLeft_Rect(frameRect)

         };

+#if SDL_VERSION_ATLEAST(2, 0, 16)

+#endif

         drawLines_Paint(&p, points + 2, 3, frame2);

         drawLines_Paint(

             &p, points, !isHover && flags & d->flags.noTopFrame ? 2 : 3, frame);

diff --git a/src/ui/paint.c b/src/ui/paint.c

index 869238d5..79adb7d1 100644

--- a/src/ui/paint.c

+++ b/src/ui/paint.c

@@ -89,17 +89,19 @@ void drawRect_Paint(const iPaint *d, iRect rect, int color) {

 /* Keep the right/bottom edge visible in the window. */

 if (br.x == d->dst->size.x) br.x--;

 if (br.y == d->dst->size.y) br.y--;

     { left_Rect(rect),  top_Rect(rect) },

     { br.x,             top_Rect(rect) },

     { br.x,             br.y },

-#if SDL_VERSION_ATLEAST(2, 0, 16) && defined (iPlatformApple)

-#else

     { left_Rect(rect),  br.y },

-#endif

     { left_Rect(rect),  top_Rect(rect) }

 };

+#if SDL_VERSION_ATLEAST(2, 0, 16)

+#endif

 setColor_Paint_(d, color);

 SDL_RenderDrawLines(renderer_Paint_(d), edges, iElemCount(edges));

}

diff --git a/src/ui/window.c b/src/ui/window.c

index 6b8abb4d..86d22b1c 100644

--- a/src/ui/window.c

+++ b/src/ui/window.c

@@ -65,6 +65,8 @@ static float initialUiScale_ = 1.0f;

static float initialUiScale_ = 1.1f;

#endif

+static iBool isOpenGLRenderer_;

iDefineTypeConstructionArgs(Window, (iRect rect), rect)

/* TODO: Define menus per platform. */

@@ -446,6 +448,7 @@ void init_Window(iWindow *d, iRect rect) {

 /* Some info. */ {

     SDL_RendererInfo info;

     SDL_GetRendererInfo(d->render, &info);

     printf("[window] renderer: %s%s\n", info.name,

            info.flags & SDL_RENDERER_ACCELERATED ? " (accelerated)" : "");

#if !defined (NDEBUG)

@@ -1187,6 +1190,10 @@ iWindow *get_Window(void) {

 return theWindow_;

}

+iBool isOpenGLRenderer_Window(void) {

+}

void setKeyboardHeight_Window(iWindow *d, int height) {

 if (d->keyboardHeight != height) {

     d->keyboardHeight = height;

diff --git a/src/ui/window.h b/src/ui/window.h

index bb98dbe9..63f7e5f2 100644

--- a/src/ui/window.h

+++ b/src/ui/window.h

@@ -137,6 +137,8 @@ iRoot * findRoot_Window (const iWindow *, const iWidget *widget);

iRoot * otherRoot_Window (const iWindow *, iRoot *root);

iWindow * get_Window (void);

+iBool isOpenGLRenderer_Window (void);

#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)

SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos);

#endif

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.8/patch/2cc4f2e37a96044002986b81081c60c10fee8a35.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
60.735615 milliseconds
Gemini-to-HTML Time
2.945951 milliseconds

This content has been proxied by September (ba2dc).