From 1a46572a7c351efc6536b0d610c87ccf76661070 Mon Sep 17 00:00:00 2001 From: Bruce Cowan <bruce@bcowan.eu> Date: Sun, 18 Feb 2018 15:52:14 +0000 Subject: [PATCH] Fix odd widths Didn't realise the GTK+ drawing functions took floats --- src/rugby-possibility-widget.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rugby-possibility-widget.c b/src/rugby-possibility-widget.c index d1195b0..1c1db86 100644 --- a/src/rugby-possibility-widget.c +++ b/src/rugby-possibility-widget.c @@ -80,10 +80,10 @@ rugby_possibility_widget_get_preferred_height (GtkWidget *widget, static void render_bar (cairo_t *cr, GtkStyleContext *context, - gint x, - gint y, - gint w, - gint h, + gdouble x, + gdouble y, + gdouble w, + gdouble h, const gchar *style) { gtk_style_context_save (context); @@ -98,9 +98,9 @@ rugby_possibility_widget_draw (GtkWidget *widget, { RugbyPossibilityWidget *self = RUGBY_POSSIBILITY_WIDGET (widget); - gint width = gtk_widget_get_allocated_width (widget); - gint height = gtk_widget_get_allocated_height (widget); - gint x = 0, y = 0; + gdouble width = gtk_widget_get_allocated_width (widget); + gdouble height = gtk_widget_get_allocated_height (widget); + gdouble x = 0.0, y = 0.0; GtkStyleContext *context = gtk_widget_get_style_context (widget); gtk_style_context_save (context); @@ -121,7 +121,7 @@ rugby_possibility_widget_draw (GtkWidget *widget, gtk_style_context_add_class (context, "fill-block"); // Tries - gint w = width / (score / 7.0); + gdouble w = width / (score / 7.0); for (int i = 0; i < tries; i++) { render_bar (cr, context, x, y, w, height, "score-try"); -- GitLab