blob: 0a3ba1a071e5ede970bbb473558db997014be01d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
From 70be0635bf09e67202181de17b0ed4e6bafcd9b8 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
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
|