From a1f69ee63bc01c3545c95ed2d9af58f70df235fa Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 27 Aug 2022 12:54:43 -0600 Subject: [PATCH] canvas: tweaks to Arc canvas item Cairo uses 0 degrees to mean "east", so the "top" or "north" of a circle is actually -90 degrees --- libs/canvas/arc.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libs/canvas/arc.cc b/libs/canvas/arc.cc index e08ea04c03..33f19add78 100644 --- a/libs/canvas/arc.cc +++ b/libs/canvas/arc.cc @@ -70,26 +70,29 @@ Arc::compute_bounding_box () const void Arc::render (Rect const & area, Cairo::RefPtr context) const { - if (_radius <= 0.0 || _arc_degrees <= 0.0 || (!fill() && !outline())) { + if (_radius <= 0.0 || (!fill() && !outline())) { return; } Duple c = item_to_window (Duple (_center.x, _center.y)); - context->arc (c.x, c.y, _radius, _start_degrees * (M_PI/180.0), _arc_degrees * (M_PI/180.0)); + if (_arc_degrees != _start_degrees) { - if (fill()) { - setup_fill_context (context); - if (outline()) { - context->fill_preserve (); - } else { - context->fill (); + context->arc (c.x, c.y, _radius, _start_degrees * (M_PI/180.0), _arc_degrees * (M_PI/180.0)); + + if (fill()) { + setup_fill_context (context); + if (outline()) { + context->fill_preserve (); + } else { + context->fill (); + } } - } - if (outline()) { - setup_outline_context (context); - context->stroke (); + if (outline()) { + setup_outline_context (context); + context->stroke (); + } } render_children (area, context);