13
0

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
This commit is contained in:
Paul Davis 2022-08-27 12:54:43 -06:00
parent b10a99dcad
commit a1f69ee63b

View File

@ -70,12 +70,14 @@ Arc::compute_bounding_box () const
void
Arc::render (Rect const & area, Cairo::RefPtr<Cairo::Context> 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));
if (_arc_degrees != _start_degrees) {
context->arc (c.x, c.y, _radius, _start_degrees * (M_PI/180.0), _arc_degrees * (M_PI/180.0));
if (fill()) {
@ -91,6 +93,7 @@ Arc::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
setup_outline_context (context);
context->stroke ();
}
}
render_children (area, context);
}