diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2008-02-05 21:40:02 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2008-02-05 21:40:02 +0000 |
| commit | 51376827b6cec51f137f814a805cd657d443d341 (patch) | |
| tree | 619550c92ed9a2de57a765dabd8720205707d8d6 /src/widgets/desktop-widget.cpp | |
| parent | fixed bug with '||' (diff) | |
| download | inkscape-51376827b6cec51f137f814a805cd657d443d341.tar.gz inkscape-51376827b6cec51f137f814a805cd657d443d341.zip | |
Iron out some rounding errors in the displaying of the rulers and of guides
(bzr r4662)
Diffstat (limited to 'src/widgets/desktop-widget.cpp')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index f4d87f084..bd329e336 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1366,7 +1366,12 @@ sp_desktop_widget_update_rulers (SPDesktopWidget *dtw) void sp_desktop_widget_update_hruler (SPDesktopWidget *dtw) { - NR::Rect viewbox = dtw->canvas->getViewbox(); + /* The viewbox (in integers) must exactly match the size of SPCanvasbuf's pixel buffer. + * This is important because the former is being used for drawing the ruler, whereas + * the latter is used for drawing e.g. the grids and guides. Only when the viewbox + * coincides with the pixel buffer, everything will line up nicely. + */ + NR::IRect viewbox = dtw->canvas->getViewboxIntegers(); double const scale = dtw->desktop->current_zoom(); double s = viewbox.min()[NR::X] / scale - dtw->ruler_origin[NR::X]; @@ -1377,7 +1382,12 @@ sp_desktop_widget_update_hruler (SPDesktopWidget *dtw) void sp_desktop_widget_update_vruler (SPDesktopWidget *dtw) { - NR::Rect viewbox = dtw->canvas->getViewbox(); + /* The viewbox (in integers) must exactly match the size of SPCanvasbuf's pixel buffer. + * This is important because the former is being used for drawing the ruler, whereas + * the latter is used for drawing e.g. the grids and guides. Only when the viewbox + * coincides with the pixel buffer, everything will line up nicely. + */ + NR::IRect viewbox = dtw->canvas->getViewboxIntegers(); double const scale = dtw->desktop->current_zoom(); double s = viewbox.min()[NR::Y] / -scale - dtw->ruler_origin[NR::Y]; |
