From 4c845eb2a03d1fbafab34c28a044298c7349116f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 17 Jul 2023 20:54:33 -0600 Subject: [PATCH] cairo single pixel line offset fix, part 1 --- libs/canvas/line_set.cc | 8 ++++---- libs/canvas/ruler.cc | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/canvas/line_set.cc b/libs/canvas/line_set.cc index 7999dfe8d9..84df65fa5b 100644 --- a/libs/canvas/line_set.cc +++ b/libs/canvas/line_set.cc @@ -135,12 +135,12 @@ LineSet::render (Rect const & area, Cairo::RefPtr context) const if (_orientation == Horizontal) { const double y = item_to_window (Duple (0, l.pos)).y; - context->move_to (intersection.x0, y - shift); - context->line_to (intersection.x1, y - shift); + context->move_to (intersection.x0, y + shift); + context->line_to (intersection.x1, y + shift); } else { const double x = item_to_window (Duple (l.pos, 0)).x; - context->move_to (x - shift, intersection.y0); - context->line_to (x - shift, intersection.y1); + context->move_to (x + shift, intersection.y0); + context->line_to (x + shift, intersection.y1); } context->stroke (); diff --git a/libs/canvas/ruler.cc b/libs/canvas/ruler.cc index e7cd6f4e8d..67c10fe690 100644 --- a/libs/canvas/ruler.cc +++ b/libs/canvas/ruler.cc @@ -147,8 +147,8 @@ Ruler::render (Rect const & area, Cairo::RefPtr cr) const if (_outline_width == 1.0) { /* Cairo single pixel line correction */ - cr->move_to (self.x0, self.y1-0.5); - cr->line_to (self.x1, self.y1-0.5); + cr->move_to (self.x0, self.y1+0.5); + cr->line_to (self.x1, self.y1+0.5); } else { cr->move_to (self.x0, self.y1); cr->line_to (self.x1, self.y1);