diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2019-05-15 19:58:43 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mail@diedenrezi.nl> | 2019-05-20 16:22:27 +0000 |
| commit | 1f69fe79b70c906eab0d78450683fa417e3f5357 (patch) | |
| tree | e4cde555e4827e6ce1e6b6be359ad68e899bf7ab /src/display/canvas-grid.cpp | |
| parent | Improve reading of last LPE offset commit (diff) | |
| download | inkscape-1f69fe79b70c906eab0d78450683fa417e3f5357.tar.gz inkscape-1f69fe79b70c906eab0d78450683fa417e3f5357.zip | |
Fix the alignment of the guideline origin (and other controls), such that it is drawn at exactly the right screen pixel
Diffstat (limited to 'src/display/canvas-grid.cpp')
| -rw-r--r-- | src/display/canvas-grid.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 92faaca13..dc821fbd3 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -911,10 +911,10 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) cairo_set_line_width(buf->ct, 1.0); cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); - // Adding a 2 px margin to the buffer rectangle to avoid missing intersections (in case of rounding errors, and due to adding 0.5 below) - Geom::IntRect buf_rect_with_margin = buf->rect; - buf_rect_with_margin.expandBy(2); - + // Adding a 2 px margin to the buffer rectangle to avoid missing intersections (in case of rounding errors, and due to adding 0.5 below) + Geom::IntRect buf_rect_with_margin = buf->rect; + buf_rect_with_margin.expandBy(2); + for (unsigned dim = 0; dim < 2; ++dim) { // std::cout << "\n " << (dim==0?"Horizontal":"Vertical") << " ------------" << std::endl; @@ -964,7 +964,6 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) // If we have two intersections, grid line intersects buffer rectangle. if (x.size() == 2 ) { - // Make sure lines are always drawn in the same direction (or dashes misplaced). Geom::Line vector( x[0], x[1]); if (Geom::dot( vector.vector(), axis.vector() ) < 0.0) { @@ -973,6 +972,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) // Set up line. Need to use floor()+0.5 such that Cairo will draw us lines with a width of a single pixel, without any aliasing. // For this we need to position the lines at exactly half pixels, see https://www.cairographics.org/FAQ/#sharp_lines + // Must be consistent with the pixel alignment of the guide lines, see CanvasXYGrid::Render(), and the drawing of the rulers cairo_move_to(buf->ct, floor(x[0][Geom::X]) + 0.5, floor(x[0][Geom::Y]) + 0.5); cairo_line_to(buf->ct, floor(x[1][Geom::X]) + 0.5, floor(x[1][Geom::Y]) + 0.5); |
