diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-12 15:14:19 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-12 15:14:19 -0500 |
commit | 20d7c58b83fde884c03d78220dc8b0dbd7bd2901 (patch) | |
tree | 92897e8f07179c12d7369ff3fcc6b83fdf9bae3a /gtk2_ardour/tempo_lines.cc | |
parent | 937cb4fd2b0c5e9e8e4d883f31f7c4dd2bb2ac08 (diff) |
make measure line positioning use Editor::sample_to_pixel() and avoid extra 0.5 pixel shift
Diffstat (limited to 'gtk2_ardour/tempo_lines.cc')
-rw-r--r-- | gtk2_ardour/tempo_lines.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 083b7a5cca..828a4cc82b 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -17,11 +17,15 @@ */ +#include "pbd/compose.h" + #include "canvas/line.h" #include "canvas/canvas.h" #include "canvas/debug.h" + #include "tempo_lines.h" #include "ardour_ui.h" +#include "public_editor.h" using namespace std; @@ -58,8 +62,7 @@ TempoLines::hide () void TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, - const ARDOUR::TempoMap::BBTPointList::const_iterator& end, - double samples_per_pixel) + const ARDOUR::TempoMap::BBTPointList::const_iterator& end) { ARDOUR::TempoMap::BBTPointList::const_iterator i; ArdourCanvas::Rect const visible = _canvas.visible_area (); @@ -97,7 +100,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, color = ARDOUR_UI::config()->get_canvasvar_MeasureLineBeat(); } - ArdourCanvas::Coord xpos = rint(((framepos_t)(*i).frame) / (double)samples_per_pixel); + ArdourCanvas::Coord xpos = PublicEditor::instance().sample_to_pixel_unrounded ((*i).frame); ArdourCanvas::Line* line; @@ -107,16 +110,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, line->reparent (_group); } else { line = new ArdourCanvas::Line (_group); - CANVAS_DEBUG_NAME (line, "tempo measure line"); + CANVAS_DEBUG_NAME (line, string_compose ("tempo measure line @ %1", (*i).frame)); line->set_ignore_events (true); } - /* move to 0.5 offset to ensure single pixel lines (see Cairo - * FAQ for info on why we do this). - */ - - line->set_x0 (xpos + 0.5); - line->set_x1 (xpos + 0.5); + line->set_x0 (xpos); + line->set_x1 (xpos); line->set_y0 (0.0); line->set_y1 (_height); line->set_outline_color (color); |