icon-loader: load SVG icons at max scale of any usable output

- Add a new function to get the maximum scale of all usable outputs
- Pass the maximum output scale through to img_svg_load(), which
  ultimately calls cairo_surface_set_device_scale() before rendering
This commit is contained in:
John Lindgren 2024-10-06 21:24:34 -04:00
parent a5d89a2e4c
commit ddfaae98ad
8 changed files with 52 additions and 12 deletions

View file

@ -604,8 +604,16 @@ ssd_update_window_icon(struct ssd *ssd)
int hpad = theme->window_button_width / 10;
int icon_size = MIN(theme->window_button_width - 2 * hpad,
theme->title_height - 2 * theme->padding_height);
/* TODO: take into account output scales */
int icon_scale = 1;
/*
* Load/render icons at the max scale of any usable output (at
* this point in time). We don't want to be constantly reloading
* icons as views are moved between outputs.
*
* TODO: currently there's no signal to reload/render icons if
* outputs are reconfigured and the max scale changes.
*/
float icon_scale = output_max_scale(ssd->view->server);
struct lab_data_buffer *icon_buffer = icon_loader_lookup(
ssd->view->server, app_id, icon_size, icon_scale);