summaryrefslogtreecommitdiff
path: root/src/ui/paint.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-08-15 08:45:12 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-08-15 08:45:12 +0300
commit20f118801d8b18b0dd77ae35c8049ca5d6d9ad44 (patch)
treecf49f555fd6263f212568bfa61547fab4bf31e9a /src/ui/paint.c
parent6a99b9b889eb949e029506b3e85e0126edfe60d7 (diff)
SDL 2.0.16 line drawing regression (OpenGL renderer)
This is not specific to macOS, but seems to affect OpenGL rendering on all platforms.
Diffstat (limited to 'src/ui/paint.c')
-rw-r--r--src/ui/paint.c12
1 files changed, 7 insertions, 5 deletions
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) {
89 /* Keep the right/bottom edge visible in the window. */ 89 /* Keep the right/bottom edge visible in the window. */
90 if (br.x == d->dst->size.x) br.x--; 90 if (br.x == d->dst->size.x) br.x--;
91 if (br.y == d->dst->size.y) br.y--; 91 if (br.y == d->dst->size.y) br.y--;
92 const SDL_Point edges[] = { 92 SDL_Point edges[] = {
93 { left_Rect(rect), top_Rect(rect) }, 93 { left_Rect(rect), top_Rect(rect) },
94 { br.x, top_Rect(rect) }, 94 { br.x, top_Rect(rect) },
95 { br.x, br.y }, 95 { br.x, br.y },
96#if SDL_VERSION_ATLEAST(2, 0, 16) && defined (iPlatformApple)
97 { left_Rect(rect), br.y - 1 }, /* regression in SDL 2.0.16? */
98#else
99 { left_Rect(rect), br.y }, 96 { left_Rect(rect), br.y },
100#endif
101 { left_Rect(rect), top_Rect(rect) } 97 { left_Rect(rect), top_Rect(rect) }
102 }; 98 };
99#if SDL_VERSION_ATLEAST(2, 0, 16)
100 if (isOpenGLRenderer_Window()) {
101 /* A very curious regression in SDL 2.0.16. */
102 edges[3].y--;
103 }
104#endif
103 setColor_Paint_(d, color); 105 setColor_Paint_(d, color);
104 SDL_RenderDrawLines(renderer_Paint_(d), edges, iElemCount(edges)); 106 SDL_RenderDrawLines(renderer_Paint_(d), edges, iElemCount(edges));
105} 107}