diff options
Diffstat (limited to 'include/netsurf/plot_style.h')
-rw-r--r-- | include/netsurf/plot_style.h | 15 |
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 */ |