diff options
Diffstat (limited to 'src/wx/content_timeline.cc')
| -rw-r--r-- | src/wx/content_timeline.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/wx/content_timeline.cc b/src/wx/content_timeline.cc index bba2b433c..537877635 100644 --- a/src/wx/content_timeline.cc +++ b/src/wx/content_timeline.cc @@ -179,7 +179,9 @@ ContentTimeline::mouse_wheel_turned(wxMouseEvent& event) void ContentTimeline::update_playhead() { - Refresh(); + if (!_last_drawn_playhead || playhead_position() != *_last_drawn_playhead) { + Refresh(); + } } @@ -265,13 +267,20 @@ ContentTimeline::paint_main() gc->SetPen(*wxRED_PEN); auto path = gc->CreatePath(); - double const ph = _viewer.position().seconds() * pixels_per_second().get_value_or(0); - path.MoveToPoint(ph, 0); - path.AddLineToPoint(ph, pixels_per_track() * _tracks + 32); + _last_drawn_playhead = playhead_position(); + path.MoveToPoint(*_last_drawn_playhead, 0); + path.AddLineToPoint(*_last_drawn_playhead, pixels_per_track() * _tracks + 32); gc->StrokePath(path); } +int +ContentTimeline::playhead_position() const +{ + return std::round(_viewer.position().seconds() * pixels_per_second().get_value_or(0)); +} + + void ContentTimeline::film_change(ChangeType type, FilmProperty p) { |
