-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Description
CDrawContext::drawEllipse seems to use incorrect scaling on linux, so that the ellipse is typically much smaller than desired.
CairoGrpahicsDeviceContext::drawEllipse() appears to have two issues:
- The inverse of the correct scaling factor is passed to cairo_scale
- imp->draw is called with scaling still enabled. This means that a stroke width of 1 will be also be scaled by the ellipse size scaling factors (interestingly causing non-uniform line width when rect width is not equal to rect height). See https://cairo.freedesktop.org/cookbook/ellipses/ for why this happens.
The following seems to work for me:
bool CairoGraphicsDeviceContext::drawEllipse (CRect rect, PlatformGraphicsDrawStyle drawStyle) const
{
impl->doInContext ([&] () {
CPoint center = rect.getCenter ();
cairo_matrix_t save_matrix;
cairo_get_matrix( impl->context, & save_matrix );
cairo_translate (impl->context, center.x, center.y);
cairo_scale( impl->context, 0.5 * rect.getWidth(), 0.5 * rect.getHeight() );
cairo_arc (impl->context, 0, 0, 1, 0, 2 * M_PI);
cairo_set_matrix( impl->context, & save_matrix );
impl->draw (drawStyle);
});
return true;
}
I'd assume that similar changes are needed for CairoGraphicsDeviceContext::drawArc().
Metadata
Metadata
Assignees
Labels
No labels