1From 70be0635bf09e67202181de17b0ed4e6bafcd9b8 Mon Sep 17 00:00:00 2001
2From: Michael Forney <mforney@mforney.org>
3Date: Mon, 12 Jun 2017 02:42:32 -0700
4Subject: [PATCH] Make stroke_width a float
5
6---
7 include/svgtiny.h | 2 +-
8 src/svgtiny.c | 3 +--
9 src/svgtiny_internal.h | 2 +-
10 3 files changed, 3 insertions(+), 4 deletions(-)
11
12diff --git a/include/svgtiny.h b/include/svgtiny.h
13index 85f146f..6acf42e 100644
14--- a/include/svgtiny.h
15+++ b/include/svgtiny.h
16@@ -29,7 +29,7 @@ struct svgtiny_shape {
17 float text_x, text_y;
18 svgtiny_colour fill;
19 svgtiny_colour stroke;
20- int stroke_width;
21+ float stroke_width;
22 };
23
24 struct svgtiny_diagram {
25diff --git a/src/svgtiny.c b/src/svgtiny.c
26index 8831b92..838e149 100644
27--- a/src/svgtiny.c
28+++ b/src/svgtiny.c
29@@ -1698,8 +1698,7 @@ struct svgtiny_shape *svgtiny_add_shape(struct svgtiny_parse_state *state)
30 shape->text = 0;
31 shape->fill = state->fill;
32 shape->stroke = state->stroke;
33- shape->stroke_width = lroundf((float) state->stroke_width *
34- (state->ctm.a + state->ctm.d) / 2.0);
35+ shape->stroke_width = state->stroke_width * (state->ctm.a + state->ctm.d) / 2.0;
36 if (0 < state->stroke_width && shape->stroke_width == 0)
37 shape->stroke_width = 1;
38
39diff --git a/src/svgtiny_internal.h b/src/svgtiny_internal.h
40index 6bf5d64..c0ef754 100644
41--- a/src/svgtiny_internal.h
42+++ b/src/svgtiny_internal.h
43@@ -51,7 +51,7 @@ struct svgtiny_parse_state {
44 /* paint attributes */
45 svgtiny_colour fill;
46 svgtiny_colour stroke;
47- int stroke_width;
48+ float stroke_width;
49
50 /* gradients */
51 struct svgtiny_parse_state_gradient fill_grad;
52--
532.18.0
54