Fix assertion failure when the only content is trimmed to zero length.
authorCarl Hetherington <cth@carlh.net>
Tue, 10 Nov 2015 22:45:57 +0000 (22:45 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 10 Nov 2015 22:45:57 +0000 (22:45 +0000)
src/wx/timeline_content_view.cc

index df0772be935dde20472dbffd1d7d54f7f3246850..324790f8715a4ae3e4f9a3498f92bebee030aca0 100644 (file)
@@ -126,10 +126,9 @@ TimelineContentView::do_paint (wxGraphicsContext* gc)
        wxDouble name_height;
        wxDouble name_descent;
        wxDouble name_leading;
+       gc->SetFont (gc->CreateFont (*wxNORMAL_FONT, foreground_colour ()));
        gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading);
-
        gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.track_height()));
-       gc->SetFont (gc->CreateFont (*wxNORMAL_FONT, foreground_colour ()));
        gc->DrawText (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4);
        gc->ResetClip ();
 }
@@ -154,4 +153,3 @@ TimelineContentView::content_changed (int p, bool frequent)
                _timeline.Refresh ();
        }
 }
-