stop using gkd_pango_context_get() in ArdourCanvas::Canvas and require concrete insta...
[ardour.git] / libs / canvas / xfade_curve.cc
index c8038aa227f478435ba23daaff76c275db7e13ec..e93331e7f987ce8430fb8e5af573d7a137a48e8d 100644 (file)
@@ -35,7 +35,7 @@ static const bool show_bg_fades = false;
 #else
 static const bool show_bg_fades = true;
 #endif
-       
+
 XFadeCurve::XFadeCurve (Canvas* c)
        : Item (c)
        , points_per_segment (32)
@@ -185,8 +185,8 @@ XFadeCurve::get_path(Rect const & area, Cairo::RefPtr<Cairo::Context> context, C
                        window_space = item_to_window (Duple (c.samples[idx].x, 0.0), false);
                        if (window_space.x >= area.x0) break;
                }
-               for (Points::size_type idx = c.n_samples; right > left;) {
-                       --idx;
+               for (Points::size_type idx = c.n_samples - 1; right > left;) {
+                       if (--idx <= left) break;
                        window_space = item_to_window (Duple (c.samples[idx].x, 0.0), false);
                        if (window_space.x <= area.x1) break;
                        right = idx;
@@ -287,7 +287,7 @@ XFadeCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) co
        if (IS_START || show_background_fade) {
                set_source_rgba (context, IS_START ? _outline_color : outline_shaded);
                context->set_line_width (IS_START ? 1.0 : .5);
-        
+
                context->begin_new_path ();
                context->append_path (*path_in);
                context->stroke();