From 70be0635bf09e67202181de17b0ed4e6bafcd9b8 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 12 Jun 2017 02:42:32 -0700 Subject: [PATCH] Make stroke_width a float --- include/svgtiny.h | 2 +- src/svgtiny.c | 3 +-- src/svgtiny_internal.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/svgtiny.h b/include/svgtiny.h index 85f146f..6acf42e 100644 --- a/include/svgtiny.h +++ b/include/svgtiny.h @@ -29,7 +29,7 @@ struct svgtiny_shape { float text_x, text_y; svgtiny_colour fill; svgtiny_colour stroke; - int stroke_width; + float stroke_width; }; struct svgtiny_diagram { diff --git a/src/svgtiny.c b/src/svgtiny.c index 8831b92..838e149 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -1698,8 +1698,7 @@ 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 = lroundf((float) state->stroke_width * - (state->ctm.a + state->ctm.d) / 2.0); + shape->stroke_width = state->stroke_width * (state->ctm.a + state->ctm.d) / 2.0; if (0 < state->stroke_width && shape->stroke_width == 0) shape->stroke_width = 1; diff --git a/src/svgtiny_internal.h b/src/svgtiny_internal.h index 6bf5d64..c0ef754 100644 --- a/src/svgtiny_internal.h +++ b/src/svgtiny_internal.h @@ -51,7 +51,7 @@ struct svgtiny_parse_state { /* paint attributes */ svgtiny_colour fill; svgtiny_colour stroke; - int stroke_width; + float stroke_width; /* gradients */ struct svgtiny_parse_state_gradient fill_grad; -- 2.18.0