13
0

rulers: fix subtle off-by-one pixel error caused by double-rounding

This change also makes it more clear that we're computing window-coordinate system values
for the x-axis than the previous inaccurate version was
This commit is contained in:
Paul Davis 2023-09-15 16:46:07 -06:00
parent aaff07f2c9
commit 0a597bea66

View File

@ -167,7 +167,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
Duple pos; Duple pos;
Pango::FontDescription* fd = (m->style == Mark::Major) ? (_second_font_description ? _second_font_description : _font_description) : _font_description; Pango::FontDescription* fd = (m->style == Mark::Major) ? (_second_font_description ? _second_font_description : _font_description) : _font_description;
pos.x = round ((m->position - _lower) / _metric->units_per_pixel); pos.x = round (m->position/_metric->units_per_pixel) + self.x0;
pos.y = self.y1; /* bottom edge */ pos.y = self.y1; /* bottom edge */
if (fd != last_font_description) { if (fd != last_font_description) {