From 84e89498601c0ed65f4e72ba04175f84ec3507f1 Mon Sep 17 00:00:00 2001 From: marco candrian Date: Thu, 17 Apr 2008 17:30:10 +0200 Subject: [PATCH] [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 --- common/draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/draw.c b/common/draw.c index bc2342b64..01997f4d5 100644 --- a/common/draw.c +++ b/common/draw.c @@ -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); } }