13
0

editor cursors: fix position computation

The cairo 0.5 pixel offset for odd-width lines is handled by Canvas::Line and is not
needed in the EditorCursor code
This commit is contained in:
Paul Davis 2023-09-15 09:59:59 -06:00
parent 4c5c7769bb
commit aaff07f2c9

View File

@ -81,12 +81,14 @@ EditorCursor::~EditorCursor ()
void
EditorCursor::set_position (samplepos_t sample)
{
if (_current_sample != sample) { PositionChanged (sample); }
if (_current_sample != sample) {
PositionChanged (sample);
}
double const new_pos = _editor.sample_to_pixel_unrounded (sample);
const double new_pos = _editor.sample_to_pixel (sample);
if (rint(new_pos) != rint(_track_canvas_item->x ())) {
_track_canvas_item->set_x (new_pos + 0.5); //accommodate the 1/2 pixel "line" offset in cairo
if (new_pos != _track_canvas_item->x ()) {
_track_canvas_item->set_x (new_pos);
}
_current_sample = sample;