Metal: inset glyph-string background fill by the box line width

Match ns_maybe_dumpglyphs_background: fill the background from
s->y + box_line_width with height s->height - 2*box_line_width instead of
the full cell height. For a boxed face (e.g. the selected tab-bar tab,
or a boxed mode-line) this leaves the box edge rows untouched, so the
relief drawn afterwards is not first overwritten with the background and
then redrawn on top. For unboxed faces box_line_width is 0, so it is
identical to the previous full-height fill (AE vs NS unchanged at 0.88%).
This commit is contained in:
Andros Fenollosa 2026-06-03 08:11:38 +02:00
parent 98720f3d1c
commit c1f9d62b27

View file

@ -1999,11 +1999,16 @@ mtl_draw_glyph_string_impl (struct glyph_string *s)
fg = face ? face->background : 0xFFFFFF; fg = face ? face->background : 0xFFFFFF;
} }
/* Background fill */ /* Background fill. Inset vertically by the box line width, exactly like the
NS backend (ns_maybe_dumpglyphs_background): for a boxed face (e.g. the
selected tab-bar tab) this leaves the box edge rows untouched so the relief
drawn afterwards is not overwritten and then redrawn. For unboxed faces
box_line_width is 0, so this is identical to filling the full height. */
if (!s->background_filled_p) if (!s->background_filled_p)
{ {
NSRect bgr = NSMakeRect (s->x, s->y, int blw = face ? max (face->box_horizontal_line_width, 0) : 0;
s->background_width, s->height); NSRect bgr = NSMakeRect (s->x, s->y + blw,
s->background_width, s->height - 2 * blw);
[fd fillRect:bgr color:bg]; [fd fillRect:bgr color:bg];
s->background_filled_p = true; s->background_filled_p = true;
} }