13
0

cairo single pixel line offset fix, part 1

This commit is contained in:
Paul Davis 2023-07-17 20:54:33 -06:00
parent 8c479ff425
commit 4c845eb2a0
2 changed files with 6 additions and 6 deletions

View File

@ -135,12 +135,12 @@ LineSet::render (Rect const & area, Cairo::RefPtr<Cairo::Context> 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 ();

View File

@ -147,8 +147,8 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> 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);