From: James Bursa Date: Sat, 28 Nov 2009 04:08:19 +0000 (-0000) Subject: Round stroke widths to nearest integer instead of down, and force to 1 if it would... X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=89b877c4ae7ded723b2eda2a35358dc4b2f55a76;p=libsvgtiny.git Round stroke widths to nearest integer instead of down, and force to 1 if it would be rounded to 0. svn path=/trunk/libsvgtiny/; revision=9707 --- diff --git a/src/svgtiny.c b/src/svgtiny.c index abc34ab..be20b20 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -1137,8 +1137,10 @@ struct svgtiny_shape *svgtiny_add_shape(struct svgtiny_parse_state *state) shape->text = 0; shape->fill = state->fill; shape->stroke = state->stroke; - shape->stroke_width = state->stroke_width * - (state->ctm.a + state->ctm.d) / 2; + shape->stroke_width = lroundf((float) state->stroke_width * + (state->ctm.a + state->ctm.d) / 2.0); + if (0 < state->stroke_width && shape->stroke_width == 0) + shape->stroke_width = 1; return shape; }