summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2009-11-28 04:08:19 (GMT)
committer James Bursa <james@netsurf-browser.org>2009-11-28 04:08:19 (GMT)
commit89b877c4ae7ded723b2eda2a35358dc4b2f55a76 (patch)
tree3e1729e5845efbdc4046601a67c2b038b40d74b2
parent333057876fffe46dc95c10d987fa370bc36344ec (diff)
downloadlibsvgtiny-89b877c4ae7ded723b2eda2a35358dc4b2f55a76.tar.gz
libsvgtiny-89b877c4ae7ded723b2eda2a35358dc4b2f55a76.tar.bz2
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
-rw-r--r--src/svgtiny.c6
1 files changed, 4 insertions, 2 deletions
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;
}