From 41729222431449a81535b28ad27ce2620cb5819b Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Fri, 17 Nov 2023 13:30:38 +0100 Subject: Move all the state required for rendering in a struct --- draw.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index b0c32ba..aed4da0 100644 --- a/draw.c +++ b/draw.c @@ -11,7 +11,7 @@ // (this will also work for animations in the future) // or use some flags to trigger drawing -Drawable *draw_create(Window *win, const char *font, int height, int left_pad, int right_pad, int top_pad, double alpha) +Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad, double alpha) { Drawable *draw = g_malloc(sizeof(Drawable)); g_assert_nonnull(draw); @@ -20,19 +20,20 @@ Drawable *draw_create(Window *win, const char *font, int height, int left_pad, i draw->desc = pango_font_description_from_string(font); log_debug("Pango found matching font '%s'", pango_font_description_get_family(draw->desc)); - draw->win = win; draw->height = height; draw->left_pad = left_pad; draw->right_pad = right_pad; draw->top_pad = top_pad; draw->alpha = alpha; + g_assert(alpha >= 0 && alpha <= 1); + + log_debug("Draw context created [height=%d, left_pad=%d, right_pad=%d, top_pad=%d, alpha=%.2lf]", height, left_pad, right_pad, top_pad, alpha); return draw; } -void draw_paint(Drawable *draw) +void draw_paint(Drawable *draw, Window *win) { - Window *win = draw->win; // FIXME: Does not work for scale != 1 //double scale = window_get_scale(win); double scale = 1; -- cgit v1.2.3