[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:
marco candrian 2008-04-17 17:30:10 +02:00 committed by Julien Danjou
parent 66d24bb191
commit 84e8949860
1 changed files with 3 additions and 3 deletions

View File

@ -328,7 +328,7 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect,
return pat; return pat;
} }
/** Draw rectangle /** Draw rectangle inside the coordinates
* \param ctx Draw context * \param ctx Draw context
* \param geometry geometry * \param geometry geometry
* \param line_width line width * \param line_width line width
@ -354,8 +354,8 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, float line_width, Bool filled, XCo
} }
else else
{ {
cairo_rectangle(ctx->cr, geometry.x + 1, geometry.y, cairo_rectangle(ctx->cr, geometry.x + line_width / 2.0, geometry.y + line_width / 2.0,
geometry.width - 1, geometry.height - 1); geometry.width - line_width, geometry.height - line_width);
cairo_stroke(ctx->cr); cairo_stroke(ctx->cr);
} }
} }