diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-17 13:30:38 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-17 13:30:38 +0100 |
| commit | 41729222431449a81535b28ad27ce2620cb5819b (patch) | |
| tree | 0cbbffb343bc1b942ea5527cd52f0cc53143b122 /draw.c | |
| parent | a88d3a4c61f482ffeafba89910b896a92830f95f (diff) | |
Move all the state required for rendering in a struct
Diffstat (limited to 'draw.c')
| -rw-r--r-- | draw.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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; |
