summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2018-05-23 13:04:19 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2018-05-23 13:04:19 +0100
commit66493421e65d8cbda3e17fdbe43824387e3d51a7 (patch)
treed260fb3aa5a0af3de954516e8eaac0d3cb5113b4 /include
parenta58d97a41a6192038573da6862571dc72a560458 (diff)
downloadnetsurf-66493421e65d8cbda3e17fdbe43824387e3d51a7.tar.gz
netsurf-66493421e65d8cbda3e17fdbe43824387e3d51a7.tar.bz2
Plotters: Change stroke width in the plot_style_t to fixed point.
Diffstat (limited to 'include')
-rw-r--r--include/netsurf/plot_style.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h
index db5a5ee26..d7a027cee 100644
--- a/include/netsurf/plot_style.h
+++ b/include/netsurf/plot_style.h
@@ -25,6 +25,7 @@
#define NETSURF_PLOT_STYLE_H
#include <stdint.h>
+#include <stdint.h>
#include "netsurf/types.h"
/** light grey widget base colour */
@@ -45,6 +46,18 @@
/* type for fixed point numbers */
typedef int32_t plot_style_fixed;
+/* Convert an int to fixed point */
+#define plot_style_int_to_fixed(v) ((v) << PLOT_STYLE_RADIX)
+
+/* Convert fixed point to int */
+#define plot_style_fixed_to_int(v) ((v) >> PLOT_STYLE_RADIX)
+
+/* Convert fixed point to float */
+#define plot_style_fixed_to_float(v) (((float)v) / PLOT_STYLE_SCALE)
+
+/* Convert fixed point to double */
+#define plot_style_fixed_to_double(v) (((double)v) / PLOT_STYLE_SCALE)
+
/**
* Type of plot operation
*/
@@ -61,7 +74,7 @@ typedef enum {
*/
typedef struct plot_style_s {
plot_operation_type_t stroke_type; /**< Stroke plot type */
- int stroke_width; /**< Width of stroke, in pixels */
+ plot_style_fixed stroke_width; /**< Width of stroke, in pixels */
colour stroke_colour; /**< Colour of stroke */
plot_operation_type_t fill_type; /**< Fill plot type */
colour fill_colour; /**< Colour of fill */