From 5ecc31885c4a1eb97a594aad70719feb3e1d0192 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 28 Mar 2025 20:24:33 +0100 Subject: [PATCH] Pre-existing bug fix: round strikethrough and underline to pixel coord --- crates/epaint/src/tessellator.rs | 4 ++-- crates/epaint/src/text/text_layout.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/epaint/src/tessellator.rs b/crates/epaint/src/tessellator.rs index 349188d0a..2b24869ae 100644 --- a/crates/epaint/src/tessellator.rs +++ b/crates/epaint/src/tessellator.rs @@ -1656,7 +1656,7 @@ impl Tessellator { if a.x == b.x { // Vertical line let mut x = a.x; - stroke.round_coord_to_pixel(self.pixels_per_point, &mut x); + stroke.round_center_to_pixel(self.pixels_per_point, &mut x); a.x = x; b.x = x; @@ -1677,7 +1677,7 @@ impl Tessellator { if a.y == b.y { // Horizontal line let mut y = a.y; - stroke.round_coord_to_pixel(self.pixels_per_point, &mut y); + stroke.round_center_to_pixel(self.pixels_per_point, &mut y); a.y = y; b.y = y; diff --git a/crates/epaint/src/text/text_layout.rs b/crates/epaint/src/text/text_layout.rs index 9c767ef73..809509258 100644 --- a/crates/epaint/src/text/text_layout.rs +++ b/crates/epaint/src/text/text_layout.rs @@ -894,7 +894,8 @@ fn add_row_hline( let mut last_right_x = f32::NAN; for glyph in &row.glyphs { - let (stroke, y) = stroke_and_y(glyph); + let (stroke, mut y) = stroke_and_y(glyph); + stroke.round_center_to_pixel(point_scale.pixels_per_point, &mut y); if stroke == Stroke::NONE { end_line(line_start.take(), last_right_x);