From 2af135d7165298b6a159b4b6314260c48bae5221 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 13 Oct 2023 01:36:57 +0300 Subject: [PATCH] gg: fix the alignment of the bottom border of draw_rounded_rect_empty on macos and linux --- vlib/gg/draw.c.v | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vlib/gg/draw.c.v b/vlib/gg/draw.c.v index b1488961cd11a2..aace662ea2cf58 100644 --- a/vlib/gg/draw.c.v +++ b/vlib/gg/draw.c.v @@ -343,8 +343,11 @@ pub fn (ctx &Context) draw_rounded_rect_empty(x f32, y f32, w f32, h f32, radius sgl.v2f(rtx + r, rty) sgl.v2f(rtx + r, rby) // bottom - sgl.v2f(lbx, lby + r - 1) - sgl.v2f(rbx, rby + r - 1) + // Note: test on native windows, macos, and linux if you need to change the offset literal here, + // with `v run vlib/gg/testdata/draw_rounded_rect_empty.vv` . Using 1 here, looks good on windows, + // and on linux with LIBGL_ALWAYS_SOFTWARE=true, but misaligned on native macos and linux. + sgl.v2f(lbx, lby + r - 0.5) + sgl.v2f(rbx, rby + r - 0.5) // left sgl.v2f(sx + 1, lty) sgl.v2f(sx + 1, lby)