+
+ setup_outline_context (context);
+
+ if (_points.size() == 2) {
+
+ /* straight line */
+
+ Duple window_space;
+
+ window_space = item_to_window (_points.front());
+ context->move_to (window_space.x, window_space.y);
+ window_space = item_to_window (_points.back());
+ context->line_to (window_space.x, window_space.y);
+
+
+ switch (curve_fill) {
+ case None:
+ context->stroke();
+ break;
+ case Inside:
+ context->stroke_preserve ();
+ window_space = item_to_window (Duple(_points.back().x, draw.height()));
+ context->line_to (window_space.x, window_space.y);
+ window_space = item_to_window (Duple(_points.front().x, draw.height()));
+ context->line_to (window_space.x, window_space.y);
+ context->close_path();
+ setup_fill_context(context);
+ context->fill ();
+ break;
+ 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);
+ window_space = item_to_window (Duple(_points.front().x, 0.0));
+ context->line_to (window_space.x, window_space.y);
+ context->close_path();
+ setup_fill_context(context);
+ context->fill ();
+ break;
+ }
+
+ } else {
+
+ /* curve of at least 3 points */
+
+ /* x-axis limits of the curve, in window space coordinates */
+
+ Duple w1 = item_to_window (Duple (_points.front().x, 0.0));
+ Duple w2 = item_to_window (Duple (_points.back().x, 0.0));
+
+ /* clamp actual draw to area bound by points, rather than our bounding box which is slightly different */
+
+ context->save ();
+ context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
+ context->clip ();
+
+ /* expand drawing area by several pixels on each side to avoid cairo stroking effects at the boundary.
+ they will still occur, but cairo's clipping will hide them.
+ */
+
+ draw = draw.expand (4.0);
+
+ /* now clip it to the actual points in the curve */