[draw] draw_rectangle draws stuff inside the coordinates
E.g. to get single line (or rectangle with width = 1 etc), the path should go through the center of the pixels (.5), when that path gets stroked finally, it filles the pixels fully. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
66d24bb191
commit
84e8949860
|
@ -328,7 +328,7 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect,
|
|||
return pat;
|
||||
}
|
||||
|
||||
/** Draw rectangle
|
||||
/** Draw rectangle inside the coordinates
|
||||
* \param ctx Draw context
|
||||
* \param geometry geometry
|
||||
* \param line_width line width
|
||||
|
@ -354,8 +354,8 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, float line_width, Bool filled, XCo
|
|||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle(ctx->cr, geometry.x + 1, geometry.y,
|
||||
geometry.width - 1, geometry.height - 1);
|
||||
cairo_rectangle(ctx->cr, geometry.x + line_width / 2.0, geometry.y + line_width / 2.0,
|
||||
geometry.width - line_width, geometry.height - line_width);
|
||||
cairo_stroke(ctx->cr);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue