diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-08 10:31:14 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-08 10:31:14 -0500 |
commit | a70edc576552cbcd51e149ac6d231618c4fa4ec7 (patch) | |
tree | 25da89e2ebf9db56c2be7b22a3698799f0fb9137 /libs/canvas | |
parent | 98dec658ee4067bdb22262640a821334ddc2ed83 (diff) |
change rounding used for convert Rect from canvas to window coordinates
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/canvas.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 313c9f7ae5..db38d2d9a1 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -195,8 +195,12 @@ Duple Canvas::canvas_to_window (Duple const & d) const { Duple wd = d.translate (Duple (-_scroll_offset_x, -_scroll_offset_y)); + + /* Note that this intentionally always returns integer coordinates */ + wd.x = round (wd.x); wd.y = round (wd.y); + return wd; } @@ -210,10 +214,14 @@ Rect Canvas::canvas_to_window (Rect const & r) const { Rect wr = r.translate (Duple (-_scroll_offset_x, -_scroll_offset_y)); - wr.x0 = floor (wr.x0); - wr.x1 = ceil (wr.x1); - wr.y0 = floor (wr.y0); - wr.y1 = ceil (wr.y1); + + /* Note that this intentionally always returns integer coordinates */ + + wr.x0 = round (wr.x0); + wr.x1 = round (wr.x1); + wr.y0 = round (wr.y0); + wr.y1 = round (wr.y1); + return wr; } |