X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fcanvas%2Fcurve.cc;h=ba6ac68df6d651730b436f4a447ee26defe23dba;hb=c4c7598adbc9e5eca5fe04a23bb7e88fc0989f34;hp=c2dd30ac163d295c1504968ff17c7f41cb2aea12;hpb=86e7d86089098347d67cf59284576414609c864c;p=ardour.git diff --git a/libs/canvas/curve.cc b/libs/canvas/curve.cc index c2dd30ac16..ba6ac68df6 100644 --- a/libs/canvas/curve.cc +++ b/libs/canvas/curve.cc @@ -27,10 +27,17 @@ using namespace ArdourCanvas; using std::min; using std::max; -Curve::Curve (Group* parent) - : Item (parent) - , PolyItem (parent) - , Fill (parent) +Curve::Curve (Canvas* c) + : PolyItem (c) + , n_samples (0) + , points_per_segment (16) + , curve_type (CatmullRomCentripetal) + , curve_fill (None) +{ +} + +Curve::Curve (Item* parent) + : PolyItem (parent) , n_samples (0) , points_per_segment (16) , curve_type (CatmullRomCentripetal) @@ -188,15 +195,9 @@ Curve::render (Rect const & area, Cairo::RefPtr context) const /* draw line between samples */ window_space = item_to_window (Duple (samples[left].x, samples[left].y)); context->move_to (window_space.x, window_space.y); - Coord last_x = round(window_space.x); - Coord last_y = round(window_space.y); for (uint32_t idx = left + 1; idx < right; ++idx) { window_space = item_to_window (Duple (samples[idx].x, samples[idx].y)); - if (last_x == round(window_space.x)) continue; - if (last_y == round(window_space.y)) continue; - last_x = round(window_space.x); - last_y = round(window_space.y); - context->line_to (last_x - .5 , last_y + .5); + context->line_to (window_space.x, window_space.y); } switch (curve_fill) { @@ -241,7 +242,7 @@ Curve::render (Rect const & area, Cairo::RefPtr context) const bool Curve::covers (Duple const & pc) const { - Duple point = canvas_to_item (pc); + Duple point = window_to_item (pc); /* O(N) N = number of points, and not accurate */