Add Zoom/Expand icon
[ardour.git] / libs / canvas / framed_curve.cc
index 7808f4e226ef44538d9833604d4842dfb6ca1da8..d8ba2e92c0b7f085d584bd9e92282c411f1add1c 100644 (file)
@@ -85,8 +85,14 @@ FramedCurve::interpolate ()
        }
        samples.clear ();
 
-       InterpolatedCurve::interpolate (curve_points, points_per_segment, CatmullRomCentripetal, false, samples);
-       n_samples = samples.size();
+       if (_points.size() == 3) {
+               samples.push_back (curve_points.front());
+               samples.push_back (curve_points.back());
+               n_samples = 2;
+       } else {
+               InterpolatedCurve::interpolate (curve_points, points_per_segment, CatmullRomCentripetal, false, samples);
+               n_samples = samples.size();
+       }
 }
 
 void
@@ -188,16 +194,15 @@ FramedCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) c
                        case Outside:
                                context->stroke_preserve ();
                                window_space = item_to_window (Duple(_points.back().x, 0.0));
-                               context->line_to (window_space.x, window_space.y);
+                               context->line_to (last_point.x, window_space.y);
                                window_space = item_to_window (Duple(_points.front().x, 0.0));
-                               context->line_to (window_space.x, window_space.y);
+                               context->line_to (first_point.x, window_space.y);
                                context->close_path();
                                setup_fill_context(context);
                                context->fill ();
                                break;
                }
        } else {
-
                /* curve of at least 3 points */
 
                /* find left and right-most sample */