From 3b9dc0ddc97d1736596bdb5f17307b0e1485decc 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 a7d749960..914b1cc34 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 638b7a705..eb1adf5fb 100644 --- a/crates/epaint/src/text/text_layout.rs +++ b/crates/epaint/src/text/text_layout.rs @@ -866,7 +866,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);