mirror of
https://codeberg.org/adnano/wmenu.git
synced 2025-10-29 05:40:20 -04:00
Only call render_menu once per frame
An actual surface is not needed to estimate font sizes; a 1x1 image will do, as long as the cairo context has the same options.
This commit is contained in:
parent
260eaba88e
commit
0947765fc9
3 changed files with 16 additions and 3 deletions
9
render.c
9
render.c
|
|
@ -13,8 +13,13 @@
|
|||
// Calculate text widths.
|
||||
void calc_widths(struct menu *menu) {
|
||||
struct wl_context *context = menu->context;
|
||||
struct pool_buffer *current = context_get_current_buffer(context);
|
||||
cairo_t *cairo = current->cairo;
|
||||
int scale = context_get_scale(context);
|
||||
cairo_surface_set_device_scale(menu->test_surface, scale, scale);
|
||||
cairo_set_antialias(menu->test_cairo, CAIRO_ANTIALIAS_BEST);
|
||||
cairo_font_options_t *fo = cairo_font_options_create();
|
||||
cairo_set_font_options(menu->test_cairo, fo);
|
||||
cairo_font_options_destroy(fo);
|
||||
cairo_t *cairo = menu->test_cairo;
|
||||
|
||||
// Calculate prompt width
|
||||
if (menu->prompt) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue